Env mortar controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{CDA|CEnvMortarController|CBreakableProp|CBaseProp|CBaseAnimating|CBaseEntity|}}
[[File:env_mortar_controller_image.png|350px|right]]
[[File:env_mortar_controller_image.png|350px|right]]
{{This is a|point entity|name=env_mortar_controller|game=Black Mesa}} This is an airstrike map that allows you to mark and launch bombs at a specified point. For full functionality, this entity must be used in combination with {{ent|env_mortar_launcher}}, {{ent|point_camera}} and {{ent|info_camera_link}}. In the original game it was used once in bm_c2a5i.
{{This is a|point entity|name=env_mortar_controller|game=Black Mesa}} This is an airstrike map that allows you to mark and launch bombs at a specified point. For full functionality, this entity must be used in combination with {{ent|env_mortar_launcher}}, {{ent|point_camera}} and {{ent|info_camera_link}}. In the original game it was used once in '''bm_c2a5i'''.
{{bug|In current versions of the game, this entity have no fire delay (the fire button lock doesn't happen). If player will spam the button - this will create a lot of bombs which will cause huge fps drop (due to explosions) and then may cause the game to crash. Not in {{bms12|4}} (the mod version) and early versions of the game.
 
{{workaround|See workaround below.
{{bug|hidetested=1|In current versions of the game, this entity have no fire delay (the fire button lock doesn't work). If a player will spam the button - this will create a lot of bombs which will cause huge fps drop (due to explosions) and then may cause the game to crash {{not|{{bms12}}}}.
{{workaround|See workaround [[Env_mortar_controller#Fixing_mortar_spam|below]].
}}
}}
}}
}}
{{bug|This entity doesn't work properly in multiplayer, only 1 player will be able to shoot, the crosshair will not work for others.}}
{{bug|hidetested=1|This entity doesn't work properly in multiplayer, only 1 player will be able to shoot, the crosshair will not work for others.}}
{{bug|Never solid.}}
{{bug|hidetested=1|Save reload will cause the pointer to back at left top corner.}}
 
==Keyvalues==
{{KV|Mortar Launcher|intn=mortarlauncher|target_destination|{{ent|env_mortar_launcher}} to use.}}
 
== Inputs ==
{{I|attachscreen|param=void|Fires on entity spawn to attach screen.|nofgd=1}}
 
==Dedicated [[ConVars]]==
{{varcom|start}}
{{varcom|cl_debug_mortar_screen|0|Integer|Enable/disable [[Env mortar controller|mortar screen]] debug. If enabled, when the player uses the screen to shoot from [[env_mortar_launcher|mortar launcher]], the game shows a purple square and red line from the square to screen's {{ent|point_camera}} entity.
{{important|This console variable is hidden with [[Console_command_flags|"development only" flag]]. Can't be changed without using server plugins.}}
}}
{{varcom|end}}


==Attaching screen==
==Attaching screen==
Line 54: Line 69:
Now spam is prevented. The only issue is mortar launch sounds, you can fix this by replacing the sound with a blank sound and playing the original sound via outputs.
Now spam is prevented. The only issue is mortar launch sounds, you can fix this by replacing the sound with a blank sound and playing the original sound via outputs.


==Keyvalues==
==See Also==
{{KV|Mortar Launcher|intn=mortarlauncher|target_destination|{{code|env_mortar_launcher}} to use.}}
*{{ent|grenade_mortar_small}} - the grenade entity used by this entity
{{KV|[[Skin]]|intn=skin|int|Some models have multiple skins. This value selects from the index, starting with 0.}}
*{{ent|env_mortar_launcher}} - the launcher
{{KV|Collisions|intn=solid|choices|Method of collision for this entity.<!--
-->{{Expand|title=Choices|margin_left=2em|
:*'''0''': None
:*'''1''': BSP ([[QPhysics]])
:*'''2''': [[Bounding box|Bounding Box]]
:*'''3''': Oriented Bounding Box (Use for runtime spawned rotated brush entities)
:*'''4''': Oriented Bounding Box, constrained to [[QAngle|Yaw]] only
:*'''5''': Custom/Test (Usually no collision with anything)
:*'''6''': [[VPhysics]]}}
}}
 
{{KV|[[Hitbox]] Set|intn=hitboxset|string|Sets the {{Ent|$hboxset}} to use.}}
{{KV|Body Group|intn=body or SetBodyGroup|int|Sets the the active {{Ent|$bodygroup}}.}}
{{KV|Model Index|intn=modelindex|short|Given the number index from dumping the <code>cl_precacheinfo modelprecache</code> table, sets entity model to the index. {{warning|If an entity has animations that ''will be'' played, then the set model also must have its own sequences, else the game crashes.}}|nofgd=1}}
{{KV|Model Scale|intn=modelscale|float|A multiplier for the size of the model. Negative values are accepted. Does not alter the physics collisions in most cases, however.{{warning|Negative or extremely high values can cause crashes!}}{{note|Scale may not appear in {{hammer4|2}}, but will appear in-game (tested in {{dods}}). This is fixed in {{hammer++|2}}.}}|since=EP2}}
{{KV|Texture Frame|intn=texframeindex|int|The initial frame number for all animated textures on this entity.|nofgd=1}}
{{KV|Start Fade Distance|intn=fademindist|float|Distance at which the entity starts fading. If 0 or less, the entity will disappear instantly when end fade is hit. The value will scale appropriately if the entity is in a [[3D Skybox]].}}
{{KV|End Fade Distance|intn=fademaxdist|float|Distance at which the entity ends fading. If 0 or less, the entity won't disappear at all. The value will scale appropriately if the entity is in a 3D Skybox.}}
{{KV|Fade Scale|intn=fadescale|float|If specified in the {{Ent|worldspawn}}, or if the engine is running below DirectX 8, entities will fade out even if the fade distances above aren't specified. This value gives more control over when this happens: numbers smaller than 1 cause the entity to fade out at further distances, and greater than 1 cause it to fade out at closer distances. Using 0 turns off the forced fade altogether. See also {{Ent|$noforcedfade}}.}}
{{KV|FX Amount/Transparency (0–255)|intn=renderamt|int|Transparency amount, requires a Render Mode other than '''Normal'''. 0 is invisible, 255 is fully visible.}}
{{KV|Render Color (R G B)|intn=rendercolor|color255|Color tint.}}
{{KV Render FX}}
{{KV Rendermode}}
{{KV|Disable Shadows|intn=disableshadows|boolean|Prevent the entity from creating cheap render-to-texture shadows. Does not affect [[shadow mapping]].}}
{{KV|Disable Receiving Shadows|intn=disablereceiveshadows|boolean|Prevent the entity from receiving shadows on itself.}}
{{KV|Lighting Origin|intn=LightingOrigin|targetname|Select an entity (not {{Ent|info_lighting}}!) from which to sample lighting instead of the entity's [[origin]].}}
{{KV|Lighting Origin Offset|intn=LightingOriginHack|targetname|The {{Ent|info_lighting_relative}} from which to sample lighting instead of the entity's origin. Use <tt>Lighting Origin</tt> instead.|deprecated=1}}
{{KV BaseEntity|base=1}}
 
== Inputs ==
{{IO|attachscreen|param=void|Fires on entity spawn to attach screen.|nofgd=1}}
{{IO|skin|param=int|Selects a [[skin]] from the model's index, starting with 0.}}
{{IO|Color|param=color255|Sets value for {{code|Color}} property.}}
{{IO|Alpha|param=integer|Sets value for {{code|Alpha}} property.}}
{{IO|SetBodyGroup|param=int|Sets the the active {{ent|$bodygroup}}.}}
{{IO|Ignite|Makes the entity catch on fire indefinitely.}}
{{IO|IgniteLifetime|param=float|Makes the entity catch on fire for a given amount of time.}}
{{IO|IgniteNumHitboxFires|param=int|Makes the entity catch on fire with a given number of [[hitbox]] fire particles. Does not function correctly in {{l4d2}} onward.|removed={{l4d2}}}}
{{IO|IgniteHitboxFireScale|param=float|Makes the entity catch on fire with a given scale for [[hitbox]] fire particles. Does not function correctly in {{l4d2}} onward.|removed={{l4d2}}}}
{{IO|BecomeRagdoll|Kills the entity and creates a client-side ragdoll from the model. Input is only passed if the model contains {{ent|$collisionjoints}}. For other models, {{ent|phys_convert}} can be used instead.}}
{{IO|SetLightingOrigin|param=targetname|Sets the entity's lighting origin to use this entity's position.}}
{{IO|SetLightingOriginHack|param=targetname|Offsets the entity's lighting origin by their distance from an {{ent|info_lighting_relative}}. Use <code>SetLightingOrigin</code> instead.|deprecated=1|removed={{l4d}}}}
{{IO|fademindist|param=float|Sets distance at which the entity starts fading. If <0, the entity will disappear instantly when end fade is hit. The value will scale appropriately if the entity is in a [[3D Skybox]].}}
{{IO|fademaxdist|param=float|Sets distance at which the entity ends fading. If <0, the entity won't disappear at all. The value will scale appropriately if the entity is in a [[3D Skybox]].}}
{{IO|SetModelScale|param=vector|only={{src13}}|Multiplies the size of the model. Does not alter the physics collisions in most cases. Can take two values separated by a space, in which case the first value would be the target model scale and the second value would be the number of seconds the change in scale will be spread over. If there is no second value, the model will scale instantly.{{tip|The <code>modelscale</code> keyvalue can be [[AddOutput]]ed as a workaround for other games with this input missing.}}
:{{warning|Negative or extremely high values can cause crashes!}}}}
{{I BaseEntity|base=1}}
 
==Outputs==
{{IO|OnIgnite|nofgd=1|Fired when the entity catches fire, such as from an {{ent|env_entity_igniter}} or the <code>Ignite</code> inputs.}}
{{O BaseEntity|}}

Latest revision as of 01:35, 15 August 2025

C++ Class hierarchy
CEnvMortarController
CBreakableProp
CBaseProp
CBaseAnimating
CBaseEntity
Env mortar controller image.png

env_mortar_controller is a point entity available in Black Mesa Black Mesa. This is an airstrike map that allows you to mark and launch bombs at a specified point. For full functionality, this entity must be used in combination with env_mortar_launcher, point_camera and info_camera_link. In the original game it was used once in bm_c2a5i.

Icon-Bug.pngBug:In current versions of the game, this entity have no fire delay (the fire button lock doesn't work). If a player will spam the button - this will create a lot of bombs which will cause huge fps drop (due to explosions) and then may cause the game to crash (not in Black Mesa (mod)).
PlacementTip.pngWorkaround:See workaround below.
Icon-Bug.pngBug:This entity doesn't work properly in multiplayer, only 1 player will be able to shoot, the crosshair will not work for others.
Icon-Bug.pngBug:Save reload will cause the pointer to back at left top corner.

Keyvalues

Mortar Launcher (mortarlauncher) <targetname>
env_mortar_launcher to use.

Inputs

attachscreen <void> !FGD
Fires on entity spawn to attach screen.

Dedicated ConVars

Cvar/Command Parameters or default value Descriptor Effect
cl_debug_mortar_screen 0 Integer Enable/disable mortar screen debug. If enabled, when the player uses the screen to shoot from mortar launcher, the game shows a purple square and red line from the square to screen's point_camera entity.
Icon-Important.pngImportant:This console variable is hidden with "development only" flag. Can't be changed without using server plugins.

Attaching screen

First, place point_camera at required position, set orientation and give a name. This entity will display area in airstrike map. You also need to change value for Render Target, set _rt_Satellite value.

Now we need info_camera_link. In Entity Whose Material Uses _rt_camera you need to add name of env_mortar_controller, in Camera Name add name of point_camera you placed earlier.

Now compile your map and check the result. You now have functional screen. Don't forget to specify env_mortar_launcher name in Mortar Launcher property.

Fixing mortar spam

env_mortar_launcher can dynamically change values in properties with AddOutput, we'll use this feature to fire 0 shells when fired once. Unfortunately, env_mortar_launcher and env_mortar_controller don't have any outputs that fires when shell is launched, we need to use triggers instead.

Create a trigger_weaponfire in the form of an empty box inside. There should be a free space of 30 hammer units inside (x, y, z), env_mortar_launcher should be placed in the center.

Now create another trigger_weaponfire that is 12 hammer units in size on all axes. This trigger should be in env_mortar_launcher center. Give a name for this trigger (shellkiller for example) and for Start Disabled? property set value Yes.

We need to add outputs now, for the second trigger (shellkiller) make the following output:

My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnStartTouch !activator Kill 0.00 No

For the first trigger, make the following outputs:

My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnStartTouch shellkiller Enable 0.00 No
Entity-output-icon.png OnStartTouch mortar_launcher AddOutput fireshellscount 0 0.00 No mortar_launcher is the name of env_mortar_launcher.
Entity-output-icon.png OnStartTouch shellkiller Disable 2.00 No
Entity-output-icon.png OnStartTouch mortar_launcher AddOutput fireshellscount 1 2.00 No


Now spam is prevented. The only issue is mortar launch sounds, you can fix this by replacing the sound with a blank sound and playing the original sound via outputs.

See Also