Getting thrown into things actually hurts now [ready for review] (#21022)

* Getting thrown into things actually hurts now

* add the blob one too dingus

* more changes consoles windows ect

* fucking hell one sec

* now up to date

* Apply suggestions from code review

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* early returns

* rename of proc

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2023-06-07 20:03:36 +01:00
committed by GitHub
co-authored by Ryan
parent 252bcfec3c
commit 89f8bba648
9 changed files with 86 additions and 24 deletions
+4
View File
@@ -547,6 +547,10 @@
if(density && !has_gravity(AM)) //thrown stuff bounces off dense stuff in no grav, unless the thrown stuff ends up inside what it hit(embedding, bola, etc...).
addtimer(CALLBACK(src, PROC_REF(hitby_react), AM), 2)
/// This proc applies special effects of a carbon mob hitting something, be it a wall, structure, or window. You can set mob_hurt to false to avoid double dipping through subtypes if returning ..()
/atom/proc/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt = FALSE, self_hurt = FALSE)
return
/atom/proc/hitby_react(atom/movable/AM)
if(AM && isturf(AM.loc))
step(AM, turn(AM.dir, 180))
+8
View File
@@ -176,3 +176,11 @@
if(circuit && !(flags & NODECONSTRUCT))
if(I.use_tool(src, user, 20, volume = I.tool_volume))
deconstruct(TRUE, user)
/obj/machinery/computer/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
if(!self_hurt && prob(50 * (damage / 15)))
obj_break(MELEE)
take_damage(damage, BRUTE)
self_hurt = TRUE
return ..()
+8
View File
@@ -1118,6 +1118,14 @@
tilt(target, from_combat = TRUE)
return TRUE
/obj/machinery/economy/vending/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
if(HAS_TRAIT(C, TRAIT_FLATTENED))
return ..()
tilt(C, from_combat = TRUE)
mob_hurt = TRUE
return ..()
/*
* Vending machine types
*/
+10
View File
@@ -297,3 +297,13 @@
// In the event that the object doesn't have an overriden version of this proc to do it, log a runtime so one can be added.
CRASH("Proc force_eject_occupant() is not overridden on a machine containing a mob.")
/obj/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
damage *= 0.75 //Define this probably somewhere, we want objects to hurt less than walls, unless special impact effects.
playsound(src, 'sound/weapons/punch1.ogg', 35, 1)
if(mob_hurt) //Density check probably not needed, one should only bump into something if it is dense, and blob tiles are not dense, because of course they are not.
return
C.visible_message("<span class='danger'>[C] slams into [src]!</span>", "<span class='userdanger'>You slam into [src]!</span>")
C.take_organ_damage(damage)
if(!self_hurt)
take_damage(damage, BRUTE)
C.KnockDown(3 SECONDS)
+25
View File
@@ -499,6 +499,31 @@
if(exposed_temperature > (T0C + heat_resistance))
take_damage(round(exposed_volume / 100), BURN, 0, 0)
/obj/structure/window/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
var/shattered = FALSE
if(damage * 2 >= obj_integrity && shardtype && !mob_hurt)
shattered = TRUE
var/obj/item/S = new shardtype(loc)
S.embedded_ignore_throwspeed_threshold = TRUE
S.throw_impact(C)
S.embedded_ignore_throwspeed_threshold = FALSE
damage *= (4/3) //Inverts damage loss from being a structure, since glass breaking on you hurts
var/turf/T = get_turf(src)
for(var/obj/structure/grille/G in T.contents)
var/obj/structure/cable/SC = T.get_cable_node()
if(SC)
playsound(G, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
tesla_zap(G, 3, SC.get_queued_available_power() * 0.05, ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_MOB_STUN | ZAP_ALLOW_DUPLICATES) //Zap for 1/20 of the amount of power, because I am evil.
SC.add_queued_power_demand(SC.get_queued_available_power() * 0.0375) // you can gain up to 3.5 via the 4x upgrades power is halved by the pole so thats 2x then 1X then .5X for 3.5x the 3 bounces shock.
qdel(G) //We don't want the grille to block the way, we want rule of cool of throwing people into space!
if(!self_hurt)
take_damage(damage * 2, BRUTE) //Makes windows more vunerable to being thrown so they'll actually shatter in a reasonable ammount of time.
self_hurt = TRUE
..()
if(shattered)
C.throw_at(throwingdatum.target, throwingdatum.maxrange - 1, throwingdatum.speed - 1) //Annnnnnnd yeet them into space, but slower, now that everything is dealt with
/obj/structure/window/GetExplosionBlock()
return reinf && fulltile ? real_explosion_block : 0
+9
View File
@@ -573,3 +573,12 @@
else
return I
return I
/turf/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
if(mob_hurt || !density)
return
playsound(src, 'sound/weapons/punch1.ogg', 35, 1)
C.visible_message("<span class='danger'>[C] slams into [src]!</span>", "<span class='userdanger'>You slam into [src]!</span>")
C.take_organ_damage(damage)
C.KnockDown(3 SECONDS)
+4
View File
@@ -268,6 +268,10 @@ GLOBAL_LIST_EMPTY(blob_nodes)
return B.blob_reagent_datum.description
return "something unknown"
/obj/structure/blob/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
damage *= 0.25 // Lets not have sorium be too much of a blender / rapidly kill itself
return ..()
/obj/structure/blob/normal
icon_state = "blob"
light_range = 0
+6 -24
View File
@@ -612,31 +612,13 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
playsound(get_turf(src), 'sound/effects/meteorimpact.ogg', 100, TRUE)
return
var/hurt = TRUE
var/damage = 10 + 1.5 * speed // speed while thrower is standing still is 2, while walking with an aggressive grab is 2.4, highest speed is 14
/*if(istype(throwingdatum, /datum/thrownthing))
var/datum/thrownthing/D = throwingdatum
if(isrobot(D.thrower))
var/mob/living/silicon/robot/R = D.thrower
if(!R.emagged)
hurt = FALSE*/
if(hit_atom.density && isturf(hit_atom))
if(hurt)
visible_message("<span class='danger'>[src] slams into [hit_atom]!</span>", "<span class='userdanger'>You slam into [hit_atom]!</span>")
take_organ_damage(damage)
KnockDown(3 SECONDS)
playsound(src, 'sound/weapons/punch1.ogg', 35, 1)
if(iscarbon(hit_atom) && hit_atom != src)
var/mob/living/carbon/victim = hit_atom
if(victim.flying)
return
if(hurt)
victim.take_organ_damage(damage)
take_organ_damage(damage)
victim.KnockDown(3 SECONDS)
KnockDown(3 SECONDS)
visible_message("<span class='danger'>[src] crashes into [victim], knocking them both over!</span>", "<span class='userdanger'>You violently crash into [victim]!</span>")
playsound(src, 'sound/weapons/punch1.ogg', 50, 1)
hit_atom.hit_by_thrown_carbon(src, throwingdatum, damage, FALSE, FALSE)
/mob/living/carbon/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
. = ..()
KnockDown(3 SECONDS)
/mob/living/carbon/proc/toggle_throw_mode()
if(in_throw_mode)
+12
View File
@@ -1139,3 +1139,15 @@
/mob/living/throw_at(atom/target, range, speed, mob/thrower, spin, diagonals_first, datum/callback/callback, force, dodgeable)
stop_pulling()
return ..()
/mob/living/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
if(C == src || flying || !density)
return
playsound(src, 'sound/weapons/punch1.ogg', 50, 1)
if(mob_hurt)
return
if(!self_hurt)
take_organ_damage(damage)
C.take_organ_damage(damage)
C.KnockDown(3 SECONDS)
C.visible_message("<span class='danger'>[C] crashes into [src], knocking them both over!</span>", "<span class='userdanger'>You violently crash into [src]!</span>")