mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-02 04:52:10 +00:00
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs. Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines. Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing. Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc. (Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
150 lines
4.8 KiB
Plaintext
150 lines
4.8 KiB
Plaintext
//////Kitchen Spike
|
|
#define VIABLE_MOB_CHECK(X) (isliving(X) && !issilicon(X) && !isbot(X))
|
|
|
|
/obj/structure/kitchenspike_frame
|
|
name = "meatspike frame"
|
|
icon = 'icons/obj/kitchen.dmi'
|
|
icon_state = "spikeframe"
|
|
desc = "The frame of a meat spike."
|
|
density = TRUE
|
|
anchored = FALSE
|
|
max_integrity = 200
|
|
|
|
/obj/structure/kitchenspike_frame/attackby(obj/item/I, mob/user, params)
|
|
add_fingerprint(user)
|
|
if(default_unfasten_wrench(user, I))
|
|
return
|
|
else if(istype(I, /obj/item/stack/rods))
|
|
var/obj/item/stack/rods/R = I
|
|
if(R.get_amount() >= 4)
|
|
R.use(4)
|
|
to_chat(user, span_notice("You add spikes to the frame."))
|
|
var/obj/F = new /obj/structure/kitchenspike(src.loc)
|
|
transfer_fingerprints_to(F)
|
|
qdel(src)
|
|
else if(I.tool_behaviour == TOOL_WELDER)
|
|
if(!I.tool_start_check(user, amount=0))
|
|
return
|
|
to_chat(user, span_notice("You begin cutting \the [src] apart..."))
|
|
if(I.use_tool(src, user, 50, volume=50))
|
|
visible_message(span_notice("[user] slices apart \the [src]."),
|
|
span_notice("You cut \the [src] apart with \the [I]."),
|
|
span_hear("You hear welding."))
|
|
new /obj/item/stack/sheet/iron(src.loc, 4)
|
|
qdel(src)
|
|
return
|
|
else
|
|
return ..()
|
|
|
|
/obj/structure/kitchenspike
|
|
name = "meat spike"
|
|
icon = 'icons/obj/kitchen.dmi'
|
|
icon_state = "spike"
|
|
desc = "A spike for collecting meat from animals."
|
|
density = TRUE
|
|
anchored = TRUE
|
|
buckle_lying = 0
|
|
can_buckle = 1
|
|
max_integrity = 250
|
|
|
|
/obj/structure/kitchenspike/attack_paw(mob/user, list/modifiers)
|
|
return attack_hand(user, modifiers)
|
|
|
|
/obj/structure/kitchenspike/crowbar_act(mob/living/user, obj/item/I)
|
|
if(has_buckled_mobs())
|
|
to_chat(user, span_warning("You can't do that while something's on the spike!"))
|
|
return TRUE
|
|
|
|
if(I.use_tool(src, user, 20, volume=100))
|
|
to_chat(user, span_notice("You pry the spikes out of the frame."))
|
|
deconstruct(TRUE)
|
|
return TRUE
|
|
|
|
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
|
/obj/structure/kitchenspike/attack_hand(mob/living/user, list/modifiers)
|
|
if(VIABLE_MOB_CHECK(user.pulling) && user.combat_mode && !has_buckled_mobs())
|
|
var/mob/living/L = user.pulling
|
|
if(do_mob(user, src, 120))
|
|
if(has_buckled_mobs()) //to prevent spam/queing up attacks
|
|
return
|
|
if(L.buckled)
|
|
return
|
|
if(user.pulling != L)
|
|
return
|
|
playsound(src.loc, 'sound/effects/splat.ogg', 25, TRUE)
|
|
L.visible_message(span_danger("[user] slams [L] onto the meat spike!"), span_userdanger("[user] slams you onto the meat spike!"), span_hear("You hear a squishy wet noise."))
|
|
L.forceMove(drop_location())
|
|
L.emote("scream")
|
|
L.add_splatter_floor()
|
|
L.adjustBruteLoss(30)
|
|
L.setDir(2)
|
|
buckle_mob(L, force=1)
|
|
var/matrix/m180 = matrix(L.transform)
|
|
m180.Turn(180)
|
|
animate(L, transform = m180, time = 3)
|
|
L.pixel_y = L.base_pixel_y + PIXEL_Y_OFFSET_LYING
|
|
else if (has_buckled_mobs())
|
|
for(var/mob/living/L in buckled_mobs)
|
|
user_unbuckle_mob(L, user)
|
|
else
|
|
..()
|
|
|
|
|
|
|
|
/obj/structure/kitchenspike/user_buckle_mob(mob/living/M, mob/user, check_loc = TRUE) //Don't want them getting put on the rack other than by spiking
|
|
return
|
|
|
|
/obj/structure/kitchenspike/user_unbuckle_mob(mob/living/buckled_mob, mob/living/carbon/human/user)
|
|
if(buckled_mob)
|
|
var/mob/living/M = buckled_mob
|
|
if(M != user)
|
|
M.visible_message(span_notice("[user] tries to pull [M] free of [src]!"),\
|
|
span_notice("[user] is trying to pull you off [src], opening up fresh wounds!"),\
|
|
span_hear("You hear a squishy wet noise."))
|
|
if(!do_after(user, 300, target = src))
|
|
if(M?.buckled)
|
|
M.visible_message(span_notice("[user] fails to free [M]!"),\
|
|
span_notice("[user] fails to pull you off of [src]."))
|
|
return
|
|
|
|
else
|
|
M.visible_message(span_warning("[M] struggles to break free from [src]!"),\
|
|
span_notice("You struggle to break free from [src], exacerbating your wounds! (Stay still for two minutes.)"),\
|
|
span_hear("You hear a wet squishing noise.."))
|
|
M.adjustBruteLoss(30)
|
|
if(!do_after(M, 1200, target = src))
|
|
if(M?.buckled)
|
|
to_chat(M, span_warning("You fail to free yourself!"))
|
|
return
|
|
if(!M.buckled)
|
|
return
|
|
release_mob(M)
|
|
|
|
/obj/structure/kitchenspike/proc/release_mob(mob/living/M)
|
|
var/matrix/m180 = matrix(M.transform)
|
|
m180.Turn(180)
|
|
animate(M, transform = m180, time = 3)
|
|
M.pixel_y = M.base_pixel_y + PIXEL_Y_OFFSET_LYING
|
|
M.adjustBruteLoss(30)
|
|
src.visible_message(span_danger("[M] falls free of [src]!"))
|
|
unbuckle_mob(M,force=1)
|
|
M.emote("scream")
|
|
M.AdjustParalyzed(20)
|
|
|
|
/obj/structure/kitchenspike/Destroy()
|
|
if(has_buckled_mobs())
|
|
for(var/mob/living/L in buckled_mobs)
|
|
release_mob(L)
|
|
return ..()
|
|
|
|
/obj/structure/kitchenspike/deconstruct(disassembled = TRUE)
|
|
if(disassembled)
|
|
var/obj/F = new /obj/structure/kitchenspike_frame(src.loc)
|
|
transfer_fingerprints_to(F)
|
|
else
|
|
new /obj/item/stack/sheet/iron(src.loc, 4)
|
|
new /obj/item/stack/rods(loc, 4)
|
|
qdel(src)
|
|
|
|
#undef VIABLE_MOB_CHECK
|