mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 06:57:42 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -1894,7 +1894,10 @@
|
||||
else
|
||||
id = H.wear_id
|
||||
|
||||
if(isnull(id.assignment))
|
||||
if(!id)
|
||||
usr << "<font color=red>ERROR:</font> Inform the coders that an [H.name] had wear_id but no ID on their ID slot."
|
||||
dat += "<td><font color=red>ERROR</font></td>"
|
||||
else if(isnull(id.assignment))
|
||||
usr << "<font color=red>ERROR:</font> Inform the coders that an [id.name] was checked for its assignment variable."
|
||||
dat += "<td><font color=red>ERROR</font></td>"
|
||||
else
|
||||
|
||||
@@ -9,46 +9,71 @@
|
||||
anchored = 1
|
||||
var/operating = 0 // 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/forwards // this is the default (forward) direction, set by the map dir, can be 0
|
||||
var/backwards // hopefully self-explanatory, can be 0
|
||||
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
|
||||
|
||||
//these ones below for backwards compatibility
|
||||
|
||||
// following two only used if a diverter is present
|
||||
var/divert_from = 0 // if non-zero, direction to divert items
|
||||
var/divert_to = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense)
|
||||
var/basedir // this is the default (forward) direction, set by the map dir
|
||||
// note dir var can vary when the direction changes
|
||||
|
||||
//cael - corner icon bug that needs a manual fix
|
||||
//note: for now, the sprites/anis and their directions are mostly independant from the actual conveyor move directions
|
||||
//if no conveyor move directions are specified, they are calculated from the sprite dir
|
||||
var/reverseSpriteMoveDir = 0
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/New()
|
||||
..()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
backwards = SOUTH
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
backwards = NORTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
backwards = WEST
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
forwards = EAST
|
||||
backwards = SOUTH
|
||||
if(NORTHWEST)
|
||||
forwards = SOUTH
|
||||
backwards = WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = NORTH
|
||||
backwards = EAST
|
||||
if(SOUTHWEST)
|
||||
forwards = WEST
|
||||
backwards = NORTH
|
||||
//added these to allow for custom conveyor dirs defined in map
|
||||
if(!forwards)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
if(NORTHEAST)
|
||||
forwards = EAST
|
||||
if(NORTHWEST)
|
||||
forwards = WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = EAST
|
||||
if(SOUTHWEST)
|
||||
forwards = WEST
|
||||
if(!backwards)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
backwards = SOUTH
|
||||
if(SOUTH)
|
||||
backwards = NORTH
|
||||
if(EAST)
|
||||
backwards = WEST
|
||||
if(WEST)
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
backwards = SOUTH
|
||||
if(NORTHWEST)
|
||||
backwards = SOUTH
|
||||
if(SOUTHEAST)
|
||||
backwards = NORTH
|
||||
if(SOUTHWEST)
|
||||
backwards = NORTH
|
||||
|
||||
/obj/machinery/conveyor/proc/setmove()
|
||||
if(operating == 1)
|
||||
if(operating > 0)
|
||||
movedir = forwards
|
||||
else
|
||||
else if(operating < 0)
|
||||
movedir = backwards
|
||||
update()
|
||||
|
||||
@@ -61,7 +86,7 @@
|
||||
operating = 0
|
||||
if(stat & NOPOWER)
|
||||
operating = 0
|
||||
icon_state = "conveyor[operating]"
|
||||
icon_state = "conveyor[operating * (reverseSpriteMoveDir?-1:1)]"
|
||||
|
||||
// machine process
|
||||
// move items to the target location
|
||||
@@ -72,6 +97,17 @@
|
||||
return
|
||||
use_power(100)
|
||||
|
||||
// update if diverter present
|
||||
// if movedir == forwards, therefore if divert_to != 0 and divert_from == backwards, then set movedir = divert_to
|
||||
// if movedir == backwards, therefore if divert_to != 0 and divert_from == forwards, then set movedir = divert_to
|
||||
//if(divert_to && divert_from == (movedir == backwards ? forwards : backwards ) )
|
||||
//movedir = divert_to
|
||||
if(divert_to)
|
||||
if( movedir == forwards && divert_from == backwards )
|
||||
movedir = divert_to
|
||||
else if( movedir == backwards && divert_from == forwards )
|
||||
movedir = divert_to
|
||||
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
spawn(1) // slight delay to prevent infinite propagation due to map order
|
||||
var/items_moved = 0
|
||||
@@ -221,3 +257,129 @@
|
||||
if(S.id == src.id)
|
||||
S.position = position
|
||||
S.update()
|
||||
|
||||
// converyor diverter
|
||||
// extendable arm that can be switched so items on the conveyer are diverted sideways
|
||||
// situate in same turf as conveyor
|
||||
// only works if belts is running proper direction
|
||||
//
|
||||
//
|
||||
/obj/machinery/diverter
|
||||
icon = 'recycling.dmi'
|
||||
icon_state = "diverter0"
|
||||
name = "diverter"
|
||||
desc = "A diverter arm for a conveyor belt."
|
||||
anchored = 1
|
||||
layer = FLY_LAYER
|
||||
var/obj/machinery/conveyor/conv // the conveyor this diverter works on
|
||||
var/deployed = 0 // true if diverter arm is extended
|
||||
var/operating = 0 // true if arm is extending/contracting
|
||||
var/divert_to // the dir that diverted items will be moved
|
||||
var/divert_from // the dir items must be moving to divert
|
||||
|
||||
// create a diverter
|
||||
// set up divert_to and divert_from directions depending on dir state
|
||||
/obj/machinery/diverter/New()
|
||||
..()
|
||||
//cael - the icon states are all derped, so these won't make sense.
|
||||
//just place the diverter according to which icon state is correct
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
divert_to = WEST//
|
||||
divert_from = SOUTH//
|
||||
if(SOUTH)
|
||||
divert_to = EAST//
|
||||
divert_from = SOUTH//NORTH
|
||||
if(EAST)
|
||||
divert_to = EAST//
|
||||
divert_from = NORTH//SOUTH
|
||||
if(WEST)
|
||||
divert_to = WEST//
|
||||
divert_from = NORTH//
|
||||
if(NORTHEAST)
|
||||
divert_to = NORTH//
|
||||
divert_from = WEST//EAST
|
||||
if(NORTHWEST)
|
||||
divert_to = NORTH//
|
||||
divert_from = EAST//WEST
|
||||
if(SOUTHEAST)
|
||||
divert_to = SOUTH//
|
||||
divert_from = WEST//EAST
|
||||
if(SOUTHWEST)
|
||||
divert_to = SOUTH//
|
||||
divert_from = EAST//WEST
|
||||
spawn(2)
|
||||
// wait for map load then find the conveyor in this turf
|
||||
conv = locate() in src.loc
|
||||
if(conv) // divert_from dir must match possible conveyor movement
|
||||
if(conv.backwards != divert_from && conv.backwards != turn(divert_from,180) )
|
||||
del(src) // if no dir match, then delete self
|
||||
set_divert()
|
||||
update()
|
||||
|
||||
// update the icon state depending on whether the diverter is extended
|
||||
/obj/machinery/diverter/proc/update()
|
||||
icon_state = "diverter[deployed]"
|
||||
|
||||
// call to set the diversion vars of underlying conveyor
|
||||
/obj/machinery/diverter/proc/set_divert()
|
||||
if(conv)
|
||||
if(deployed)
|
||||
conv.divert_to = divert_to
|
||||
conv.divert_from = divert_from
|
||||
else
|
||||
conv.divert_to = 0
|
||||
conv.divert_from = 0
|
||||
conv.setmove()
|
||||
|
||||
|
||||
// *** TESTING click to toggle
|
||||
/obj/machinery/diverter/Click()
|
||||
toggle()
|
||||
|
||||
|
||||
// toggle between arm deployed and not deployed, showing animation
|
||||
//
|
||||
/obj/machinery/diverter/proc/toggle()
|
||||
if( stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(operating)
|
||||
return
|
||||
|
||||
use_power(50)
|
||||
operating = 1
|
||||
if(deployed)
|
||||
flick("diverter10",src)
|
||||
icon_state = "diverter0"
|
||||
sleep(10)
|
||||
deployed = 0
|
||||
else
|
||||
flick("diverter01",src)
|
||||
icon_state = "diverter1"
|
||||
sleep(10)
|
||||
deployed = 1
|
||||
operating = 0
|
||||
update()
|
||||
set_divert()
|
||||
|
||||
// don't allow movement into the 'backwards' direction if deployed
|
||||
/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == divert_to) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != divert_from)
|
||||
|
||||
// don't allow movement through the arm if deployed
|
||||
/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == turn(divert_to,180)) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != turn(divert_from,180))
|
||||
|
||||
//divert_to = NORTH
|
||||
//divert_from = EAST
|
||||
@@ -349,8 +349,6 @@
|
||||
|
||||
var/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
// travels through the pipes.
|
||||
|
||||
|
||||
H.init(src) // copy the contents of disposer to holder
|
||||
|
||||
air_contents = new() // new empty gas resv.
|
||||
@@ -492,9 +490,9 @@
|
||||
var/datum/gas_mixture/gas = null // gas used to flush, will appear at exit point
|
||||
var/active = 0 // true if the holder is moving, otherwise inactive
|
||||
dir = 0
|
||||
var/count = 1000 //*** can travel 1000 steps before going inactive (in case of loops)
|
||||
var/has_fat_guy = 0 // true if contains a fat person
|
||||
var/destinationTag = 0 // changes if contains a delivery container
|
||||
var/count = 1000 //*** can travel 1000 steps before going to the mail room (in case of loops)
|
||||
var/destinationTag = null // changes if contains a delivery container
|
||||
var/tomail = 0 //changes if contains wrapped package
|
||||
|
||||
|
||||
// initialize a holder from the contents of a disposal unit
|
||||
@@ -514,9 +512,11 @@
|
||||
if(istype(AM, /obj/effect/bigDelivery))
|
||||
var/obj/effect/bigDelivery/T = AM
|
||||
src.destinationTag = T.sortTag
|
||||
if(istype(AM, /obj/item/smallDelivery))
|
||||
else if(istype(AM, /obj/item/smallDelivery))
|
||||
var/obj/item/smallDelivery/T = AM
|
||||
src.destinationTag = T.sortTag
|
||||
else if (!src.destinationTag)
|
||||
src.destinationTag = "Mail Office"
|
||||
|
||||
|
||||
// start the movement process
|
||||
@@ -538,12 +538,6 @@
|
||||
process()
|
||||
var/obj/structure/disposalpipe/last
|
||||
while(active)
|
||||
if(has_fat_guy && prob(2)) // chance of becoming stuck per segment if contains a fat guy
|
||||
active = 0
|
||||
// find the fat guys
|
||||
for(var/mob/living/carbon/human/H in src)
|
||||
|
||||
break
|
||||
sleep(1) // was 1
|
||||
var/obj/structure/disposalpipe/curr = loc
|
||||
last = curr
|
||||
@@ -553,7 +547,8 @@
|
||||
|
||||
//
|
||||
if(!(count--))
|
||||
active = 0
|
||||
tomail = 1 //So loops end up in the mail room.
|
||||
destinationTag = null
|
||||
return
|
||||
|
||||
|
||||
@@ -584,9 +579,6 @@
|
||||
var/mob/M = AM
|
||||
if(M.client) // if a client mob, update eye to follow this holder
|
||||
M.client.eye = src
|
||||
|
||||
if(other.has_fat_guy)
|
||||
has_fat_guy = 1
|
||||
del(other)
|
||||
|
||||
|
||||
@@ -939,7 +931,10 @@
|
||||
|
||||
desc = "An underfloor disposal pipe with a package sorting mechanism."
|
||||
icon_state = "pipe-j1s"
|
||||
var/sortType = 0
|
||||
var/list/sortType = list()
|
||||
var/list/backType = list()
|
||||
var/backsort = 0 //For sending disposal packets to upstream destinations.
|
||||
var/mailsort = 0
|
||||
var/posdir = 0
|
||||
var/negdir = 0
|
||||
var/sortdir = 0
|
||||
@@ -965,20 +960,29 @@
|
||||
// if coming in from posdir, then flip around and go back to posdir
|
||||
// if coming in from sortdir, go to posdir
|
||||
|
||||
nextdir(var/fromdir, var/sortTag)
|
||||
nextdir(var/fromdir, var/sortTag, var/ismail)
|
||||
//var/flipdir = turn(fromdir, 180)
|
||||
if(sortTag)
|
||||
for(var/i, i <= backType.len, i++)
|
||||
if(sortTag == src.backType[i])
|
||||
return negdir
|
||||
|
||||
if(fromdir != sortdir) // probably came from the negdir
|
||||
|
||||
if(src.sortType == sortTag) //if destination matches filtered type...
|
||||
var/issort = 0
|
||||
for(var/i, i <= sortType.len, i++)
|
||||
if(sortTag == src.sortType[i])
|
||||
issort = 1
|
||||
|
||||
if(issort || ((!sortTag || ismail) && mailsort)) //if destination matches filtered type...
|
||||
return sortdir // exit through sortdirection
|
||||
else
|
||||
return posdir
|
||||
else // came from sortdir
|
||||
// so go with the flow to positive direction
|
||||
return posdir
|
||||
return posdir // so go with the flow to positive direction
|
||||
|
||||
transfer(var/obj/structure/disposalholder/H)
|
||||
var/nextdir = nextdir(H.dir, H.destinationTag)
|
||||
var/nextdir = nextdir(H.dir, H.destinationTag, H.tomail)
|
||||
H.dir = nextdir
|
||||
var/turf/T = H.nextloc()
|
||||
var/obj/structure/disposalpipe/P = H.findpipe(T)
|
||||
@@ -997,9 +1001,6 @@
|
||||
return P
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//a trunk joining to a disposal bin or outlet on the same turf
|
||||
/obj/structure/disposalpipe/trunk
|
||||
icon_state = "pipe-t"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
icon_state = "deliverycrate"
|
||||
var/obj/wrapped = null
|
||||
density = 1
|
||||
var/sortTag = 0
|
||||
var/sortTag = null
|
||||
flags = FPRINT
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
|
||||
@@ -24,6 +24,18 @@
|
||||
var/obj/item/device/destTagger/O = W
|
||||
user << "\blue *TAGGED*"
|
||||
src.sortTag = O.currTag
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = input(usr,"Label text?","Set label","")
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
if(length(str) > 64)
|
||||
usr << "\red Text too long."
|
||||
return
|
||||
var/label = str
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [label]."
|
||||
src.name = "[src.name] ([label])"
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery
|
||||
@@ -32,11 +44,11 @@
|
||||
icon = 'storage.dmi'
|
||||
icon_state = "deliverycrateSmall"
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = 0
|
||||
var/sortTag = null
|
||||
flags = FPRINT
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
attack_self(mob/user)
|
||||
if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
src.wrapped.loc = (get_turf(src.loc))
|
||||
|
||||
@@ -48,6 +60,18 @@
|
||||
var/obj/item/device/destTagger/O = W
|
||||
user << "\blue *TAGGED*"
|
||||
src.sortTag = O.currTag
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = input(usr,"Label text?","Set label","")
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
if(length(str) > 64)
|
||||
usr << "\red Text too long."
|
||||
return
|
||||
var/label = str
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [label]."
|
||||
src.name = "[src.name] ([label])"
|
||||
return
|
||||
|
||||
|
||||
@@ -56,6 +80,7 @@
|
||||
name = "package wrapper"
|
||||
icon = 'items.dmi'
|
||||
icon_state = "deliveryPaper"
|
||||
w_class = 4.0
|
||||
var/amount = 25.0
|
||||
|
||||
|
||||
@@ -102,13 +127,18 @@
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
icon_state = "forensic0"
|
||||
var/currTag = 0
|
||||
var/currTag = null
|
||||
var/list/spaceList = list(0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0) // Breaks up departments with whitespace.
|
||||
var/list/locationList = list("Disposals",
|
||||
"Cargo Bay", "QM Office", "Engineering", "CE Office",
|
||||
"Atmospherics", "Security", "HoS Office", "Medbay",
|
||||
"CMO Office", "Chemistry", "Research", "RD Office",
|
||||
"Robotics", "HoP Office", "Library", "Chapel", "Theatre",
|
||||
"Bar", "Kitchen", "Hydroponics", "Janitor Closet",)
|
||||
"Mail Office", "Cargo Bay", "QM Office",
|
||||
"Locker Room", "Tool Storage", "Laundry Room", "Toilets",
|
||||
"Security", "Courtroom", "Detective's Office", "Law Office",
|
||||
"Research Division", "Research Director", "Genetics",
|
||||
"Medbay", "CMO", "Chemistry", "Morgue",
|
||||
"Library", "Chapel", "Chapel Office", "Theater", "Janitor",
|
||||
"Bar", "Kitchen", "Diner", "Hydroponics",
|
||||
"Meeting Room", "HoP Office",
|
||||
"Atmospherics", "Engineering", "Chief Engineer", "Robotics",)
|
||||
//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
|
||||
|
||||
@@ -120,37 +150,36 @@
|
||||
flags = FPRINT | TABLEPASS | ONBELT | CONDUCT
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
user.machine = src
|
||||
interact(user)
|
||||
|
||||
proc/interact(mob/user as mob)
|
||||
var/dat = "<TT><B>TagMaster 2.2</B><BR><BR>"
|
||||
if (src.currTag == 0)
|
||||
if (!currTag)
|
||||
dat += "<br>Current Selection: None<br>"
|
||||
else
|
||||
dat += "<br>Current Selection: [locationList[currTag]]<br><br>"
|
||||
dat += "<br>Current Selection: [currTag]<br><br>"
|
||||
for (var/i = 1, i <= locationList.len, i++)
|
||||
dat += "<A href='?src=\ref[src];nextTag=[i]'>[locationList[i]]</A>"
|
||||
if (i%4==0)
|
||||
if(spaceList[i])
|
||||
dat += "<br>"
|
||||
else
|
||||
dat += " "
|
||||
dat += "<A href='?src=\ref[src];nextTag=[i]'>[locationList[i]]</A>"
|
||||
dat += "<br>"
|
||||
user << browse(dat, "window=destTagScreen")
|
||||
onclose(user, "destTagScreen")
|
||||
usr.machine = null
|
||||
return
|
||||
|
||||
Topic(href, href_list)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["nextTag"])
|
||||
var/n = text2num(href_list["nextTag"])
|
||||
src.currTag = n
|
||||
src.updateUsrDialog()
|
||||
src.currTag = locationList[n]
|
||||
if(istype(loc,/mob))
|
||||
interact(loc)
|
||||
else
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
|
||||
/*
|
||||
attack(target as obj, mob/user as mob)
|
||||
user << "/blue *TAGGED*"
|
||||
target.sortTag = src.currTag
|
||||
|
||||
attack(target as obj, mob/user as mob)
|
||||
user << "/blue You can only tag properly wrapped delivery packages!"
|
||||
*/
|
||||
attack(target as obj, mob/user as mob)
|
||||
if (istype(target, /obj/effect/bigDelivery))
|
||||
user << "\blue *TAGGED*"
|
||||
@@ -190,14 +219,14 @@
|
||||
// travels through the pipes.
|
||||
for(var/obj/effect/bigDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if(O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
if(!O.sortTag)
|
||||
O.sortTag = "Disposals"
|
||||
for(var/obj/item/smallDelivery/O in src)
|
||||
deliveryCheck = 1
|
||||
if (O.sortTag == 0)
|
||||
O.sortTag = 1
|
||||
if (!O.sortTag)
|
||||
O.sortTag = "Disposals"
|
||||
if(deliveryCheck == 0)
|
||||
H.destinationTag = 1
|
||||
H.destinationTag = "Disposals"
|
||||
|
||||
|
||||
H.init(src) // copy the contents of disposer to holder
|
||||
@@ -216,4 +245,11 @@
|
||||
if(mode == 2) // if was ready,
|
||||
mode = 1 // switch to charging
|
||||
update()
|
||||
return
|
||||
return
|
||||
|
||||
CanPass(atom/A, turf/T)
|
||||
if(istype(A, /mob/living)) // You Shall Not Pass!
|
||||
var/mob/living/M = A
|
||||
HasEntered(M)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user