RPD refactor: part 2

This commit is contained in:
Citinited
2018-05-30 21:47:03 +01:00
parent ce42a6d952
commit 2ec3c797fd
13 changed files with 505 additions and 295 deletions
-8
View File
@@ -52,11 +52,3 @@
#define MAX_STACK_SIZE 50
//maximum amount of cable in a coil
#define MAXCOIL 30
//rpd stuff
#define RPD_ATMOS_MODE 1
#define RPD_DISPOSALS_MODE 2
#define RPD_ROTATE_MODE 3
#define RPD_FLIP_MODE 4
#define RPD_DELETE_MODE 5
+69
View File
@@ -0,0 +1,69 @@
//Atmospherics pipes
#define PIPE_SIMPLE_STRAIGHT 0
#define PIPE_SIMPLE_BENT 1
#define PIPE_HE_STRAIGHT 2
#define PIPE_HE_BENT 3
#define PIPE_CONNECTOR 4
#define PIPE_MANIFOLD 5
#define PIPE_JUNCTION 6
#define PIPE_UVENT 7
#define PIPE_MVALVE 8
#define PIPE_PUMP 9
#define PIPE_SCRUBBER 10
#define PIPE_INSULATED_STRAIGHT 11
#define PIPE_INSULATED_BENT 12
#define PIPE_GAS_FILTER 13
#define PIPE_GAS_MIXER 14
#define PIPE_PASSIVE_GATE 15
#define PIPE_VOLUME_PUMP 16
#define PIPE_HEAT_EXCHANGE 17
#define PIPE_TVALVE 18
#define PIPE_MANIFOLD4W 19
#define PIPE_CAP 20
#define PIPE_OMNI_MIXER 21
#define PIPE_OMNI_FILTER 22
#define PIPE_UNIVERSAL 23
#define PIPE_SUPPLY_STRAIGHT 24
#define PIPE_SUPPLY_BENT 25
#define PIPE_SCRUBBERS_STRAIGHT 26
#define PIPE_SCRUBBERS_BENT 27
#define PIPE_SUPPLY_MANIFOLD 28
#define PIPE_SCRUBBERS_MANIFOLD 29
#define PIPE_SUPPLY_MANIFOLD4W 30
#define PIPE_SCRUBBERS_MANIFOLD4W 31
#define PIPE_SUPPLY_CAP 32
#define PIPE_SCRUBBERS_CAP 33
#define PIPE_INJECTOR 34
#define PIPE_DVALVE 35
#define PIPE_DP_VENT 36
#define PIPE_PASV_VENT 37
#define PIPE_DTVALVE 38
#define PIPE_CIRCULATOR 39
#define PIPE_GAS_SENSOR 98
#define PIPE_METER 99
//Disposals pipes
#define PIPE_DISPOSALS_STRAIGHT 0
#define PIPE_DISPOSALS_BENT 1
#define PIPE_DISPOSALS_JUNCTION 2
#define PIPE_DISPOSALS_Y_JUNCTION 4
#define PIPE_DISPOSALS_TRUNK 5
#define PIPE_DISPOSALS_BIN 6
#define PIPE_DISPOSALS_OUTLET 7
#define PIPE_DISPOSALS_CHUTE 8
//RPD stuff
#define RPD_ATMOS_MODE 1
#define RPD_DISPOSALS_MODE 2
#define RPD_ROTATE_MODE 3
#define RPD_FLIP_MODE 4
#define RPD_DELETE_MODE 5
#define RPD_ATMOS_PIPING 1
#define RPD_SUPPLY_PIPING 2
#define RPD_SCRUBBERS_PIPING 3
#define RPD_DEVICES 4
#define RPD_HEAT_PIPING 5
+7
View File
@@ -50,6 +50,13 @@
init_subtypes(/datum/crafting_recipe, crafting_recipes)
//RPD stuff
var/list/pipe_list = list()
init_subtypes(/datum/pipes/atmospheric, pipe_list)
init_subtypes(/datum/pipes/disposal, pipe_list)
for(var/I in pipe_list)
var/datum/pipes/P = I
construction_pipe_list += list(list("pipename" = P.pipename, "pipeid" = P.pipeid, "atmosordisposals" = P.pipetype, "category" = P.category, "orientations" = P.orientations, "icon" = P.previewicon, "bendy" = P.bendy))
return 1
/* // Uncomment to debug chemical reaction list.
+3 -1
View File
@@ -43,4 +43,6 @@ var/global/list/meteor_list = list() //list of all meteors
var/global/list/poi_list = list() //list of points of interest for observe/follow
var/global/list/active_jammers = list() // List of active radio jammers
var/global/list/active_diseases = list() //List of Active disease in all mobs; purely for quick referencing.
var/global/list/active_diseases = list() //List of Active disease in all mobs; purely for quick referencing.
var/global/list/construction_pipe_list = list() //List of all pipe datums
+311
View File
@@ -0,0 +1,311 @@
//For use with the RPD (for now). All pipes here are ones that can be dispensed with the RPD
#define RPD_ATMOS 1
#define RPD_DISPOSAL 2
/datum/pipes
var/pipename //What the pipe is called in the interface
var/pipeid //Use the pipe define for this
var/pipetype //Atmos, disposals etc.
var/category //What category of pipe
var/bendy = FALSE//Is this pipe bendy?
var/orientations //Number of orientations (for interface purposes)
var/previewicon //icon_state of the dispensed pipe (for interface purposes)
/datum/pipes/atmospheric
pipetype = RPD_ATMOS
category = RPD_ATMOS_PIPING
/datum/pipes/disposal
pipetype = RPD_DISPOSAL
//Normal pipes
/datum/pipes/atmospheric/simple
pipename = "Straight pipe"
pipeid = PIPE_SIMPLE_STRAIGHT
orientations = 2
previewicon = "simple"
/datum/pipes/atmospheric/simple/bent
pipename = "Bent pipe"
pipeid = PIPE_SIMPLE_BENT
orientations = 4
bendy = TRUE
/datum/pipes/atmospheric/manifold
pipename = "T-manifold"
pipeid = PIPE_MANIFOLD
orientations = 4
previewicon = "manifold"
/datum/pipes/atmospheric/manifold4w
pipename = "4-way manifold"
pipeid = PIPE_MANIFOLD4W
orientations = 1
previewicon = "manifold4w"
/datum/pipes/atmospheric/cap
pipename = "Pipe cap"
pipeid = PIPE_CAP
orientations = 4
previewicon = "cap"
/datum/pipes/atmospheric/valve
pipename = "Manual valve"
pipeid = PIPE_MVALVE
orientations = 2
previewicon = "mvalve"
/datum/pipes/atmospheric/valve/digital
pipename = "Digital valve"
pipeid = PIPE_DVALVE
previewicon = "dvalve"
/datum/pipes/atmospheric/tvalve
pipename = "Manual T-valve"
pipeid = PIPE_TVALVE
orientations = 4
previewicon = "tvalve"
/datum/pipes/atmospheric/tvalve/digital
pipename = "Digital T-valve"
pipeid = PIPE_DTVALVE
previewicon = "dtvalve"
//Supply pipes
/datum/pipes/atmospheric/simple/supply
pipename = "Straight supply pipe"
pipeid = PIPE_SUPPLY_STRAIGHT
category = RPD_SUPPLY_PIPING
/datum/pipes/atmospheric/simple/bent/supply
pipename = "Bent supply pipe"
pipeid = PIPE_SUPPLY_BENT
category = RPD_SUPPLY_PIPING
/datum/pipes/atmospheric/manifold/supply
pipename = "Supply T-manifold"
pipeid = PIPE_SUPPLY_MANIFOLD
category = RPD_SUPPLY_PIPING
/datum/pipes/atmospheric/manifold4w/supply
pipename = "4-way supply manifold"
pipeid = PIPE_SUPPLY_MANIFOLD4W
category = RPD_SUPPLY_PIPING
/datum/pipes/atmospheric/cap/supply
pipename = "Supply pipe cap"
pipeid = PIPE_SUPPLY_CAP
category = RPD_SUPPLY_PIPING
//Scrubbers pipes
/datum/pipes/atmospheric/simple/scrubbers
pipename = "Straight scrubbers pipe"
pipeid = PIPE_SCRUBBERS_STRAIGHT
category = RPD_SCRUBBERS_PIPING
/datum/pipes/atmospheric/simple/bent/scrubbers
pipename = "Bent scrubbers pipe"
pipeid = PIPE_SCRUBBERS_BENT
category = RPD_SCRUBBERS_PIPING
/datum/pipes/atmospheric/manifold/scrubbers
pipename = "Scrubbers T-manifold"
pipeid = PIPE_SCRUBBERS_MANIFOLD
category = RPD_SCRUBBERS_PIPING
/datum/pipes/atmospheric/manifold4w/scrubbers
pipename = "4-way scrubbers manifold"
pipeid = PIPE_SCRUBBERS_MANIFOLD4W
category = RPD_SCRUBBERS_PIPING
/datum/pipes/atmospheric/cap/scrubbers
pipename = "Scrubbers pipe cap"
pipeid = PIPE_SCRUBBERS_CAP
category = RPD_SCRUBBERS_PIPING
//Devices
/datum/pipes/atmospheric/upa
pipename = "Universal pipe adapter"
pipeid = PIPE_UNIVERSAL
orientations = 2
previewicon = "universal"
category = RPD_DEVICES
/datum/pipes/atmospheric/connector
pipename = "Connector"
pipeid = PIPE_CONNECTOR
orientations = 4
previewicon = "connector"
category = RPD_DEVICES
/datum/pipes/atmospheric/unaryvent
pipename = "Unary vent"
pipeid = PIPE_UVENT
orientations = 4
previewicon = "uvent"
category = RPD_DEVICES
/datum/pipes/atmospheric/scrubber
pipename = "Scrubber"
pipeid = PIPE_SCRUBBER
orientations = 4
previewicon = "scrubber"
category = RPD_DEVICES
/datum/pipes/atmospheric/pump
pipename = "Gas pump"
pipeid = PIPE_PUMP
orientations = 4
previewicon = "pump"
category = RPD_DEVICES
/datum/pipes/atmospheric/volume_pump
pipename = "Volume pump"
pipeid = PIPE_VOLUME_PUMP
orientations = 4
previewicon = "volumepump"
category = RPD_DEVICES
/datum/pipes/atmospheric/gate
pipename = "Passive gate"
pipeid = PIPE_PASSIVE_GATE
orientations = 4
previewicon = "passivegate"
category = RPD_DEVICES
/datum/pipes/atmospheric/filter
pipename = "Gas filter"
pipeid = PIPE_GAS_FILTER
orientations = 4
previewicon = "filter"
category = RPD_DEVICES
/datum/pipes/atmospheric/mixer
pipename = "Gas mixer"
pipeid = PIPE_GAS_MIXER
orientations = 4
previewicon = "mixer"
category = RPD_DEVICES
/datum/pipes/atmospheric/sensor
pipename = "Gas sensor"
pipeid = PIPE_GAS_SENSOR
orientations = 1
previewicon = "sensor"
category = RPD_DEVICES
/datum/pipes/atmospheric/meter
pipename = "Gas meter"
pipeid = PIPE_METER
orientations = 1
previewicon = "meter"
category = RPD_DEVICES
/datum/pipes/atmospheric/passive_vent
pipename = "Passive vent"
pipeid = PIPE_PASV_VENT
orientations = 4
previewicon = "passive vent"
category = RPD_DEVICES
/datum/pipes/atmospheric/dual_vent_pump
pipename = "Dual-port vent pump"
pipeid = PIPE_DP_VENT
orientations = 2
previewicon = "dual-port vent"
category = RPD_DEVICES
/datum/pipes/atmospheric/injector
pipename = "Air injector"
pipeid = PIPE_INJECTOR
orientations = 4
previewicon = "injector"
category = RPD_DEVICES
//Heat exchange pipes
/datum/pipes/atmospheric/he
pipename = "Straight pipe"
pipeid = PIPE_HE_STRAIGHT
orientations = 2
previewicon = "he"
category = RPD_HEAT_PIPING
/datum/pipes/atmospheric/he/bent
pipename = "Bent pipe"
pipeid = PIPE_HE_BENT
orientations = 4
bendy = TRUE
/datum/pipes/atmospheric/he_junction
pipename = "Junction"
pipeid = PIPE_JUNCTION
orientations = 4
previewicon = "junction"
category = RPD_HEAT_PIPING
/datum/pipes/atmospheric/heat_exchanger
pipename = "Heat exchanger"
pipeid = PIPE_HEAT_EXCHANGE
orientations = 4
previewicon = "heunary"
category = RPD_HEAT_PIPING
//DISPOSALS PIPES
/datum/pipes/disposal/straight
pipename = "Straight pipe"
pipeid = PIPE_DISPOSALS_STRAIGHT
orientations = 2
previewicon = "conpipe-s"
/datum/pipes/disposal/bent
pipename = "Bent pipe"
pipeid = PIPE_DISPOSALS_BENT
orientations = 4
previewicon = "conpipe-c"
/datum/pipes/disposal/junction
pipename = "Junction"
pipeid = PIPE_DISPOSALS_JUNCTION
orientations = 4
previewicon = "conpipe-j1"
/datum/pipes/disposal/y_junction
pipename = "Y-junction"
pipeid = PIPE_DISPOSALS_Y_JUNCTION
orientations = 4
previewicon = "conpipe-y"
/datum/pipes/disposal/trunk
pipename = "Trunk"
pipeid = PIPE_DISPOSALS_TRUNK
orientations = 4
previewicon = "conpipe-t"
/datum/pipes/disposal/bin
pipename = "Bin"
pipeid = PIPE_DISPOSALS_BIN
orientations = 1
previewicon = "condisposal"
/datum/pipes/disposal/outlet
pipename = "Outlet"
pipeid = PIPE_DISPOSALS_OUTLET
orientations = 4
previewicon = "outlet"
/datum/pipes/disposal/chute
pipename = "Chute"
pipeid = PIPE_DISPOSALS_CHUTE
orientations = 4
previewicon = "intake"
#undef RPD_ATMOS
#undef RPD_DISPOSAL
-82
View File
@@ -1,44 +1,3 @@
#define PIPE_SIMPLE_STRAIGHT 0
#define PIPE_SIMPLE_BENT 1
#define PIPE_HE_STRAIGHT 2
#define PIPE_HE_BENT 3
#define PIPE_CONNECTOR 4
#define PIPE_MANIFOLD 5
#define PIPE_JUNCTION 6
#define PIPE_UVENT 7
#define PIPE_MVALVE 8
#define PIPE_PUMP 9
#define PIPE_SCRUBBER 10
#define PIPE_INSULATED_STRAIGHT 11
#define PIPE_INSULATED_BENT 12
#define PIPE_GAS_FILTER 13
#define PIPE_GAS_MIXER 14
#define PIPE_PASSIVE_GATE 15
#define PIPE_VOLUME_PUMP 16
#define PIPE_HEAT_EXCHANGE 17
#define PIPE_TVALVE 18
#define PIPE_MANIFOLD4W 19
#define PIPE_CAP 20
#define PIPE_OMNI_MIXER 21
#define PIPE_OMNI_FILTER 22
#define PIPE_UNIVERSAL 23
#define PIPE_SUPPLY_STRAIGHT 24
#define PIPE_SUPPLY_BENT 25
#define PIPE_SCRUBBERS_STRAIGHT 26
#define PIPE_SCRUBBERS_BENT 27
#define PIPE_SUPPLY_MANIFOLD 28
#define PIPE_SCRUBBERS_MANIFOLD 29
#define PIPE_SUPPLY_MANIFOLD4W 30
#define PIPE_SCRUBBERS_MANIFOLD4W 31
#define PIPE_SUPPLY_CAP 32
#define PIPE_SCRUBBERS_CAP 33
#define PIPE_INJECTOR 34
#define PIPE_DVALVE 35
#define PIPE_DP_VENT 36
#define PIPE_PASV_VENT 37
#define PIPE_DTVALVE 38
#define PIPE_CIRCULATOR 39
/obj/item/pipe
name = "pipe"
desc = "A pipe"
@@ -688,44 +647,3 @@
our_rpd.delete_single_pipe(user, src)
else
..()
#undef PIPE_SIMPLE_STRAIGHT
#undef PIPE_SIMPLE_BENT
#undef PIPE_HE_STRAIGHT
#undef PIPE_HE_BENT
#undef PIPE_CONNECTOR
#undef PIPE_MANIFOLD
#undef PIPE_JUNCTION
#undef PIPE_UVENT
#undef PIPE_MVALVE
#undef PIPE_PUMP
#undef PIPE_SCRUBBER
#undef PIPE_INSULATED_STRAIGHT
#undef PIPE_INSULATED_BENT
#undef PIPE_GAS_FILTER
#undef PIPE_GAS_MIXER
#undef PIPE_PASSIVE_GATE
#undef PIPE_VOLUME_PUMP
#undef PIPE_HEAT_EXCHANGE
#undef PIPE_TVALVE
#undef PIPE_MANIFOLD4W
#undef PIPE_CAP
#undef PIPE_OMNI_MIXER
#undef PIPE_OMNI_FILTER
#undef PIPE_UNIVERSAL
#undef PIPE_SUPPLY_STRAIGHT
#undef PIPE_SUPPLY_BENT
#undef PIPE_SCRUBBERS_STRAIGHT
#undef PIPE_SCRUBBERS_BENT
#undef PIPE_SUPPLY_MANIFOLD
#undef PIPE_SCRUBBERS_MANIFOLD
#undef PIPE_SUPPLY_MANIFOLD4W
#undef PIPE_SCRUBBERS_MANIFOLD4W
#undef PIPE_SUPPLY_CAP
#undef PIPE_SCRUBBERS_CAP
#undef PIPE_INJECTOR
#undef PIPE_DVALVE
#undef PIPE_DP_VENT
#undef PIPE_PASV_VENT
#undef PIPE_DTVALVE
#undef PIPE_CIRCULATOR
+16 -30
View File
@@ -10,12 +10,12 @@
/obj/machinery/pipedispenser/attack_hand(mob/user)
if(..())
return 1
interact(user)
/obj/machinery/pipedispenser/attack_ghost(mob/user)
interact(user)
/obj/machinery/pipedispenser/interact(mob/user)
var/dat = {"
<b>Regular pipes:</b><BR>
@@ -163,22 +163,22 @@
/obj/machinery/pipedispenser/disposal/attack_hand(mob/user)
if(..())
return
interact(user)
/obj/machinery/pipedispenser/disposal/attack_ghost(mob/user)
interact(user)
/obj/machinery/pipedispenser/disposal/interact(mob/user)
var/dat = {"<b>Disposal Pipes</b><br><br>
<A href='?src=[UID()];dmake=0'>Pipe</A><BR>
<A href='?src=[UID()];dmake=1'>Bent Pipe</A><BR>
<A href='?src=[UID()];dmake=2'>Junction</A><BR>
<A href='?src=[UID()];dmake=3'>Y-Junction</A><BR>
<A href='?src=[UID()];dmake=4'>Trunk</A><BR>
<A href='?src=[UID()];dmake=5'>Bin</A><BR>
<A href='?src=[UID()];dmake=6'>Outlet</A><BR>
<A href='?src=[UID()];dmake=7'>Chute</A><BR>
<A href='?src=[UID()];dmake=4'>Y-Junction</A><BR>
<A href='?src=[UID()];dmake=5'>Trunk</A><BR>
<A href='?src=[UID()];dmake=6'>Bin</A><BR>
<A href='?src=[UID()];dmake=7'>Outlet</A><BR>
<A href='?src=[UID()];dmake=8'>Chute</A><BR>
"}
var/datum/browser/popup = new(user, "pipedispenser", name, 400, 400)
@@ -194,29 +194,15 @@
if(!wait)
var/p_type = text2num(href_list["dmake"])
var/obj/structure/disposalconstruct/C = new (loc)
var/obj/structure/disposalconstruct/C = new (loc, p_type)
switch(p_type)
if(0)
C.ptype = 0
if(1)
C.ptype = 1
if(2)
C.ptype = 2
if(3)
C.ptype = 4
if(4)
C.ptype = 5
if(5)
C.ptype = 6
C.density = 1
if(6)
C.ptype = 7
C.density = 1
C.density = TRUE
if(7)
C.ptype = 8
C.density = 1
C.density = TRUE
if(8)
C.density = TRUE
C.add_fingerprint(usr)
C.update()
wait = 1
spawn(15)
wait = 0
+31 -116
View File
@@ -2,23 +2,6 @@
Rapid Pipe Dispenser
*/
#define SIMPLE_CAP 20
#define SUPPLY_CAP 32
#define SCRUBBERS_CAP 33
#define HE_EXCHANGER 17
#define CONNECTOR 4
#define UNARY_VENT 7
#define PASSIVE_VENT 37
#define GAS_SCRUBBER 10
#define INJECTOR 34
#define GAS_SENSOR 98
#define METER 99
#define DISPOSALS_JUNCTION 2
#define ATMOS_PIPING 1
#define SUPPLY_PIPING 2
#define SCRUBBERS_PIPING 3
#define DEVICES 4
#define HEAT_PIPING 5
#define RPD_COOLDOWN_TIME 4 //How long should we have to wait between dispensing pipes?
#define RPD_WALLBUILD_TIME 40 //How long should drilling into a wall take?
@@ -40,11 +23,11 @@
origin_tech = "engineering=4;materials=2"
var/datum/effect_system/spark_spread/spark_system
var/lastused
var/iconrotation = 0 //used to orient icons and pipes
var/iconrotation = 0 //Used to orient icons and pipes
var/mode = RPD_ATMOS_MODE //Disposals, atmospherics, etc.
var/pipetype = 1//For nanoUI menus
var/whatpipe = 0 //What kind of pipe is it? See code/game/machinery/pipe/construction.dm for a list of defines
var/whatdpipe = 0 //What kind of disposals pipe is it?
var/pipetype = RPD_ATMOS_PIPING//For nanoUI menus, this is a subtype of pipes e.g. scrubbers pipes, devices
var/whatpipe = PIPE_SIMPLE_STRAIGHT //What kind of atmos pipe is it?
var/whatdpipe = PIPE_DISPOSALS_STRAIGHT //What kind of disposals pipe is it?
var/spawndelay = RPD_COOLDOWN_TIME
var/walldelay = RPD_WALLBUILD_TIME
@@ -56,7 +39,7 @@
//Procs
/obj/item/rpd/proc/Activaterpd(delay) //Maybe makes sparks and activates cooldown if there is a delay.
/obj/item/rpd/proc/activate_rpd(delay) //Maybe makes sparks and activates cooldown if there is a delay
playsound(loc, "sound/machines/click.ogg", 50, 1)
if(prob(15))
spark_system.start()
@@ -65,34 +48,31 @@
/obj/item/rpd/proc/create_atmos_pipe(mob/user, turf/T) //Make an atmos pipe, meter, or gas sensor
var/obj/item/pipe/P
if(whatpipe == GAS_SENSOR)
if(whatpipe == PIPE_GAS_SENSOR)
P = new /obj/item/pipe_gsensor(T)
else if(whatpipe == METER)
else if(whatpipe == PIPE_METER)
P = new /obj/item/pipe_meter(T)
else
P = new(T, pipe_type = whatpipe, dir = user.dir)
if(iconrotation == 0 && P.is_bent_pipe()) //Automatic rotation of dispensed pipes
P = new(T, pipe_type = whatpipe, dir = user.dir) //Make the pipe, BUT WAIT! There's more!
if(!iconrotation && P.is_bent_pipe()) //Automatically rotates dispensed pipes if the user selected auto-rotation
P.dir = turn(user.dir, 135)
else if(iconrotation == 0 && P.pipe_type in list(CONNECTOR, UNARY_VENT, GAS_SCRUBBER, HE_EXCHANGER, SIMPLE_CAP, SUPPLY_CAP, SCRUBBERS_CAP, INJECTOR, PASSIVE_VENT)) //Some pipes dispense oppositely to what you'd expect, but we don't want to do anything if they selected a direction
else if(!iconrotation && P.pipe_type in list(PIPE_CONNECTOR, PIPE_UVENT, PIPE_SCRUBBER, PIPE_HEAT_EXCHANGE, PIPE_CAP, PIPE_SUPPLY_CAP, PIPE_SCRUBBERS_CAP, PIPE_INJECTOR, PIPE_PASV_VENT)) //Some pipes dispense oppositely to what you'd expect, but we don't want to do anything if they selected a direction
P.flip()
else if(iconrotation != 0 && P.is_bent_pipe()) //If they selected a rotation and the pipe is bent
else if(iconrotation && P.is_bent_pipe()) //If user selected a rotation and the pipe is bent
P.dir = turn(iconrotation, -45)
else if(iconrotation != 0)
else if(iconrotation) //If user selected a rotation
P.dir = iconrotation
to_chat(user, "<span class = 'notice'>[src] rapidly dispenses [P]!</span>")
Activaterpd(1)
activate_rpd(1)
/obj/item/rpd/proc/create_disposals_pipe(mob/user, turf/T) //Make a disposals pipe / construct
var/obj/structure/disposalconstruct/P = new(T) //Now we make the pipe
P.dir = iconrotation
P.ptype = whatdpipe
if(iconrotation == 0) //Automatic rotation
var/obj/structure/disposalconstruct/P = new(T, whatdpipe, iconrotation)
if(!iconrotation) //Automatic rotation
P.dir = user.dir
if(iconrotation == 0 && whatdpipe != DISPOSALS_JUNCTION) //Disposals pipes are in the opposite direction to atmos pipes, so we need to flip them. Junctions don't have this quirk though
if(!iconrotation && whatdpipe != PIPE_DISPOSALS_JUNCTION) //Disposals pipes are in the opposite direction to atmos pipes, so we need to flip them. Junctions don't have this quirk though
P.flip()
P.update()
to_chat(user, "<span class = 'notice'>[src] rapidly dispenses [P]!</span>")
Activaterpd(1)
activate_rpd(1)
/obj/item/rpd/proc/rotate_all_pipes(mob/user, turf/T) //Rotate all pipes on a turf
for(var/obj/item/pipe/P in T)
@@ -123,76 +103,29 @@
eaten = TRUE
if(eaten)
to_chat(user, "<span class='notice'>[src] sucks up the loose pipes on [T].")
Activaterpd()
activate_rpd()
else
to_chat(user, "<span class='notice'>There were no loose pipes on [T].</span>")
/obj/item/rpd/proc/delete_single_pipe(mob/user, obj/P) //Delete a single pipe
to_chat(user, "<span class='notice'>[src] sucks up [P].</span>")
QDEL_NULL(P)
Activaterpd()
activate_rpd()
//Lists of things
var/list/pipelist = list( //id refers to the pipe_type found in construction.dm, icon refers to the name of the icon state in icons/obj/pipe-item.dmi. Icons are made with the asset-cache
list("pipename" = "Straight pipe", "id" = 0, "category" = ATMOS_PIPING, "orientations" = 2, "icon" = "simple"),
list("pipename" = "Bent pipe", "id" = 1, "category" = ATMOS_PIPING, "orientations" = 4, "icon" = "simple", "bendy" = 1),
list("pipename" = "T-manifold", "id" = 5, "category" = ATMOS_PIPING, "orientations" = 4, "icon" = "manifold"),
list("pipename" = "4-way manifold", "id" = 19, "category" = ATMOS_PIPING, "orientations" = 1, "icon" = "manifold4w"),
list("pipename" = "Pipe cap", "id" = 20, "category" = ATMOS_PIPING, "orientations" = 4, "icon" = "cap"),
list("pipename" = "Manual valve", "id" = 8, "category" = ATMOS_PIPING, "orientations" = 2, "icon" = "mvalve"),
list("pipename" = "Digital valve", "id" = 35, "category" = ATMOS_PIPING, "orientations" = 2, "icon" = "dvalve"),
list("pipename" = "Manual T-valve", "id" = 18, "category" = ATMOS_PIPING, "orientations" = 4, "icon" = "tvalve"),
list("pipename" = "Digital T-valve", "id" = 38, "category" = ATMOS_PIPING, "orientations" = 4, "icon" = "dtvalve"),
list("pipename" = "Straight supply pipe", "id" = 24, "category" = SUPPLY_PIPING, "orientations" = 2, "icon" = "simple"),
list("pipename" = "Bent supply pipe", "id" = 25, "category" = SUPPLY_PIPING, "orientations" = 4, "icon" = "simple", "bendy" = 1),
list("pipename" = "Supply T-manifold", "id" = 28, "category" = SUPPLY_PIPING, "orientations" = 4, "icon" = "manifold"),
list("pipename" = "4-way supply manifold", "id" = 30, "category" = SUPPLY_PIPING, "orientations" = 1, "icon" = "manifold4w"),
list("pipename" = "Supply pipe cap", "id" = 32, "category" = SUPPLY_PIPING, "orientations" = 4, "icon" = "cap"),
list("pipename" = "Straight scrubbers pipe", "id" = 26, "category" = SCRUBBERS_PIPING, "orientations" = 2, "icon" = "simple"),
list("pipename" = "Bent scrubbers pipe", "id" = 27, "category" = SCRUBBERS_PIPING, "orientations" = 4, "icon" = "simple", "bendy" = 1),
list("pipename" = "Scrubbers T-manifold", "id" = 29, "category" = SCRUBBERS_PIPING, "orientations" = 4, "icon" = "manifold"),
list("pipename" = "4-way scrubbers manifold", "id" = 31, "category" = SCRUBBERS_PIPING, "orientations" = 1, "icon" = "manifold4w"),
list("pipename" = "Scrubbers pipe cap", "id" = 33, "category" = SCRUBBERS_PIPING, "orientations" = 4, "icon" = "cap"),
list("pipename" = "Universal pipe adapter", "id" = 23, "category" = DEVICES, "orientations" = 2, "icon" = "universal"),
list("pipename" = "Connector", "id" = 4, "category" = DEVICES, "orientations" = 4, "icon" = "connector"),
list("pipename" = "Unary vent", "id" = 7, "category" = DEVICES, "orientations" = 4, "icon" = "uvent"),
list("pipename" = "Scrubber", "id" = 10, "category" = DEVICES, "orientations" = 4, "icon" = "scrubber"),
list("pipename" = "Gas pump", "id" = 9, "category" = DEVICES, "orientations" = 4, "icon" = "pump"),
list("pipename" = "Volume pump", "id" = 16, "category" = DEVICES, "orientations" = 4, "icon" = "volumepump"),
list("pipename" = "Passive gate", "id" = 15, "category" = DEVICES, "orientations" = 4, "icon" = "passivegate"),
list("pipename" = "Gas filter", "id" = 13, "category" = DEVICES, "orientations" = 4, "icon" = "filter"),
list("pipename" = "Gas mixer", "id" = 14, "category" = DEVICES, "orientations" = 4, "icon" = "mixer"),
list("pipename" = "Gas sensor", "id" = 98, "category" = DEVICES, "orientations" = 1, "icon" = "sensor"),
list("pipename" = "Meter", "id" = 99, "category" = DEVICES, "orientations" = 1, "icon" = "meter"),
list("pipename" = "Passive vent", "id" = 37, "category" = DEVICES, "orientations" = 4, "icon" = "passive vent"),
list("pipename" = "Dual-port vent pump", "id" = 36, "category" = DEVICES, "orientations" = 2, "icon" = "dual-port vent"),
list("pipename" = "Air injector", "id" = 34, "category" = DEVICES, "orientations" = 4, "icon" = "injector"),
list("pipename" = "Straight HE pipe", "id" = 2, "category" = HEAT_PIPING, "orientations" = 2, "icon" = "he"),
list("pipename" = "Bent HE pipe", "id" = 3, "category" = HEAT_PIPING, "orientations" = 4, "icon" = "he", "bendy" = 1),
list("pipename" = "Junction", "id" = 6, "category" = HEAT_PIPING, "orientations" = 4, "icon" = "junction"),
list("pipename" = "Heat exchanger", "id" = 17, "category" = HEAT_PIPING, "orientations" = 4, "icon" = "heunary"))
var/list/dpipelist = list(
list("pipename" = "Straight pipe", "id" = 0, "orientations" = 2, "icon" = "conpipe-s"),
list("pipename" = "Bent pipe", "id" = 1, "orientations" = 4, "icon" = "conpipe-c"),
list("pipename" = "Junction", "id" = 2, "orientations" = 4, "icon" = "conpipe-j1"),
list("pipename" = "Y-junction", "id" = 4, "orientations" = 4, "icon" = "conpipe-y"),
list("pipename" = "Trunk", "id" = 5, "orientations" = 4, "icon" = "conpipe-t"),
list("pipename" = "Bin", "id" = 6, "orientations" = 1, "icon" = "condisposal"),
list("pipename" = "Outlet", "id" = 7, "orientations" = 4, "icon" = "outlet"),
list("pipename" = "Chute", "id" = 8, "orientations" = 4, "icon" = "intake"))
var/list/mainmenu = list(
list("category" = "Atmospherics", "mode" = 1, "icon" = "wrench"),
list("category" = "Disposals", "mode" = 2, "icon" = "recycle"),
list("category" = "Rotate", "mode" = 3, "icon" = "rotate-right"),
list("category" = "Flip", "mode" = 4, "icon" = "exchange"),
list("category" = "Recycle", "mode" = 5, "icon" = "trash"))
list("category" = "Atmospherics", "mode" = RPD_ATMOS_MODE, "icon" = "wrench"),
list("category" = "Disposals", "mode" = RPD_DISPOSALS_MODE, "icon" = "recycle"),
list("category" = "Rotate", "mode" = RPD_ROTATE_MODE, "icon" = "rotate-right"),
list("category" = "Flip", "mode" = RPD_FLIP_MODE, "icon" = "exchange"),
list("category" = "Recycle", "mode" = RPD_DELETE_MODE, "icon" = "trash"))
var/list/pipemenu = list(
list("pipecategory" = "Normal", "pipemode" = 1),
list("pipecategory" = "Supply", "pipemode" = 2),
list("pipecategory" = "Scrubber", "pipemode" = 3),
list("pipecategory" = "Devices", "pipemode" = 4),
list("pipecategory" = "Heat exchange", "pipemode" = 5))
list("pipecategory" = "Normal", "pipemode" = RPD_ATMOS_PIPING),
list("pipecategory" = "Supply", "pipemode" = RPD_SUPPLY_PIPING),
list("pipecategory" = "Scrubber", "pipemode" = RPD_SCRUBBERS_PIPING),
list("pipecategory" = "Devices", "pipemode" = RPD_DEVICES),
list("pipecategory" = "Heat exchange", "pipemode" = RPD_HEAT_PIPING))
//NanoUI stuff
@@ -208,11 +141,10 @@ var/list/pipemenu = list(
/obj/item/rpd/ui_data(mob/user, ui_key = "main", datum/topic_state/state = inventory_state)
var/data[0]
data["dpipelist"] = dpipelist
data["iconrotation"] = iconrotation
data["mainmenu"] = mainmenu
data["mode"] = mode
data["pipelist"] = pipelist
data["pipelist"] = construction_pipe_list
data["pipemenu"] = pipemenu
data["pipetype"] = pipetype
data["whatdpipe"] = whatdpipe
@@ -239,24 +171,7 @@ var/list/pipemenu = list(
..()
if(loc != user || !proximity || world.time < lastused + spawndelay)
return
target.rpd_act(user, src)
target.rpd_act(user, src) //Handle RPD effects in separate procs
#undef SIMPLE_CAP
#undef SUPPLY_CAP
#undef SCRUBBERS_CAP
#undef HE_EXCHANGER
#undef CONNECTOR
#undef UNARY_VENT
#undef PASSIVE_VENT
#undef GAS_SCRUBBER
#undef INJECTOR
#undef GAS_SENSOR
#undef METER
#undef DISPOSALS_JUNCTION
#undef ATMOS_PIPING
#undef SUPPLY_PIPING
#undef SCRUBBERS_PIPING
#undef DEVICES
#undef HEAT_PIPING
#undef RPD_COOLDOWN_TIME
#undef RPD_WALLBUILD_TIME
+1 -1
View File
@@ -71,7 +71,7 @@
/turf/ex_act(severity)
return 0
/turf/rpd_act(mob/user, obj/item/rpd/our_rpd)
/turf/rpd_act(mob/user, obj/item/rpd/our_rpd) //This is the default turf behaviour for the RPD; override it as required
if(our_rpd.mode == RPD_ATMOS_MODE)
our_rpd.create_atmos_pipe(user, src)
else if(our_rpd.mode == RPD_DISPOSALS_MODE)
@@ -17,6 +17,14 @@
var/dpdir = 0 // directions as disposalpipe
var/base_state = "pipe-s"
/obj/structure/disposalconstruct/New(loc, pipe_type, direction)
..()
if(pipe_type)
ptype = pipe_type
if(dir)
dir = direction
update()
// update iconstate and dpdir due to dir and type
/obj/structure/disposalconstruct/proc/update()
var/flip = turn(dir, 180)
@@ -267,10 +275,7 @@
return
/obj/structure/disposalconstruct/rpd_act(mob/user, obj/item/rpd/our_rpd)
if(anchored)
to_chat(user, "<span class='notice'>[src] is bolted down!</span>")
return
else if(our_rpd.mode == RPD_ROTATE_MODE)
if(our_rpd.mode == RPD_ROTATE_MODE)
rotate()
else if(our_rpd.mode == RPD_FLIP_MODE)
flip()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 96 KiB

+56 -53
View File
@@ -11,93 +11,96 @@ Used In File(s): /code/game/objects/items/weapons/rpd.dm
<h3>Pipe type:</strong></h3>
<div>
{{for data.pipemenu}} <!--We loop through the pipe menu (normal, scrubbers, etc.) and display all entries-->
{{:helper.link(String(value.pipecategory), null, {"pipetype": Number(value.pipemode)}, data.pipetype == Number(value.pipemode) ? "linkOn" : null)}}
{{:helper.link(String(value.pipecategory), null, {pipetype: Number(value.pipemode)}, data.pipetype == Number(value.pipemode) ? "linkOn" : null)}}
{{/for}}
</div>
<h4>Available pipes:</h4>
<div style = "float:left;margin-right:30pt;">
{{for data.pipelist}} <!--Display all pipes that match the selected menu-->
{{if value.category == data.pipetype}}
<div class = "item">{{:helper.link(String(value.pipename), "arrow-right", {"whatpipe": Number(value.id)}, data.whatpipe == Number(value.id) ? "linkOn" : null)}}</div>
{{if value.atmosordisposals == 1 && value.category == data.pipetype}}
<div class = "item">{{:helper.link(String(value.pipename), "arrow-right", {"whatpipe": Number(value.pipeid)}, data.whatpipe == Number(value.pipeid) ? "linkOn" : null)}}</div>
{{/if}}
{{/for}}
</div>
{{for data.pipelist}} <!-- For the selected pipe, we want to show a preview to allow the user to select a rotation-->
{{if value.atmosordisposals != 1 || value.pipeid != data.whatpipe || value.orientations == 1}} <!--Skip all this icon nonsense if the pipe is: not an atmos pipe; not the pipe we selected; or pipe has one orientation-->
{{continue;}}
{{/if}}
<div style = "float:left;">
{{if value.id == data.whatpipe && value.orientations != 1}} <!--If the pipe in the pipelist matches our currently selected pipe and actually has more than one orientation, we want a preview-->
<div style = "margin-bottom:30pt;">
{{:helper.link("Orient automatically", null, {"iconrotation": 0}, data.iconrotation == 0 ? "linkOn" : null)}}
</div>
{{/if}}
{{if value.id == data.whatpipe && value.orientations != 1 && value.bendy != 1}} <!--If the pipe in the pipelist matches our currently selected pipe and is not bendy-->
<div style = "margin-bottom:30pt;">
{{:helper.link("Orient automatically", null, {iconrotation: 0}, data.iconrotation == 0 ? "linkOn" : null)}}
</div>
{{if value.bendy}} <!--If the pipe is bendy-->
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 1}, data.iconrotation == 1 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-north.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 4}, data.iconrotation == 4 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-east.png">
</div>
{{/if}}
{{if value.id == data.whatpipe && value.orientations == 4 && value.bendy != 1}}
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 2}, data.iconrotation == 2 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-south.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 8}, data.iconrotation == 8 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-west.png">
</div>
{{/if}}
{{if value.id == data.whatpipe && value.bendy == 1}}
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 1}, data.iconrotation == 1 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 1}, data.iconrotation == 1 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-northeast.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 4}, data.iconrotation == 4 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 4}, data.iconrotation == 4 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-southeast.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 2}, data.iconrotation == 2 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 2}, data.iconrotation == 2 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-southwest.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 8}, data.iconrotation == 8 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 8}, data.iconrotation == 8 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-northwest.png">
</div>
{{else}}
<div>
{{:helper.link("", "arrow-right", {iconrotation: 1}, data.iconrotation == 1 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-north.png">
</div>
<div>
{{:helper.link("", "arrow-right", {iconrotation: 4}, data.iconrotation == 4 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-east.png">
</div>
{{if value.orientations == 4}}
<div>
{{:helper.link("", "arrow-right", {iconrotation: 2}, data.iconrotation == 2 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-south.png">
</div>
<div>
{{:helper.link("", "arrow-right", {iconrotation: 8}, data.iconrotation == 8 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-west.png">
</div>
{{/if}}
{{/if}}
</div>
{{/for}}
{{else data.mode == 2}}
<h4>Available pipes:</h4>
<div style = "float:left;margin-right:30pt;">
{{for data.dpipelist}}
<div class = "item">{{:helper.link(String(value.pipename), "arrow-right", {"whatdpipe": Number(value.id)}, data.whatdpipe == Number(value.id) ? "linkOn" : null)}}</div>
{{for data.pipelist}}
{{if value.atmosordisposals == 2}}
<div class = "item">{{:helper.link(String(value.pipename), "arrow-right", {"whatdpipe": Number(value.pipeid)}, data.whatdpipe == Number(value.pipeid) ? "linkOn" : null)}}</div>
{{/if}}
{{/for}}
</div>
{{for data.dpipelist}}
{{for data.pipelist}}
{{if value.atmosordisposals != 2 || value.pipeid != data.whatdpipe || value.orientations == 1}} <!--Skip all this icon nonsense if the pipe is: not an atmos pipe; not the pipe we selected; or pipe has one orientation-->
{{continue;}}
{{/if}}
<div style = "float:left;">
{{if value.id == data.whatdpipe && value.orientations != 1}}
<div style = "margin-bottom:30pt;">
{{:helper.link("Orient automatically", null, {"iconrotation": 0}, data.iconrotation == 0 ? "linkOn" : null)}}
</div>
<div style = "margin-bottom:30pt;">
{{:helper.link("Orient automatically", null, {iconrotation: 0}, data.iconrotation == 0 ? "linkOn" : null)}}
</div>
<div>
{{:helper.link("", "arrow-right", {iconrotation: 1}, data.iconrotation == 1 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-north.png">
</div>
<div>
{{:helper.link("", "arrow-right", {iconrotation: 4}, data.iconrotation == 4 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-east.png">
</div>
{{if value.orientations == 4}}
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 1}, data.iconrotation == 1 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-north.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 4}, data.iconrotation == 4 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-east.png">
</div>
{{/if}}
{{if value.id == data.whatdpipe && value.orientations == 4}}
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 2}, data.iconrotation == 2 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 2}, data.iconrotation == 2 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-south.png">
</div>
<div>
{{:helper.link("", "arrow-right", {"iconrotation": 8}, data.iconrotation == 8 ? "linkOn" : null)}}
{{:helper.link("", "arrow-right", {iconrotation: 8}, data.iconrotation == 8 ? "linkOn" : null)}}
<img src = "{{:value.icon}}-west.png">
</div>
{{/if}}
@@ -109,4 +112,4 @@ Used In File(s): /code/game/objects/items/weapons/rpd.dm
<h3>Device ready to flip loose pipes...</h3>
{{else data.mode == 5}}
<h3>Device ready to eat loose pipes...</h3>
{{/if}}
{{/if}}
+2
View File
@@ -45,6 +45,7 @@
#include "code\__DEFINES\misc.dm"
#include "code\__DEFINES\mobs.dm"
#include "code\__DEFINES\pda.dm"
#include "code\__DEFINES\pipes.dm"
#include "code\__DEFINES\preferences.dm"
#include "code\__DEFINES\process_scheduler.dm"
#include "code\__DEFINES\qdel.dm"
@@ -229,6 +230,7 @@
#include "code\datums\mixed.dm"
#include "code\datums\mutable_appearance.dm"
#include "code\datums\periodic_news.dm"
#include "code\datums\pipe_datums.dm"
#include "code\datums\progressbar.dm"
#include "code\datums\recipe.dm"
#include "code\datums\ruins.dm"