Refactors throwing (#25946)

* refactors datum/thrownthing

* cleanup

* lewc review

* calling parent doesn't do anything lmao
This commit is contained in:
chuga-git
2024-06-26 21:03:51 +00:00
committed by GitHub
parent 936d19c0a0
commit da42a1c2f6
9 changed files with 173 additions and 92 deletions
+8 -8
View File
@@ -38,9 +38,10 @@
*/
/datum/component/boomerang/proc/prepare_throw(datum/source, datum/thrownthing/thrown_thing, spin)
SIGNAL_HANDLER
if(thrower_easy_catch_enabled && iscarbon(thrown_thing?.thrower))
var/mob/living/carbon/C = thrown_thing.thrower
C.throw_mode_on()
var/mob/thrower = thrown_thing?.get_thrower()
if(thrower_easy_catch_enabled && iscarbon(thrower))
var/mob/living/carbon/carbon_mob = thrower
carbon_mob.throw_mode_on()
/**
* Proc that triggers when the thrown boomerang hits an object.
@@ -75,11 +76,10 @@
/datum/component/boomerang/proc/aerodynamic_swing(datum/thrownthing/throwing_datum, obj/item/true_parent)
var/mob/thrown_by = locateUID(true_parent.thrownby)
if(istype(thrown_by))
var/dir = get_dir(true_parent, thrown_by)
var/turf/T = get_ranged_target_turf(thrown_by, dir, 2)
addtimer(CALLBACK(true_parent, TYPE_PROC_REF(/atom/movable, throw_at), T, boomerang_throw_range, throwing_datum.speed, null, TRUE), 1)
last_boomerang_throw = world.time + BOOMERANG_REBOUND_INTERVAL
true_parent.visible_message("<span class='danger'>[true_parent] is flying back at [throwing_datum.thrower]!</span>", \
addtimer(CALLBACK(true_parent, TYPE_PROC_REF(/atom/movable, throw_at), thrown_by, boomerang_throw_range, throwing_datum.speed, null, TRUE), 0.1 SECONDS)
COOLDOWN_START(src, last_boomerang_throw, BOOMERANG_REBOUND_INTERVAL)
var/mob/thrower = throwing_datum?.get_thrower()
true_parent.visible_message("<span class='danger'>[true_parent] is flying back at [thrower]!</span>", \
"<span class='danger'>You see [true_parent] fly back at you!</span>", \
"<span class='hear'>You hear an aerodynamic woosh!</span>")