From 3c50c2f6ba4e18e904556ebde1cf64a41d41aad3 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Wed, 11 Jan 2017 02:07:20 -0800 Subject: [PATCH] Makes conveyors easier to place with buildmode, adds vars to autogibbers makes them kill stuff stupid fast --- code/game/atoms.dm | 4 ++ code/game/machinery/machinery.dm | 16 +++++ code/modules/admin/buildmode.dm | 22 ++---- .../kitchen_machinery/gibber.dm | 67 ++++++++++++------- code/modules/recycling/conveyor2.dm | 4 ++ 5 files changed, 72 insertions(+), 41 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 663d6c5a8f9..b02d6ba04c1 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -15,6 +15,10 @@ var/atom_say_verb = "says" var/dont_save = 0 // For atoms that are temporary by necessity - like lighting overlays + // A list of datums that desire to interact with this atom - used so that automated processes + // don't step on one another's toes, if they are doing an action that takes time + var/list/interaction_queue = list() + ///Chemistry. var/datum/reagents/reagents = null diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 60ce5e32a34..4d41a591b9c 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -132,6 +132,22 @@ Class Procs: else fast_processing += src +// gotta go fast +/obj/machinery/proc/makeSpeedProcess() + if(speed_process) + return + speed_process = 1 + machine_processing -= src + fast_processing += src + +// gotta go slow +/obj/machinery/proc/makeNormalProcess() + if(!speed_process) + return + speed_process = 0 + machine_processing += src + fast_processing -= src + /obj/machinery/New() //new machines += src ..() diff --git a/code/modules/admin/buildmode.dm b/code/modules/admin/buildmode.dm index 72461ed6ae1..3acc106b907 100644 --- a/code/modules/admin/buildmode.dm +++ b/code/modules/admin/buildmode.dm @@ -446,22 +446,8 @@ log_admin("Build Mode: [key_name(user)] built an airlock at ([object.x],[object.y],[object.z])") new/obj/machinery/door/airlock(get_turf(object)) else if(istype(object,/turf) && ctrl_click && left_click) - switch(build_dir) - if(NORTH) - var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) - WIN.dir = NORTH - if(SOUTH) - var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) - WIN.dir = SOUTH - if(EAST) - var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) - WIN.dir = EAST - if(WEST) - var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) - WIN.dir = WEST - if(NORTHWEST) - var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) - WIN.dir = NORTHWEST + var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object)) + WIN.set_dir(build_dir) log_admin("Build Mode: [key_name(user)] built a window at ([object.x],[object.y],[object.z])") if(ADV_BUILDMODE) @@ -472,7 +458,7 @@ T.ChangeTurf(objholder) else var/obj/A = new objholder (get_turf(object)) - A.dir = build_dir + A.set_dir(build_dir) log_admin("Build Mode: [key_name(user)] modified [A]'s ([A.x],[A.y],[A.z]) dir to [build_dir]") else if(right_click) if(isobj(object)) @@ -561,7 +547,7 @@ T.ChangeTurf(objholder) else var/obj/A = new objholder(T) - A.dir = build_dir + A.set_dir(build_dir) deselect_region() return diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index fafa983cf1d..71376425939 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -12,7 +12,12 @@ var/locked = 0 //Used to prevent mobs from breaking the feedin anim var/gib_throw_dir = WEST // Direction to spit meat and gibs in. Defaults to west. + var/gibtime = 40 // Time from starting until meat appears + var/animation_delay = GIBBER_ANIMATION_DELAY + + // For hiding gibs, making an even more devious trap (invisible autogibbers) + var/stealthmode = FALSE var/list/victims = list() @@ -110,25 +115,25 @@ /obj/machinery/gibber/proc/move_into_gibber(var/mob/user,var/mob/living/victim) if(occupant) - to_chat(user, "The gibber is full, empty it first!") + to_chat(user, "The [src] is full, empty it first!") return if(operating) - to_chat(user, "The gibber is locked and running, wait for it to finish.") + to_chat(user, "The [src] is locked and running, wait for it to finish.") return if(!ishuman(victim) || issmall(victim)) - to_chat(user, "This is not suitable for the gibber!") + to_chat(user, "This is not suitable for the [src]]!") return if(victim.abiotic(1)) to_chat(user, "Subject may not have abiotic items on.") return - user.visible_message("[user] starts to put [victim] into the gibber!") + user.visible_message("[user] starts to put [victim] into the [src]!") add_fingerprint(user) if(do_after(user, 30, target = victim) && user.Adjacent(src) && victim.Adjacent(user) && !occupant) - user.visible_message("[user] stuffs [victim] into the gibber!") + user.visible_message("[user] stuffs [victim] into the [src]]!") victim.forceMove(src) occupant = victim @@ -195,16 +200,16 @@ holder2.layer = MOB_LAYER + 0.1 //3D, it's above the mob, rest of the gibber is behind holder2.anchored = 1 - animate(holder, pixel_y = 16, time = GIBBER_ANIMATION_DELAY) //animate going down + animate(holder, pixel_y = 16, time = animation_delay) //animate going down - sleep(GIBBER_ANIMATION_DELAY) + sleep(animation_delay) holder.overlays -= feedee //reset static icon feedee.icon += icon('icons/obj/kitchen.dmi', "footicon") //this is some byond magic; += to the icon var with a black and white image will mask it holder.overlays += feedee - animate(holder, pixel_y = -3, time = GIBBER_ANIMATION_DELAY) //animate going down further + animate(holder, pixel_y = -3, time = animation_delay) //animate going down further - sleep(GIBBER_ANIMATION_DELAY) //time everything right, animate doesn't prevent proc from continuing + sleep(animation_delay) //time everything right, animate doesn't prevent proc from continuing qdel(holder) //get rid of holder object qdel(holder2) //get rid of holder object @@ -281,15 +286,20 @@ playsound(get_turf(src), 'sound/effects/splat.ogg', 50, 1) operating = 0 - for(var/obj/item/thing in contents) //Meat is spawned inside the gibber and thrown out afterwards. - thing.loc = get_turf(thing) // Drop it onto the turf for throwing. - thing.throw_at(get_edge_target_turf(src,gib_throw_dir),rand(1,5),15) // Being pelted with bits of meat and bone would hurt. - sleep(1) + if(stealthmode) + for(var/atom/movable/AM in contents) + qdel(AM) + sleep(1) + else + for(var/obj/item/thing in contents) //Meat is spawned inside the gibber and thrown out afterwards. + thing.loc = get_turf(thing) // Drop it onto the turf for throwing. + thing.throw_at(get_edge_target_turf(src,gib_throw_dir),rand(1,5),15) // Being pelted with bits of meat and bone would hurt. + sleep(1) - for(var/obj/effect/gibs in contents) //throw out the gibs too - gibs.loc = get_turf(gibs) //drop onto turf for throwing - gibs.throw_at(get_edge_target_turf(src,gib_throw_dir),rand(1,5),15) - sleep(1) + for(var/obj/effect/gibs in contents) //throw out the gibs too + gibs.loc = get_turf(gibs) //drop onto turf for throwing + gibs.throw_at(get_edge_target_turf(src,gib_throw_dir),rand(1,5),15) + sleep(1) pixel_x = initial(pixel_x) //return to it's spot after shaking operating = 0 @@ -306,6 +316,8 @@ var/acceptdir = NORTH var/lastacceptdir = NORTH var/turf/lturf + var/consumption_delay = 3 SECONDS + var/target_found = 0 /obj/machinery/gibber/autogibber/New() ..() @@ -320,7 +332,7 @@ RefreshParts() /obj/machinery/gibber/autogibber/process() - if(!lturf || occupant || locked || dirty || operating) + if(!lturf || occupant || locked || dirty || operating || occupant || target_found) return if(acceptdir != lastacceptdir) @@ -331,15 +343,22 @@ lturf = T for(var/mob/living/carbon/human/H in lturf) - if(istype(H) && H.loc == lturf) + if(istype(H) && H.loc == lturf && !(locate(/obj/machinery/gibber/autogibber) in H.interaction_queue)) + target_found = 1 + H.interaction_queue += src visible_message({"\The [src] states, "Food detected!""}) - sleep(30) + sleep(consumption_delay) if(H.loc == lturf) //still standing there if(force_move_into_gibber(H)) + locked = 1 // no escape ejectclothes(occupant) cleanbay() startgibbing(null, 1) + locked = 0 + if(H) + H.interaction_queue -= src break + target_found = 0 /obj/machinery/gibber/autogibber/proc/force_move_into_gibber(var/mob/living/carbon/human/victim) if(!istype(victim)) return 0 @@ -364,7 +383,7 @@ continue if(istype(O,/obj/item/organ)) continue - if(O.flags & NODROP) + if(O.flags & NODROP || stealthmode) qdel(O) //they are already dead by now H.unEquip(O) O.loc = loc @@ -372,7 +391,7 @@ sleep(1) for(var/obj/item/clothing/C in H) - if(C.flags & NODROP) + if(C.flags & NODROP || stealthmode) qdel(C) H.unEquip(C) C.loc = loc @@ -384,7 +403,9 @@ /obj/machinery/gibber/autogibber/proc/cleanbay() var/spats = 0 //keeps track of how many items get spit out. Don't show a message if none are found. for(var/obj/O in src) - if(istype(O)) + if(stealthmode) + qdel(O) + else if(istype(O)) O.loc = loc O.throw_at(get_edge_target_turf(src,gib_throw_dir),rand(1,5),15) spats++ diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 1e56d9d6d57..2785683e378 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -50,6 +50,10 @@ dir = newdir update_move_direction() +/obj/machinery/conveyor/set_dir(newdir) + . = ..() + update_move_direction() + /obj/machinery/conveyor/proc/update_move_direction() switch(dir)