Template:FGD-entry

From Source Entities
Jump to navigation Jump to search

@{{{1}}} = {{{2}}} [ ]


FGD entry skeleton. See Template:Fakepre.

1 <string>
The bit of text after the @ sign. E.g. BaseClass, FilterClass, NPCClass. This then needs to be followed by the ent's helpers, such as base() and size(). (Sorry, but separate parameters for each of those would be way too expensive and cluttering.)
2 <string>
Name of the entity or base class.
3 <string>
The entry's meat: Template:FGD-f, Template:FGD-k, Template:FGD-i, Template:FGD-o.
desc <string>
Description of the entity. Remember that medium-to-large strings will get broken by Hammer's actual FGD parser, so add "+" if needed.

An example based off existing FGD code:

{{fakepre|// Base class for env_global
{{FGD-entry|BaseClass base(Targetname)|EnvGlobal|desc=An entity to control a global game state, with an optional associated counter, that persists across level transitions.|
{{FGD-f|1|Set Initial State|0}}

{{FGD-k|Initial State|choices|c=initialstate|def=0|If 'Set Initial State' is ticked, this will set the global's state when the map loads.|0|Off|1|On|2|Dead}}
{{FGD-k|Counter|integer|c=counter|def=0|Initial value of an integer counter associated with this global. Useful for checking if a player has collected a certain number of items, for example.}}

{{FGD-i|TurnOn|void|Sets the global's state to ON.}}
{{FGD-i|TurnOff|void|Sets the global's state to OFF.}}
{{FGD-i|Toggle|void|Switches the state of the global between ON and OFF.}}
{{FGD-i|Remove|void|Sets the state of the global to DEAD.}}
{{FGD-i|SetCounter|integer|Sets this global's counter to the specified number.}}
{{FGD-i|AddToCounter|integer|Adds the specified amount to the counter. Negative values will subtract.}}
{{FGD-i|GetCounter|void|Makes the Counter output fire.}}

{{FGD-o|Counter|integer|Fires when sent GetCounter. "+"{{outadd|the current value of this global's counter}}}}}}}}
// Base class for env_global

@BaseClass base(Targetname) = EnvGlobal : "An entity to control a global game state, with an optional associated counter, that persists across level transitions." [ spawnflags(flags) = [ 1 : "Set Initial State" : 0 ]

initialstate(choices) : "Initial State" : 0 : "If 'Set Initial State' is ticked, this will set the global's state when the map loads." = [ 0 : "Off" 1 : "On" 2 : "Dead" ] counter(integer) : "Counter" : 0 : "Initial value of an integer counter associated with this global. Useful for checking if a player has collected a certain number of items, for example."

input TurnOn(void) : "Sets the global's state to ON." input TurnOff(void) : "Sets the global's state to OFF." input Toggle(void) : "Switches the state of the global between ON and OFF." input Remove(void) : "Sets the state of the global to DEAD." input SetCounter(integer) : "Sets this global's counter to the specified number." input AddToCounter(integer) : "Adds the specified amount to the counter. Negative values will subtract." input GetCounter(void) : "Makes the Counter output fire."

output Counter(integer) : "Fires when sent GetCounter. "+"Automatically puts the current value of this global's counter as the input parameter, unless overridden by the mapper."

]