mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 21:19:44 +01:00
Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings * Whitespace changes * Comment out merger hooks in gitattributes Corrupt maps would have to be resolved in repo before hooks could be updated * Revert "Whitespace changes" This reverts commitafbdd1d844. * Whitespace again minus example * Gitignore example changelog * Restore changelog merge setting * Keep older dmi hook attribute until hooks can be updated * update vscode settings too * Renormalize remaining * Revert "Gitignore example changelog" This reverts commitde22ad375d. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
+346
-346
@@ -1,346 +1,346 @@
|
||||
#define OFF 0
|
||||
#define FORWARDS 1
|
||||
#define BACKWARDS -1
|
||||
|
||||
//conveyor2 is pretty much like the original, except it supports corners, but not diverters.
|
||||
//note that corner pieces transfer stuff clockwise when running forward, and anti-clockwise backwards.
|
||||
|
||||
/obj/machinery/conveyor
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor0"
|
||||
name = "conveyor belt"
|
||||
desc = "A conveyor belt."
|
||||
plane = TURF_PLANE
|
||||
layer = ABOVE_TURF_LAYER
|
||||
anchored = TRUE
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/weapon/circuitboard/conveyor
|
||||
var/operating = OFF // 1 if running forward, -1 if backwards, 0 if off
|
||||
var/operable = 1 // true if can operate (no broken segments in this belt run)
|
||||
var/forwards // this is the default (forward) direction, set by the map dir
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/movedir // the actual direction to move stuff in
|
||||
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/id = "" // the control ID - must match controller ID
|
||||
|
||||
/obj/machinery/conveyor/centcom_auto
|
||||
id = "round_end_belt"
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/Initialize(mapload, newdir, on = 0)
|
||||
. = ..()
|
||||
if(newdir)
|
||||
set_dir(newdir)
|
||||
|
||||
update_dir()
|
||||
|
||||
if(on)
|
||||
set_operating(FORWARDS)
|
||||
|
||||
default_apply_parts()
|
||||
|
||||
/obj/machinery/conveyor/proc/toggle_speed(var/forced)
|
||||
if(forced)
|
||||
speed_process = forced
|
||||
else
|
||||
speed_process = !speed_process // switching gears
|
||||
if(speed_process) // high gear
|
||||
update_active_power_usage(initial(idle_power_usage) * 4)
|
||||
else // low gear
|
||||
update_active_power_usage(initial(idle_power_usage))
|
||||
update()
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operating(var/new_operating)
|
||||
if(new_operating == operating)
|
||||
return // No change
|
||||
operating = new_operating
|
||||
if(operating == FORWARDS)
|
||||
movedir = forwards
|
||||
else if(operating == BACKWARDS)
|
||||
movedir = backwards
|
||||
else
|
||||
operating = OFF
|
||||
update()
|
||||
|
||||
/obj/machinery/conveyor/set_dir()
|
||||
.=..()
|
||||
update_dir()
|
||||
|
||||
/obj/machinery/conveyor/proc/update_dir()
|
||||
if(!(dir in cardinal)) // Diagonal. Forwards is *away* from dir, curving to the right.
|
||||
forwards = turn(dir, 45)
|
||||
backwards = turn(dir, 135)
|
||||
else
|
||||
forwards = dir
|
||||
backwards = turn(dir, 180)
|
||||
|
||||
/obj/machinery/conveyor/proc/update()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "conveyor-broken"
|
||||
operating = OFF
|
||||
update_use_power(USE_POWER_OFF)
|
||||
return
|
||||
if(!operable)
|
||||
operating = OFF
|
||||
if(stat & NOPOWER)
|
||||
operating = OFF
|
||||
icon_state = "conveyor[operating]"
|
||||
|
||||
if(!operating)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
return
|
||||
if(speed_process) // high gear
|
||||
STOP_MACHINE_PROCESSING(src)
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
else // low gear
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
START_MACHINE_PROCESSING(src)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
|
||||
// machine process
|
||||
// move items to the target location
|
||||
/obj/machinery/conveyor/process()
|
||||
if(stat & (BROKEN | NOPOWER))
|
||||
return PROCESS_KILL
|
||||
if(!operating)
|
||||
return PROCESS_KILL
|
||||
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
spawn(1) // slight delay to prevent infinite propagation due to map order //TODO: please no spawn() in process(). It's a very bad idea
|
||||
var/items_moved = 0
|
||||
for(var/atom/movable/A in affecting)
|
||||
if(istype(A,/obj/effect/abstract)) // Flashlight's lights are not physical objects
|
||||
continue
|
||||
if(!A.anchored)
|
||||
if(A.loc == src.loc) // prevents the object from being affected if it's not currently here.
|
||||
step(A,movedir)
|
||||
items_moved++
|
||||
if(items_moved >= 10)
|
||||
break
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user)
|
||||
if(isrobot(user)) return //Carn: fix for borgs dropping their modules on conveyor belts
|
||||
if(I.loc != user) return // This should stop mounted modules ending up outside the module.
|
||||
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, I))
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
if(panel_open)
|
||||
var/input = sanitize(tgui_input_text(usr, "What id would you like to give this conveyor?", "Multitool-Conveyor interface", id))
|
||||
if(!input)
|
||||
to_chat(user, "No input found. Please hang up and try your call again.")
|
||||
return
|
||||
id = input
|
||||
for(var/obj/machinery/conveyor_switch/C in machines)
|
||||
if(C.id == id)
|
||||
C.conveyors |= src
|
||||
return
|
||||
|
||||
user.drop_item(get_turf(src))
|
||||
return
|
||||
|
||||
// attack with hand, move pulled object onto conveyor
|
||||
/obj/machinery/conveyor/attack_hand(mob/user as mob)
|
||||
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
|
||||
return
|
||||
if (user.pulling.anchored)
|
||||
return
|
||||
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
|
||||
return
|
||||
if (ismob(user.pulling))
|
||||
var/mob/M = user.pulling
|
||||
M.stop_pulling()
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.stop_pulling()
|
||||
else
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.stop_pulling()
|
||||
return
|
||||
|
||||
|
||||
// make the conveyor broken
|
||||
// also propagate inoperability to any connected conveyor with the same ID
|
||||
/obj/machinery/conveyor/proc/broken()
|
||||
stat |= BROKEN
|
||||
update()
|
||||
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, dir)
|
||||
if(C)
|
||||
C.set_operable(dir, id, 0)
|
||||
|
||||
C = locate() in get_step(src, turn(dir,180))
|
||||
if(C)
|
||||
C.set_operable(turn(dir,180), id, 0)
|
||||
|
||||
|
||||
//set the operable var if ID matches, propagating in the given direction
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op)
|
||||
|
||||
if(id != match_id)
|
||||
return
|
||||
operable = op
|
||||
|
||||
update()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir)
|
||||
if(C)
|
||||
C.set_operable(stepdir, id, op)
|
||||
|
||||
/obj/machinery/conveyor/power_change()
|
||||
if((. = ..()))
|
||||
update()
|
||||
|
||||
// the conveyor control switch
|
||||
//
|
||||
//
|
||||
|
||||
/obj/machinery/conveyor_switch
|
||||
|
||||
name = "conveyor switch"
|
||||
desc = "A conveyor control switch."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/position = 0 // 0 off, -1 reverse, 1 forward
|
||||
var/last_pos = -1 // last direction setting
|
||||
var/operated = 1 // true if just operated
|
||||
var/oneway = 0 // Voreadd: One way levels mid-round!
|
||||
|
||||
var/id = "" // must match conveyor IDs to control them
|
||||
|
||||
var/list/conveyors // the list of converyors that are controlled by this switch
|
||||
anchored = TRUE
|
||||
var/speed_active = FALSE // are the linked conveyors on SSfastprocess?
|
||||
|
||||
|
||||
|
||||
/obj/machinery/conveyor_switch/Initialize()
|
||||
..()
|
||||
update()
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/obj/machinery/conveyor_switch/LateInitialize()
|
||||
conveyors = list()
|
||||
for(var/obj/machinery/conveyor/C in machines)
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/toggle_speed(var/forced)
|
||||
speed_active = !speed_active // switching gears
|
||||
if(speed_active) // high gear
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.toggle_speed(TRUE)
|
||||
else // low gear
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.toggle_speed(FALSE)
|
||||
|
||||
// update the icon depending on the position
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/update()
|
||||
if(position<0)
|
||||
icon_state = "switch-rev"
|
||||
else if(position>0)
|
||||
icon_state = "switch-fwd"
|
||||
else
|
||||
icon_state = "switch-off"
|
||||
|
||||
|
||||
// timed process
|
||||
// if the switch changed, update the linked conveyors
|
||||
|
||||
/obj/machinery/conveyor_switch/process()
|
||||
if(!operated)
|
||||
return
|
||||
operated = 0
|
||||
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.set_operating(position)
|
||||
|
||||
// attack with hand, switch position
|
||||
/obj/machinery/conveyor_switch/attack_hand(mob/user)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
|
||||
if(position == 0)
|
||||
if(last_pos < 0 || oneway == 1)
|
||||
position = 1
|
||||
last_pos = 0
|
||||
else
|
||||
position = -1
|
||||
last_pos = 0
|
||||
else
|
||||
last_pos = position
|
||||
position = 0
|
||||
|
||||
operated = 1
|
||||
update()
|
||||
|
||||
// find any switches with same id as this one, and set their positions to match us
|
||||
for(var/obj/machinery/conveyor_switch/S in machines)
|
||||
if(S.id == src.id)
|
||||
S.position = position
|
||||
S.update()
|
||||
|
||||
/obj/machinery/conveyor_switch/attackby(var/obj/item/I, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
|
||||
if(!panel_open) //It's probably better to just check this once instead of each time
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = I.get_welder()
|
||||
if(!WT.remove_fuel(0, user))
|
||||
to_chat(user, "The welding tool must be on to complete this task.")
|
||||
return
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
if(do_after(user, 20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
to_chat(user, "<span class='notice'>You deconstruct the frame.</span>")
|
||||
new /obj/item/stack/material/steel( src.loc, 2 )
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_MULTITOOL))
|
||||
var/input = sanitize(tgui_input_text(usr, "What id would you like to give this conveyor switch?", "Multitool-Conveyor interface", id))
|
||||
if(!input)
|
||||
to_chat(user, "No input found. Please hang up and try your call again.")
|
||||
return
|
||||
id = input
|
||||
conveyors = list() // Clear list so they aren't double added.
|
||||
for(var/obj/machinery/conveyor/C in machines)
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_WRENCH))
|
||||
if(oneway == 1)
|
||||
to_chat(user, "You set the switch to two way operation.")
|
||||
oneway = 0
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
return
|
||||
else
|
||||
to_chat(user, "You set the switch to one way operation.")
|
||||
oneway = 1
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
return
|
||||
|
||||
//Ports making conveyors fast from CHOMPstation
|
||||
if(I.has_tool_quality(TOOL_WIRECUTTER))
|
||||
toggle_speed()
|
||||
to_chat(user, "You adjust the speed of the conveyor switch")
|
||||
return
|
||||
|
||||
/obj/machinery/conveyor_switch/oneway
|
||||
oneway = 1
|
||||
|
||||
/obj/machinery/conveyor_switch/examine()
|
||||
.=..()
|
||||
if(oneway == 1)
|
||||
. += " It appears to only go in one direction."
|
||||
#define OFF 0
|
||||
#define FORWARDS 1
|
||||
#define BACKWARDS -1
|
||||
|
||||
//conveyor2 is pretty much like the original, except it supports corners, but not diverters.
|
||||
//note that corner pieces transfer stuff clockwise when running forward, and anti-clockwise backwards.
|
||||
|
||||
/obj/machinery/conveyor
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "conveyor0"
|
||||
name = "conveyor belt"
|
||||
desc = "A conveyor belt."
|
||||
plane = TURF_PLANE
|
||||
layer = ABOVE_TURF_LAYER
|
||||
anchored = TRUE
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/weapon/circuitboard/conveyor
|
||||
var/operating = OFF // 1 if running forward, -1 if backwards, 0 if off
|
||||
var/operable = 1 // true if can operate (no broken segments in this belt run)
|
||||
var/forwards // this is the default (forward) direction, set by the map dir
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/movedir // the actual direction to move stuff in
|
||||
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/id = "" // the control ID - must match controller ID
|
||||
|
||||
/obj/machinery/conveyor/centcom_auto
|
||||
id = "round_end_belt"
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/Initialize(mapload, newdir, on = 0)
|
||||
. = ..()
|
||||
if(newdir)
|
||||
set_dir(newdir)
|
||||
|
||||
update_dir()
|
||||
|
||||
if(on)
|
||||
set_operating(FORWARDS)
|
||||
|
||||
default_apply_parts()
|
||||
|
||||
/obj/machinery/conveyor/proc/toggle_speed(var/forced)
|
||||
if(forced)
|
||||
speed_process = forced
|
||||
else
|
||||
speed_process = !speed_process // switching gears
|
||||
if(speed_process) // high gear
|
||||
update_active_power_usage(initial(idle_power_usage) * 4)
|
||||
else // low gear
|
||||
update_active_power_usage(initial(idle_power_usage))
|
||||
update()
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operating(var/new_operating)
|
||||
if(new_operating == operating)
|
||||
return // No change
|
||||
operating = new_operating
|
||||
if(operating == FORWARDS)
|
||||
movedir = forwards
|
||||
else if(operating == BACKWARDS)
|
||||
movedir = backwards
|
||||
else
|
||||
operating = OFF
|
||||
update()
|
||||
|
||||
/obj/machinery/conveyor/set_dir()
|
||||
.=..()
|
||||
update_dir()
|
||||
|
||||
/obj/machinery/conveyor/proc/update_dir()
|
||||
if(!(dir in cardinal)) // Diagonal. Forwards is *away* from dir, curving to the right.
|
||||
forwards = turn(dir, 45)
|
||||
backwards = turn(dir, 135)
|
||||
else
|
||||
forwards = dir
|
||||
backwards = turn(dir, 180)
|
||||
|
||||
/obj/machinery/conveyor/proc/update()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "conveyor-broken"
|
||||
operating = OFF
|
||||
update_use_power(USE_POWER_OFF)
|
||||
return
|
||||
if(!operable)
|
||||
operating = OFF
|
||||
if(stat & NOPOWER)
|
||||
operating = OFF
|
||||
icon_state = "conveyor[operating]"
|
||||
|
||||
if(!operating)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
return
|
||||
if(speed_process) // high gear
|
||||
STOP_MACHINE_PROCESSING(src)
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
else // low gear
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
START_MACHINE_PROCESSING(src)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
|
||||
// machine process
|
||||
// move items to the target location
|
||||
/obj/machinery/conveyor/process()
|
||||
if(stat & (BROKEN | NOPOWER))
|
||||
return PROCESS_KILL
|
||||
if(!operating)
|
||||
return PROCESS_KILL
|
||||
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
spawn(1) // slight delay to prevent infinite propagation due to map order //TODO: please no spawn() in process(). It's a very bad idea
|
||||
var/items_moved = 0
|
||||
for(var/atom/movable/A in affecting)
|
||||
if(istype(A,/obj/effect/abstract)) // Flashlight's lights are not physical objects
|
||||
continue
|
||||
if(!A.anchored)
|
||||
if(A.loc == src.loc) // prevents the object from being affected if it's not currently here.
|
||||
step(A,movedir)
|
||||
items_moved++
|
||||
if(items_moved >= 10)
|
||||
break
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user)
|
||||
if(isrobot(user)) return //Carn: fix for borgs dropping their modules on conveyor belts
|
||||
if(I.loc != user) return // This should stop mounted modules ending up outside the module.
|
||||
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, I))
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
if(panel_open)
|
||||
var/input = sanitize(tgui_input_text(usr, "What id would you like to give this conveyor?", "Multitool-Conveyor interface", id))
|
||||
if(!input)
|
||||
to_chat(user, "No input found. Please hang up and try your call again.")
|
||||
return
|
||||
id = input
|
||||
for(var/obj/machinery/conveyor_switch/C in machines)
|
||||
if(C.id == id)
|
||||
C.conveyors |= src
|
||||
return
|
||||
|
||||
user.drop_item(get_turf(src))
|
||||
return
|
||||
|
||||
// attack with hand, move pulled object onto conveyor
|
||||
/obj/machinery/conveyor/attack_hand(mob/user as mob)
|
||||
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
|
||||
return
|
||||
if (user.pulling.anchored)
|
||||
return
|
||||
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
|
||||
return
|
||||
if (ismob(user.pulling))
|
||||
var/mob/M = user.pulling
|
||||
M.stop_pulling()
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.stop_pulling()
|
||||
else
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.stop_pulling()
|
||||
return
|
||||
|
||||
|
||||
// make the conveyor broken
|
||||
// also propagate inoperability to any connected conveyor with the same ID
|
||||
/obj/machinery/conveyor/proc/broken()
|
||||
stat |= BROKEN
|
||||
update()
|
||||
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, dir)
|
||||
if(C)
|
||||
C.set_operable(dir, id, 0)
|
||||
|
||||
C = locate() in get_step(src, turn(dir,180))
|
||||
if(C)
|
||||
C.set_operable(turn(dir,180), id, 0)
|
||||
|
||||
|
||||
//set the operable var if ID matches, propagating in the given direction
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op)
|
||||
|
||||
if(id != match_id)
|
||||
return
|
||||
operable = op
|
||||
|
||||
update()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir)
|
||||
if(C)
|
||||
C.set_operable(stepdir, id, op)
|
||||
|
||||
/obj/machinery/conveyor/power_change()
|
||||
if((. = ..()))
|
||||
update()
|
||||
|
||||
// the conveyor control switch
|
||||
//
|
||||
//
|
||||
|
||||
/obj/machinery/conveyor_switch
|
||||
|
||||
name = "conveyor switch"
|
||||
desc = "A conveyor control switch."
|
||||
icon = 'icons/obj/recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/position = 0 // 0 off, -1 reverse, 1 forward
|
||||
var/last_pos = -1 // last direction setting
|
||||
var/operated = 1 // true if just operated
|
||||
var/oneway = 0 // Voreadd: One way levels mid-round!
|
||||
|
||||
var/id = "" // must match conveyor IDs to control them
|
||||
|
||||
var/list/conveyors // the list of converyors that are controlled by this switch
|
||||
anchored = TRUE
|
||||
var/speed_active = FALSE // are the linked conveyors on SSfastprocess?
|
||||
|
||||
|
||||
|
||||
/obj/machinery/conveyor_switch/Initialize()
|
||||
..()
|
||||
update()
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/obj/machinery/conveyor_switch/LateInitialize()
|
||||
conveyors = list()
|
||||
for(var/obj/machinery/conveyor/C in machines)
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/toggle_speed(var/forced)
|
||||
speed_active = !speed_active // switching gears
|
||||
if(speed_active) // high gear
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.toggle_speed(TRUE)
|
||||
else // low gear
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.toggle_speed(FALSE)
|
||||
|
||||
// update the icon depending on the position
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/update()
|
||||
if(position<0)
|
||||
icon_state = "switch-rev"
|
||||
else if(position>0)
|
||||
icon_state = "switch-fwd"
|
||||
else
|
||||
icon_state = "switch-off"
|
||||
|
||||
|
||||
// timed process
|
||||
// if the switch changed, update the linked conveyors
|
||||
|
||||
/obj/machinery/conveyor_switch/process()
|
||||
if(!operated)
|
||||
return
|
||||
operated = 0
|
||||
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.set_operating(position)
|
||||
|
||||
// attack with hand, switch position
|
||||
/obj/machinery/conveyor_switch/attack_hand(mob/user)
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
|
||||
if(position == 0)
|
||||
if(last_pos < 0 || oneway == 1)
|
||||
position = 1
|
||||
last_pos = 0
|
||||
else
|
||||
position = -1
|
||||
last_pos = 0
|
||||
else
|
||||
last_pos = position
|
||||
position = 0
|
||||
|
||||
operated = 1
|
||||
update()
|
||||
|
||||
// find any switches with same id as this one, and set their positions to match us
|
||||
for(var/obj/machinery/conveyor_switch/S in machines)
|
||||
if(S.id == src.id)
|
||||
S.position = position
|
||||
S.update()
|
||||
|
||||
/obj/machinery/conveyor_switch/attackby(var/obj/item/I, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
|
||||
if(!panel_open) //It's probably better to just check this once instead of each time
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = I.get_welder()
|
||||
if(!WT.remove_fuel(0, user))
|
||||
to_chat(user, "The welding tool must be on to complete this task.")
|
||||
return
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
if(do_after(user, 20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
to_chat(user, "<span class='notice'>You deconstruct the frame.</span>")
|
||||
new /obj/item/stack/material/steel( src.loc, 2 )
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_MULTITOOL))
|
||||
var/input = sanitize(tgui_input_text(usr, "What id would you like to give this conveyor switch?", "Multitool-Conveyor interface", id))
|
||||
if(!input)
|
||||
to_chat(user, "No input found. Please hang up and try your call again.")
|
||||
return
|
||||
id = input
|
||||
conveyors = list() // Clear list so they aren't double added.
|
||||
for(var/obj/machinery/conveyor/C in machines)
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_WRENCH))
|
||||
if(oneway == 1)
|
||||
to_chat(user, "You set the switch to two way operation.")
|
||||
oneway = 0
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
return
|
||||
else
|
||||
to_chat(user, "You set the switch to one way operation.")
|
||||
oneway = 1
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
return
|
||||
|
||||
//Ports making conveyors fast from CHOMPstation
|
||||
if(I.has_tool_quality(TOOL_WIRECUTTER))
|
||||
toggle_speed()
|
||||
to_chat(user, "You adjust the speed of the conveyor switch")
|
||||
return
|
||||
|
||||
/obj/machinery/conveyor_switch/oneway
|
||||
oneway = 1
|
||||
|
||||
/obj/machinery/conveyor_switch/examine()
|
||||
.=..()
|
||||
if(oneway == 1)
|
||||
. += " It appears to only go in one direction."
|
||||
|
||||
@@ -1,366 +1,366 @@
|
||||
// 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 = FALSE
|
||||
density = FALSE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
matter = list(MAT_STEEL = 1850)
|
||||
level = 2
|
||||
var/sortType = ""
|
||||
var/ptype = 0
|
||||
var/subtype = 0
|
||||
var/dpdir = 0 // directions as disposalpipe
|
||||
var/base_state = "pipe-s"
|
||||
|
||||
/obj/structure/disposalconstruct/New(var/newturf, var/newtype, var/newdir, var/flipped, var/newsubtype)
|
||||
..(newturf)
|
||||
ptype = newtype
|
||||
dir = newdir
|
||||
// Disposals handle "bent"/"corner" strangely, handle this specially.
|
||||
if(ptype == DISPOSAL_PIPE_STRAIGHT && (dir in cornerdirs))
|
||||
ptype = DISPOSAL_PIPE_CORNER
|
||||
switch(dir)
|
||||
if(NORTHWEST)
|
||||
dir = WEST
|
||||
if(NORTHEAST)
|
||||
dir = NORTH
|
||||
if(SOUTHWEST)
|
||||
dir = SOUTH
|
||||
if(SOUTHEAST)
|
||||
dir = EAST
|
||||
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE)
|
||||
density = TRUE
|
||||
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
subtype = newsubtype
|
||||
|
||||
if(flipped)
|
||||
do_a_flip()
|
||||
else
|
||||
update() // do_a_flip() calls update anyway, so, lazy way of catching unupdated pipe!
|
||||
|
||||
// update iconstate and dpdir due to dir and type
|
||||
/obj/structure/disposalconstruct/proc/update()
|
||||
var/flip = turn(dir, 180)
|
||||
var/left = turn(dir, 90)
|
||||
var/right = turn(dir, -90)
|
||||
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_STRAIGHT)
|
||||
base_state = "pipe-s"
|
||||
dpdir = dir | flip
|
||||
if(DISPOSAL_PIPE_CORNER)
|
||||
base_state = "pipe-c"
|
||||
dpdir = dir | right
|
||||
if(DISPOSAL_PIPE_JUNCTION)
|
||||
base_state = "pipe-j1"
|
||||
dpdir = dir | right | flip
|
||||
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||
base_state = "pipe-j2"
|
||||
dpdir = dir | left | flip
|
||||
if(DISPOSAL_PIPE_JUNCTION_Y)
|
||||
base_state = "pipe-y"
|
||||
dpdir = dir | left | right
|
||||
if(DISPOSAL_PIPE_TRUNK)
|
||||
base_state = "pipe-t"
|
||||
dpdir = dir
|
||||
// disposal bin has only one dir, thus we don't need to care about setting it
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
if(anchored)
|
||||
base_state = "disposal"
|
||||
else
|
||||
base_state = "condisposal"
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
base_state = "outlet"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
base_state = "intake"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
base_state = "pipe-j1s"
|
||||
dpdir = dir | right | flip
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
base_state = "pipe-j2s"
|
||||
dpdir = dir | left | flip
|
||||
if(DISPOSAL_PIPE_UPWARD)
|
||||
base_state = "pipe-u"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_DOWNWARD)
|
||||
base_state = "pipe-d"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
base_state = "pipe-tagger"
|
||||
dpdir = dir | flip
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
base_state = "pipe-tagger-partial"
|
||||
dpdir = dir | flip
|
||||
|
||||
if(!(ptype in list(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE, DISPOSAL_PIPE_UPWARD, DISPOSAL_PIPE_DOWNWARD, DISPOSAL_PIPE_TAGGER, DISPOSAL_PIPE_TAGGER_PARTIAL)))
|
||||
icon_state = "con[base_state]"
|
||||
else
|
||||
icon_state = base_state
|
||||
|
||||
if(invisibility) // if invisible, fade icon
|
||||
alpha = 128
|
||||
else
|
||||
alpha = 255
|
||||
//otherwise burying half-finished pipes under floors causes them to half-fade
|
||||
|
||||
// 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_clockwise()
|
||||
set category = "Object"
|
||||
set name = "Rotate Pipe Clockwise"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before rotating it.")
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
update()
|
||||
|
||||
/obj/structure/disposalconstruct/verb/flip()
|
||||
set category = "Object"
|
||||
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
|
||||
|
||||
do_a_flip()
|
||||
|
||||
/obj/structure/disposalconstruct/proc/do_a_flip()
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_JUNCTION)
|
||||
ptype = DISPOSAL_PIPE_JUNCTION_FLIPPED
|
||||
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||
ptype = DISPOSAL_PIPE_JUNCTION
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
ptype = DISPOSAL_PIPE_SORTER_FLIPPED
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
ptype = DISPOSAL_PIPE_SORTER
|
||||
|
||||
update()
|
||||
|
||||
// returns the type path of disposalpipe corresponding to this item dtype
|
||||
/obj/structure/disposalconstruct/proc/dpipetype()
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_STRAIGHT,DISPOSAL_PIPE_CORNER)
|
||||
return /obj/structure/disposalpipe/segment
|
||||
if(DISPOSAL_PIPE_JUNCTION,DISPOSAL_PIPE_JUNCTION_FLIPPED,DISPOSAL_PIPE_JUNCTION_Y)
|
||||
return /obj/structure/disposalpipe/junction
|
||||
if(DISPOSAL_PIPE_TRUNK)
|
||||
return /obj/structure/disposalpipe/trunk
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
return /obj/machinery/disposal
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
return /obj/structure/disposaloutlet
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
return /obj/machinery/disposal/deliveryChute
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
return /obj/structure/disposalpipe/sortjunction
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
return /obj/structure/disposalpipe/sortjunction/wildcard
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
return /obj/structure/disposalpipe/sortjunction/untagged
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
return /obj/structure/disposalpipe/sortjunction/flipped
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
|
||||
if(DISPOSAL_PIPE_UPWARD)
|
||||
return /obj/structure/disposalpipe/up
|
||||
if(DISPOSAL_PIPE_DOWNWARD)
|
||||
return /obj/structure/disposalpipe/down
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
return /obj/structure/disposalpipe/tagger
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
return /obj/structure/disposalpipe/tagger/partial
|
||||
return
|
||||
|
||||
|
||||
|
||||
// attackby item
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user)
|
||||
var/nicetype = "pipe"
|
||||
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
||||
src.add_fingerprint(user)
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
nicetype = "disposal bin"
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
nicetype = "disposal outlet"
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
nicetype = "delivery chute"
|
||||
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
nicetype = "sorting pipe"
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
nicetype = "wildcard sorting pipe"
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
nicetype = "untagged sorting pipe"
|
||||
ispipe = 1
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
nicetype = "tagging pipe"
|
||||
ispipe = 1
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
nicetype = "partial tagging pipe"
|
||||
ispipe = 1
|
||||
else
|
||||
nicetype = "pipe"
|
||||
ispipe = 1
|
||||
|
||||
var/turf/T = src.loc
|
||||
if(!T.is_plating())
|
||||
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
|
||||
return
|
||||
|
||||
var/obj/structure/disposalpipe/CP = locate() in T
|
||||
|
||||
// wrench: (un)anchor
|
||||
if(I.has_tool_quality(TOOL_WRENCH))
|
||||
if(anchored)
|
||||
anchored = FALSE
|
||||
if(ispipe)
|
||||
level = 2
|
||||
density = FALSE
|
||||
else
|
||||
density = TRUE
|
||||
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
||||
else
|
||||
if(ptype == DISPOSAL_PIPE_BIN || ptype == DISPOSAL_PIPE_OUTLET || ptype == DISPOSAL_PIPE_CHUTE) // Disposal or outlet
|
||||
if(CP) // There's something there
|
||||
if(!istype(CP,/obj/structure/disposalpipe/trunk))
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else // Nothing under, fuck.
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else
|
||||
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
|
||||
|
||||
anchored = TRUE
|
||||
if(ispipe)
|
||||
level = 1 // We don't want disposal bins to disappear under the floors
|
||||
density = FALSE
|
||||
else
|
||||
density = TRUE // We don't want disposal bins or outlets to go density 0
|
||||
to_chat(user, "You attach the [nicetype] to the underfloor.")
|
||||
playsound(src, I.usesound, 100, 1)
|
||||
update()
|
||||
|
||||
// weldingtool: convert to real pipe
|
||||
else if(I.has_tool_quality(TOOL_WELDER))
|
||||
if(anchored)
|
||||
var/obj/item/weapon/weldingtool/W = I.get_welder()
|
||||
if(W.remove_fuel(0,user))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "Welding the [nicetype] in place.")
|
||||
if(do_after(user, 20 * W.toolspeed))
|
||||
if(!src || !W.isOn()) return
|
||||
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.set_dir(dir)
|
||||
P.dpdir = dpdir
|
||||
P.update_icon()
|
||||
|
||||
//Needs some special treatment ;)
|
||||
if(ptype==DISPOSAL_PIPE_SORTER || ptype==DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
||||
SortP.sortType = sortType
|
||||
SortP.updatedir()
|
||||
SortP.updatedesc()
|
||||
SortP.updatename()
|
||||
|
||||
else if(ptype==DISPOSAL_PIPE_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==DISPOSAL_PIPE_OUTLET)
|
||||
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.set_dir(dir)
|
||||
P.target = get_ranged_target_turf(src, dir, 10) //TODO: replace this with a proc parameter or other cleaner
|
||||
var/obj/structure/disposalpipe/trunk/Trunk = CP
|
||||
Trunk.linked = P
|
||||
|
||||
else if(ptype==DISPOSAL_PIPE_CHUTE)
|
||||
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.set_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/hides_under_flooring()
|
||||
if(anchored)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
// VOREStation Add Start - Helper procs for RCD
|
||||
/obj/structure/disposalconstruct/proc/is_pipe()
|
||||
return (ptype != DISPOSAL_PIPE_BIN && ptype != DISPOSAL_PIPE_OUTLET && ptype != DISPOSAL_PIPE_CHUTE)
|
||||
|
||||
//helper proc that makes sure you can place the construct (i.e no dense objects stacking)
|
||||
/obj/structure/disposalconstruct/proc/can_place()
|
||||
if(is_pipe())
|
||||
return TRUE
|
||||
|
||||
for(var/obj/structure/disposalconstruct/DC in get_turf(src))
|
||||
if(DC == src)
|
||||
continue
|
||||
|
||||
if(!DC.is_pipe()) //there's already a chute/outlet/bin there
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
// VOREStation Add End
|
||||
// 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 = FALSE
|
||||
density = FALSE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
matter = list(MAT_STEEL = 1850)
|
||||
level = 2
|
||||
var/sortType = ""
|
||||
var/ptype = 0
|
||||
var/subtype = 0
|
||||
var/dpdir = 0 // directions as disposalpipe
|
||||
var/base_state = "pipe-s"
|
||||
|
||||
/obj/structure/disposalconstruct/New(var/newturf, var/newtype, var/newdir, var/flipped, var/newsubtype)
|
||||
..(newturf)
|
||||
ptype = newtype
|
||||
dir = newdir
|
||||
// Disposals handle "bent"/"corner" strangely, handle this specially.
|
||||
if(ptype == DISPOSAL_PIPE_STRAIGHT && (dir in cornerdirs))
|
||||
ptype = DISPOSAL_PIPE_CORNER
|
||||
switch(dir)
|
||||
if(NORTHWEST)
|
||||
dir = WEST
|
||||
if(NORTHEAST)
|
||||
dir = NORTH
|
||||
if(SOUTHWEST)
|
||||
dir = SOUTH
|
||||
if(SOUTHEAST)
|
||||
dir = EAST
|
||||
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE)
|
||||
density = TRUE
|
||||
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
subtype = newsubtype
|
||||
|
||||
if(flipped)
|
||||
do_a_flip()
|
||||
else
|
||||
update() // do_a_flip() calls update anyway, so, lazy way of catching unupdated pipe!
|
||||
|
||||
// update iconstate and dpdir due to dir and type
|
||||
/obj/structure/disposalconstruct/proc/update()
|
||||
var/flip = turn(dir, 180)
|
||||
var/left = turn(dir, 90)
|
||||
var/right = turn(dir, -90)
|
||||
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_STRAIGHT)
|
||||
base_state = "pipe-s"
|
||||
dpdir = dir | flip
|
||||
if(DISPOSAL_PIPE_CORNER)
|
||||
base_state = "pipe-c"
|
||||
dpdir = dir | right
|
||||
if(DISPOSAL_PIPE_JUNCTION)
|
||||
base_state = "pipe-j1"
|
||||
dpdir = dir | right | flip
|
||||
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||
base_state = "pipe-j2"
|
||||
dpdir = dir | left | flip
|
||||
if(DISPOSAL_PIPE_JUNCTION_Y)
|
||||
base_state = "pipe-y"
|
||||
dpdir = dir | left | right
|
||||
if(DISPOSAL_PIPE_TRUNK)
|
||||
base_state = "pipe-t"
|
||||
dpdir = dir
|
||||
// disposal bin has only one dir, thus we don't need to care about setting it
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
if(anchored)
|
||||
base_state = "disposal"
|
||||
else
|
||||
base_state = "condisposal"
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
base_state = "outlet"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
base_state = "intake"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
base_state = "pipe-j1s"
|
||||
dpdir = dir | right | flip
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
base_state = "pipe-j2s"
|
||||
dpdir = dir | left | flip
|
||||
if(DISPOSAL_PIPE_UPWARD)
|
||||
base_state = "pipe-u"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_DOWNWARD)
|
||||
base_state = "pipe-d"
|
||||
dpdir = dir
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
base_state = "pipe-tagger"
|
||||
dpdir = dir | flip
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
base_state = "pipe-tagger-partial"
|
||||
dpdir = dir | flip
|
||||
|
||||
if(!(ptype in list(DISPOSAL_PIPE_BIN, DISPOSAL_PIPE_OUTLET, DISPOSAL_PIPE_CHUTE, DISPOSAL_PIPE_UPWARD, DISPOSAL_PIPE_DOWNWARD, DISPOSAL_PIPE_TAGGER, DISPOSAL_PIPE_TAGGER_PARTIAL)))
|
||||
icon_state = "con[base_state]"
|
||||
else
|
||||
icon_state = base_state
|
||||
|
||||
if(invisibility) // if invisible, fade icon
|
||||
alpha = 128
|
||||
else
|
||||
alpha = 255
|
||||
//otherwise burying half-finished pipes under floors causes them to half-fade
|
||||
|
||||
// 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_clockwise()
|
||||
set category = "Object"
|
||||
set name = "Rotate Pipe Clockwise"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "You must unfasten the pipe before rotating it.")
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
update()
|
||||
|
||||
/obj/structure/disposalconstruct/verb/flip()
|
||||
set category = "Object"
|
||||
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
|
||||
|
||||
do_a_flip()
|
||||
|
||||
/obj/structure/disposalconstruct/proc/do_a_flip()
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_JUNCTION)
|
||||
ptype = DISPOSAL_PIPE_JUNCTION_FLIPPED
|
||||
if(DISPOSAL_PIPE_JUNCTION_FLIPPED)
|
||||
ptype = DISPOSAL_PIPE_JUNCTION
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
ptype = DISPOSAL_PIPE_SORTER_FLIPPED
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
ptype = DISPOSAL_PIPE_SORTER
|
||||
|
||||
update()
|
||||
|
||||
// returns the type path of disposalpipe corresponding to this item dtype
|
||||
/obj/structure/disposalconstruct/proc/dpipetype()
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_STRAIGHT,DISPOSAL_PIPE_CORNER)
|
||||
return /obj/structure/disposalpipe/segment
|
||||
if(DISPOSAL_PIPE_JUNCTION,DISPOSAL_PIPE_JUNCTION_FLIPPED,DISPOSAL_PIPE_JUNCTION_Y)
|
||||
return /obj/structure/disposalpipe/junction
|
||||
if(DISPOSAL_PIPE_TRUNK)
|
||||
return /obj/structure/disposalpipe/trunk
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
return /obj/machinery/disposal
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
return /obj/structure/disposaloutlet
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
return /obj/machinery/disposal/deliveryChute
|
||||
if(DISPOSAL_PIPE_SORTER)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
return /obj/structure/disposalpipe/sortjunction
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
return /obj/structure/disposalpipe/sortjunction/wildcard
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
return /obj/structure/disposalpipe/sortjunction/untagged
|
||||
if(DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
return /obj/structure/disposalpipe/sortjunction/flipped
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
|
||||
if(DISPOSAL_PIPE_UPWARD)
|
||||
return /obj/structure/disposalpipe/up
|
||||
if(DISPOSAL_PIPE_DOWNWARD)
|
||||
return /obj/structure/disposalpipe/down
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
return /obj/structure/disposalpipe/tagger
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
return /obj/structure/disposalpipe/tagger/partial
|
||||
return
|
||||
|
||||
|
||||
|
||||
// attackby item
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user)
|
||||
var/nicetype = "pipe"
|
||||
var/ispipe = 0 // Indicates if we should change the level of this pipe
|
||||
src.add_fingerprint(user)
|
||||
switch(ptype)
|
||||
if(DISPOSAL_PIPE_BIN)
|
||||
nicetype = "disposal bin"
|
||||
if(DISPOSAL_PIPE_OUTLET)
|
||||
nicetype = "disposal outlet"
|
||||
if(DISPOSAL_PIPE_CHUTE)
|
||||
nicetype = "delivery chute"
|
||||
if(DISPOSAL_PIPE_SORTER, DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
switch(subtype)
|
||||
if(DISPOSAL_SORT_NORMAL)
|
||||
nicetype = "sorting pipe"
|
||||
if(DISPOSAL_SORT_WILDCARD)
|
||||
nicetype = "wildcard sorting pipe"
|
||||
if(DISPOSAL_SORT_UNTAGGED)
|
||||
nicetype = "untagged sorting pipe"
|
||||
ispipe = 1
|
||||
if(DISPOSAL_PIPE_TAGGER)
|
||||
nicetype = "tagging pipe"
|
||||
ispipe = 1
|
||||
if(DISPOSAL_PIPE_TAGGER_PARTIAL)
|
||||
nicetype = "partial tagging pipe"
|
||||
ispipe = 1
|
||||
else
|
||||
nicetype = "pipe"
|
||||
ispipe = 1
|
||||
|
||||
var/turf/T = src.loc
|
||||
if(!T.is_plating())
|
||||
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
|
||||
return
|
||||
|
||||
var/obj/structure/disposalpipe/CP = locate() in T
|
||||
|
||||
// wrench: (un)anchor
|
||||
if(I.has_tool_quality(TOOL_WRENCH))
|
||||
if(anchored)
|
||||
anchored = FALSE
|
||||
if(ispipe)
|
||||
level = 2
|
||||
density = FALSE
|
||||
else
|
||||
density = TRUE
|
||||
to_chat(user, "You detach the [nicetype] from the underfloor.")
|
||||
else
|
||||
if(ptype == DISPOSAL_PIPE_BIN || ptype == DISPOSAL_PIPE_OUTLET || ptype == DISPOSAL_PIPE_CHUTE) // Disposal or outlet
|
||||
if(CP) // There's something there
|
||||
if(!istype(CP,/obj/structure/disposalpipe/trunk))
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else // Nothing under, fuck.
|
||||
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
|
||||
return
|
||||
else
|
||||
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
|
||||
|
||||
anchored = TRUE
|
||||
if(ispipe)
|
||||
level = 1 // We don't want disposal bins to disappear under the floors
|
||||
density = FALSE
|
||||
else
|
||||
density = TRUE // We don't want disposal bins or outlets to go density 0
|
||||
to_chat(user, "You attach the [nicetype] to the underfloor.")
|
||||
playsound(src, I.usesound, 100, 1)
|
||||
update()
|
||||
|
||||
// weldingtool: convert to real pipe
|
||||
else if(I.has_tool_quality(TOOL_WELDER))
|
||||
if(anchored)
|
||||
var/obj/item/weapon/weldingtool/W = I.get_welder()
|
||||
if(W.remove_fuel(0,user))
|
||||
playsound(src, W.usesound, 100, 1)
|
||||
to_chat(user, "Welding the [nicetype] in place.")
|
||||
if(do_after(user, 20 * W.toolspeed))
|
||||
if(!src || !W.isOn()) return
|
||||
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.set_dir(dir)
|
||||
P.dpdir = dpdir
|
||||
P.update_icon()
|
||||
|
||||
//Needs some special treatment ;)
|
||||
if(ptype==DISPOSAL_PIPE_SORTER || ptype==DISPOSAL_PIPE_SORTER_FLIPPED)
|
||||
var/obj/structure/disposalpipe/sortjunction/SortP = P
|
||||
SortP.sortType = sortType
|
||||
SortP.updatedir()
|
||||
SortP.updatedesc()
|
||||
SortP.updatename()
|
||||
|
||||
else if(ptype==DISPOSAL_PIPE_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==DISPOSAL_PIPE_OUTLET)
|
||||
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.set_dir(dir)
|
||||
P.target = get_ranged_target_turf(src, dir, 10) //TODO: replace this with a proc parameter or other cleaner
|
||||
var/obj/structure/disposalpipe/trunk/Trunk = CP
|
||||
Trunk.linked = P
|
||||
|
||||
else if(ptype==DISPOSAL_PIPE_CHUTE)
|
||||
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
|
||||
src.transfer_fingerprints_to(P)
|
||||
P.set_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/hides_under_flooring()
|
||||
if(anchored)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
// VOREStation Add Start - Helper procs for RCD
|
||||
/obj/structure/disposalconstruct/proc/is_pipe()
|
||||
return (ptype != DISPOSAL_PIPE_BIN && ptype != DISPOSAL_PIPE_OUTLET && ptype != DISPOSAL_PIPE_CHUTE)
|
||||
|
||||
//helper proc that makes sure you can place the construct (i.e no dense objects stacking)
|
||||
/obj/structure/disposalconstruct/proc/can_place()
|
||||
if(is_pipe())
|
||||
return TRUE
|
||||
|
||||
for(var/obj/structure/disposalconstruct/DC in get_turf(src))
|
||||
if(DC == src)
|
||||
continue
|
||||
|
||||
if(!DC.is_pipe()) //there's already a chute/outlet/bin there
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
// VOREStation Add End
|
||||
|
||||
+1640
-1640
File diff suppressed because it is too large
Load Diff
@@ -1,466 +1,466 @@
|
||||
/obj/structure/bigDelivery
|
||||
desc = "A big wrapped package."
|
||||
name = "large parcel"
|
||||
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
||||
icon_state = "deliverycloset"
|
||||
var/obj/wrapped = null
|
||||
density = TRUE
|
||||
var/sortTag = null
|
||||
flags = NOBLUDGEON
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/label_y
|
||||
var/label_x
|
||||
var/tag_x
|
||||
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
unwrap()
|
||||
|
||||
/obj/structure/bigDelivery/proc/unwrap()
|
||||
playsound(src, 'sound/items/package_unwrap.ogg', 50, 1)
|
||||
// Destroy will drop our wrapped object on the turf, so let it.
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
if("Description")
|
||||
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, span_red("Invalid text."))
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
/obj/structure/bigDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if(nameset || examtext)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycloset")
|
||||
I.pixel_x = 2
|
||||
if(label_y == null)
|
||||
label_y = rand(-6, 11)
|
||||
I.pixel_y = label_y
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(label_x == null)
|
||||
label_x = rand(-8, 6)
|
||||
I.pixel_x = label_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
if(src.sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
if(icon_state == "deliverycloset")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-2, 3)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 9
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-8, 6)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/structure/bigDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
|
||||
/obj/item/smallDelivery
|
||||
desc = "A small wrapped package."
|
||||
name = "small parcel"
|
||||
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
||||
icon_state = "deliverycrate3"
|
||||
drop_sound = 'sound/items/drop/cardboardbox.ogg'
|
||||
pickup_sound = 'sound/items/pickup/cardboardbox.ogg'
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = null
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/tag_x
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if (src.wrapped) //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)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
|
||||
if("Description")
|
||||
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, span_red("Invalid text."))
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if((nameset || examtext) && icon_state != "deliverycrate1")
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycrate5")
|
||||
I.pixel_y = -1
|
||||
add_overlay(I)
|
||||
if(src.sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
switch(icon_state)
|
||||
if("deliverycrate1")
|
||||
I.pixel_y = -5
|
||||
if("deliverycrate2")
|
||||
I.pixel_y = -2
|
||||
if("deliverycrate3")
|
||||
I.pixel_y = 0
|
||||
if("deliverycrate4")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(0,5)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 3
|
||||
if("deliverycrate5")
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/item/smallDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
|
||||
/obj/item/weapon/packageWrap
|
||||
name = "package wrapper"
|
||||
desc = "Like wrapping paper, but less festive."
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
var/amount = 25.0
|
||||
drop_sound = 'sound/items/drop/wrapper.ogg'
|
||||
|
||||
|
||||
/obj/item/weapon/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/weapon/gift) || istype(target, /obj/item/weapon/evidencebag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(!isturf(target.loc)) //no wrapping things inside other things, just breaks things, put it on the ground first.
|
||||
return
|
||||
if(user in target) //no wrapping closets that you are inside - it's not physically possible
|
||||
return
|
||||
|
||||
user.attack_log += text("\[[time_stamp()]\] [span_blue("Has used [src.name] on \ref[target]")]")
|
||||
|
||||
|
||||
if (istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box)))
|
||||
var/obj/item/O = target
|
||||
if (src.amount > 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.forceMove(P)
|
||||
P.w_class = O.w_class
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
switch(i)
|
||||
if(1) P.name = "tiny parcel"
|
||||
if(3) P.name = "normal-sized parcel"
|
||||
if(4) P.name = "large parcel"
|
||||
if(5) P.name = "huge parcel"
|
||||
if(i < 1)
|
||||
P.icon_state = "deliverycrate1"
|
||||
P.name = "tiny parcel"
|
||||
if(i > 5)
|
||||
P.icon_state = "deliverycrate5"
|
||||
P.name = "huge parcel"
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
src.add_fingerprint(usr)
|
||||
src.amount -= 1
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a small object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if (istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a large object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if(src.amount < 3)
|
||||
to_chat(user, "<span class='warning'>You need more paper.</span>")
|
||||
else if (istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
O.sealed = 1
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a large object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if(src.amount < 3)
|
||||
to_chat(user, "<span class='warning'>You need more paper.</span>")
|
||||
else
|
||||
to_chat(user, span_blue("The object you are trying to wrap is unsuitable for the sorting machinery!"))
|
||||
if (src.amount <= 0)
|
||||
new /obj/item/weapon/c_tube( src.loc )
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/weapon/packageWrap/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 0)
|
||||
. += span_blue("There are [amount] units of package wrap left!")
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.forceMove(get_turf(src))
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.sealed = 0
|
||||
wrapped = null
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(T)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/destTagger
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon_state = "dest_tagger"
|
||||
var/currTag = 0
|
||||
|
||||
w_class = ITEMSIZE_SMALL
|
||||
item_state = "electronic"
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
/obj/item/device/destTagger/tgui_state(mob/user)
|
||||
return GLOB.tgui_inventory_state
|
||||
|
||||
/obj/item/device/destTagger/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "DestinationTagger", name)
|
||||
ui.open()
|
||||
|
||||
/obj/item/device/destTagger/tgui_data(mob/user, datum/tgui/ui)
|
||||
var/list/data = ..()
|
||||
|
||||
data["currTag"] = currTag
|
||||
data["taggerLocs"] = GLOB.tagger_locations
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/device/destTagger/attack_self(mob/user as mob)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/item/device/destTagger/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
add_fingerprint(usr)
|
||||
switch(action)
|
||||
if("set_tag")
|
||||
var/new_tag = params["tag"]
|
||||
if(!(new_tag in GLOB.tagger_locations))
|
||||
return FALSE
|
||||
currTag = new_tag
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
name = "Delivery chute"
|
||||
desc = "A chute for big and small packages alike!"
|
||||
density = TRUE
|
||||
icon_state = "intake"
|
||||
|
||||
var/c_mode = 0
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Initialize()
|
||||
. = ..()
|
||||
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(var/atom/movable/AM) //Go straight into the chute
|
||||
if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect) || istype(AM, /obj/mecha)) 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/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
// travels through the pipes.
|
||||
air_contents = new() // new empty gas resv.
|
||||
|
||||
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
|
||||
|
||||
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/attackby(var/obj/item/I, var/mob/user)
|
||||
if(!I || !user)
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
c_mode = !c_mode
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
to_chat(user, "You [c_mode ? "remove" : "attach"] the screws around the power connection.")
|
||||
return
|
||||
if(I.has_tool_quality(TOOL_WELDER) && c_mode==1)
|
||||
var/obj/item/weapon/weldingtool/W = I.get_welder()
|
||||
if(!W.remove_fuel(0,user))
|
||||
to_chat(user, "You need more welding fuel to complete this task.")
|
||||
return
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "You start slicing the floorweld off the delivery chute.")
|
||||
if(do_after(user,20 * W.toolspeed))
|
||||
if(!src || !W.isOn()) return
|
||||
to_chat(user, "You sliced the floorweld off the delivery chute.")
|
||||
var/obj/structure/disposalconstruct/C = new (src.loc)
|
||||
C.ptype = 8 // 8 = Delivery chute
|
||||
C.update()
|
||||
C.anchored = TRUE
|
||||
C.density = TRUE
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Destroy()
|
||||
if(trunk)
|
||||
trunk.linked = null
|
||||
..()
|
||||
/obj/structure/bigDelivery
|
||||
desc = "A big wrapped package."
|
||||
name = "large parcel"
|
||||
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
||||
icon_state = "deliverycloset"
|
||||
var/obj/wrapped = null
|
||||
density = TRUE
|
||||
var/sortTag = null
|
||||
flags = NOBLUDGEON
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/label_y
|
||||
var/label_x
|
||||
var/tag_x
|
||||
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
unwrap()
|
||||
|
||||
/obj/structure/bigDelivery/proc/unwrap()
|
||||
playsound(src, 'sound/items/package_unwrap.ogg', 50, 1)
|
||||
// Destroy will drop our wrapped object on the turf, so let it.
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
if("Description")
|
||||
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, span_red("Invalid text."))
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
/obj/structure/bigDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if(nameset || examtext)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycloset")
|
||||
I.pixel_x = 2
|
||||
if(label_y == null)
|
||||
label_y = rand(-6, 11)
|
||||
I.pixel_y = label_y
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(label_x == null)
|
||||
label_x = rand(-8, 6)
|
||||
I.pixel_x = label_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
if(src.sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
if(icon_state == "deliverycloset")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-2, 3)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 9
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-8, 6)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/structure/bigDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
|
||||
/obj/item/smallDelivery
|
||||
desc = "A small wrapped package."
|
||||
name = "small parcel"
|
||||
icon = 'icons/obj/storage_vr.dmi' //VOREStation Edit
|
||||
icon_state = "deliverycrate3"
|
||||
drop_sound = 'sound/items/drop/cardboardbox.ogg'
|
||||
pickup_sound = 'sound/items/pickup/cardboardbox.ogg'
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = null
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/tag_x
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if (src.wrapped) //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)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
|
||||
if("Description")
|
||||
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, span_red("Invalid text."))
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if((nameset || examtext) && icon_state != "deliverycrate1")
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycrate5")
|
||||
I.pixel_y = -1
|
||||
add_overlay(I)
|
||||
if(src.sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
switch(icon_state)
|
||||
if("deliverycrate1")
|
||||
I.pixel_y = -5
|
||||
if("deliverycrate2")
|
||||
I.pixel_y = -2
|
||||
if("deliverycrate3")
|
||||
I.pixel_y = 0
|
||||
if("deliverycrate4")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(0,5)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 3
|
||||
if("deliverycrate5")
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/item/smallDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
|
||||
/obj/item/weapon/packageWrap
|
||||
name = "package wrapper"
|
||||
desc = "Like wrapping paper, but less festive."
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
var/amount = 25.0
|
||||
drop_sound = 'sound/items/drop/wrapper.ogg'
|
||||
|
||||
|
||||
/obj/item/weapon/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/weapon/gift) || istype(target, /obj/item/weapon/evidencebag))
|
||||
return
|
||||
if(target.anchored)
|
||||
return
|
||||
if(!isturf(target.loc)) //no wrapping things inside other things, just breaks things, put it on the ground first.
|
||||
return
|
||||
if(user in target) //no wrapping closets that you are inside - it's not physically possible
|
||||
return
|
||||
|
||||
user.attack_log += text("\[[time_stamp()]\] [span_blue("Has used [src.name] on \ref[target]")]")
|
||||
|
||||
|
||||
if (istype(target, /obj/item) && !(istype(target, /obj/item/weapon/storage) && !istype(target,/obj/item/weapon/storage/box)))
|
||||
var/obj/item/O = target
|
||||
if (src.amount > 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.forceMove(P)
|
||||
P.w_class = O.w_class
|
||||
var/i = round(O.w_class)
|
||||
if(i in list(1,2,3,4,5))
|
||||
P.icon_state = "deliverycrate[i]"
|
||||
switch(i)
|
||||
if(1) P.name = "tiny parcel"
|
||||
if(3) P.name = "normal-sized parcel"
|
||||
if(4) P.name = "large parcel"
|
||||
if(5) P.name = "huge parcel"
|
||||
if(i < 1)
|
||||
P.icon_state = "deliverycrate1"
|
||||
P.name = "tiny parcel"
|
||||
if(i > 5)
|
||||
P.icon_state = "deliverycrate5"
|
||||
P.name = "huge parcel"
|
||||
P.add_fingerprint(usr)
|
||||
O.add_fingerprint(usr)
|
||||
src.add_fingerprint(usr)
|
||||
src.amount -= 1
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a small object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if (istype(target, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.icon_state = "deliverycrate"
|
||||
P.wrapped = O
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a large object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if(src.amount < 3)
|
||||
to_chat(user, "<span class='warning'>You need more paper.</span>")
|
||||
else if (istype (target, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = target
|
||||
if (src.amount > 3 && !O.opened)
|
||||
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
|
||||
P.wrapped = O
|
||||
O.sealed = 1
|
||||
O.loc = P
|
||||
src.amount -= 3
|
||||
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
|
||||
"<span class='notice'>You wrap \the [target], leaving [amount] units of paper on \the [src].</span>",\
|
||||
"You hear someone taping paper around a large object.")
|
||||
playsound(src, 'sound/items/package_wrap.ogg', 50, 1)
|
||||
else if(src.amount < 3)
|
||||
to_chat(user, "<span class='warning'>You need more paper.</span>")
|
||||
else
|
||||
to_chat(user, span_blue("The object you are trying to wrap is unsuitable for the sorting machinery!"))
|
||||
if (src.amount <= 0)
|
||||
new /obj/item/weapon/c_tube( src.loc )
|
||||
qdel(src)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/weapon/packageWrap/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 0)
|
||||
. += span_blue("There are [amount] units of package wrap left!")
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.forceMove(get_turf(src))
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.sealed = 0
|
||||
wrapped = null
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(T)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/destTagger
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon_state = "dest_tagger"
|
||||
var/currTag = 0
|
||||
|
||||
w_class = ITEMSIZE_SMALL
|
||||
item_state = "electronic"
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
/obj/item/device/destTagger/tgui_state(mob/user)
|
||||
return GLOB.tgui_inventory_state
|
||||
|
||||
/obj/item/device/destTagger/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "DestinationTagger", name)
|
||||
ui.open()
|
||||
|
||||
/obj/item/device/destTagger/tgui_data(mob/user, datum/tgui/ui)
|
||||
var/list/data = ..()
|
||||
|
||||
data["currTag"] = currTag
|
||||
data["taggerLocs"] = GLOB.tagger_locations
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/device/destTagger/attack_self(mob/user as mob)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/item/device/destTagger/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
add_fingerprint(usr)
|
||||
switch(action)
|
||||
if("set_tag")
|
||||
var/new_tag = params["tag"]
|
||||
if(!(new_tag in GLOB.tagger_locations))
|
||||
return FALSE
|
||||
currTag = new_tag
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
name = "Delivery chute"
|
||||
desc = "A chute for big and small packages alike!"
|
||||
density = TRUE
|
||||
icon_state = "intake"
|
||||
|
||||
var/c_mode = 0
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Initialize()
|
||||
. = ..()
|
||||
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(var/atom/movable/AM) //Go straight into the chute
|
||||
if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect) || istype(AM, /obj/mecha)) 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/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
// travels through the pipes.
|
||||
air_contents = new() // new empty gas resv.
|
||||
|
||||
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
|
||||
|
||||
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/attackby(var/obj/item/I, var/mob/user)
|
||||
if(!I || !user)
|
||||
return
|
||||
|
||||
if(I.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
c_mode = !c_mode
|
||||
playsound(src, I.usesound, 50, 1)
|
||||
to_chat(user, "You [c_mode ? "remove" : "attach"] the screws around the power connection.")
|
||||
return
|
||||
if(I.has_tool_quality(TOOL_WELDER) && c_mode==1)
|
||||
var/obj/item/weapon/weldingtool/W = I.get_welder()
|
||||
if(!W.remove_fuel(0,user))
|
||||
to_chat(user, "You need more welding fuel to complete this task.")
|
||||
return
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "You start slicing the floorweld off the delivery chute.")
|
||||
if(do_after(user,20 * W.toolspeed))
|
||||
if(!src || !W.isOn()) return
|
||||
to_chat(user, "You sliced the floorweld off the delivery chute.")
|
||||
var/obj/structure/disposalconstruct/C = new (src.loc)
|
||||
C.ptype = 8 // 8 = Delivery chute
|
||||
C.update()
|
||||
C.anchored = TRUE
|
||||
C.density = TRUE
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/disposal/deliveryChute/Destroy()
|
||||
if(trunk)
|
||||
trunk.linked = null
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user