[DNM][DNM][WIP] Projectile backend code port and update
Ports#54924, #65061, #59804 from /tg. adds auxiliary code from /tg to make code work.
This commit is contained in:
+31
-3
@@ -9,6 +9,9 @@
|
||||
plane = GAME_PLANE
|
||||
appearance_flags = TILE_BOUND
|
||||
|
||||
/// pass_flags that we are. If any of this matches a pass_flag on a moving thing, by default, we let them through.
|
||||
var/pass_flags_self = NONE
|
||||
|
||||
var/level = 2
|
||||
///If non-null, overrides a/an/some in all cases
|
||||
var/article
|
||||
@@ -269,12 +272,27 @@
|
||||
return FALSE
|
||||
if((P.flag in list("bullet", "bomb")) && P.ricochet_incidence_leeway)
|
||||
if((a_incidence_s < 90 && a_incidence_s < 90 - P.ricochet_incidence_leeway) || (a_incidence_s > 270 && a_incidence_s -270 > P.ricochet_incidence_leeway))
|
||||
return
|
||||
return FALSE
|
||||
var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s)
|
||||
P.setAngle(new_angle_s)
|
||||
return TRUE
|
||||
|
||||
/atom/proc/CanPass(atom/movable/mover, turf/target)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
if(mover.movement_type & PHASING)
|
||||
return TRUE
|
||||
. = CanAllowThrough(mover, target)
|
||||
// This is cheaper than calling the proc every time since most things dont override CanPassThrough
|
||||
if(!mover.generic_canpass)
|
||||
return mover.CanPassThrough(src, target, .)
|
||||
|
||||
/// Returns true or false to allow the mover to move through src
|
||||
/atom/proc/CanAllowThrough(atom/movable/mover, turf/target)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
if(mover.pass_flags & pass_flags_self)
|
||||
return TRUE
|
||||
if(mover.throwing && (pass_flags_self & LETPASSTHROW))
|
||||
return TRUE
|
||||
return !density
|
||||
|
||||
/**
|
||||
@@ -445,9 +463,19 @@
|
||||
wires.emp_pulse(severity)
|
||||
return protection // Pass the protection value collected here upwards
|
||||
|
||||
/atom/proc/bullet_act(obj/item/projectile/P, def_zone)
|
||||
/**
|
||||
* React to a hit by a projectile object
|
||||
*
|
||||
* Default behaviour is to send the [COMSIG_ATOM_BULLET_ACT] and then call [on_hit][/obj/item/projectile/proc/on_hit] on the projectile
|
||||
*
|
||||
* @params
|
||||
* P - projectile
|
||||
* def_zone - zone hit
|
||||
* piercing_hit - is this hit piercing or normal?
|
||||
*/
|
||||
/atom/proc/bullet_act(obj/item/projectile/P, def_zone, piercing_hit = FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, P, def_zone)
|
||||
. = P.on_hit(src, 0, def_zone)
|
||||
. = P.on_hit(src, 0, def_zone, piercing_hit)
|
||||
|
||||
//used on altdisarm() for special interactions between the shoved victim (target) and the src, with user being the one shoving the target on it.
|
||||
// IMPORTANT: if you wish to add a new own shove_act() to a certain object, remember to add SHOVABLE_ONTO to its obj_flags bitfied var first.
|
||||
|
||||
Reference in New Issue
Block a user