projectile
Vars | |
armour_penetration | How much armor this projectile pierces. |
---|---|
can_hit_turfs | If true directly targeted turfs can be hit |
force_hit | If the object being hit can pass ths damage on to something else, it should not do it for this bullet |
hit_stunned_targets | If TRUE, hit mobs even if they're on the floor and not our target |
ignore_source_check | If TRUE, we can hit our firer. |
impacted | We already impacted these things, do not impact them again. Used to make sure we can pierce things we want to pierce. Lazylist, typecache style (object = TRUE) for performance. |
pass_flags | |
phasing_ignore_direct_target | If FALSE, allow us to hit something directly targeted/clicked/whatnot even if we're able to phase through it |
pierces | number of times we've pierced something. Incremented BEFORE bullet_act and on_hit proc! |
projectile_phasing | Bitflag for things the projectile should just phase through entirely - No hitting unless direct target and [phasing_ignore_direct_target] is FALSE. Uses pass_flags flags. |
projectile_piercing | Bitflag for things the projectile should hit, but pierce through without deleting itself. Defers to projectile_phasing. Uses pass_flags flags. |
ricochet_auto_aim_angle | On ricochet, if ricochet_auto_aim_range is nonzero, we'll consider any mobs within this range of the normal angle of incidence to home in on, higher = more auto aim |
ricochet_auto_aim_range | On ricochet, if nonzero, we consider all mobs within this range of our projectile at the time of ricochet to home in on like Revolver Ocelot, as governed by ricochet_auto_aim_angle |
ricochet_chance | 0-100, the base chance of ricocheting, before being modified by the atom we shoot and our chance decay |
ricochet_decay_chance | 0-1 (or more, I guess) multiplier, the ricochet_chance is modified by multiplying this after each ricochet |
ricochet_decay_damage | 0-1 (or more, I guess) multiplier, the projectile's damage is modified by multiplying this after each ricochet |
ricochet_incidence_leeway | the angle of impact must be within this many degrees of the struck surface, set to 0 to allow any angle |
ricochets | how many times we've ricochet'd so far (instance variable, not a stat) |
ricochets_max | how many times we can ricochet max |
shrapnel_type | If defined, on hit we create an item of this type then call hitby() on the hit target with this, mainly used for embedding items (bullets) in targets |
temporary_unstoppable_movement | We are flagged PHASING temporarily to not stop moving when we Bump something but want to keep going anyways. |
Procs | |
CanPassThrough | Projectile can pass through Used to not even attempt to Bump() or fail to Cross() anything we already hit. |
Impact | Called when the projectile hits something This can either be from it bumping something, or it passing over a turf/being crossed and scanning that there is infact a valid target it needs to hit. This target isn't however necessarily WHAT it hits that is determined by process_hit and select_target. |
Moved | Projectile moved: |
on_entered | Projectile crossed: When something enters a projectile's tile, make sure the projectile hits it if it should be hitting it. |
on_hit | Called when the projectile hits something |
prehit_pierce | Checks if we should pierce something. |
process_hit | The primary workhorse proc of projectile impacts. This is a RECURSIVE call - process_hit is called on the first selected target, and then repeatedly called if the projectile still hasn't been deleted. |
scan_crossed_hit | Scan if we should hit something and hit it if we need to The difference between this and handling in Impact is In this we strictly check if we need to Impact() something in specific If we do, we do We don't even check if it got hit already - Impact() does that In impact there's more code for selecting WHAT to hit So this proc is more of checking if we should hit something at all BY having an atom cross us. |
scan_moved_turf | Scans if we should hit something on the turf we just moved to if we haven't already |
select_target | Selects a target to hit from a turf |
Var Details
armour_penetration
How much armor this projectile pierces.
can_hit_turfs
If true directly targeted turfs can be hit
force_hit
If the object being hit can pass ths damage on to something else, it should not do it for this bullet
hit_stunned_targets
If TRUE, hit mobs even if they're on the floor and not our target
ignore_source_check
If TRUE, we can hit our firer.
impacted
We already impacted these things, do not impact them again. Used to make sure we can pierce things we want to pierce. Lazylist, typecache style (object = TRUE) for performance.
pass_flags
- PROJECTILE PIERCING
-
WARNING:
-
Projectile piercing MUST be done using these variables.
-
Ordinary passflags will be IGNORED.
-
The two flag variables below both use pass flags.
-
In the context of LETPASStHROW, it means the projectile will ignore things that are currently "in the air" from a throw.
-
Also, projectiles sense hits using Bump(), and then pierce them if necessary.
-
They simply do not follow conventional movement rules.
-
NEVER flag a projectile as PHASING movement type.
-
If you so badly need to make one go through everything, override check_pierce() for your projectile to always return PROJECTILE_PIERCE_PHASE/HIT. The "usual" flags of pass_flags is used in that can_hit_target ignores these unless they're specifically targeted/clicked on. This behavior entirely bypasses process_hit if triggered, rather than phasing which uses prehit_pierce() to check.
-
phasing_ignore_direct_target
If FALSE, allow us to hit something directly targeted/clicked/whatnot even if we're able to phase through it
pierces
number of times we've pierced something. Incremented BEFORE bullet_act and on_hit proc!
projectile_phasing
Bitflag for things the projectile should just phase through entirely - No hitting unless direct target and [phasing_ignore_direct_target] is FALSE. Uses pass_flags flags.
projectile_piercing
Bitflag for things the projectile should hit, but pierce through without deleting itself. Defers to projectile_phasing. Uses pass_flags flags.
ricochet_auto_aim_angle
On ricochet, if ricochet_auto_aim_range is nonzero, we'll consider any mobs within this range of the normal angle of incidence to home in on, higher = more auto aim
ricochet_auto_aim_range
On ricochet, if nonzero, we consider all mobs within this range of our projectile at the time of ricochet to home in on like Revolver Ocelot, as governed by ricochet_auto_aim_angle
ricochet_chance
0-100, the base chance of ricocheting, before being modified by the atom we shoot and our chance decay
ricochet_decay_chance
0-1 (or more, I guess) multiplier, the ricochet_chance is modified by multiplying this after each ricochet
ricochet_decay_damage
0-1 (or more, I guess) multiplier, the projectile's damage is modified by multiplying this after each ricochet
ricochet_incidence_leeway
the angle of impact must be within this many degrees of the struck surface, set to 0 to allow any angle
ricochets
how many times we've ricochet'd so far (instance variable, not a stat)
ricochets_max
how many times we can ricochet max
shrapnel_type
If defined, on hit we create an item of this type then call hitby() on the hit target with this, mainly used for embedding items (bullets) in targets
temporary_unstoppable_movement
We are flagged PHASING temporarily to not stop moving when we Bump something but want to keep going anyways.
Proc Details
CanPassThrough
Projectile can pass through Used to not even attempt to Bump() or fail to Cross() anything we already hit.
Impact
Called when the projectile hits something This can either be from it bumping something, or it passing over a turf/being crossed and scanning that there is infact a valid target it needs to hit. This target isn't however necessarily WHAT it hits that is determined by process_hit and select_target.
Furthermore, this proc shouldn't check can_hit_target - this should only be called if can hit target is already checked. Also, we select_target to find what to process_hit first.
Moved
Projectile moved:
If not fired yet, do not do anything. Else,
If temporary unstoppable movement used for piercing through things we already hit (impacted list) is set, unset it. Scan turf we're now in for anything we can/should hit. This is useful for hitting non dense objects the user directly clicks on, as well as for PHASING projectiles to be able to hit things at all as they don't ever Bump().
on_entered
Projectile crossed: When something enters a projectile's tile, make sure the projectile hits it if it should be hitting it.
on_hit
Called when the projectile hits something
@params target - thing hit blocked - percentage of hit blocked pierce_hit - are we piercing through or regular hitting
prehit_pierce
Checks if we should pierce something.
NOT meant to be a pure proc, since this replaces prehit() which was used to do things. Return PROJECTILE_DELETE_WITHOUT_HITTING to delete projectile without hitting at all!
process_hit
The primary workhorse proc of projectile impacts. This is a RECURSIVE call - process_hit is called on the first selected target, and then repeatedly called if the projectile still hasn't been deleted.
Order of operations:
- Checks if we are deleted, or if we're somehow trying to hit a null, in which case, bail out
- Adds the thing we're hitting to impacted so we can make sure we don't doublehit
- Checks piercing - stores this. Afterwards: Hit and delete, hit without deleting and pass through, pass through without hitting, or delete without hitting depending on result If we're going through without hitting, find something else to hit if possible and recurse, set unstoppable movement to true If we're deleting without hitting, delete and return Otherwise, send signal of COMSIG_PROJECTILE_PREHIT to target Then, hit, deleting ourselves if necessary. @params T - Turf we're on/supposedly hitting target - target we're hitting hit_something - only should be set by recursive calling by this proc - tracks if we hit something already
Returns if we hit something.
scan_crossed_hit
Scan if we should hit something and hit it if we need to The difference between this and handling in Impact is In this we strictly check if we need to Impact() something in specific If we do, we do We don't even check if it got hit already - Impact() does that In impact there's more code for selecting WHAT to hit So this proc is more of checking if we should hit something at all BY having an atom cross us.
scan_moved_turf
Scans if we should hit something on the turf we just moved to if we haven't already
This proc is a little high in overhead but allows us to not snowflake CanPass in living and other things.
select_target
Selects a target to hit from a turf
@params T - The turf target - The "preferred" atom to hit, usually what we Bumped() first.
Priority: 0. Anything that is already in impacted is ignored no matter what. Furthermore, in any bracket, if the target atom parameter is in it, that's hit first. Furthermore, can_hit_target is always checked. This (entire proc) is PERFORMANCE OVERHEAD!! But, it shouldn't be ""too"" bad and I frankly don't have a better generic non snowflakey way that I can think of right now at 3 AM. FURTHERMORE, mobs/objs have a density check from can_hit_target - to hit non dense objects over a turf, you must click on them, same for mobs that usually wouldn't get hit.
- The thing originally aimed at/clicked on
- Mobs - picks lowest buckled mob to prevent scarp piggybacking memes
- Objs
- Turf
- Nothing