mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
File standardisation (#13131)
* Adds the check components * Adds in trailing newlines * Converts all CRLF to LF * Post merge EOF * Post merge line endings * Final commit
This commit is contained in:
+492
-492
@@ -1,492 +1,492 @@
|
||||
#define DIRECTION_FORWARDS 1
|
||||
#define DIRECTION_OFF 0
|
||||
#define DIRECTION_REVERSED -1
|
||||
#define IS_OPERATING (operating && can_conveyor_run())
|
||||
|
||||
GLOBAL_LIST_INIT(conveyor_belts, list()) //Saves us having to look through the entire machines list for our things
|
||||
GLOBAL_LIST_INIT(conveyor_switches, list())
|
||||
|
||||
//conveyor2 is pretty much like the original, except it supports corners, but not diverters.
|
||||
//Except this is pretty heavily modified so it's more like conveyor2.5
|
||||
|
||||
/obj/machinery/conveyor
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor_stopped_cw"
|
||||
name = "conveyor belt"
|
||||
desc = "It's a conveyor belt, commonly used to transport large numbers of items elsewhere quite quickly."
|
||||
layer = CONVEYOR_LAYER // so they appear under stuff but not below stuff like vents
|
||||
anchored = TRUE
|
||||
move_force = MOVE_FORCE_DEFAULT
|
||||
var/operating = FALSE //NB: this can be TRUE while the belt doesn't go
|
||||
var/forwards // The direction the conveyor sends you in
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/clockwise = TRUE // For corner pieces - do we go clockwise or counterclockwise?
|
||||
var/operable = TRUE // Can this belt actually go?
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/reversed = FALSE // set to TRUE to have the conveyor belt be reversed
|
||||
var/id //ID of the connected lever
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/New(loc, new_dir, new_id)
|
||||
..(loc)
|
||||
GLOB.conveyor_belts += src
|
||||
if(new_id)
|
||||
id = new_id
|
||||
if(new_dir)
|
||||
dir = new_dir
|
||||
update_move_direction()
|
||||
for(var/I in GLOB.conveyor_switches)
|
||||
var/obj/machinery/conveyor_switch/S = I
|
||||
if(id == S.id)
|
||||
S.conveyors += src
|
||||
|
||||
/obj/machinery/conveyor/Destroy()
|
||||
GLOB.conveyor_belts -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/conveyor/setDir(newdir)
|
||||
. = ..()
|
||||
update_move_direction()
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
/obj/machinery/conveyor/attackby(obj/item/I, mob/user)
|
||||
if(stat & BROKEN)
|
||||
return ..()
|
||||
else if(istype(I, /obj/item/conveyor_switch_construct))
|
||||
var/obj/item/conveyor_switch_construct/S = I
|
||||
if(S.id == id)
|
||||
return ..()
|
||||
for(var/obj/machinery/conveyor_switch/CS in GLOB.conveyor_switches)
|
||||
if(CS.id == id)
|
||||
CS.conveyors -= src
|
||||
id = S.id
|
||||
to_chat(user, "<span class='notice'>You link [I] with [src].</span>")
|
||||
else if(user.a_intent != INTENT_HARM)
|
||||
if(user.drop_item())
|
||||
I.forceMove(loc)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/conveyor/crowbar_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
if(!(stat & BROKEN))
|
||||
var/obj/item/conveyor_construct/C = new(loc)
|
||||
C.id = id
|
||||
transfer_fingerprints_to(C)
|
||||
to_chat(user,"<span class='notice'>You remove [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/conveyor/wrench_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
set_rotation(user)
|
||||
update_move_direction()
|
||||
|
||||
// attack with hand, move pulled object onto conveyor
|
||||
/obj/machinery/conveyor/attack_hand(mob/user as mob)
|
||||
user.Move_Pulled(src)
|
||||
|
||||
/obj/machinery/conveyor/update_icon()
|
||||
..()
|
||||
if(IS_OPERATING)
|
||||
icon_state = "conveyor_started_[clockwise ? "cw" : "ccw"]"
|
||||
if(reversed)
|
||||
icon_state += "_r"
|
||||
else
|
||||
icon_state = "conveyor_stopped_[clockwise ? "cw" : "ccw"]"
|
||||
|
||||
/obj/machinery/conveyor/proc/update_move_direction()
|
||||
update_icon()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
backwards = SOUTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
backwards = WEST
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
backwards = NORTH
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
forwards = clockwise ? EAST : NORTH
|
||||
backwards = clockwise ? SOUTH : WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = clockwise ? SOUTH : EAST
|
||||
backwards = clockwise ? WEST : NORTH
|
||||
if(SOUTHWEST)
|
||||
forwards = clockwise ? WEST : SOUTH
|
||||
backwards = clockwise ? NORTH : EAST
|
||||
if(NORTHWEST)
|
||||
forwards = clockwise ? NORTH : WEST
|
||||
backwards = clockwise ? EAST : SOUTH
|
||||
if(!reversed)
|
||||
return
|
||||
var/temporary_direction = forwards
|
||||
forwards = backwards
|
||||
backwards = temporary_direction
|
||||
|
||||
/obj/machinery/conveyor/proc/set_rotation(mob/user)
|
||||
dir = turn(reversed ? backwards : forwards, -90) //Fuck it, let's do it this way instead of doing something clever with dir
|
||||
var/turf/left = get_step(src, turn(dir, 90)) //We need to get conveyors to the right, left, and behind this one to be able to determine if we need to make a corner piece
|
||||
var/turf/right = get_step(src, turn(dir, -90))
|
||||
var/turf/back = get_step(src, turn(dir, 180))
|
||||
to_chat(user, "<span class='notice'>You rotate [src].</span>")
|
||||
var/obj/machinery/conveyor/CL = locate() in left
|
||||
var/obj/machinery/conveyor/CR = locate() in right
|
||||
var/obj/machinery/conveyor/CB = locate() in back
|
||||
var/link_to_left = FALSE
|
||||
var/link_to_right = FALSE
|
||||
var/link_to_back = FALSE
|
||||
if(CL)
|
||||
if(CL.id == id && get_step(CL, CL.reversed ? CL.backwards : CL.forwards) == loc)
|
||||
link_to_left = TRUE
|
||||
if(CR)
|
||||
if(CR.id == id && get_step(CR, CR.reversed ? CR.backwards : CR.forwards) == loc)
|
||||
link_to_right = TRUE
|
||||
if(CB)
|
||||
if(CB.id == id && get_step(CB, CB.reversed ? CB.backwards : CB.forwards) == loc)
|
||||
link_to_back = TRUE
|
||||
if(link_to_back) //Don't need to do anything because we can assume the conveyor carries on in a line
|
||||
return
|
||||
else if(!(link_to_left ^ link_to_right)) //Either no valid conveyors point here, or two point here (making a "junction" with this belt as the middle piece). Either way we don't need a corner
|
||||
return
|
||||
if(link_to_right)
|
||||
dir = turn(dir, 45)
|
||||
clockwise = TRUE
|
||||
else if(link_to_left)
|
||||
dir = turn(dir, -45)
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/conveyor/process()
|
||||
if(!IS_OPERATING)
|
||||
return
|
||||
use_power(100)
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
var/still_stuff_to_move = FALSE
|
||||
for(var/atom/movable/AM in affecting)
|
||||
if(AM.anchored)
|
||||
continue
|
||||
still_stuff_to_move = TRUE
|
||||
addtimer(CALLBACK(src, .proc/move_thing, AM), 1)
|
||||
CHECK_TICK
|
||||
if(!still_stuff_to_move && speed_process)
|
||||
makeNormalProcess()
|
||||
else if(still_stuff_to_move && !speed_process)
|
||||
makeSpeedProcess()
|
||||
|
||||
/obj/machinery/conveyor/Crossed(atom/movable/AM, oldloc)
|
||||
if(!speed_process && !AM.anchored)
|
||||
makeSpeedProcess()
|
||||
..()
|
||||
|
||||
/obj/machinery/conveyor/proc/move_thing(atom/movable/AM)
|
||||
if(move_force < (AM.move_resist))
|
||||
return FALSE
|
||||
if(!AM.anchored && AM.loc == loc)
|
||||
step(AM, forwards)
|
||||
|
||||
|
||||
/obj/machinery/conveyor/proc/can_conveyor_run()
|
||||
if(stat & BROKEN)
|
||||
return FALSE
|
||||
else if(stat & NOPOWER)
|
||||
return FALSE
|
||||
else if(!operable)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// make the conveyor broken and propagate inoperability to any connected conveyor with the same conveyor datum
|
||||
/obj/machinery/conveyor/proc/make_broken()
|
||||
stat |= BROKEN
|
||||
operable = FALSE
|
||||
update_icon()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, forwards)
|
||||
if(C)
|
||||
C.set_operable(TRUE, id, FALSE)
|
||||
C = locate() in get_step(src, backwards)
|
||||
if(C)
|
||||
C.set_operable(FALSE, id, FALSE)
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operable(propagate_forwards, match_id, op) //Sets a conveyor inoperable if ID matches it, and propagates forwards / backwards
|
||||
if(id != match_id)
|
||||
return
|
||||
operable = op
|
||||
update_icon()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, propagate_forwards ? forwards : backwards)
|
||||
if(C)
|
||||
C.set_operable(propagate_forwards ? TRUE : FALSE, id, op)
|
||||
|
||||
// the conveyor control switch
|
||||
|
||||
/obj/machinery/conveyor_switch
|
||||
name = "conveyor switch"
|
||||
desc = "This switch controls any and all conveyor belts it is linked to."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/position = DIRECTION_OFF
|
||||
var/reversed = TRUE
|
||||
var/one_way = FALSE // Do we go in one direction?
|
||||
anchored = TRUE
|
||||
var/id
|
||||
var/list/conveyors = list()
|
||||
|
||||
/obj/machinery/conveyor_switch/New(newloc, new_id)
|
||||
..(newloc)
|
||||
GLOB.conveyor_switches += src
|
||||
if(!id)
|
||||
id = new_id
|
||||
for(var/I in GLOB.conveyor_belts)
|
||||
var/obj/machinery/conveyor/C = I
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
|
||||
/obj/machinery/conveyor_switch/Destroy()
|
||||
GLOB.conveyor_switches -= src
|
||||
return ..()
|
||||
|
||||
// update the icon depending on the position
|
||||
|
||||
/obj/machinery/conveyor_switch/update_icon()
|
||||
overlays.Cut()
|
||||
if(!position)
|
||||
icon_state = "switch-off"
|
||||
else if(position == DIRECTION_REVERSED)
|
||||
icon_state = "switch-rev"
|
||||
if(!(stat & NOPOWER))
|
||||
overlays += "redlight"
|
||||
else if(position == DIRECTION_FORWARDS)
|
||||
icon_state = "switch-fwd"
|
||||
if(!(stat & NOPOWER))
|
||||
overlays += "greenlight"
|
||||
|
||||
/obj/machinery/conveyor_switch/oneway
|
||||
one_way = TRUE
|
||||
|
||||
// attack with hand, switch position
|
||||
/obj/machinery/conveyor_switch/attack_hand(mob/user)
|
||||
if(..())
|
||||
return TRUE
|
||||
toggle(user)
|
||||
|
||||
/obj/machinery/conveyor_switch/attack_ghost(mob/user)
|
||||
if(user.can_advanced_admin_interact())
|
||||
toggle(user)
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/toggle(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(!allowed(user) && !user.can_advanced_admin_interact()) //this is in Para but not TG. I don't think there's any which are set anyway.
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
if(position)
|
||||
position = DIRECTION_OFF
|
||||
else
|
||||
reversed = one_way ? FALSE : !reversed
|
||||
position = reversed ? DIRECTION_REVERSED : DIRECTION_FORWARDS
|
||||
update_icon()
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.operating = abs(position)
|
||||
if(C.reversed != reversed)
|
||||
C.reversed = reversed
|
||||
C.update_move_direction()
|
||||
else
|
||||
C.update_icon()
|
||||
CHECK_TICK
|
||||
for(var/I in GLOB.conveyor_switches) // find any switches with same id as this one, and set their positions to match us
|
||||
var/obj/machinery/conveyor_switch/S = I
|
||||
if(S == src || S.id != id)
|
||||
continue
|
||||
S.position = position
|
||||
S.one_way = one_way //Break everything!!1!
|
||||
S.reversed = reversed
|
||||
S.update_icon()
|
||||
CHECK_TICK
|
||||
|
||||
/obj/machinery/conveyor_switch/crowbar_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
var/obj/item/conveyor_switch_construct/C = new(loc, id)
|
||||
transfer_fingerprints_to(C)
|
||||
to_chat(user,"<span class='notice'>You detach [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/conveyor_switch/multitool_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
one_way = !one_way
|
||||
to_chat(user, "<span class='notice'>[src] will now go [one_way ? "forwards only" : "both forwards and backwards"].</span>")
|
||||
|
||||
/obj/machinery/conveyor_switch/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
// CONVEYOR CONSTRUCTION STARTS HERE
|
||||
|
||||
/obj/item/conveyor_construct
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor_loose"
|
||||
name = "conveyor belt assembly"
|
||||
desc = "A conveyor belt assembly, used for the assembly of conveyor belt systems."
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
var/id
|
||||
|
||||
/obj/item/conveyor_construct/attackby(obj/item/I, mob/user, params)
|
||||
..()
|
||||
if(!istype(I, /obj/item/conveyor_switch_construct))
|
||||
return
|
||||
var/obj/item/conveyor_switch_construct/C = I
|
||||
to_chat(user, "<span class='notice'>You link [src] to [C].</span>")
|
||||
id = C.id
|
||||
|
||||
/obj/item/conveyor_construct/afterattack(turf/T, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(user.incapacitated())
|
||||
return
|
||||
if(!istype(T, /turf/simulated/floor))
|
||||
return
|
||||
if(T == get_turf(user))
|
||||
to_chat(user, "<span class='notice'>You cannot place [src] under yourself.</span>")
|
||||
return
|
||||
if(locate(/obj/machinery/conveyor) in T) //Can't put conveyors beneath conveyors
|
||||
to_chat(user, "<span class='notice'>There's already a conveyor there!</span>")
|
||||
return
|
||||
var/obj/machinery/conveyor/C = new(T, user.dir, id)
|
||||
transfer_fingerprints_to(C)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/conveyor_switch_construct
|
||||
name = "conveyor switch assembly"
|
||||
desc = "A conveyor control switch assembly. When set up, it'll control any and all conveyor belts it is linked to."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch"
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
var/id
|
||||
|
||||
/obj/item/conveyor_switch_construct/New(loc, new_id)
|
||||
..(loc)
|
||||
if(new_id)
|
||||
id = new_id
|
||||
else
|
||||
id = world.time + rand() //this couldn't possibly go wrong
|
||||
|
||||
|
||||
/obj/item/conveyor_switch_construct/afterattack(turf/T, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(user.incapacitated())
|
||||
return
|
||||
if(!istype(T, /turf/simulated/floor))
|
||||
return
|
||||
var/found = FALSE
|
||||
for(var/obj/machinery/conveyor/C in view())
|
||||
if(C.id == id)
|
||||
found = TRUE
|
||||
break
|
||||
if(!found)
|
||||
to_chat(user, "<span class='notice'>[src] did not detect any linked conveyor belts in range.</span>")
|
||||
return
|
||||
var/obj/machinery/conveyor_switch/NC = new(T, id)
|
||||
transfer_fingerprints_to(NC)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/conveyor_switch_construct/attackby(obj/item/I, mob/user)
|
||||
if(!istype(I, /obj/item/conveyor_switch_construct))
|
||||
return ..()
|
||||
var/obj/item/conveyor_switch_construct/S = I
|
||||
id = S.id
|
||||
to_chat(user, "<span class='notice'>You link the two switch constructs.</span>")
|
||||
|
||||
/obj/item/paper/conveyor
|
||||
name = "paper- 'Nano-it-up U-build series, #9: Build your very own conveyor belt, in SPACE'"
|
||||
info = "<h1>Congratulations!</h1><p>You are now the proud owner of the best conveyor set available for space mail order! \
|
||||
We at Nano-it-up know you love to prepare your own structures without wasting time, so we have devised a special streamlined \
|
||||
assembly procedure that puts all other mail-order products to shame!</p>\
|
||||
<p>Firstly, you need to link the conveyor switch assembly to each of the conveyor belt assemblies. After doing so, you simply need to install the belt \
|
||||
assemblies onto the floor, et voila, belt built. Our special Nano-it-up smart switch will detected any linked assemblies as far as the eye can see! </p>\
|
||||
<p> Set single directional switches by using your multitool on the switch after you've installed the switch assembly.</p>\
|
||||
<p> This convenience, you can only have it when you Nano-it-up. Stay nano!</p>"
|
||||
|
||||
/obj/machinery/conveyor/counterclockwise
|
||||
clockwise = FALSE
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
|
||||
/obj/machinery/conveyor/auto/New(loc, newdir)
|
||||
..(loc, newdir)
|
||||
operating = TRUE
|
||||
update_icon()
|
||||
|
||||
//Other types of conveyor, mostly for saving yourself a headache during mapping
|
||||
|
||||
/obj/machinery/conveyor/north
|
||||
dir = NORTH
|
||||
|
||||
/obj/machinery/conveyor/northeast
|
||||
dir = NORTHEAST
|
||||
|
||||
/obj/machinery/conveyor/east
|
||||
dir = EAST
|
||||
|
||||
/obj/machinery/conveyor/southeast
|
||||
dir = SOUTHEAST
|
||||
|
||||
/obj/machinery/conveyor/south
|
||||
dir = SOUTH
|
||||
|
||||
/obj/machinery/conveyor/southwest
|
||||
dir = SOUTHWEST
|
||||
|
||||
/obj/machinery/conveyor/west
|
||||
dir = WEST
|
||||
|
||||
/obj/machinery/conveyor/northwest
|
||||
dir = NORTHWEST
|
||||
|
||||
/obj/machinery/conveyor/north/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/northeast/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/east/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/southeast/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/south/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/southwest/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/west/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/northwest/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
#undef DIRECTION_FORWARDS
|
||||
#undef DIRECTION_OFF
|
||||
#undef DIRECTION_REVERSED
|
||||
#undef IS_OPERATING
|
||||
#define DIRECTION_FORWARDS 1
|
||||
#define DIRECTION_OFF 0
|
||||
#define DIRECTION_REVERSED -1
|
||||
#define IS_OPERATING (operating && can_conveyor_run())
|
||||
|
||||
GLOBAL_LIST_INIT(conveyor_belts, list()) //Saves us having to look through the entire machines list for our things
|
||||
GLOBAL_LIST_INIT(conveyor_switches, list())
|
||||
|
||||
//conveyor2 is pretty much like the original, except it supports corners, but not diverters.
|
||||
//Except this is pretty heavily modified so it's more like conveyor2.5
|
||||
|
||||
/obj/machinery/conveyor
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor_stopped_cw"
|
||||
name = "conveyor belt"
|
||||
desc = "It's a conveyor belt, commonly used to transport large numbers of items elsewhere quite quickly."
|
||||
layer = CONVEYOR_LAYER // so they appear under stuff but not below stuff like vents
|
||||
anchored = TRUE
|
||||
move_force = MOVE_FORCE_DEFAULT
|
||||
var/operating = FALSE //NB: this can be TRUE while the belt doesn't go
|
||||
var/forwards // The direction the conveyor sends you in
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/clockwise = TRUE // For corner pieces - do we go clockwise or counterclockwise?
|
||||
var/operable = TRUE // Can this belt actually go?
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/reversed = FALSE // set to TRUE to have the conveyor belt be reversed
|
||||
var/id //ID of the connected lever
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/New(loc, new_dir, new_id)
|
||||
..(loc)
|
||||
GLOB.conveyor_belts += src
|
||||
if(new_id)
|
||||
id = new_id
|
||||
if(new_dir)
|
||||
dir = new_dir
|
||||
update_move_direction()
|
||||
for(var/I in GLOB.conveyor_switches)
|
||||
var/obj/machinery/conveyor_switch/S = I
|
||||
if(id == S.id)
|
||||
S.conveyors += src
|
||||
|
||||
/obj/machinery/conveyor/Destroy()
|
||||
GLOB.conveyor_belts -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/conveyor/setDir(newdir)
|
||||
. = ..()
|
||||
update_move_direction()
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
/obj/machinery/conveyor/attackby(obj/item/I, mob/user)
|
||||
if(stat & BROKEN)
|
||||
return ..()
|
||||
else if(istype(I, /obj/item/conveyor_switch_construct))
|
||||
var/obj/item/conveyor_switch_construct/S = I
|
||||
if(S.id == id)
|
||||
return ..()
|
||||
for(var/obj/machinery/conveyor_switch/CS in GLOB.conveyor_switches)
|
||||
if(CS.id == id)
|
||||
CS.conveyors -= src
|
||||
id = S.id
|
||||
to_chat(user, "<span class='notice'>You link [I] with [src].</span>")
|
||||
else if(user.a_intent != INTENT_HARM)
|
||||
if(user.drop_item())
|
||||
I.forceMove(loc)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/conveyor/crowbar_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
if(!(stat & BROKEN))
|
||||
var/obj/item/conveyor_construct/C = new(loc)
|
||||
C.id = id
|
||||
transfer_fingerprints_to(C)
|
||||
to_chat(user,"<span class='notice'>You remove [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/conveyor/wrench_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
set_rotation(user)
|
||||
update_move_direction()
|
||||
|
||||
// attack with hand, move pulled object onto conveyor
|
||||
/obj/machinery/conveyor/attack_hand(mob/user as mob)
|
||||
user.Move_Pulled(src)
|
||||
|
||||
/obj/machinery/conveyor/update_icon()
|
||||
..()
|
||||
if(IS_OPERATING)
|
||||
icon_state = "conveyor_started_[clockwise ? "cw" : "ccw"]"
|
||||
if(reversed)
|
||||
icon_state += "_r"
|
||||
else
|
||||
icon_state = "conveyor_stopped_[clockwise ? "cw" : "ccw"]"
|
||||
|
||||
/obj/machinery/conveyor/proc/update_move_direction()
|
||||
update_icon()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
backwards = SOUTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
backwards = WEST
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
backwards = NORTH
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
forwards = clockwise ? EAST : NORTH
|
||||
backwards = clockwise ? SOUTH : WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = clockwise ? SOUTH : EAST
|
||||
backwards = clockwise ? WEST : NORTH
|
||||
if(SOUTHWEST)
|
||||
forwards = clockwise ? WEST : SOUTH
|
||||
backwards = clockwise ? NORTH : EAST
|
||||
if(NORTHWEST)
|
||||
forwards = clockwise ? NORTH : WEST
|
||||
backwards = clockwise ? EAST : SOUTH
|
||||
if(!reversed)
|
||||
return
|
||||
var/temporary_direction = forwards
|
||||
forwards = backwards
|
||||
backwards = temporary_direction
|
||||
|
||||
/obj/machinery/conveyor/proc/set_rotation(mob/user)
|
||||
dir = turn(reversed ? backwards : forwards, -90) //Fuck it, let's do it this way instead of doing something clever with dir
|
||||
var/turf/left = get_step(src, turn(dir, 90)) //We need to get conveyors to the right, left, and behind this one to be able to determine if we need to make a corner piece
|
||||
var/turf/right = get_step(src, turn(dir, -90))
|
||||
var/turf/back = get_step(src, turn(dir, 180))
|
||||
to_chat(user, "<span class='notice'>You rotate [src].</span>")
|
||||
var/obj/machinery/conveyor/CL = locate() in left
|
||||
var/obj/machinery/conveyor/CR = locate() in right
|
||||
var/obj/machinery/conveyor/CB = locate() in back
|
||||
var/link_to_left = FALSE
|
||||
var/link_to_right = FALSE
|
||||
var/link_to_back = FALSE
|
||||
if(CL)
|
||||
if(CL.id == id && get_step(CL, CL.reversed ? CL.backwards : CL.forwards) == loc)
|
||||
link_to_left = TRUE
|
||||
if(CR)
|
||||
if(CR.id == id && get_step(CR, CR.reversed ? CR.backwards : CR.forwards) == loc)
|
||||
link_to_right = TRUE
|
||||
if(CB)
|
||||
if(CB.id == id && get_step(CB, CB.reversed ? CB.backwards : CB.forwards) == loc)
|
||||
link_to_back = TRUE
|
||||
if(link_to_back) //Don't need to do anything because we can assume the conveyor carries on in a line
|
||||
return
|
||||
else if(!(link_to_left ^ link_to_right)) //Either no valid conveyors point here, or two point here (making a "junction" with this belt as the middle piece). Either way we don't need a corner
|
||||
return
|
||||
if(link_to_right)
|
||||
dir = turn(dir, 45)
|
||||
clockwise = TRUE
|
||||
else if(link_to_left)
|
||||
dir = turn(dir, -45)
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/conveyor/process()
|
||||
if(!IS_OPERATING)
|
||||
return
|
||||
use_power(100)
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
var/still_stuff_to_move = FALSE
|
||||
for(var/atom/movable/AM in affecting)
|
||||
if(AM.anchored)
|
||||
continue
|
||||
still_stuff_to_move = TRUE
|
||||
addtimer(CALLBACK(src, .proc/move_thing, AM), 1)
|
||||
CHECK_TICK
|
||||
if(!still_stuff_to_move && speed_process)
|
||||
makeNormalProcess()
|
||||
else if(still_stuff_to_move && !speed_process)
|
||||
makeSpeedProcess()
|
||||
|
||||
/obj/machinery/conveyor/Crossed(atom/movable/AM, oldloc)
|
||||
if(!speed_process && !AM.anchored)
|
||||
makeSpeedProcess()
|
||||
..()
|
||||
|
||||
/obj/machinery/conveyor/proc/move_thing(atom/movable/AM)
|
||||
if(move_force < (AM.move_resist))
|
||||
return FALSE
|
||||
if(!AM.anchored && AM.loc == loc)
|
||||
step(AM, forwards)
|
||||
|
||||
|
||||
/obj/machinery/conveyor/proc/can_conveyor_run()
|
||||
if(stat & BROKEN)
|
||||
return FALSE
|
||||
else if(stat & NOPOWER)
|
||||
return FALSE
|
||||
else if(!operable)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// make the conveyor broken and propagate inoperability to any connected conveyor with the same conveyor datum
|
||||
/obj/machinery/conveyor/proc/make_broken()
|
||||
stat |= BROKEN
|
||||
operable = FALSE
|
||||
update_icon()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, forwards)
|
||||
if(C)
|
||||
C.set_operable(TRUE, id, FALSE)
|
||||
C = locate() in get_step(src, backwards)
|
||||
if(C)
|
||||
C.set_operable(FALSE, id, FALSE)
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operable(propagate_forwards, match_id, op) //Sets a conveyor inoperable if ID matches it, and propagates forwards / backwards
|
||||
if(id != match_id)
|
||||
return
|
||||
operable = op
|
||||
update_icon()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, propagate_forwards ? forwards : backwards)
|
||||
if(C)
|
||||
C.set_operable(propagate_forwards ? TRUE : FALSE, id, op)
|
||||
|
||||
// the conveyor control switch
|
||||
|
||||
/obj/machinery/conveyor_switch
|
||||
name = "conveyor switch"
|
||||
desc = "This switch controls any and all conveyor belts it is linked to."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/position = DIRECTION_OFF
|
||||
var/reversed = TRUE
|
||||
var/one_way = FALSE // Do we go in one direction?
|
||||
anchored = TRUE
|
||||
var/id
|
||||
var/list/conveyors = list()
|
||||
|
||||
/obj/machinery/conveyor_switch/New(newloc, new_id)
|
||||
..(newloc)
|
||||
GLOB.conveyor_switches += src
|
||||
if(!id)
|
||||
id = new_id
|
||||
for(var/I in GLOB.conveyor_belts)
|
||||
var/obj/machinery/conveyor/C = I
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
|
||||
/obj/machinery/conveyor_switch/Destroy()
|
||||
GLOB.conveyor_switches -= src
|
||||
return ..()
|
||||
|
||||
// update the icon depending on the position
|
||||
|
||||
/obj/machinery/conveyor_switch/update_icon()
|
||||
overlays.Cut()
|
||||
if(!position)
|
||||
icon_state = "switch-off"
|
||||
else if(position == DIRECTION_REVERSED)
|
||||
icon_state = "switch-rev"
|
||||
if(!(stat & NOPOWER))
|
||||
overlays += "redlight"
|
||||
else if(position == DIRECTION_FORWARDS)
|
||||
icon_state = "switch-fwd"
|
||||
if(!(stat & NOPOWER))
|
||||
overlays += "greenlight"
|
||||
|
||||
/obj/machinery/conveyor_switch/oneway
|
||||
one_way = TRUE
|
||||
|
||||
// attack with hand, switch position
|
||||
/obj/machinery/conveyor_switch/attack_hand(mob/user)
|
||||
if(..())
|
||||
return TRUE
|
||||
toggle(user)
|
||||
|
||||
/obj/machinery/conveyor_switch/attack_ghost(mob/user)
|
||||
if(user.can_advanced_admin_interact())
|
||||
toggle(user)
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/toggle(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(!allowed(user) && !user.can_advanced_admin_interact()) //this is in Para but not TG. I don't think there's any which are set anyway.
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
if(position)
|
||||
position = DIRECTION_OFF
|
||||
else
|
||||
reversed = one_way ? FALSE : !reversed
|
||||
position = reversed ? DIRECTION_REVERSED : DIRECTION_FORWARDS
|
||||
update_icon()
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.operating = abs(position)
|
||||
if(C.reversed != reversed)
|
||||
C.reversed = reversed
|
||||
C.update_move_direction()
|
||||
else
|
||||
C.update_icon()
|
||||
CHECK_TICK
|
||||
for(var/I in GLOB.conveyor_switches) // find any switches with same id as this one, and set their positions to match us
|
||||
var/obj/machinery/conveyor_switch/S = I
|
||||
if(S == src || S.id != id)
|
||||
continue
|
||||
S.position = position
|
||||
S.one_way = one_way //Break everything!!1!
|
||||
S.reversed = reversed
|
||||
S.update_icon()
|
||||
CHECK_TICK
|
||||
|
||||
/obj/machinery/conveyor_switch/crowbar_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
var/obj/item/conveyor_switch_construct/C = new(loc, id)
|
||||
transfer_fingerprints_to(C)
|
||||
to_chat(user,"<span class='notice'>You detach [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/conveyor_switch/multitool_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
one_way = !one_way
|
||||
to_chat(user, "<span class='notice'>[src] will now go [one_way ? "forwards only" : "both forwards and backwards"].</span>")
|
||||
|
||||
/obj/machinery/conveyor_switch/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
// CONVEYOR CONSTRUCTION STARTS HERE
|
||||
|
||||
/obj/item/conveyor_construct
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor_loose"
|
||||
name = "conveyor belt assembly"
|
||||
desc = "A conveyor belt assembly, used for the assembly of conveyor belt systems."
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
var/id
|
||||
|
||||
/obj/item/conveyor_construct/attackby(obj/item/I, mob/user, params)
|
||||
..()
|
||||
if(!istype(I, /obj/item/conveyor_switch_construct))
|
||||
return
|
||||
var/obj/item/conveyor_switch_construct/C = I
|
||||
to_chat(user, "<span class='notice'>You link [src] to [C].</span>")
|
||||
id = C.id
|
||||
|
||||
/obj/item/conveyor_construct/afterattack(turf/T, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(user.incapacitated())
|
||||
return
|
||||
if(!istype(T, /turf/simulated/floor))
|
||||
return
|
||||
if(T == get_turf(user))
|
||||
to_chat(user, "<span class='notice'>You cannot place [src] under yourself.</span>")
|
||||
return
|
||||
if(locate(/obj/machinery/conveyor) in T) //Can't put conveyors beneath conveyors
|
||||
to_chat(user, "<span class='notice'>There's already a conveyor there!</span>")
|
||||
return
|
||||
var/obj/machinery/conveyor/C = new(T, user.dir, id)
|
||||
transfer_fingerprints_to(C)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/conveyor_switch_construct
|
||||
name = "conveyor switch assembly"
|
||||
desc = "A conveyor control switch assembly. When set up, it'll control any and all conveyor belts it is linked to."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch"
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
var/id
|
||||
|
||||
/obj/item/conveyor_switch_construct/New(loc, new_id)
|
||||
..(loc)
|
||||
if(new_id)
|
||||
id = new_id
|
||||
else
|
||||
id = world.time + rand() //this couldn't possibly go wrong
|
||||
|
||||
|
||||
/obj/item/conveyor_switch_construct/afterattack(turf/T, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(user.incapacitated())
|
||||
return
|
||||
if(!istype(T, /turf/simulated/floor))
|
||||
return
|
||||
var/found = FALSE
|
||||
for(var/obj/machinery/conveyor/C in view())
|
||||
if(C.id == id)
|
||||
found = TRUE
|
||||
break
|
||||
if(!found)
|
||||
to_chat(user, "<span class='notice'>[src] did not detect any linked conveyor belts in range.</span>")
|
||||
return
|
||||
var/obj/machinery/conveyor_switch/NC = new(T, id)
|
||||
transfer_fingerprints_to(NC)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/conveyor_switch_construct/attackby(obj/item/I, mob/user)
|
||||
if(!istype(I, /obj/item/conveyor_switch_construct))
|
||||
return ..()
|
||||
var/obj/item/conveyor_switch_construct/S = I
|
||||
id = S.id
|
||||
to_chat(user, "<span class='notice'>You link the two switch constructs.</span>")
|
||||
|
||||
/obj/item/paper/conveyor
|
||||
name = "paper- 'Nano-it-up U-build series, #9: Build your very own conveyor belt, in SPACE'"
|
||||
info = "<h1>Congratulations!</h1><p>You are now the proud owner of the best conveyor set available for space mail order! \
|
||||
We at Nano-it-up know you love to prepare your own structures without wasting time, so we have devised a special streamlined \
|
||||
assembly procedure that puts all other mail-order products to shame!</p>\
|
||||
<p>Firstly, you need to link the conveyor switch assembly to each of the conveyor belt assemblies. After doing so, you simply need to install the belt \
|
||||
assemblies onto the floor, et voila, belt built. Our special Nano-it-up smart switch will detected any linked assemblies as far as the eye can see! </p>\
|
||||
<p> Set single directional switches by using your multitool on the switch after you've installed the switch assembly.</p>\
|
||||
<p> This convenience, you can only have it when you Nano-it-up. Stay nano!</p>"
|
||||
|
||||
/obj/machinery/conveyor/counterclockwise
|
||||
clockwise = FALSE
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
|
||||
/obj/machinery/conveyor/auto/New(loc, newdir)
|
||||
..(loc, newdir)
|
||||
operating = TRUE
|
||||
update_icon()
|
||||
|
||||
//Other types of conveyor, mostly for saving yourself a headache during mapping
|
||||
|
||||
/obj/machinery/conveyor/north
|
||||
dir = NORTH
|
||||
|
||||
/obj/machinery/conveyor/northeast
|
||||
dir = NORTHEAST
|
||||
|
||||
/obj/machinery/conveyor/east
|
||||
dir = EAST
|
||||
|
||||
/obj/machinery/conveyor/southeast
|
||||
dir = SOUTHEAST
|
||||
|
||||
/obj/machinery/conveyor/south
|
||||
dir = SOUTH
|
||||
|
||||
/obj/machinery/conveyor/southwest
|
||||
dir = SOUTHWEST
|
||||
|
||||
/obj/machinery/conveyor/west
|
||||
dir = WEST
|
||||
|
||||
/obj/machinery/conveyor/northwest
|
||||
dir = NORTHWEST
|
||||
|
||||
/obj/machinery/conveyor/north/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/northeast/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/east/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/southeast/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/south/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/southwest/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/west/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
/obj/machinery/conveyor/northwest/ccw
|
||||
icon_state = "conveyor_stopped_ccw"
|
||||
clockwise = FALSE
|
||||
|
||||
#undef DIRECTION_FORWARDS
|
||||
#undef DIRECTION_OFF
|
||||
#undef DIRECTION_REVERSED
|
||||
#undef IS_OPERATING
|
||||
|
||||
@@ -1,265 +1,265 @@
|
||||
// Disposal pipe construction
|
||||
// This is the pipe that you drag around, not the attached ones.
|
||||
|
||||
/obj/structure/disposalconstruct
|
||||
|
||||
name = "disposal pipe segment"
|
||||
desc = "A huge pipe segment used for constructing disposal systems."
|
||||
icon = 'icons/obj/pipes/disposal.dmi'
|
||||
icon_state = "conpipe-s"
|
||||
anchored = 0
|
||||
density = 0
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
level = 2
|
||||
max_integrity = 200
|
||||
var/ptype = PIPE_DISPOSALS_STRAIGHT //Use the defines
|
||||
var/base_state
|
||||
var/dpdir = 0 // directions as disposalpipe
|
||||
|
||||
/obj/structure/disposalconstruct/New(loc, pipe_type, direction)
|
||||
..()
|
||||
if(pipe_type)
|
||||
ptype = pipe_type
|
||||
if(dir)
|
||||
dir = direction
|
||||
update()
|
||||
|
||||
// update iconstate and dpdir due to dir and type
|
||||
/obj/structure/disposalconstruct/proc/update()
|
||||
base_state = get_pipe_icon(ptype)
|
||||
icon_state = "con[base_state]"
|
||||
var/flip = turn(dir, 180)
|
||||
var/left = turn(dir, 90)
|
||||
var/right = turn(dir, -90)
|
||||
name = get_pipe_name(ptype, PIPETYPE_DISPOSAL)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_STRAIGHT)
|
||||
dpdir = dir | flip
|
||||
if(PIPE_DISPOSALS_BENT)
|
||||
dpdir = dir | right
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT)
|
||||
dpdir = dir | right | flip
|
||||
if(PIPE_DISPOSALS_JUNCTION_LEFT)
|
||||
dpdir = dir | left | flip
|
||||
if(PIPE_DISPOSALS_Y_JUNCTION)
|
||||
dpdir = dir | left | right
|
||||
if(PIPE_DISPOSALS_TRUNK)
|
||||
dpdir = dir
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT)
|
||||
dpdir = dir | right | flip
|
||||
if(PIPE_DISPOSALS_SORT_LEFT)
|
||||
dpdir = dir | left | flip
|
||||
// disposal bin has only one dir, thus we don't need to care about setting it
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
if(!anchored)
|
||||
icon_state = "[base_state]-unanchored"
|
||||
else
|
||||
icon_state = base_state
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
dpdir = dir
|
||||
icon_state = base_state
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
dpdir = dir
|
||||
icon_state = base_state
|
||||
if(!(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)))
|
||||
icon_state = "con[base_state]"
|
||||
if(invisibility) // if invisible, fade icon
|
||||
icon -= rgb(0,0,0,128)
|
||||
|
||||
// hide called by levelupdate if turf intact status changes
|
||||
// change visibility status and force update of icon
|
||||
/obj/structure/disposalconstruct/hide(var/intact)
|
||||
invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact
|
||||
update()
|
||||
|
||||
|
||||
// flip and rotate verbs
|
||||
/obj/structure/disposalconstruct/verb/rotate()
|
||||
set name = "Rotate Pipe"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before rotating it.")
|
||||
return
|
||||
|
||||
dir = turn(dir, -90)
|
||||
update()
|
||||
|
||||
/obj/structure/disposalconstruct/AltClick(mob/user)
|
||||
if(user.incapacitated())
|
||||
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
|
||||
return
|
||||
if(!Adjacent(user))
|
||||
return
|
||||
rotate()
|
||||
|
||||
/obj/structure/disposalconstruct/verb/flip()
|
||||
set name = "Flip Pipe"
|
||||
set src in view(1)
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before flipping it.")
|
||||
return
|
||||
|
||||
dir = turn(dir, 180)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT)
|
||||
ptype = PIPE_DISPOSALS_JUNCTION_LEFT
|
||||
if(PIPE_DISPOSALS_JUNCTION_LEFT)
|
||||
ptype = PIPE_DISPOSALS_JUNCTION_RIGHT
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT)
|
||||
ptype = PIPE_DISPOSALS_SORT_LEFT
|
||||
if(PIPE_DISPOSALS_SORT_LEFT)
|
||||
ptype = PIPE_DISPOSALS_SORT_RIGHT
|
||||
|
||||
update()
|
||||
|
||||
// returns the type path of disposalpipe corresponding to this item dtype
|
||||
/obj/structure/disposalconstruct/proc/dpipetype()
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_STRAIGHT, PIPE_DISPOSALS_BENT)
|
||||
return /obj/structure/disposalpipe/segment
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT, PIPE_DISPOSALS_JUNCTION_LEFT, PIPE_DISPOSALS_Y_JUNCTION)
|
||||
return /obj/structure/disposalpipe/junction
|
||||
if(PIPE_DISPOSALS_TRUNK)
|
||||
return /obj/structure/disposalpipe/trunk
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
return /obj/machinery/disposal
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
return /obj/structure/disposaloutlet
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
return /obj/machinery/disposal/deliveryChute
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
|
||||
return /obj/structure/disposalpipe/sortjunction
|
||||
return
|
||||
|
||||
|
||||
|
||||
// attackby item
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
|
||||
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user, params)
|
||||
var/nicetype = "pipe"
|
||||
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
||||
src.add_fingerprint(user)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
nicetype = "disposal bin"
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
nicetype = "disposal outlet"
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
nicetype = "delivery chute"
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
|
||||
nicetype = "sorting pipe"
|
||||
ispipe = 1
|
||||
else
|
||||
nicetype = "pipe"
|
||||
ispipe = 1
|
||||
|
||||
var/turf/T = src.loc
|
||||
if(T.intact)
|
||||
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/wrench))
|
||||
if(anchored)
|
||||
anchored = 0
|
||||
if(ispipe)
|
||||
level = 2
|
||||
density = 0
|
||||
else
|
||||
density = 1
|
||||
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
||||
else
|
||||
anchored = 1
|
||||
if(ispipe)
|
||||
level = 1 // We don't want disposal bins to disappear under the floors
|
||||
density = 0
|
||||
else
|
||||
density = 1 // We don't want disposal bins or outlets to go density 0
|
||||
to_chat(user, "You attach the [nicetype] to the underfloor.")
|
||||
playsound(src.loc, I.usesound, 100, 1)
|
||||
update()
|
||||
return
|
||||
|
||||
|
||||
if(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) // Disposal or outlet
|
||||
var/obj/structure/disposalpipe/trunk/CP = locate() in T
|
||||
if(!CP) // There's no trunk
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
if(CP)
|
||||
update()
|
||||
var/pdir = CP.dpdir
|
||||
if(istype(CP, /obj/structure/disposalpipe/broken))
|
||||
pdir = CP.dir
|
||||
if(pdir & dpdir)
|
||||
to_chat(user, "There is already a [nicetype] at that location.")
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weldingtool))
|
||||
if(anchored)
|
||||
if(I.tool_use_check(user, 0))
|
||||
to_chat(user, "Welding the [nicetype] in place.")
|
||||
if(I.use_tool(src, user, 20, volume = I.tool_volume))
|
||||
to_chat(user, "The [nicetype] has been welded in place!")
|
||||
update() // TODO: Make this neat
|
||||
if(ispipe) // Pipe
|
||||
|
||||
var/pipetype = dpipetype()
|
||||
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.base_icon_state = base_state
|
||||
P.dir = dir
|
||||
P.dpdir = dpdir
|
||||
P.update_icon()
|
||||
|
||||
//Needs some special treatment ;)
|
||||
if(ptype == PIPE_DISPOSALS_SORT_RIGHT || ptype == PIPE_DISPOSALS_SORT_LEFT)
|
||||
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
||||
SortP.updatedir()
|
||||
|
||||
else if(ptype == PIPE_DISPOSALS_BIN) // Disposal bin
|
||||
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.mode = 0 // start with pump off
|
||||
|
||||
else if(ptype == PIPE_DISPOSALS_OUTLET) // Disposal outlet
|
||||
|
||||
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.dir = dir
|
||||
|
||||
else if(ptype==PIPE_DISPOSALS_CHUTE) // Disposal outlet
|
||||
|
||||
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.dir = dir
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
to_chat(user, "You need more welding fuel to complete this task.")
|
||||
return
|
||||
else
|
||||
to_chat(user, "You need to attach it to the plating first!")
|
||||
return
|
||||
|
||||
/obj/structure/disposalconstruct/rpd_act(mob/user, obj/item/rpd/our_rpd)
|
||||
. = TRUE
|
||||
if(our_rpd.mode == RPD_ROTATE_MODE)
|
||||
rotate()
|
||||
else if(our_rpd.mode == RPD_FLIP_MODE)
|
||||
flip()
|
||||
else if(our_rpd.mode == RPD_DELETE_MODE)
|
||||
our_rpd.delete_single_pipe(user, src)
|
||||
else
|
||||
return ..()
|
||||
// Disposal pipe construction
|
||||
// This is the pipe that you drag around, not the attached ones.
|
||||
|
||||
/obj/structure/disposalconstruct
|
||||
|
||||
name = "disposal pipe segment"
|
||||
desc = "A huge pipe segment used for constructing disposal systems."
|
||||
icon = 'icons/obj/pipes/disposal.dmi'
|
||||
icon_state = "conpipe-s"
|
||||
anchored = 0
|
||||
density = 0
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
level = 2
|
||||
max_integrity = 200
|
||||
var/ptype = PIPE_DISPOSALS_STRAIGHT //Use the defines
|
||||
var/base_state
|
||||
var/dpdir = 0 // directions as disposalpipe
|
||||
|
||||
/obj/structure/disposalconstruct/New(loc, pipe_type, direction)
|
||||
..()
|
||||
if(pipe_type)
|
||||
ptype = pipe_type
|
||||
if(dir)
|
||||
dir = direction
|
||||
update()
|
||||
|
||||
// update iconstate and dpdir due to dir and type
|
||||
/obj/structure/disposalconstruct/proc/update()
|
||||
base_state = get_pipe_icon(ptype)
|
||||
icon_state = "con[base_state]"
|
||||
var/flip = turn(dir, 180)
|
||||
var/left = turn(dir, 90)
|
||||
var/right = turn(dir, -90)
|
||||
name = get_pipe_name(ptype, PIPETYPE_DISPOSAL)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_STRAIGHT)
|
||||
dpdir = dir | flip
|
||||
if(PIPE_DISPOSALS_BENT)
|
||||
dpdir = dir | right
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT)
|
||||
dpdir = dir | right | flip
|
||||
if(PIPE_DISPOSALS_JUNCTION_LEFT)
|
||||
dpdir = dir | left | flip
|
||||
if(PIPE_DISPOSALS_Y_JUNCTION)
|
||||
dpdir = dir | left | right
|
||||
if(PIPE_DISPOSALS_TRUNK)
|
||||
dpdir = dir
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT)
|
||||
dpdir = dir | right | flip
|
||||
if(PIPE_DISPOSALS_SORT_LEFT)
|
||||
dpdir = dir | left | flip
|
||||
// disposal bin has only one dir, thus we don't need to care about setting it
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
if(!anchored)
|
||||
icon_state = "[base_state]-unanchored"
|
||||
else
|
||||
icon_state = base_state
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
dpdir = dir
|
||||
icon_state = base_state
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
dpdir = dir
|
||||
icon_state = base_state
|
||||
if(!(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)))
|
||||
icon_state = "con[base_state]"
|
||||
if(invisibility) // if invisible, fade icon
|
||||
icon -= rgb(0,0,0,128)
|
||||
|
||||
// hide called by levelupdate if turf intact status changes
|
||||
// change visibility status and force update of icon
|
||||
/obj/structure/disposalconstruct/hide(var/intact)
|
||||
invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact
|
||||
update()
|
||||
|
||||
|
||||
// flip and rotate verbs
|
||||
/obj/structure/disposalconstruct/verb/rotate()
|
||||
set name = "Rotate Pipe"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before rotating it.")
|
||||
return
|
||||
|
||||
dir = turn(dir, -90)
|
||||
update()
|
||||
|
||||
/obj/structure/disposalconstruct/AltClick(mob/user)
|
||||
if(user.incapacitated())
|
||||
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
|
||||
return
|
||||
if(!Adjacent(user))
|
||||
return
|
||||
rotate()
|
||||
|
||||
/obj/structure/disposalconstruct/verb/flip()
|
||||
set name = "Flip Pipe"
|
||||
set src in view(1)
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before flipping it.")
|
||||
return
|
||||
|
||||
dir = turn(dir, 180)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT)
|
||||
ptype = PIPE_DISPOSALS_JUNCTION_LEFT
|
||||
if(PIPE_DISPOSALS_JUNCTION_LEFT)
|
||||
ptype = PIPE_DISPOSALS_JUNCTION_RIGHT
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT)
|
||||
ptype = PIPE_DISPOSALS_SORT_LEFT
|
||||
if(PIPE_DISPOSALS_SORT_LEFT)
|
||||
ptype = PIPE_DISPOSALS_SORT_RIGHT
|
||||
|
||||
update()
|
||||
|
||||
// returns the type path of disposalpipe corresponding to this item dtype
|
||||
/obj/structure/disposalconstruct/proc/dpipetype()
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_STRAIGHT, PIPE_DISPOSALS_BENT)
|
||||
return /obj/structure/disposalpipe/segment
|
||||
if(PIPE_DISPOSALS_JUNCTION_RIGHT, PIPE_DISPOSALS_JUNCTION_LEFT, PIPE_DISPOSALS_Y_JUNCTION)
|
||||
return /obj/structure/disposalpipe/junction
|
||||
if(PIPE_DISPOSALS_TRUNK)
|
||||
return /obj/structure/disposalpipe/trunk
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
return /obj/machinery/disposal
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
return /obj/structure/disposaloutlet
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
return /obj/machinery/disposal/deliveryChute
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
|
||||
return /obj/structure/disposalpipe/sortjunction
|
||||
return
|
||||
|
||||
|
||||
|
||||
// attackby item
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
|
||||
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user, params)
|
||||
var/nicetype = "pipe"
|
||||
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
||||
src.add_fingerprint(user)
|
||||
switch(ptype)
|
||||
if(PIPE_DISPOSALS_BIN)
|
||||
nicetype = "disposal bin"
|
||||
if(PIPE_DISPOSALS_OUTLET)
|
||||
nicetype = "disposal outlet"
|
||||
if(PIPE_DISPOSALS_CHUTE)
|
||||
nicetype = "delivery chute"
|
||||
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
|
||||
nicetype = "sorting pipe"
|
||||
ispipe = 1
|
||||
else
|
||||
nicetype = "pipe"
|
||||
ispipe = 1
|
||||
|
||||
var/turf/T = src.loc
|
||||
if(T.intact)
|
||||
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/wrench))
|
||||
if(anchored)
|
||||
anchored = 0
|
||||
if(ispipe)
|
||||
level = 2
|
||||
density = 0
|
||||
else
|
||||
density = 1
|
||||
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
||||
else
|
||||
anchored = 1
|
||||
if(ispipe)
|
||||
level = 1 // We don't want disposal bins to disappear under the floors
|
||||
density = 0
|
||||
else
|
||||
density = 1 // We don't want disposal bins or outlets to go density 0
|
||||
to_chat(user, "You attach the [nicetype] to the underfloor.")
|
||||
playsound(src.loc, I.usesound, 100, 1)
|
||||
update()
|
||||
return
|
||||
|
||||
|
||||
if(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) // Disposal or outlet
|
||||
var/obj/structure/disposalpipe/trunk/CP = locate() in T
|
||||
if(!CP) // There's no trunk
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
if(CP)
|
||||
update()
|
||||
var/pdir = CP.dpdir
|
||||
if(istype(CP, /obj/structure/disposalpipe/broken))
|
||||
pdir = CP.dir
|
||||
if(pdir & dpdir)
|
||||
to_chat(user, "There is already a [nicetype] at that location.")
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weldingtool))
|
||||
if(anchored)
|
||||
if(I.tool_use_check(user, 0))
|
||||
to_chat(user, "Welding the [nicetype] in place.")
|
||||
if(I.use_tool(src, user, 20, volume = I.tool_volume))
|
||||
to_chat(user, "The [nicetype] has been welded in place!")
|
||||
update() // TODO: Make this neat
|
||||
if(ispipe) // Pipe
|
||||
|
||||
var/pipetype = dpipetype()
|
||||
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.base_icon_state = base_state
|
||||
P.dir = dir
|
||||
P.dpdir = dpdir
|
||||
P.update_icon()
|
||||
|
||||
//Needs some special treatment ;)
|
||||
if(ptype == PIPE_DISPOSALS_SORT_RIGHT || ptype == PIPE_DISPOSALS_SORT_LEFT)
|
||||
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
||||
SortP.updatedir()
|
||||
|
||||
else if(ptype == PIPE_DISPOSALS_BIN) // Disposal bin
|
||||
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.mode = 0 // start with pump off
|
||||
|
||||
else if(ptype == PIPE_DISPOSALS_OUTLET) // Disposal outlet
|
||||
|
||||
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.dir = dir
|
||||
|
||||
else if(ptype==PIPE_DISPOSALS_CHUTE) // Disposal outlet
|
||||
|
||||
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.dir = dir
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
to_chat(user, "You need more welding fuel to complete this task.")
|
||||
return
|
||||
else
|
||||
to_chat(user, "You need to attach it to the plating first!")
|
||||
return
|
||||
|
||||
/obj/structure/disposalconstruct/rpd_act(mob/user, obj/item/rpd/our_rpd)
|
||||
. = TRUE
|
||||
if(our_rpd.mode == RPD_ROTATE_MODE)
|
||||
rotate()
|
||||
else if(our_rpd.mode == RPD_FLIP_MODE)
|
||||
flip()
|
||||
else if(our_rpd.mode == RPD_DELETE_MODE)
|
||||
our_rpd.delete_single_pipe(user, src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
+1384
-1384
File diff suppressed because it is too large
Load Diff
@@ -1,444 +1,444 @@
|
||||
/obj/structure/bigDelivery
|
||||
name = "large parcel"
|
||||
desc = "A big wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycloset"
|
||||
density = 1
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/obj/wrapped = null
|
||||
var/init_welded = 0
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(T)
|
||||
return ..()
|
||||
|
||||
/obj/structure/bigDelivery/ex_act(severity)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.ex_act()
|
||||
CHECK_TICK
|
||||
..()
|
||||
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
if(wrapped)
|
||||
wrapped.loc = get_turf(src)
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.welded = init_welded
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in src)
|
||||
AM.loc = T
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
|
||||
to_chat(user, "<span class='notice'>*[tag]*</span>")
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/shippingPackage))
|
||||
var/obj/item/shippingPackage/sp = W
|
||||
if(sp.sealed)
|
||||
return
|
||||
else
|
||||
sortTag = sp.sortTag
|
||||
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
|
||||
qdel(sp)
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(3))
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
giftwrapped = 1
|
||||
if(istype(wrapped, /obj/structure/closet/crate))
|
||||
icon_state = "giftcrate"
|
||||
else
|
||||
icon_state = "giftcloset"
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/smallDelivery
|
||||
name = "small parcel"
|
||||
desc = "A small wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycrateSmall"
|
||||
item_state = "deliverypackage"
|
||||
var/obj/item/wrapped = null
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
/obj/item/smallDelivery/ex_act(severity)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.ex_act()
|
||||
CHECK_TICK
|
||||
..()
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if(wrapped && wrapped.loc) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = user.loc
|
||||
if(ishuman(user))
|
||||
user.put_in_hands(wrapped)
|
||||
else
|
||||
wrapped.loc = get_turf(src)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
|
||||
to_chat(user, "<span class='notice'>*[tag]*</span>")
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/shippingPackage))
|
||||
var/obj/item/shippingPackage/sp = W
|
||||
if(sp.sealed)
|
||||
return
|
||||
else
|
||||
sortTag = sp.sortTag
|
||||
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
|
||||
qdel(sp)
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(1))
|
||||
icon_state = "giftcrate[wrapped.w_class]"
|
||||
giftwrapped = 1
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/packageWrap
|
||||
name = "package wrapper"
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
singular_name = "package wrapper"
|
||||
flags = NOBLUDGEON
|
||||
amount = 25
|
||||
max_amount = 25
|
||||
resistance_flags = FLAMMABLE
|
||||
|
||||
/obj/item/stack/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete
|
||||
return
|
||||
if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \
|
||||
|| istype(target, /obj/item/evidencebag) || istype(target, /obj/structure/closet/body_bag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(target in user)
|
||||
return
|
||||
|
||||
if(istype(target, /obj/item) && !(istype(target, /obj/item/storage) && !istype(target,/obj/item/storage/box) && !istype(target, /obj/item/shippingPackage)))
|
||||
var/obj/item/O = target
|
||||
if(use(1))
|
||||
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up!
|
||||
if(!istype(O.loc, /turf))
|
||||
if(user.client)
|
||||
user.client.screen -= O
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
P.w_class = i
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
else
|
||||
return
|
||||
else if(istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(amount >= 3 && do_after_once(user, 15, target = target))
|
||||
if(O.opened || !use(3))
|
||||
return
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
return
|
||||
else if(istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(amount >= 3 && do_after_once(user, 15, target = target))
|
||||
if(O.opened || !use(3))
|
||||
return
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
P.init_welded = O.welded
|
||||
O.welded = 1
|
||||
O.loc = P
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The object you are trying to wrap is unsuitable for the sorting machinery.</span>")
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] wraps [target].</span>")
|
||||
user.create_attack_log("<font color='blue'>Has used [name] on [target]</font>")
|
||||
|
||||
if(amount <= 0 && !src.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
return
|
||||
|
||||
/obj/item/destTagger
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "dest_tagger"
|
||||
var/currTag = 0
|
||||
//The whole system for the sorttype var is determined based on the order of this list,
|
||||
//disposals must always be 1, since anything that's untagged will automatically go to disposals, or sorttype = 1 --Superxpdude
|
||||
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
item_state = "electronic"
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
/obj/item/destTagger/proc/openwindow(mob/user as mob)
|
||||
var/dat = "<tt><center><h1><b>TagMaster 2.2</b></h1></center>"
|
||||
|
||||
dat += "<table style='width:100%; padding:4px;'><tr>"
|
||||
for(var/i = 1, i <= GLOB.TAGGERLOCATIONS.len, i++)
|
||||
dat += "<td><a href='?src=[UID()];nextTag=[i]'>[GLOB.TAGGERLOCATIONS[i]]</a></td>"
|
||||
|
||||
if(i%4==0)
|
||||
dat += "</tr><tr>"
|
||||
|
||||
dat += "</tr></table><br>Current Selection: [currTag ? GLOB.TAGGERLOCATIONS[currTag] : "None"]</tt>"
|
||||
|
||||
user << browse(dat, "window=destTagScreen;size=450x350")
|
||||
onclose(user, "destTagScreen")
|
||||
|
||||
/obj/item/destTagger/attack_self(mob/user as mob)
|
||||
openwindow(user)
|
||||
return
|
||||
|
||||
/obj/item/destTagger/Topic(href, href_list)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["nextTag"])
|
||||
var/n = text2num(href_list["nextTag"])
|
||||
src.currTag = n
|
||||
openwindow(usr)
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
name = "Delivery chute"
|
||||
desc = "A chute for big and small packages alike!"
|
||||
density = 1
|
||||
icon_state = "intake"
|
||||
required_mode_to_deconstruct = 1
|
||||
deconstructs_to = PIPE_DISPOSALS_CHUTE
|
||||
var/can_deconstruct = FALSE
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/New()
|
||||
..()
|
||||
spawn(5)
|
||||
trunk = locate() in src.loc
|
||||
if(trunk)
|
||||
trunk.linked = src // link the pipe trunk to self
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/interact()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/update()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Bumped(atom/movable/AM) //Go straight into the chute
|
||||
if(istype(AM, /obj/item/projectile)) return
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
if(AM.loc.y != src.loc.y+1) return
|
||||
if(EAST)
|
||||
if(AM.loc.x != src.loc.x+1) return
|
||||
if(SOUTH)
|
||||
if(AM.loc.y != src.loc.y-1) return
|
||||
if(WEST)
|
||||
if(AM.loc.x != src.loc.x-1) return
|
||||
|
||||
if(istype(AM, /obj))
|
||||
var/obj/O = AM
|
||||
O.loc = src
|
||||
else if(istype(AM, /mob))
|
||||
var/mob/M = AM
|
||||
M.loc = src
|
||||
src.flush()
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/flush()
|
||||
flushing = 1
|
||||
flick("intake-closing", src)
|
||||
var/deliveryCheck = 0
|
||||
var/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
// travels through the pipes.
|
||||
for(var/obj/structure/bigDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if(O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
for(var/obj/item/smallDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if(O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
for(var/obj/item/shippingPackage/O in src)
|
||||
deliveryCheck = 1
|
||||
if(!O.sealed || O.sortTag == 0) //unsealed or untagged shipping packages will default to disposals
|
||||
O.sortTag = 1
|
||||
if(deliveryCheck == 0)
|
||||
H.destinationTag = 1
|
||||
|
||||
sleep(10)
|
||||
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0)
|
||||
sleep(5) // wait for animation to finish
|
||||
|
||||
H.init(src) // copy the contents of disposer to holder
|
||||
air_contents = new() // The holder just took our gas; replace it
|
||||
H.start(src) // start the holder processing movement
|
||||
flushing = 0
|
||||
// now reset disposal state
|
||||
flush = 0
|
||||
if(mode == 2) // if was ready,
|
||||
mode = 1 // switch to charging
|
||||
update()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/screwdriver_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
can_deconstruct = !can_deconstruct
|
||||
to_chat(user, "You [can_deconstruct ? "unfasten": "fasten"] the screws around the power connection.")
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/welder_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!can_deconstruct)
|
||||
return
|
||||
if(contents.len > 0)
|
||||
to_chat(user, "Eject the items first!")
|
||||
return
|
||||
if(!I.tool_use_check(user, 0))
|
||||
return
|
||||
WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE
|
||||
if(I.use_tool(src, user, 20, volume = I.tool_volume))
|
||||
WELDER_FLOOR_SLICE_SUCCESS_MESSAGE
|
||||
var/obj/structure/disposalconstruct/C = new (loc)
|
||||
C.ptype = deconstructs_to
|
||||
C.update()
|
||||
C.anchored = TRUE
|
||||
C.density = TRUE
|
||||
qdel(src)
|
||||
|
||||
/obj/item/shippingPackage
|
||||
name = "Shipping package"
|
||||
desc = "A pre-labeled package for shipping an item to coworkers."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "shippack"
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = 0
|
||||
var/sealed = 0
|
||||
|
||||
/obj/item/shippingPackage/attackby(obj/item/O, mob/user, params)
|
||||
if(sealed)
|
||||
if(istype(O, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Intended recipient?","Address","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] addresses [src] to [str].</span>")
|
||||
name = "Shipping package (RE: [str])"
|
||||
return
|
||||
if(wrapped)
|
||||
to_chat(user, "<span class='notice'>[src] already contains \a [wrapped].</span>")
|
||||
return
|
||||
if(istype(O, /obj/item) && !istype(O, /obj/item/storage) && !istype(O, /obj/item/shippingPackage))
|
||||
if(!user.canUnEquip(O))
|
||||
to_chat(user, "<span class='warning'>[O] is stuck to your hand, you cannot put it in [src]!</span>")
|
||||
return
|
||||
if(O.w_class > 3)
|
||||
to_chat(user, "<span class='notice'>[O] is too large to fit in [src].</span>")
|
||||
else
|
||||
wrapped = O
|
||||
user.unEquip(O)
|
||||
O.forceMove(src)
|
||||
O.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
to_chat(user, "<span class='notice'>You put [O] in [src].</span>")
|
||||
|
||||
/obj/item/shippingPackage/attack_self(mob/user)
|
||||
if(sealed)
|
||||
to_chat(user, "<span class='notice'>You tear open [src], dropping the contents onto the floor.</span>")
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
user.unEquip(src)
|
||||
wrapped.forceMove(get_turf(user))
|
||||
wrapped = null
|
||||
qdel(src)
|
||||
else if(wrapped)
|
||||
switch(alert("Select an action:",, "Remove Object", "Seal Package", "Cancel"))
|
||||
if("Remove Object")
|
||||
to_chat(user, "<span class='notice'>You shake out [src]'s contents onto the floor.</span>")
|
||||
wrapped.forceMove(get_turf(user))
|
||||
wrapped = null
|
||||
if("Seal Package")
|
||||
to_chat(user, "<span class='notice'>You seal [src], preparing it for delivery.</span>")
|
||||
icon_state = "shippack_sealed"
|
||||
sealed = 1
|
||||
update_desc()
|
||||
else
|
||||
if(alert("Do you want to tear up the package?",, "Yes", "No") == "Yes")
|
||||
to_chat(user, "<span class='notice'>You shred [src].</span>")
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
user.unEquip(src)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/shippingPackage/proc/update_desc()
|
||||
desc = "A pre-labeled package for shipping an item to coworkers."
|
||||
if(sortTag)
|
||||
desc += " The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sortTag]]\"."
|
||||
if(!sealed)
|
||||
desc += " The package is not sealed."
|
||||
|
||||
/obj/item/shippingPackage/Destroy()
|
||||
QDEL_NULL(wrapped)
|
||||
return ..()
|
||||
/obj/structure/bigDelivery
|
||||
name = "large parcel"
|
||||
desc = "A big wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycloset"
|
||||
density = 1
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/obj/wrapped = null
|
||||
var/init_welded = 0
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(T)
|
||||
return ..()
|
||||
|
||||
/obj/structure/bigDelivery/ex_act(severity)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.ex_act()
|
||||
CHECK_TICK
|
||||
..()
|
||||
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
if(wrapped)
|
||||
wrapped.loc = get_turf(src)
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.welded = init_welded
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in src)
|
||||
AM.loc = T
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
|
||||
to_chat(user, "<span class='notice'>*[tag]*</span>")
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/shippingPackage))
|
||||
var/obj/item/shippingPackage/sp = W
|
||||
if(sp.sealed)
|
||||
return
|
||||
else
|
||||
sortTag = sp.sortTag
|
||||
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
|
||||
qdel(sp)
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(3))
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
giftwrapped = 1
|
||||
if(istype(wrapped, /obj/structure/closet/crate))
|
||||
icon_state = "giftcrate"
|
||||
else
|
||||
icon_state = "giftcloset"
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/smallDelivery
|
||||
name = "small parcel"
|
||||
desc = "A small wrapped package."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycrateSmall"
|
||||
item_state = "deliverypackage"
|
||||
var/obj/item/wrapped = null
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
|
||||
/obj/item/smallDelivery/ex_act(severity)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.ex_act()
|
||||
CHECK_TICK
|
||||
..()
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if(wrapped && wrapped.loc) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = user.loc
|
||||
if(ishuman(user))
|
||||
user.put_in_hands(wrapped)
|
||||
else
|
||||
wrapped.loc = get_turf(src)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
|
||||
if(sortTag != O.currTag)
|
||||
var/tag = uppertext(GLOB.TAGGERLOCATIONS[O.currTag])
|
||||
to_chat(user, "<span class='notice'>*[tag]*</span>")
|
||||
sortTag = O.currTag
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
|
||||
|
||||
else if(istype(W, /obj/item/shippingPackage))
|
||||
var/obj/item/shippingPackage/sp = W
|
||||
if(sp.sealed)
|
||||
return
|
||||
else
|
||||
sortTag = sp.sortTag
|
||||
to_chat(user, "<span class='notice'>You rip the label off the shipping package and affix it to [src].</span>")
|
||||
qdel(sp)
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
if(WP.use(1))
|
||||
icon_state = "giftcrate[wrapped.w_class]"
|
||||
giftwrapped = 1
|
||||
user.visible_message("<span class='notice'>[user] wraps the package in festive paper!</span>")
|
||||
if(WP.amount <= 0 && !WP.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/packageWrap
|
||||
name = "package wrapper"
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
singular_name = "package wrapper"
|
||||
flags = NOBLUDGEON
|
||||
amount = 25
|
||||
max_amount = 25
|
||||
resistance_flags = FLAMMABLE
|
||||
|
||||
/obj/item/stack/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete
|
||||
return
|
||||
if(istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \
|
||||
|| istype(target, /obj/item/evidencebag) || istype(target, /obj/structure/closet/body_bag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(target in user)
|
||||
return
|
||||
|
||||
if(istype(target, /obj/item) && !(istype(target, /obj/item/storage) && !istype(target,/obj/item/storage/box) && !istype(target, /obj/item/shippingPackage)))
|
||||
var/obj/item/O = target
|
||||
if(use(1))
|
||||
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(O.loc)) //Aaannd wrap it up!
|
||||
if(!istype(O.loc, /turf))
|
||||
if(user.client)
|
||||
user.client.screen -= O
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
P.w_class = i
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
else
|
||||
return
|
||||
else if(istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(amount >= 3 && do_after_once(user, 15, target = target))
|
||||
if(O.opened || !use(3))
|
||||
return
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
return
|
||||
else if(istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if(O.opened)
|
||||
return
|
||||
if(amount >= 3 && do_after_once(user, 15, target = target))
|
||||
if(O.opened || !use(3))
|
||||
return
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
P.init_welded = O.welded
|
||||
O.welded = 1
|
||||
O.loc = P
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You need more paper.</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The object you are trying to wrap is unsuitable for the sorting machinery.</span>")
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] wraps [target].</span>")
|
||||
user.create_attack_log("<font color='blue'>Has used [name] on [target]</font>")
|
||||
|
||||
if(amount <= 0 && !src.loc) //if we used our last wrapping paper, drop a cardboard tube
|
||||
new /obj/item/c_tube( get_turf(user) )
|
||||
return
|
||||
|
||||
/obj/item/destTagger
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "dest_tagger"
|
||||
var/currTag = 0
|
||||
//The whole system for the sorttype var is determined based on the order of this list,
|
||||
//disposals must always be 1, since anything that's untagged will automatically go to disposals, or sorttype = 1 --Superxpdude
|
||||
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
item_state = "electronic"
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
/obj/item/destTagger/proc/openwindow(mob/user as mob)
|
||||
var/dat = "<tt><center><h1><b>TagMaster 2.2</b></h1></center>"
|
||||
|
||||
dat += "<table style='width:100%; padding:4px;'><tr>"
|
||||
for(var/i = 1, i <= GLOB.TAGGERLOCATIONS.len, i++)
|
||||
dat += "<td><a href='?src=[UID()];nextTag=[i]'>[GLOB.TAGGERLOCATIONS[i]]</a></td>"
|
||||
|
||||
if(i%4==0)
|
||||
dat += "</tr><tr>"
|
||||
|
||||
dat += "</tr></table><br>Current Selection: [currTag ? GLOB.TAGGERLOCATIONS[currTag] : "None"]</tt>"
|
||||
|
||||
user << browse(dat, "window=destTagScreen;size=450x350")
|
||||
onclose(user, "destTagScreen")
|
||||
|
||||
/obj/item/destTagger/attack_self(mob/user as mob)
|
||||
openwindow(user)
|
||||
return
|
||||
|
||||
/obj/item/destTagger/Topic(href, href_list)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["nextTag"])
|
||||
var/n = text2num(href_list["nextTag"])
|
||||
src.currTag = n
|
||||
openwindow(usr)
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
name = "Delivery chute"
|
||||
desc = "A chute for big and small packages alike!"
|
||||
density = 1
|
||||
icon_state = "intake"
|
||||
required_mode_to_deconstruct = 1
|
||||
deconstructs_to = PIPE_DISPOSALS_CHUTE
|
||||
var/can_deconstruct = FALSE
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/New()
|
||||
..()
|
||||
spawn(5)
|
||||
trunk = locate() in src.loc
|
||||
if(trunk)
|
||||
trunk.linked = src // link the pipe trunk to self
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/interact()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/update()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Bumped(atom/movable/AM) //Go straight into the chute
|
||||
if(istype(AM, /obj/item/projectile)) return
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
if(AM.loc.y != src.loc.y+1) return
|
||||
if(EAST)
|
||||
if(AM.loc.x != src.loc.x+1) return
|
||||
if(SOUTH)
|
||||
if(AM.loc.y != src.loc.y-1) return
|
||||
if(WEST)
|
||||
if(AM.loc.x != src.loc.x-1) return
|
||||
|
||||
if(istype(AM, /obj))
|
||||
var/obj/O = AM
|
||||
O.loc = src
|
||||
else if(istype(AM, /mob))
|
||||
var/mob/M = AM
|
||||
M.loc = src
|
||||
src.flush()
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/flush()
|
||||
flushing = 1
|
||||
flick("intake-closing", src)
|
||||
var/deliveryCheck = 0
|
||||
var/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
// travels through the pipes.
|
||||
for(var/obj/structure/bigDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if(O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
for(var/obj/item/smallDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if(O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
for(var/obj/item/shippingPackage/O in src)
|
||||
deliveryCheck = 1
|
||||
if(!O.sealed || O.sortTag == 0) //unsealed or untagged shipping packages will default to disposals
|
||||
O.sortTag = 1
|
||||
if(deliveryCheck == 0)
|
||||
H.destinationTag = 1
|
||||
|
||||
sleep(10)
|
||||
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0)
|
||||
sleep(5) // wait for animation to finish
|
||||
|
||||
H.init(src) // copy the contents of disposer to holder
|
||||
air_contents = new() // The holder just took our gas; replace it
|
||||
H.start(src) // start the holder processing movement
|
||||
flushing = 0
|
||||
// now reset disposal state
|
||||
flush = 0
|
||||
if(mode == 2) // if was ready,
|
||||
mode = 1 // switch to charging
|
||||
update()
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/screwdriver_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
can_deconstruct = !can_deconstruct
|
||||
to_chat(user, "You [can_deconstruct ? "unfasten": "fasten"] the screws around the power connection.")
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/welder_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!can_deconstruct)
|
||||
return
|
||||
if(contents.len > 0)
|
||||
to_chat(user, "Eject the items first!")
|
||||
return
|
||||
if(!I.tool_use_check(user, 0))
|
||||
return
|
||||
WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE
|
||||
if(I.use_tool(src, user, 20, volume = I.tool_volume))
|
||||
WELDER_FLOOR_SLICE_SUCCESS_MESSAGE
|
||||
var/obj/structure/disposalconstruct/C = new (loc)
|
||||
C.ptype = deconstructs_to
|
||||
C.update()
|
||||
C.anchored = TRUE
|
||||
C.density = TRUE
|
||||
qdel(src)
|
||||
|
||||
/obj/item/shippingPackage
|
||||
name = "Shipping package"
|
||||
desc = "A pre-labeled package for shipping an item to coworkers."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "shippack"
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = 0
|
||||
var/sealed = 0
|
||||
|
||||
/obj/item/shippingPackage/attackby(obj/item/O, mob/user, params)
|
||||
if(sealed)
|
||||
if(istype(O, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Intended recipient?","Address","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] addresses [src] to [str].</span>")
|
||||
name = "Shipping package (RE: [str])"
|
||||
return
|
||||
if(wrapped)
|
||||
to_chat(user, "<span class='notice'>[src] already contains \a [wrapped].</span>")
|
||||
return
|
||||
if(istype(O, /obj/item) && !istype(O, /obj/item/storage) && !istype(O, /obj/item/shippingPackage))
|
||||
if(!user.canUnEquip(O))
|
||||
to_chat(user, "<span class='warning'>[O] is stuck to your hand, you cannot put it in [src]!</span>")
|
||||
return
|
||||
if(O.w_class > 3)
|
||||
to_chat(user, "<span class='notice'>[O] is too large to fit in [src].</span>")
|
||||
else
|
||||
wrapped = O
|
||||
user.unEquip(O)
|
||||
O.forceMove(src)
|
||||
O.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
to_chat(user, "<span class='notice'>You put [O] in [src].</span>")
|
||||
|
||||
/obj/item/shippingPackage/attack_self(mob/user)
|
||||
if(sealed)
|
||||
to_chat(user, "<span class='notice'>You tear open [src], dropping the contents onto the floor.</span>")
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
user.unEquip(src)
|
||||
wrapped.forceMove(get_turf(user))
|
||||
wrapped = null
|
||||
qdel(src)
|
||||
else if(wrapped)
|
||||
switch(alert("Select an action:",, "Remove Object", "Seal Package", "Cancel"))
|
||||
if("Remove Object")
|
||||
to_chat(user, "<span class='notice'>You shake out [src]'s contents onto the floor.</span>")
|
||||
wrapped.forceMove(get_turf(user))
|
||||
wrapped = null
|
||||
if("Seal Package")
|
||||
to_chat(user, "<span class='notice'>You seal [src], preparing it for delivery.</span>")
|
||||
icon_state = "shippack_sealed"
|
||||
sealed = 1
|
||||
update_desc()
|
||||
else
|
||||
if(alert("Do you want to tear up the package?",, "Yes", "No") == "Yes")
|
||||
to_chat(user, "<span class='notice'>You shred [src].</span>")
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
user.unEquip(src)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/shippingPackage/proc/update_desc()
|
||||
desc = "A pre-labeled package for shipping an item to coworkers."
|
||||
if(sortTag)
|
||||
desc += " The label says \"Deliver to [GLOB.TAGGERLOCATIONS[sortTag]]\"."
|
||||
if(!sealed)
|
||||
desc += " The package is not sealed."
|
||||
|
||||
/obj/item/shippingPackage/Destroy()
|
||||
QDEL_NULL(wrapped)
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user