spell_targeting
The base class for the targeting systems spells use.
To create a new targeting datum you just inherit from this base type and override the /datum/spell_targeting/proc/choose_targets proc. Override the /datum/spell_targeting/proc/valid_target proc for more complex validations. More complex behaviour like auto targeting and click based activation is possible.
Vars | |
allowed_type | Which type the targets have to be |
---|---|
include_user | If it includes user. Not always used in all spell_targeting objects |
max_targets | How many targets are allowed. INFINITY is used to target unlimited targets |
range | The range of the spell; outer radius for aoe spells |
selection_type | Can be SPELL_SELECTION_RANGE or SPELL_SELECTION_VIEW |
try_auto_target | Whether or not the spell will try to auto target first before setting up the intercept click |
use_intercept_click | Whether or not the targeting is done by intercepting a click or not |
use_obstacle_check | If the spell should do an obstacle check from the user to the target. Windows, for example, will block the spell if this is true. |
use_turf_of_user | Whether or not the spell should use the turf of the user as starting point |
Procs | |
InterceptClickOn | Called when the parent spell intercepts the click |
attempt_auto_target | Will attempt to auto target the spell. Only works with 1 target currently |
choose_targets | Called when choosing the targets for the parent spell |
obstacle_check | Checks if the path from the source to the target is free. Mobs won't block the path. But any dense object (other than tables) will. |
valid_target | Checks whether or not the given target is valid. Calls spell.valid_target as well |
Var Details
allowed_type
Which type the targets have to be
include_user
If it includes user. Not always used in all spell_targeting objects
max_targets
How many targets are allowed. INFINITY is used to target unlimited targets
range
The range of the spell; outer radius for aoe spells
selection_type
Can be SPELL_SELECTION_RANGE or SPELL_SELECTION_VIEW
try_auto_target
Whether or not the spell will try to auto target first before setting up the intercept click
use_intercept_click
Whether or not the targeting is done by intercepting a click or not
use_obstacle_check
If the spell should do an obstacle check from the user to the target. Windows, for example, will block the spell if this is true.
use_turf_of_user
Whether or not the spell should use the turf of the user as starting point
Proc Details
InterceptClickOn
Called when the parent spell intercepts the click
Arguments:
- user - Who clicks with the spell targeting active?
- params - Additional parameters from the click
- A - Atom the user clicked on
- spell - The spell being cast
attempt_auto_target
Will attempt to auto target the spell. Only works with 1 target currently
choose_targets
Called when choosing the targets for the parent spell
Arguments:
- user - the one who casts the spell
- spell - The spell being cast
- params - Params given by the intercept click. Only available if use_intercept_click is TRUE
- clicked_atom - The atom clicked on. Only available if use_intercept_click is TRUE
obstacle_check
Checks if the path from the source to the target is free. Mobs won't block the path. But any dense object (other than tables) will.
Arguments:
- source - Where is the spell effect coming from?
- target - Where is the spell effect going?
valid_target
Checks whether or not the given target is valid. Calls spell.valid_target as well
Arguments:
- target - The one who is being considered as a target
- user - Who is casting the spell
- spell - The spell being cast
- check_if_in_range - If a view/range check has to be done to see if the target is valid