Env mortar controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{CDA|CEnvMortarController|CBreakableProp|CBaseProp|CBaseAnimating|CBaseEntity|}}  
{{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. Most inputs and outputs are same as [[CBaseAnimating]].
{{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|hidetested=1|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|{{bms12}}}}.
{{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 below.
{{workaround|See workaround [[Env_mortar_controller#Fixing_mortar_spam|below]].
}}
}}
}}
}}
Line 11: Line 11:


==Keyvalues==
==Keyvalues==
{{KV Targetname}}
{{KV|Mortar Launcher|intn=mortarlauncher|target_destination|{{ent|env_mortar_launcher}} to use.}}
{{KV|Mortar Launcher|intn=mortarlauncher|target_destination|{{ent|env_mortar_launcher}} to use.}}


== Inputs ==
== Inputs ==
{{I|attachscreen|param=void|Fires on entity spawn to attach screen.|nofgd=1}}
{{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==

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