Merge pull request #2215 from Citadel-Station-13/upstream-merge-29319
[MIRROR] Refactors pie throwing and fixes throwing not finalizing in some cases
This commit is contained in:
@@ -103,7 +103,7 @@ SUBSYSTEM_DEF(throwing)
|
||||
finalize()
|
||||
return
|
||||
|
||||
/datum/thrownthing/proc/finalize(hit = FALSE)
|
||||
/datum/thrownthing/proc/finalize(hit = FALSE, target=null)
|
||||
set waitfor = 0
|
||||
SSthrowing.processing -= thrownthing
|
||||
//done throwing, either because it hit something or it finished moving
|
||||
@@ -120,13 +120,15 @@ SUBSYSTEM_DEF(throwing)
|
||||
thrownthing.newtonian_move(init_dir)
|
||||
else
|
||||
thrownthing.newtonian_move(init_dir)
|
||||
|
||||
if(target)
|
||||
thrownthing.throw_impact(target, src)
|
||||
|
||||
if (callback)
|
||||
callback.Invoke()
|
||||
|
||||
/datum/thrownthing/proc/hit_atom(atom/A)
|
||||
thrownthing.throw_impact(A, src)
|
||||
thrownthing.newtonian_move(init_dir)
|
||||
finalize(TRUE)
|
||||
finalize(hit=TRUE, target=A)
|
||||
|
||||
/datum/thrownthing/proc/hitcheck()
|
||||
for (var/thing in get_turf(thrownthing))
|
||||
@@ -134,6 +136,5 @@ SUBSYSTEM_DEF(throwing)
|
||||
if (AM == thrownthing)
|
||||
continue
|
||||
if (AM.density && !(AM.pass_flags & LETPASSTHROW) && !(AM.flags & ON_BORDER))
|
||||
thrownthing.throwing = null
|
||||
thrownthing.throw_impact(AM, src)
|
||||
finalize(hit=TRUE, target=AM)
|
||||
return TRUE
|
||||
|
||||
@@ -26,24 +26,29 @@
|
||||
tastes = list("pie" = 1)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/pie/cream/throw_impact(atom/hit_atom)
|
||||
if(!..()) //was it caught by a mob?
|
||||
var/turf/T = get_turf(hit_atom)
|
||||
new/obj/effect/decal/cleanable/pie_smudge(T)
|
||||
reagents.reaction(hit_atom, TOUCH)
|
||||
. = ..()
|
||||
if(!.) //if we're not being caught
|
||||
splat(hit_atom)
|
||||
|
||||
if(ishuman(hit_atom))
|
||||
var/mob/living/carbon/human/H = hit_atom
|
||||
var/mutable_appearance/creamoverlay = mutable_appearance('icons/effects/creampie.dmi')
|
||||
if(H.dna.species.id == "lizard")
|
||||
creamoverlay.icon_state = "creampie_lizard"
|
||||
else
|
||||
creamoverlay.icon_state = "creampie_human"
|
||||
H.Knockdown(20) //splat!
|
||||
H.adjust_blurriness(1)
|
||||
visible_message("<span class='userdanger'>[H] was creamed by [src]!!</span>")
|
||||
H.add_overlay(creamoverlay)
|
||||
|
||||
qdel(src)
|
||||
/obj/item/weapon/reagent_containers/food/snacks/pie/cream/proc/splat(atom/movable/hit_atom)
|
||||
if(isliving(loc)) //someone caught us!
|
||||
return
|
||||
var/turf/T = get_turf(hit_atom)
|
||||
new/obj/effect/decal/cleanable/pie_smudge(T)
|
||||
reagents.reaction(hit_atom, TOUCH)
|
||||
if(ishuman(hit_atom))
|
||||
var/mob/living/carbon/human/H = hit_atom
|
||||
var/mutable_appearance/creamoverlay = mutable_appearance('icons/effects/creampie.dmi')
|
||||
if(H.dna.species.limbs_id == "lizard")
|
||||
creamoverlay.icon_state = "creampie_lizard"
|
||||
else
|
||||
creamoverlay.icon_state = "creampie_human"
|
||||
H.Knockdown(20) //splat!
|
||||
H.adjust_blurriness(1)
|
||||
H.visible_message("<span class='warning'>[H] is creamed by [src]!</span>", "<span class='userdanger'>You've been creamed by [src]!</span>")
|
||||
playsound(H, "desceration", 50, TRUE)
|
||||
H.add_overlay(creamoverlay)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/pie/berryclafoutis
|
||||
|
||||
Reference in New Issue
Block a user