mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-06 07:22:42 +00:00
more water pipes stuff
This commit is contained in:
@@ -5,7 +5,20 @@
|
||||
desc = "A sink used for washing one's hands and face."
|
||||
anchored = 1
|
||||
var/busy = 0 //Something's being washed at the moment
|
||||
var/mode = 0 //0 == fill, 1 == pour
|
||||
|
||||
var/obj/machinery/water/binary/fixture/cxn
|
||||
|
||||
New()
|
||||
..()
|
||||
reagents = new(100)
|
||||
reagents.my_atom = src
|
||||
spawn(2)
|
||||
cxn = locate(/obj/machinery/water/binary/fixture) in loc
|
||||
if(cxn)
|
||||
cxn.parent = src
|
||||
|
||||
verbs += /obj/machinery/sink/proc/mode_pour
|
||||
|
||||
attack_hand(mob/M as mob)
|
||||
if(busy)
|
||||
@@ -14,18 +27,33 @@
|
||||
|
||||
var/turf/location = M.loc
|
||||
if(!isturf(location)) return
|
||||
usr << "\blue You start washing up."
|
||||
M << "\blue You start washing up."
|
||||
|
||||
// collect water, at least 10u?
|
||||
var/amt_needed = 25 - reagents.total_volume
|
||||
if(!cxn || cxn.fill(amt_needed) < amt_needed)
|
||||
M << "\The [src] barely trickles. Cleaning up with \the [src] is impossible!"
|
||||
return
|
||||
|
||||
busy = 1
|
||||
sleep(40)
|
||||
busy = 0
|
||||
|
||||
// react, for if there's something not water
|
||||
reagents.reaction(M, TOUCH)
|
||||
|
||||
// ok, this is just goop..
|
||||
if(reagents.get_reagent_amount("water") < 10)
|
||||
M << "\red This does not feel... very water-like..."
|
||||
return
|
||||
|
||||
if(M.loc != location) return //Person has moved away from the sink
|
||||
|
||||
if(M.blood_DNA)
|
||||
reagents.add_reagent("blood", 10) // down the sink
|
||||
M.clean_blood()
|
||||
if(istype(M, /mob/living/carbon))
|
||||
var/mob/living/carbon/C = M
|
||||
C.clean_blood()
|
||||
/*
|
||||
if(C.r_hand)
|
||||
C.r_hand.clean_blood() // The hand you attack with is empty anyway, the other one should not be washed while doing this.
|
||||
@@ -49,22 +77,63 @@
|
||||
for(var/mob/V in viewers(src, null))
|
||||
V.show_message(text("\blue [M] washes up using \the [src]."))
|
||||
|
||||
// empty sink
|
||||
cxn.drain(reagents.total_volume)
|
||||
|
||||
proc/mode_pour()
|
||||
set name = "Toggle Mode -> Pour"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
mode = 1
|
||||
verbs -= /obj/machinery/sink/proc/mode_pour
|
||||
verbs += /obj/machinery/sink/proc/mode_fill
|
||||
usr << "You will now pour reagents down \the [src]."
|
||||
|
||||
proc/mode_fill()
|
||||
set name = "Toggle Mode -> Fill"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
mode = 0
|
||||
verbs -= /obj/machinery/sink/proc/mode_fill
|
||||
verbs += /obj/machinery/sink/proc/mode_pour
|
||||
usr << "You will now fill your container from the faucet."
|
||||
|
||||
attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if(busy)
|
||||
user << "\red Someone's already washing something here."
|
||||
return
|
||||
|
||||
// collect water, any water?
|
||||
var/amt_needed = 10 - reagents.total_volume
|
||||
if(!cxn || cxn.fill(amt_needed) == 0)
|
||||
user << "\The [src] barely trickles. Getting water from \the [src] is impossible!"
|
||||
return
|
||||
|
||||
if (istype(O, /obj/item/weapon/reagent_containers/glass) || istype(O,/obj/item/weapon/reagent_containers/food/drinks))
|
||||
if(O.reagents.total_volume < O.reagents.maximum_volume)
|
||||
O:reagents.add_reagent("water", 10)
|
||||
user.visible_message( \
|
||||
"\blue [user] fills the [O] using the [src].", \
|
||||
"\blue You fill the [O] using the [src].")
|
||||
if(!mode)
|
||||
// fill
|
||||
if(O.reagents.total_volume < O.reagents.maximum_volume)
|
||||
reagents.trans_to(O, reagents.total_volume)
|
||||
user.visible_message( \
|
||||
"\blue [user] fills \the [O] using \the [src].", \
|
||||
"\blue You fill \the [O] using \the [src].")
|
||||
else
|
||||
user.visible_message( \
|
||||
"\blue [user] spills water out of \the overflowing [O] into \the [src].", \
|
||||
"\blue You spill water out of \the overflowing [O] into \the [src].")
|
||||
else
|
||||
user.visible_message( \
|
||||
"\blue [user] spills water out of the overflowing [O] into the [src].", \
|
||||
"\blue You spill water out of the overflowing [O] into the [src].")
|
||||
// pour
|
||||
if(O.reagents.total_volume > 0)
|
||||
O.reagents.trans_to(src, O.reagents.total_volume)
|
||||
user.visible_message( \
|
||||
"\blue [user] pours the contents of \the [O] into \the [src].", \
|
||||
"\blue You pour the contents of \the [O] into \the [src].")
|
||||
else
|
||||
user << "\The [O] is empty."
|
||||
// empty sink
|
||||
cxn.drain(reagents.total_volume)
|
||||
return
|
||||
else if (istype(O, /obj/item/weapon/melee/baton))
|
||||
var/obj/item/weapon/melee/baton/B = O
|
||||
@@ -81,6 +150,9 @@
|
||||
user.visible_message( \
|
||||
"[user] was stunned by his wet [O].", \
|
||||
"\red You have wet \the [O], it shocks you!")
|
||||
|
||||
// empty sink
|
||||
cxn.drain(reagents.total_volume)
|
||||
return
|
||||
|
||||
var/turf/location = user.loc
|
||||
@@ -95,23 +167,30 @@
|
||||
sleep(40)
|
||||
busy = 0
|
||||
|
||||
reagents.reaction(O, TOUCH)
|
||||
|
||||
if(user.loc != location) return //User has moved
|
||||
if(!I) return //Item's been destroyed while washing
|
||||
if(user.get_active_hand() != I) return //Person has switched hands or the item in their hands
|
||||
|
||||
if(O.blood_DNA)
|
||||
reagents.add_reagent("blood", 10) // down the sink
|
||||
O.clean_blood()
|
||||
user.visible_message( \
|
||||
"\blue [user] washes \a [I] using \the [src].", \
|
||||
"\blue You wash \a [I] using \the [src].")
|
||||
|
||||
// empty sink
|
||||
cxn.drain(reagents.total_volume)
|
||||
|
||||
shower
|
||||
name = "Shower"
|
||||
name = "shower"
|
||||
desc = "This is dumb."
|
||||
|
||||
kitchen
|
||||
name = "Kitchen Sink"
|
||||
name = "kitchen sink"
|
||||
icon_state = "sink_alt"
|
||||
|
||||
kitchen2
|
||||
name = "Kitchen Sink"
|
||||
name = "kitchen sink"
|
||||
icon_state = "sink_alt2"
|
||||
|
||||
@@ -21,6 +21,16 @@
|
||||
//1 = hacked
|
||||
var/gibs_ready = 0
|
||||
var/obj/crayon
|
||||
var/obj/machinery/water/binary/fixture/cxn
|
||||
|
||||
New()
|
||||
..()
|
||||
reagents = new(200)
|
||||
reagents.my_atom = src
|
||||
spawn(2)
|
||||
cxn = locate(/obj/machinery/water/binary/fixture) in loc
|
||||
if(cxn)
|
||||
cxn.parent = src
|
||||
|
||||
/obj/machinery/washing_machine/verb/start()
|
||||
set name = "Start Washing"
|
||||
@@ -31,13 +41,31 @@
|
||||
usr << "The washing machine cannot run in this state."
|
||||
return
|
||||
|
||||
if(!cxn)
|
||||
usr << "\The [src] makes a grinding sound and stalls."
|
||||
|
||||
if( locate(/mob,contents) )
|
||||
state = 8
|
||||
else
|
||||
state = 5
|
||||
update_icon()
|
||||
|
||||
// collect water, fill up
|
||||
var/amt_needed
|
||||
do
|
||||
amt_needed = reagents.maximum_volume/2 - reagents.total_volume
|
||||
cxn.fill(amt_needed)
|
||||
sleep(10)
|
||||
while(amt_needed > 0)
|
||||
|
||||
// now, clean things
|
||||
sleep(200)
|
||||
for(var/atom/A in contents)
|
||||
reagents.reaction(A, TOUCH)
|
||||
|
||||
if(A.blood_DNA)
|
||||
reagents.add_reagent("blood", 10) // down the sink
|
||||
reagents.add_reagent("carbon", 5)
|
||||
A.clean_blood()
|
||||
|
||||
if(crayon)
|
||||
@@ -142,6 +170,7 @@
|
||||
gibs_ready = 1
|
||||
else
|
||||
state = 4
|
||||
cxn.drain(reagents.total_volume)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/washing_machine/verb/climb_out()
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
/obj/machinery/water/binary/fixture
|
||||
name = "water fixture connection"
|
||||
icon = 'water_fixtures.dmi'
|
||||
icon_state = "fixture"
|
||||
icon_state = "fixture-f"
|
||||
level = 1
|
||||
layer = 2.9
|
||||
|
||||
var/obj/parent
|
||||
|
||||
update_icon()
|
||||
icon_state = "intact[invisibility ? "-f" : "" ]"
|
||||
|
||||
hide(var/i)
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
invisibility = i ? 101 : 0
|
||||
@@ -75,3 +78,7 @@
|
||||
"You hear ratchet.")
|
||||
new /obj/item/water_pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
visible
|
||||
icon_state = "fixture"
|
||||
level = 2
|
||||
@@ -97,9 +97,16 @@ obj/machinery/water/trinary/filter
|
||||
|
||||
return 1
|
||||
|
||||
hide(var/i)
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
invisibility = i ? 101 : 0
|
||||
update_icon()
|
||||
|
||||
initialize()
|
||||
set_frequency(frequency)
|
||||
..()
|
||||
var/turf/T = src.loc // hide if turf is not intact
|
||||
hide(T.intact)
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
initialize_directions = SOUTH
|
||||
density = 1
|
||||
|
||||
var/obj/item/weapon/reagent_containers/glass/connected_device
|
||||
var/icon_type = ""
|
||||
|
||||
var/obj/item/weapon/reagent_containers/glass/connected_device
|
||||
var/obj/machinery/water/node
|
||||
var/datum/water/pipe_network/network
|
||||
|
||||
@@ -19,14 +20,14 @@
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "[node.level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
||||
icon_state = "[node.level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact[icon_type]"
|
||||
dir = get_dir(src, node)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
icon_state = "exposed[icon_type]"
|
||||
|
||||
overlays = new()
|
||||
if(connected_device)
|
||||
overlays += "inserted"
|
||||
overlays += "inserted[icon_type]"
|
||||
|
||||
if(connected_device.reagents.total_volume)
|
||||
var/obj/effect/overlay = new/obj
|
||||
@@ -204,4 +205,8 @@
|
||||
update_icon()
|
||||
user << "\blue You add \the [W] to \the [src]."
|
||||
else
|
||||
return ..()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/water/glass_connector/wall
|
||||
icon_state = "intact-w"
|
||||
icon_type = "-w"
|
||||
@@ -32,13 +32,6 @@
|
||||
|
||||
return
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(node)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
||||
dir = get_dir(src, node)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
|
||||
Reference in New Issue
Block a user