Locker Shoving Re-Reloaded (#62618)

* Locker Shoving Re-Reloaded

The signals here were weird, converted them to connect loc. I did my best to make sure behavior matched what
existed pre arcane pr
Unshat shove code considerably, believe it or not it used to be worse.
This commit is contained in:
LemonInTheDark
2021-11-09 13:13:59 -08:00
committed by GitHub
parent f5f56ddedb
commit 71c480574a
7 changed files with 110 additions and 90 deletions
@@ -74,7 +74,12 @@
. = ..()
update_appearance()
PopulateContents()
RegisterSignal(src, COMSIG_CARBON_DISARM_COLLIDE, .proc/locker_carbon)
if(QDELETED(src)) //It turns out populate contents has a 1 in 100 chance of qdeling src on /obj/structure/closet/emcloset
return //Why
var/static/list/loc_connections = list(
COMSIG_CARBON_DISARM_COLLIDE = .proc/locker_carbon,
)
AddElement(/datum/element/connect_loc, loc_connections)
//USE THIS TO FILL IT, NOT INITIALIZE OR NEW
/obj/structure/closet/proc/PopulateContents()
@@ -679,19 +684,22 @@
/obj/structure/closet/return_temperature()
return
/obj/structure/closet/proc/locker_carbon(obj/structure/closet/closet, mob/living/carbon/shover, mob/living/carbon/target)
/obj/structure/closet/proc/locker_carbon(datum/source, mob/living/carbon/shover, mob/living/carbon/target, shove_blocked)
SIGNAL_HANDLER
if(!opened && (locked || welded)) //Yes this could be less code, no I don't care
return
if(!opened && !shove_blocked)
return
if(opened)
target.forceMove(src)
if(!(locked || welded))
toggle()
else
target.Knockdown(SHOVE_KNOCKDOWN_SOLID)
toggle()
update_icon()
target.visible_message(span_danger("[shover.name] shoves [target.name] into \the [src]!"),
span_userdanger("You're shoved into \the [src] by [target.name]!"), span_hear("You hear aggressive shuffling followed by a loud thud!"), COMBAT_MESSAGE_RANGE, src)
to_chat(src, span_danger("You shove [target.name] into \the [src]!"))
log_combat(src, target, "shoved", "into [src] (locker/crate)")
if(locked || welded)
return
return COMSIG_CARBON_SHOVE_HANDLED
#undef LOCKER_FULL
@@ -49,7 +49,7 @@
if ("nothing")
// doot
// teehee
// teehee //Fuck you
if ("delete")
qdel(src)
+11 -6
View File
@@ -41,7 +41,10 @@
if(_buildstack)
buildstack = _buildstack
AddElement(/datum/element/climbable)
RegisterSignal(src, COMSIG_CARBON_DISARM_COLLIDE, .proc/table_carbon)
var/static/list/loc_connections = list(
COMSIG_CARBON_DISARM_COLLIDE = .proc/table_carbon,
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/table/examine(mob/user)
. = ..()
@@ -259,14 +262,16 @@
return TRUE
return FALSE
/obj/structure/table/proc/table_carbon(obj/structure/table/the_table, mob/living/carbon/shover, mob/living/carbon/target)
/obj/structure/table/proc/table_carbon(datum/source, mob/living/carbon/shover, mob/living/carbon/target, shove_blocked)
SIGNAL_HANDLER
if(!shove_blocked)
return
target.Knockdown(SHOVE_KNOCKDOWN_TABLE)
target.visible_message(span_danger("[shover.name] shoves [target.name] onto \the [the_table]!"),
span_userdanger("You're shoved onto \the [the_table] by [shover.name]!"), span_hear("You hear aggressive shuffling followed by a loud thud!"), COMBAT_MESSAGE_RANGE, src)
to_chat(shover, span_danger("You shove [target.name] onto \the [the_table]!"))
target.visible_message(span_danger("[shover.name] shoves [target.name] onto \the [src]!"),
span_userdanger("You're shoved onto \the [src] by [shover.name]!"), span_hear("You hear aggressive shuffling followed by a loud thud!"), COMBAT_MESSAGE_RANGE, src)
to_chat(shover, span_danger("You shove [target.name] onto \the [src]!"))
target.throw_at(src, 1, 1, null, FALSE) //1 speed throws with no spin are basically just forcemoves with a hard collision check
log_combat(src, target, "shoved", "onto [the_table] (table)")
log_combat(src, target, "shoved", "onto [src] (table)")
return COMSIG_CARBON_SHOVE_HANDLED
/obj/structure/table/greyscale