Skip to content

Commit 69d5060

Browse files
committed
add a cut down version of eris bidons
1 parent e3393dc commit 69d5060

File tree

9 files changed

+208
-17
lines changed

9 files changed

+208
-17
lines changed

code/__defines/flags.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
/// This atom is queued for an overlay update.
3333
#define ATOM_AWAITING_OVERLAY_UPDATE (1<<5)
3434

35+
///The Reagent cannot be refilled
36+
#define ATOM_REAGENTS_NO_REFILL (1<<6)
37+
3538

3639
/* -- /turf/var/turf_flags -- */
3740

code/game/atoms.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ var/global/list/pre_init_created_atoms // atom creation ordering means some stuf
129129
/atom/proc/is_open_container()
130130
return atom_flags & ATOM_REAGENTS_IS_OPEN
131131

132+
/atom/proc/can_refill()
133+
return atom_flags & ~ATOM_REAGENTS_NO_REFILL
134+
132135
/*//Convenience proc to see whether a container can be accessed in a certain way.
133136
134137
proc/can_subract_container()

code/modules/reagents/machinery/dispenser/reagent_tank.dm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
density = 1
1010
anchored = 0
1111
pressure_resistance = 2*ONE_ATMOSPHERE
12-
12+
atom_flags = ATOM_REAGENTS_NO_REFILL
13+
var/volume = 5000
14+
var/has_hose = TRUE
1315
var/obj/item/hose_connector/input/active/InputSocket
1416
var/obj/item/hose_connector/output/active/OutputSocket
15-
1617
var/amount_per_transfer_from_this = 10
1718
var/possible_transfer_amounts = list(10,25,50,100)
1819

@@ -22,21 +23,20 @@
2223
/obj/structure/reagent_dispensers/Destroy()
2324
QDEL_NULL(InputSocket)
2425
QDEL_NULL(OutputSocket)
25-
26-
..()
26+
return ..()
2727

2828
/obj/structure/reagent_dispensers/Initialize()
29-
var/datum/reagents/R = new/datum/reagents(5000)
29+
var/datum/reagents/R = new/datum/reagents(volume)
3030
reagents = R
3131
R.my_atom = src
3232
if (!possible_transfer_amounts)
3333
src.verbs -= /obj/structure/reagent_dispensers/verb/set_APTFT
3434

35-
InputSocket = new(src)
36-
InputSocket.carrier = src
37-
OutputSocket = new(src)
38-
OutputSocket.carrier = src
39-
35+
if(has_hose)
36+
InputSocket = new(src)
37+
InputSocket.carrier = src
38+
OutputSocket = new(src)
39+
OutputSocket.carrier = src
4040
. = ..()
4141

4242
/obj/structure/reagent_dispensers/examine(mob/user)

code/modules/reagents/reagent_containers/_reagent_containers.dm

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
src.verbs -= /obj/item/reagent_containers/verb/set_APTFT
2323
create_reagents(volume)
2424

25+
/obj/item/reagent_containers/on_reagent_change()
26+
update_icon()
27+
2528
/obj/item/reagent_containers/attack_self(mob/user as mob)
2629
return
2730

@@ -38,12 +41,14 @@
3841
return 0
3942

4043
if(!target.reagents || !target.reagents.total_volume)
41-
to_chat(user, "<span class='notice'>[target] is empty.</span>")
42-
return 1
44+
if(target.can_refill())
45+
return 0
46+
else
47+
to_chat(user, "<span class='notice'>[target] is empty.</span>")
48+
return 1
4349

4450
if(reagents && !reagents.get_free_space())
45-
to_chat(user, "<span class='notice'>[src] is full.</span>")
46-
return 1
51+
return 0
4752

4853
var/trans = target.reagents.trans_to_obj(src, target:amount_per_transfer_from_this)
4954
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
@@ -116,8 +121,8 @@
116121
feed_sound(user)
117122
return TRUE
118123

119-
/obj/item/reagent_containers/proc/standard_pour_into(var/mob/user, var/atom/target) // This goes into afterattack and yes, it's atom-level
120-
if(!target.is_open_container() || !target.reagents)
124+
/obj/item/reagent_containers/proc/standard_pour_into(var/mob/user, var/atom/target, var/pour_all = FALSE) // This goes into afterattack and yes, it's atom-level
125+
if(!target.is_open_container() || !target.reagents || !target.can_refill())
121126
return 0
122127

123128
if(!reagents || !reagents.total_volume)
@@ -128,6 +133,7 @@
128133
to_chat(user, "<span class='notice'>[target] is full.</span>")
129134
return 1
130135

131-
var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
136+
var/trans = pour_all ? reagents.total_volume : amount_per_transfer_from_this
137+
trans = reagents.trans_to(target, trans)
132138
to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>")
133139
return 1
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/obj/structure/reagent_dispensers/bidon
2+
name = "bidon canister"
3+
desc = "A canister for handling large volumes of chemicals."
4+
icon = 'icons/obj/structures/bidon.dmi'
5+
icon_state = "bidon"
6+
possible_transfer_amounts = list(10, 30, 60, 120, 200, 300)
7+
unacidable = TRUE
8+
has_hose = FALSE
9+
var/use_reagent_color = TRUE
10+
var/fill_step = 10
11+
12+
13+
/obj/structure/reagent_dispensers/bidon/Initialize()
14+
. = ..()
15+
update_icon()
16+
17+
18+
/obj/structure/reagent_dispensers/bidon/update_icon()
19+
cut_overlays()
20+
if (!is_open_container())
21+
add_overlay("[icon_state]_lid")
22+
var/fill_state = ceil(round(reagents.total_volume / volume * 100, fill_step), 0, 100)
23+
if (!fill_state)
24+
return
25+
if (use_reagent_color)
26+
var/image/image = image(icon, icon_state = "[icon_state][fill_state]")
27+
image.color = reagents.get_color()
28+
add_overlay(image)
29+
else
30+
add_overlay("[icon_state][fill_state]")
31+
32+
33+
/obj/structure/reagent_dispensers/bidon/examine(mob/user, distance, infix, suffix)
34+
. = ..()
35+
if (distance > 5)
36+
return
37+
. += "The lid is [is_open_container() ? "off" : "on"]."
38+
if (distance < 3)
39+
. += "It holds [round(reagents.total_volume, 0.1)]/[volume] units of reagents."
40+
41+
42+
/obj/structure/reagent_dispensers/bidon/attack_hand(mob/living/user)
43+
playsound(src, 'sound/items/trayhit2.ogg', 50, TRUE)
44+
atom_flags ^= ATOM_REAGENTS_IS_OPEN
45+
if (is_open_container())
46+
to_chat(user, SPAN_ITALIC("You open the lid of \the [src]."))
47+
else
48+
to_chat(user, SPAN_ITALIC("You close the lid of \the [src]."))
49+
update_icon()
50+
51+
52+
/obj/structure/reagent_dispensers/bidon/attackby(obj/item/item, mob/living/user)
53+
if (!is_open_container() && istype(item, /obj/item/reagent_containers))
54+
to_chat(user, SPAN_WARNING("Remove the lid first."))
55+
return TRUE
56+
return ..()
57+
58+
59+
/obj/structure/reagent_dispensers/bidon/stasis
60+
name = "stasis bidon canister"
61+
desc = "A canister for handling large volumes of chemicals. This one has a stasis field."
62+
icon_state = "bidon_stasis"
63+
atom_flags = ATOM_REAGENTS_SKIP_REACTIONS
64+
use_reagent_color = FALSE
65+
fill_step = 20
66+
var/timer_seconds
67+
var/timer_handle
68+
69+
70+
/obj/structure/reagent_dispensers/bidon/stasis/update_icon()
71+
..()
72+
if (timer_handle)
73+
add_overlay("timer_active")
74+
else if (timer_seconds)
75+
add_overlay("timer_idle")
76+
77+
78+
/obj/structure/reagent_dispensers/bidon/stasis/examine(mob/user, distance, infix, suffix)
79+
. = ..()
80+
if (distance > 5 || !timer_seconds)
81+
return
82+
var/timer_display = "a timer"
83+
if (timer_handle)
84+
timer_display = "an active timer"
85+
if (distance > 3)
86+
. += "It has [timer_display] attached."
87+
else
88+
. += "It has [timer_display] attached set for [timer_seconds] seconds."
89+
90+
91+
/obj/structure/reagent_dispensers/bidon/stasis/attackby(obj/item/item, mob/living/user)
92+
if (istype(item, /obj/item/assembly/timer))
93+
if (timer_seconds)
94+
to_chat(user, SPAN_WARNING("\The [src] already has a timer attached."))
95+
else if (user.unEquip(item))
96+
var/obj/item/assembly/timer/timer = item
97+
timer_seconds = timer.time
98+
qdel(item)
99+
playsound(src, 'sound/items/Screwdriver.ogg', 50, TRUE)
100+
user.visible_message(
101+
SPAN_ITALIC("\The [user] attaches \a [item] to \a [src]."),
102+
SPAN_ITALIC("You attach \the [item] to \the [src]."),
103+
SPAN_ITALIC("You hear metal clicking together."),
104+
range = 5
105+
)
106+
return TRUE
107+
if (item.is_screwdriver())
108+
if (!timer_seconds)
109+
to_chat(user, SPAN_WARNING("\The [src] doesn't have a timer attached."))
110+
else if (timer_handle)
111+
to_chat(user, SPAN_WARNING("\The [src]'s timer is active."))
112+
else
113+
user.visible_message(
114+
SPAN_ITALIC("\The [user] removes the timer from \the [src]."),
115+
SPAN_ITALIC("You remove the timer from \the [src]."),
116+
SPAN_ITALIC("You hear metal clicking together."),
117+
range = 5
118+
)
119+
playsound(src, item.usesound, 50, TRUE)
120+
var/obj/item/assembly/timer/timer = new (loc)
121+
user.put_in_hands(timer)
122+
timer.time = timer_seconds
123+
timer_seconds = 0
124+
return TRUE
125+
if (item.is_multitool())
126+
if (!timer_seconds)
127+
to_chat(user, SPAN_WARNING("\The [src] doesn't have a timer attached."))
128+
return TRUE
129+
else if (timer_handle)
130+
deltimer(timer_handle)
131+
timer_handle = null
132+
user.visible_message(
133+
SPAN_ITALIC("\The [user] disables the timer on \the [src]."),
134+
SPAN_ITALIC("You disable the timer on \the [src]."),
135+
SPAN_ITALIC("You hear soft beeping."),
136+
range = 5
137+
)
138+
update_icon()
139+
else
140+
timer_handle = addtimer(CALLBACK(src, .proc/timer_end), timer_seconds SECONDS, TIMER_STOPPABLE)
141+
user.visible_message(
142+
SPAN_ITALIC("\The [user] activates the timer on \the [src]."),
143+
SPAN_ITALIC("You activate the timer on \the [src]."),
144+
SPAN_ITALIC("You hear soft beeping."),
145+
range = 5
146+
)
147+
playsound(src, item.usesound, 50, TRUE)
148+
update_icon()
149+
return TRUE
150+
return ..()
151+
152+
153+
/obj/structure/reagent_dispensers/bidon/stasis/proc/timer_end()
154+
atom_flags &= ~(ATOM_REAGENTS_SKIP_REACTIONS)
155+
reagents.handle_reactions()
156+
atom_flags |= ATOM_REAGENTS_SKIP_REACTIONS
157+
timer_handle = null
158+
update_icon()

code/modules/reagents/reagent_containers/glass.dm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
for(var/type in can_be_placed_into) //Is it something it can be placed into?
107107
if(istype(target, type))
108108
return 1
109+
110+
//Disarm intent tries to empty the beaker
111+
if(user.a_intent == I_DISARM && standard_pour_into(user, target, TRUE))
112+
return TRUE
113+
109114
if(standard_dispenser_refill(user, target)) //Are they clicking a water tank/some dispenser?
110115
return 1
111116
if(standard_pour_into(user, target)) //Pouring into another beaker?

code/modules/research/designs/bio_devices.dm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,18 @@
5959
build_path = /obj/item/analyzer/plant_analyzer
6060
sort_string = "JAADA"
6161

62+
/datum/design/item/biotech/bidon
63+
desc = "A canister for handling large volumes of chemicals."
64+
id = "bidon"
65+
req_tech = list(TECH_MATERIAL = 4, TECH_BIO = 4)
66+
materials = list(MAT_STEEL = 2000, "glass" = 1000)
67+
build_path = /obj/structure/reagent_dispensers/bidon
68+
sort_string = "JAADB"
69+
70+
/datum/design/item/biotech/bidon_stasis
71+
desc = "A stasis canister for handling large volumes of chemicals."
72+
id = "bidon_stasis"
73+
req_tech = list(TECH_MATERIAL = 6, TECH_BIO = 4, TECH_DATA = 5)
74+
materials = list(MAT_STEEL = 2000, "glass" = 1000, MAT_SILVER = 100)
75+
build_path = /obj/structure/reagent_dispensers/bidon/stasis
76+
sort_string = "JAADC"

icons/obj/structures/bidon.dmi

2.96 KB
Binary file not shown.

polaris.dme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,6 +3002,7 @@
30023002
#include "code\modules\reagents\reactions\instant\instant.dm"
30033003
#include "code\modules\reagents\reactions\instant\vox.dm"
30043004
#include "code\modules\reagents\reagent_containers\_reagent_containers.dm"
3005+
#include "code\modules\reagents\reagent_containers\bidon.dm"
30053006
#include "code\modules\reagents\reagent_containers\blood_pack.dm"
30063007
#include "code\modules\reagents\reagent_containers\borghypo.dm"
30073008
#include "code\modules\reagents\reagent_containers\dropper.dm"

0 commit comments

Comments
 (0)