env_mortar_controller

From Valve Developer Community
Jump to navigation Jump to search
Env mortar controller image.png
Class hierarchy
???
???
CBaseAnimating
CBaseEntity

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. Most inputs and outputs are same as CBaseAnimating.

Represented by class CEnvMortarController.

Icon-Bug.pngBug: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 Black Mesa Black Mesa (the mod version) and early versions of the game.
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.

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

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

Inputs

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

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.