Port TG hitby refactor and detonation of items by projectiles

This commit is contained in:
variableundefined
2019-09-09 22:57:31 -04:00
parent 2e1743598f
commit 69537dd60c
27 changed files with 51 additions and 47 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
/obj/item/borg/stun/attack(mob/living/M, mob/living/silicon/robot/user)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.check_shields(0, "[M]'s [name]", src, MELEE_ATTACK))
if(H.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK))
playsound(M, 'sound/weapons/genhit.ogg', 50, 1)
return 0
+1 -1
View File
@@ -210,7 +210,7 @@
brightness_on = 0
sharp_when_wielded = FALSE // It's a toy
/obj/item/twohanded/dualsaber/toy/hit_reaction()
/obj/item/twohanded/dualsaber/toy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
return 0
/obj/item/twohanded/dualsaber/toy/IsReflect()//Stops Toy Dualsabers from reflecting energy projectiles
@@ -213,10 +213,11 @@
ptank = new /obj/item/tank/plasma/full(src)
update_icon()
/obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(ptank && damage && attack_type == PROJECTILE_ATTACK && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits the fueltank on [owner]'s [src], rupturing it! What a shot!</span>")
var/target_turf = get_turf(owner)
var/turf/target_turf = get_turf(owner)
log_game("A projectile ([hitby]) detonated a flamethrower tank held by [key_name(owner)] at [COORD(target_turf)]")
ignite_turf(target_turf, 100)
qdel(ptank)
return 1 //It hit the flamethrower, not them
@@ -113,9 +113,12 @@
spawn(det_time)
prime()
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(damage && attack_type == PROJECTILE_ATTACK && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
var/turf/T = get_turf(src)
log_game("A projectile ([hitby]) detonated a grenade held by [key_name(owner)] at [COORD(T)]")
message_admins("A projectile ([hitby]) detonated a grenade held by [key_name_admin(owner)] at [ADMIN_COORDJMP(T)]")
prime()
return 1 //It hit the grenade, not them
@@ -137,7 +137,7 @@
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
/obj/item/nullrod/claymore/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/nullrod/claymore/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(attack_type == PROJECTILE_ATTACK)
final_block_chance = 0 //Don't bring a sword to a gunfight
return ..()
@@ -119,7 +119,7 @@
if(item_color == null)
item_color = pick("red", "blue", "green", "purple")
/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(active)
return ..()
return 0
@@ -156,7 +156,7 @@
..()
item_color = null
/obj/item/melee/energy/sword/cyborg/saw/hit_reaction()
/obj/item/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
return 0
/obj/item/melee/energy/sword/saber
@@ -44,7 +44,7 @@
hitsound = 'sound/weapons/rapierhit.ogg'
materials = list(MAT_METAL = 1000)
/obj/item/melee/rapier/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/melee/rapier/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(attack_type == PROJECTILE_ATTACK)
final_block_chance = 0 //Don't bring a sword to a gunfight
return ..()
+3 -3
View File
@@ -3,7 +3,7 @@
block_chance = 50
armor = list(melee = 50, bullet = 50, laser = 50, energy = 0, bomb = 30, bio = 0, rad = 0)
/obj/item/shield/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/shield/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(attack_type == THROWN_PROJECTILE_ATTACK)
final_block_chance += 30
if(attack_type == LEAP_ATTACK)
@@ -63,7 +63,7 @@
attack_verb = list("shoved", "bashed")
var/active = 0
/obj/item/shield/energy/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
/obj/item/shield/energy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
return 0
/obj/item/shield/energy/IsReflect()
@@ -110,7 +110,7 @@
w_class = WEIGHT_CLASS_NORMAL
var/active = 0
/obj/item/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
/obj/item/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(active)
return ..()
return 0
+1 -1
View File
@@ -175,7 +175,7 @@
if(ishuman(L))
var/mob/living/carbon/human/H = L
if(H.check_shields(0, "[user]'s [name]", src, MELEE_ATTACK)) //No message; check_shields() handles that
if(H.check_shields(src, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
return
@@ -51,7 +51,7 @@
if(cooldown <= 0)
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(H.check_shields(0, "[user]'s [name]", src, MELEE_ATTACK))
if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
return
if(check_martial_counter(H, user))
return
+2 -2
View File
@@ -267,7 +267,7 @@
user.SpinAnimation(7, 1)
sleep(1)
/obj/item/twohanded/dualsaber/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
/obj/item/twohanded/dualsaber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(wielded)
return ..()
return FALSE
@@ -507,7 +507,7 @@
armour_penetration = 100
force_on = 30
/obj/item/twohanded/required/chainsaw/doomslayer/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
/obj/item/twohanded/required/chainsaw/doomslayer/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(attack_type == PROJECTILE_ATTACK)
owner.visible_message("<span class='danger'>Ranged attacks just make [owner] angrier!</span>")
playsound(src, pick('sound/weapons/bulletflyby.ogg','sound/weapons/bulletflyby2.ogg','sound/weapons/bulletflyby3.ogg'), 75, 1)
+3 -3
View File
@@ -171,11 +171,11 @@
desc = "This thing looks dangerous... Dangerously good at baseball, that is."
homerun_able = 1
/obj/item/melee/baseball_bat/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type, atom/movable/AM)
/obj/item/melee/baseball_bat/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
. = ..()
if(!istype(AM, /obj/item) || attack_type != THROWN_PROJECTILE_ATTACK)
if(!isitem(hitby) || attack_type != THROWN_PROJECTILE_ATTACK)
return FALSE
var/obj/item/I = AM
var/obj/item/I = hitby
if(I.w_class <= WEIGHT_CLASS_NORMAL || istype(I, /obj/item/beach_ball)) // baseball bat deflecting
if(deflectmode)
if(prob(10))