Fixes for projectiles bugs (#42463)

* Bandaid fixes for bugs with reflectors projectiles and plasma cutters

* * Fixed bouncing piercing projectiles on qdel
* Fixed projectiles reflection not working
* Fixed heavy beam pulses not penetrating
* Changed numerous projectiles procs to use the new BULLET_ACT_* format

* Final conversions to new BULLET_ACT_* format
This commit is contained in:
Menshin
2019-01-23 09:00:11 +01:00
committed by oranges
parent b1b7eb4eab
commit 9dabcbbb04
22 changed files with 58 additions and 56 deletions
@@ -336,14 +336,14 @@
/obj/item/projectile/tentacle/on_hit(atom/target, blocked = FALSE)
var/mob/living/carbon/human/H = firer
if(blocked >= 100)
return 0
return BULLET_ACT_BLOCK
if(isitem(target))
var/obj/item/I = target
if(!I.anchored)
to_chat(firer, "<span class='notice'>You pull [I] towards yourself.</span>")
H.throw_mode_on()
I.throw_at(H, 10, 2)
. = 1
. = BULLET_ACT_HIT
else if(isliving(target))
var/mob/living/L = target
@@ -358,7 +358,7 @@
if(INTENT_HELP)
C.visible_message("<span class='danger'>[L] is pulled by [H]'s tentacle!</span>","<span class='userdanger'>A tentacle grabs you and pulls you towards [H]!</span>")
C.throw_at(get_step_towards(H,C), 8, 2)
return 1
return BULLET_ACT_HIT
if(INTENT_DISARM)
var/obj/item/I = C.get_active_held_item()
@@ -366,27 +366,27 @@
if(C.dropItemToGround(I))
C.visible_message("<span class='danger'>[I] is yanked off [C]'s hand by [src]!</span>","<span class='userdanger'>A tentacle pulls [I] away from you!</span>")
on_hit(I) //grab the item as if you had hit it directly with the tentacle
return 1
return BULLET_ACT_HIT
else
to_chat(firer, "<span class='danger'>You can't seem to pry [I] off [C]'s hands!</span>")
return 0
return BULLET_ACT_BLOCK
else
to_chat(firer, "<span class='danger'>[C] has nothing in hand to disarm!</span>")
return 0
return BULLET_ACT_HIT
if(INTENT_GRAB)
C.visible_message("<span class='danger'>[L] is grabbed by [H]'s tentacle!</span>","<span class='userdanger'>A tentacle grabs you and pulls you towards [H]!</span>")
C.throw_at(get_step_towards(H,C), 8, 2, H, TRUE, TRUE, callback=CALLBACK(src, .proc/tentacle_grab, H, C))
return 1
return BULLET_ACT_HIT
if(INTENT_HARM)
C.visible_message("<span class='danger'>[L] is thrown towards [H] by a tentacle!</span>","<span class='userdanger'>A tentacle grabs you and throws you towards [H]!</span>")
C.throw_at(get_step_towards(H,C), 8, 2, H, TRUE, TRUE, callback=CALLBACK(src, .proc/tentacle_stab, H, C))
return 1
return BULLET_ACT_HIT
else
L.visible_message("<span class='danger'>[L] is pulled by [H]'s tentacle!</span>","<span class='userdanger'>A tentacle grabs you and pulls you towards [H]!</span>")
L.throw_at(get_step_towards(H,L), 8, 2)
. = 1
. = BULLET_ACT_HIT
/obj/item/projectile/tentacle/Destroy()
qdel(chain)
@@ -181,7 +181,7 @@
if(isliving(target))
var/mob/living/L = target
if(is_servant_of_ratvar(L) || L.stat || L.has_status_effect(STATUS_EFFECT_KINDLE))
return
return BULLET_ACT_HIT
var/atom/O = L.anti_magic_check()
playsound(L, 'sound/magic/fireball.ogg', 50, TRUE, frequency = 1.25)
if(O)
@@ -76,7 +76,7 @@
new_angle_s -= 360
P.setAngle(new_angle_s)
return -1 // complete projectile permutation
return BULLET_ACT_FORCE_PIERCE // complete projectile permutation
if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
P.on_hit(src, 100, def_zone)
@@ -360,8 +360,8 @@
playsound(H, 'sound/effects/shovel_dig.ogg', 70, 1)
H.visible_message("<span class='danger'>The [P.name] sinks harmlessly in [H]'s sandy body!</span>", \
"<span class='userdanger'>The [P.name] sinks harmlessly in [H]'s sandy body!</span>")
return 2
return 0
return BULLET_ACT_BLOCK
return BULLET_ACT_HIT
//Reflects lasers and resistant to burn damage, but very vulnerable to brute damage. Shatters on death.
/datum/species/golem/glass
@@ -397,8 +397,8 @@
var/turf/target = get_turf(P.starting)
// redirect the projectile
P.preparePixelProjectile(locate(CLAMP(target.x + new_x, 1, world.maxx), CLAMP(target.y + new_y, 1, world.maxy), H.z), H)
return -1
return 0
return BULLET_ACT_FORCE_PIERCE
return BULLET_ACT_HIT
//Teleports when hit or when it wants to
/datum/species/golem/bluespace
@@ -823,10 +823,10 @@
/datum/species/golem/bronze/bullet_act(obj/item/projectile/P, mob/living/carbon/human/H)
if(!(world.time > last_gong_time + gong_cooldown))
return 0
return BULLET_ACT_HIT
if(P.flag == "bullet" || P.flag == "bomb")
gong(H)
return 0
return BULLET_ACT_HIT
/datum/species/golem/bronze/spec_hitby(atom/movable/AM, mob/living/carbon/human/H)
..()
@@ -64,8 +64,8 @@
if(light_amount < SHADOW_SPECIES_LIGHT_THRESHOLD)
H.visible_message("<span class='danger'>[H] dances in the shadows, evading [P]!</span>")
playsound(T, "bullet_miss", 75, 1)
return -1
return 0
return BULLET_ACT_FORCE_PIERCE
return BULLET_ACT_HIT
/datum/species/shadow/nightmare/check_roundstart_eligible()
return FALSE
+2 -2
View File
@@ -123,7 +123,7 @@
/mob/living/proc/apply_effects(stun = 0, knockdown = 0, unconscious = 0, irradiate = 0, slur = 0, stutter = 0, eyeblur = 0, drowsy = 0, blocked = FALSE, stamina = 0, jitter = 0, paralyze = 0, immobilize = 0)
if(blocked >= 100)
return 0
return BULLET_ACT_BLOCK
if(stun)
apply_effect(stun, EFFECT_STUN, blocked)
if(knockdown)
@@ -148,7 +148,7 @@
apply_damage(stamina, STAMINA, null, blocked)
if(jitter)
apply_effect(jitter, EFFECT_JITTER, blocked)
return 1
return BULLET_ACT_HIT
/mob/living/proc/getBruteLoss()
+1 -1
View File
@@ -40,7 +40,7 @@
return FALSE
/mob/living/proc/on_hit(obj/item/projectile/P)
return
return BULLET_ACT_HIT
/mob/living/bullet_act(obj/item/projectile/P, def_zone)
var/armor = run_armor_check(def_zone, P.flag, "","",P.armour_penetration)
@@ -171,7 +171,7 @@
new_angle_s -= 360
P.setAngle(new_angle_s)
return -1 // complete projectile permutation
return BULLET_ACT_FORCE_PIERCE // complete projectile permutation
return ..()
@@ -565,8 +565,8 @@
/obj/item/projectile/beam/beam_rifle/hitscan/aiming_beam/prehit(atom/target)
qdel(src)
return FALSE
return BULLET_ACT_HIT
/obj/item/projectile/beam/beam_rifle/hitscan/aiming_beam/on_hit()
qdel(src)
return FALSE
return BULLET_ACT_HIT
+4 -3
View File
@@ -130,7 +130,7 @@
return BODY_ZONE_CHEST
/obj/item/projectile/proc/prehit(atom/target)
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE)
var/turf/target_loca = get_turf(target)
@@ -151,12 +151,12 @@
W.add_dent(WALL_DENT_SHOT, hitx, hity)
return 0
return BULLET_ACT_HIT
if(!isliving(target))
if(impact_effect_type && !hitscan)
new impact_effect_type(target_loca, hitx, hity)
return 0
return BULLET_ACT_HIT
var/mob/living/L = target
@@ -615,6 +615,7 @@
. = ..()
if(.)
if(temporary_unstoppable_movement)
temporary_unstoppable_movement = FALSE
DISABLE_BITFIELD(movement_type, UNSTOPPABLE)
if(fired && can_hit_target(original, permutated, TRUE))
Bump(original)
+1 -1
View File
@@ -106,7 +106,7 @@
/obj/item/projectile/beam/pulse/heavy/on_hit(atom/target, blocked = FALSE)
life -= 10
if(life > 0)
. = -1
. = BULLET_ACT_FORCE_PIERCE
..()
/obj/item/projectile/beam/emitter
@@ -16,7 +16,7 @@
..()
reagents.reaction(M, INJECT)
reagents.trans_to(M, reagents.total_volume)
return TRUE
return BULLET_ACT_HIT
else
blocked = 100
target.visible_message("<span class='danger'>\The [src] was deflected!</span>", \
@@ -25,7 +25,7 @@
..(target, blocked)
DISABLE_BITFIELD(reagents.flags, NO_REACT)
reagents.handle_reactions()
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/bullet/dart/metalfoam/Initialize()
. = ..()
@@ -12,7 +12,7 @@
if(M.can_inject(null, FALSE, def_zone, FALSE))
if(injector.inject(M, firer))
QDEL_NULL(injector)
return TRUE
return BULLET_ACT_HIT
else
blocked = 100
target.visible_message("<span class='danger'>\The [src] was deflected!</span>", \
@@ -9,4 +9,4 @@
/obj/item/projectile/bullet/a40mm/on_hit(atom/target, blocked = FALSE)
..()
explosion(target, -1, 0, 2, 1, 0, flame_range = 3)
return TRUE
return BULLET_ACT_HIT
@@ -52,7 +52,7 @@
/obj/item/projectile/bullet/shotgun_frag12/on_hit(atom/target, blocked = FALSE)
..()
explosion(target, -1, 0, 1)
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/bullet/pellet
var/tile_dropoff = 0.75
+13 -13
View File
@@ -17,7 +17,7 @@
var/mob/M = target
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
return
return BULLET_ACT_BLOCK
M.death(0)
/obj/item/projectile/magic/resurrection
@@ -31,10 +31,10 @@
. = ..()
if(isliving(target))
if(target.hellbound)
return
return BULLET_ACT_BLOCK
if(target.anti_magic_check())
target.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
return
return BULLET_ACT_BLOCK
if(iscarbon(target))
var/mob/living/carbon/C = target
C.regenerate_limbs()
@@ -60,7 +60,7 @@
var/mob/M = target
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
return
return BULLET_ACT_BLOCK
var/teleammount = 0
var/teleloc = target
if(!isturf(target))
@@ -86,9 +86,9 @@
var/mob/M = target
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
return
return BULLET_ACT_BLOCK
if(isturf(target))
return
return BULLET_ACT_HIT
var/turf/origin_turf = get_turf(target)
var/turf/destination_turf = find_safe_turf()
@@ -142,7 +142,7 @@
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] fizzles on contact with [M]!</span>")
qdel(src)
return
return BULLET_ACT_BLOCK
wabbajack(change)
qdel(src)
@@ -341,7 +341,7 @@
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
qdel(src)
return
return BULLET_ACT_BLOCK
. = ..()
/obj/item/projectile/magic/arcane_barrage
@@ -379,11 +379,11 @@
if(M.anti_magic_check())
M.visible_message("<span class='warning'>[src] vanishes on contact with [A]!</span>")
qdel(src)
return
return BULLET_ACT_BLOCK
if(M.anchored)
return ..()
M.forceMove(src)
return FALSE
return BULLET_ACT_HIT
return ..()
/obj/item/projectile/magic/locker/on_hit(target)
@@ -486,7 +486,7 @@
if(M.anti_magic_check())
visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
qdel(src)
return
return BULLET_ACT_BLOCK
tesla_zap(src, tesla_range, tesla_power, tesla_flags)
qdel(src)
@@ -513,7 +513,7 @@
var/mob/living/M = target
if(M.anti_magic_check())
visible_message("<span class='warning'>[src] vanishes into smoke on contact with [target]!</span>")
return
return BULLET_ACT_BLOCK
M.take_overall_damage(0,10) //between this 10 burn, the 10 brute, the explosion brute, and the onfire burn, your at about 65 damage if you stop drop and roll immediately
var/turf/T = get_turf(target)
explosion(T, -1, exp_heavy, exp_light, exp_flash, 0, flame_range = exp_fire)
@@ -530,7 +530,7 @@
if(ismob(target))
var/mob/living/M = target
if(M.anti_magic_check())
return
return BULLET_ACT_BLOCK
var/turf/T = get_turf(target)
for(var/i=0, i<50, i+=10)
addtimer(CALLBACK(GLOBAL_PROC, .proc/explosion, T, -1, exp_heavy, exp_light, exp_flash, FALSE, FALSE, exp_fire), i)
@@ -30,7 +30,7 @@
if(target == original)
DISABLE_BITFIELD(movement_type, UNSTOPPABLE)
else if(!isturf(target))
return FALSE
return BULLET_ACT_HIT
return ..()
/obj/item/projectile/curse_hand/Destroy()
@@ -10,11 +10,11 @@
/obj/item/projectile/ion/on_hit(atom/target, blocked = FALSE)
..()
empulse(target, 1, 1)
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/ion/weak
/obj/item/projectile/ion/weak/on_hit(atom/target, blocked = FALSE)
..()
empulse(target, 0, 0)
return TRUE
return BULLET_ACT_HIT
@@ -20,7 +20,7 @@
mine_range--
range++
if(range > 0)
return -1
return BULLET_ACT_FORCE_PIERCE
/obj/item/projectile/plasma/adv
damage = 7
@@ -6,7 +6,7 @@
/obj/item/projectile/bullet/gyro/on_hit(atom/target, blocked = FALSE)
..()
explosion(target, -1, 0, 2)
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/bullet/a84mm
name ="\improper HEDP rocket"
@@ -27,7 +27,7 @@
if(issilicon(target))
var/mob/living/silicon/S = target
S.take_overall_damage(anti_armour_damage*0.75, anti_armour_damage*0.25)
return TRUE
return BULLET_ACT_HIT
/obj/item/projectile/bullet/a84mm_he
name ="\improper HE rocket"
@@ -42,4 +42,4 @@
explosion(target, 0, 1, 2, 4)
else
explosion(target, 0, 0, 2, 4)
return TRUE
return BULLET_ACT_HIT