CBeam: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Nescius moved page Beam to CBeam: Moving page history)
No edit summary
Line 1: Line 1:
{{LanguageBar}}
{{ent not in fgd|nolink=1|because=it doesn't provide enough KIO access and [[env_beam]] is available, but it might be of interest for [[vscript]] use}}
[[File:Dog hand beams.png|300px|thumb|right|When Dog holds objects, his hand creates four <code>beam</code>s.]]
{{CD|CBeam|base=CBaseEntity|file1=1}}
{{CD|CBeam|base=CBaseEntity|file1=1}}
{{this is a|point entity|name=beam}}
It is a base entity used by other entities to make beams or other effects, such as bubbles. The entities which use this one offer greater control over the effect.


==Keyvalues==
== Fields <!-- is this correct name ? Would members be better ? --> ==
{{KV|Damage/second|intn=damage|string|How much damage this beam does per second to things it hits when it is continually on, or instantaneously if it strikes. For continuous damage, the value should be greater than 10 or it may not work.
{{note|These are changable via [[#See Also|NetProps vscript instance ↓]] or available [[#KIO_access_to_fields|KIO ↓]]}}
{{note|Damage is scaled to the difficulty setting:
:{{skill|50%|100%|150%}}}}}}
{{KV|HDR color scale|intn=HDRColorScale|float|Value to multiply sprite color by when running in HDR mode.}}
{{KV|Dissolve Type|intn=dissolvetype|choices|If this beam damages and kills something, effects to show around the object.
:*-1: None
:*0: Energy
:*1: Heavy Electrical
:*2: Light Electrical}}


==Inputs==
{{DEFINE_FIELD|m_nHaloIndex|FIELD_MODELINDEX}}
{{IO|Width|param=float|Set the width of the beam, in pixels.}}
{{DEFINE_FIELD|m_nBeamType|FIELD_INTEGER}}
{{IO|Noise|param=float|nofgd=1|Set how far away from the middle the beam is allowed to deviate.}}
{{DEFINE_FIELD|m_nBeamFlags|FIELD_INTEGER}}
{{IO|Alpha|param=integer|Sets the beam's alpha (0 - 255).}}
{{DEFINE_FIELD|m_nNumBeamEnts|FIELD_INTEGER}}
{{IO|Color|param=color255|Sets the beam's render color (R G B).}}
{{DEFINE_FIELD|m_nMinDXLevel|FIELD_INTEGER}}
{{IO|ColorRedValue|param=float|Sets the red color channel's value (0 - 255).}}
{{IO|ColorGreenValue|param=float|Sets the green color channel's value (0 - 255).}}
{{IO|ColorBlueValue|param=float|Sets the blue color channel's value (0 - 255).}}
{{IO|ScrollSpeed|param=float|Set the scroll speed in units per second (0 - 100).}}


==Flags==
{{DEFINE_FIELD|m_flHDRColorScale|FIELD_FLOAT}}
{{Fl Beam}}
{{DEFINE_FIELD|m_flDamage|FIELD_FLOAT}}
{{DEFINE_FIELD|m_nDissolveType|FIELD_INTEGER}}


== Additional information in [[ent_text]] overlay ==
{{DEFINE_FIELD|m_fWidth|FIELD_FLOAT|Width of the beam at the start}}
* start: <origin>
{{DEFINE_FIELD|m_fEndWidth|FIELD_FLOAT|Width of the beam at the end}}
* end: <m_vecEndPos>
{{DEFINE_FIELD|m_fFadeLength|FIELD_FLOAT}}
{{DEFINE_FIELD|m_fHaloScale|FIELD_FLOAT}}
{{DEFINE_FIELD|m_fAmplitude|FIELD_FLOAT}}
{{DEFINE_FIELD|m_fStartFrame|FIELD_FLOAT}}
{{DEFINE_FIELD|m_fSpeed|FIELD_FLOAT}}


exact format:<pre>
{{DEFINE_FIELD|m_flFrameRate|FIELD_FLOAT}}
start: (%.2f,%.2f,%.2f)", GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z
{{DEFINE_FIELD|m_flFrame|FIELD_FLOAT}}
end  : (%.2f,%.2f,%.2f)", m_vecEndPos.GetX(), m_vecEndPos.GetY(), m_vecEndPos.GetZ()
</pre>


== See Also ==
{{DEFINE_FIELD|m_flFireTime|FIELD_TIME}}
* {{l4d2}} [https://steamcommunity.com/sharedfiles/filedetails/?id=2433786424&searchtext=borderlands Example vscript addon utilizing this entity]
 
* {{l4d2}} [[Left_4_Dead_2/Script_Functions#CNetPropManager]]
{{DEFINE_FIELD|m_vecEndPos|FIELD_POSITION_VECTOR}}
* {{tf2}} [[Team_Fortress_2/Scripting/Script_Functions#CNetPropManager]]
{{DEFINE_FIELD|m_hEndEntity|FIELD_EHANDLE}}
* {{ent|env_beam}}
 
* {{ent|env_quadraticbeam}}
 
#ifdef PORTAL
{{DEFINE_FIELD|m_bDrawInMainRender|FIELD_BOOLEAN}}
{{DEFINE_FIELD|m_bDrawInPortalRender|FIELD_BOOLEAN}}
#endif
=== Array fields ===
{{DEFINE_ARRAY|m_hAttachEntity|FIELD_EHANDLE|10}}
{{DEFINE_ARRAY|m_nAttachIndex|FIELD_INTEGER|10}}
 
== KIO access to fields <!-- not sure if this is correct way to call this stuff --> ==
=== KeyFields ===
{{DEFINE_KEYFIELD|[[#Fields|m_flHDRColorScale ↑]]|FIELD_FLOAT|HDRColorScale}}
{{DEFINE_KEYFIELD|[[#Fields|m_flDamage ↑]]|FIELD_FLOAT|damage}}
{{DEFINE_KEYFIELD|[[#Fields|m_nDissolveType ↑]]|FIELD_INTEGER|dissolvetype}}
 
=== Inputs ===
{{note|These inputs are usable either as Keyvalue or Input, they are also not autocompleted for [[ent_fire]] ConCommand}}
{{DEFINE_INPUT|[[#Fields|m_fSpeed ↑]]|FIELD_FLOAT|ScrollSpeed}}
 
=== Input Functions ===
{{DEFINE_INPUTFUNC|FIELD_FLOAT|Width|src=sdkmp13|game/shared/beam_shared.cpp#L833 InputWidth|Asserts that specified width is lower than MAX_BEAM_WIDTH and then sets [[#Fields|m_fWidth ↑]] and [[#Fields|m_fEndWidth ↑]]}}
{{DEFINE_INPUTFUNC|FIELD_FLOAT|Noise|src=sdkmp13|game/shared/beam_shared.cpp#L857 InputNoise|Sets [[#Fields|m_fAmplitude ↑]]}}
{{DEFINE_INPUTFUNC|FIELD_FLOAT|ColorRedValue|src=sdkmp13|game/shared/beam_shared.cpp#L839 InputColorRedValue|Sets r portion of m_clrRender to value clamped between 0, 255}}
{{DEFINE_INPUTFUNC|FIELD_FLOAT|ColorGreenValue|src=sdkmp13|game/shared/beam_shared.cpp#L845 InputColorGreenValue|Sets g portion of m_clrRender to value clamped between 0, 255}}
{{DEFINE_INPUTFUNC|FIELD_FLOAT|ColorBlueValue|src=sdkmp13|game/shared/beam_shared.cpp#L851 InputColorBlueValue|Sets b portion of m_clrRender to value clamped between 0, 255}}
 
== Constants ==
*MAX_BEAM_WIDTH = 102.3f
*MAX_BEAM_SCROLLSPEED = 100.0f
*MAX_BEAM_NOISEAMPLITUDE = 64
 
== Flags ==
{{fl|1|SF_BEAM_STARTON}}
{{fl|2|SF_BEAM_TOGGLE}}
{{fl|4|SF_BEAM_RANDOM}}
{{fl|8|SF_BEAM_RING}}
{{fl|16|SF_BEAM_SPARKSTART}}
{{fl|32|SF_BEAM_SPARKEND}}
{{fl|64|SF_BEAM_DECALS}}
{{fl|128|SF_BEAM_SHADEIN}}
{{fl|256|SF_BEAM_SHADEOUT}}
{{fl|512|SF_BEAM_TAPEROUT}}
{{fl|32768|SF_BEAM_TEMPORARY}}

Revision as of 03:32, 24 September 2024

C++ Class hierarchy
CBeam
CBaseEntity
C++ beam_shared.cpp

Fields

Note.pngNote:These are changable via NetProps vscript instance ↓ or available KIO ↓

m_nHaloIndex <FIELD_MODELINDEX>

m_nBeamType <FIELD_INTEGER>

m_nBeamFlags <FIELD_INTEGER>

m_nNumBeamEnts <FIELD_INTEGER>

m_nMinDXLevel <FIELD_INTEGER>


m_flHDRColorScale <FIELD_FLOAT>

m_flDamage <FIELD_FLOAT>

m_nDissolveType <FIELD_INTEGER>


m_fWidth <FIELD_FLOAT>

Width of the beam at the start

m_fEndWidth <FIELD_FLOAT>

Width of the beam at the end

m_fFadeLength <FIELD_FLOAT>

m_fHaloScale <FIELD_FLOAT>

m_fAmplitude <FIELD_FLOAT>

m_fStartFrame <FIELD_FLOAT>

m_fSpeed <FIELD_FLOAT>


m_flFrameRate <FIELD_FLOAT>

m_flFrame <FIELD_FLOAT>


m_flFireTime <FIELD_TIME>


m_vecEndPos <FIELD_POSITION_VECTOR>

m_hEndEntity <FIELD_EHANDLE>


  1. ifdef PORTAL

m_bDrawInMainRender <FIELD_BOOLEAN>

m_bDrawInPortalRender <FIELD_BOOLEAN>

  1. endif


Array fields

m_hAttachEntity[10] <FIELD_EHANDLE>

m_nAttachIndex[10] <FIELD_INTEGER>


KIO access to fields

KeyFields

m_flHDRColorScale ↑ <FIELD_FLOAT> (HDRColorScale)

m_flDamage ↑ <FIELD_FLOAT> (damage)

m_nDissolveType ↑ <FIELD_INTEGER> (dissolvetype)


Inputs

Note.pngNote:These inputs are usable either as Keyvalue or Input, they are also not autocompleted for ent_fire ConCommand

m_fSpeed ↑ <FIELD_FLOAT> (ScrollSpeed)


Input Functions

Width <FIELD_FLOAT> linked function: InputWidth

Asserts that specified width is lower than MAX_BEAM_WIDTH and then sets m_fWidth ↑ and m_fEndWidth ↑

Noise <FIELD_FLOAT> linked function: InputNoise

Sets m_fAmplitude ↑

ColorRedValue <FIELD_FLOAT> linked function: InputColorRedValue

Sets r portion of m_clrRender to value clamped between 0, 255

ColorGreenValue <FIELD_FLOAT> linked function: InputColorGreenValue

Sets g portion of m_clrRender to value clamped between 0, 255

ColorBlueValue <FIELD_FLOAT> linked function: InputColorBlueValue

Sets b portion of m_clrRender to value clamped between 0, 255

Constants

  • MAX_BEAM_WIDTH = 102.3f
  • MAX_BEAM_SCROLLSPEED = 100.0f
  • MAX_BEAM_NOISEAMPLITUDE = 64

Flags

SF_BEAM_STARTON : [1]
SF_BEAM_TOGGLE : [2]
SF_BEAM_RANDOM : [4]
SF_BEAM_RING : [8]
SF_BEAM_SPARKSTART : [16]
SF_BEAM_SPARKEND : [32]
SF_BEAM_DECALS : [64]
SF_BEAM_SHADEIN : [128]
SF_BEAM_SHADEOUT : [256]
SF_BEAM_TAPEROUT : [512]
SF_BEAM_TEMPORARY : [32768]