|
18 | 18 | var/can_toggle_open = TRUE |
19 | 19 | var/tmp/possible_transfer_amounts = @"[10,25,50,100,500]" |
20 | 20 |
|
21 | | -/obj/structure/reagent_dispensers/Initialize(ml, _mat, _reinf_mat) |
22 | | - . = ..() |
23 | | - if (!possible_transfer_amounts) |
24 | | - verbs -= /obj/structure/reagent_dispensers/verb/set_amount_dispensed |
25 | | - |
26 | | -/obj/structure/reagent_dispensers/receive_mouse_drop(atom/dropping, mob/user, params) |
27 | | - if(!(. = ..()) && user?.get_active_held_item() == dropping && isitem(dropping)) |
28 | | - // Awful. Sorry. |
29 | | - var/obj/item/item = dropping |
30 | | - var/old_atom_flags = atom_flags |
31 | | - atom_flags |= ATOM_FLAG_OPEN_CONTAINER |
32 | | - if(item.standard_pour_into(user, src)) |
33 | | - . = TRUE |
34 | | - atom_flags = old_atom_flags |
| 21 | +/obj/structure/reagent_dispensers/get_reagent_amount_dispensed() |
| 22 | + return amount_dispensed |
| 23 | + |
| 24 | +/obj/structure/reagent_dispensers/set_reagent_amount_dispensed(new_amount) |
| 25 | + amount_dispensed = new_amount |
| 26 | + |
| 27 | +/obj/structure/reagent_dispensers/get_possible_reagent_transfer_amounts() |
| 28 | + return cached_json_decode(possible_transfer_amounts) |
35 | 29 |
|
36 | 30 | /obj/structure/reagent_dispensers/on_reagent_change() |
37 | 31 | if(!(. = ..())) |
|
61 | 55 | . += "Its refilling cap is open." |
62 | 56 | else |
63 | 57 | . += "Its refilling cap is closed." |
64 | | - . += SPAN_NOTICE("It contains:") |
65 | | - if(LAZYLEN(reagents?.reagent_volumes)) |
66 | | - for(var/decl/material/reagent as anything in reagents.liquid_volumes) |
67 | | - . += SPAN_NOTICE("[LIQUID_VOLUME(reagents, reagent)] unit\s of [reagent.get_reagent_name(reagents, MAT_PHASE_LIQUID)].") |
68 | | - for(var/decl/material/reagent as anything in reagents.solid_volumes) |
69 | | - . += SPAN_NOTICE("[SOLID_VOLUME(reagents, reagent)] unit\s of [reagent.get_reagent_name(reagents, MAT_PHASE_SOLID)].") |
70 | | - else |
71 | | - . += SPAN_NOTICE("Nothing.") |
72 | | - if(reagents?.maximum_volume) |
73 | | - . += "It may contain up to [reagents.maximum_volume] unit\s of fluid." |
74 | 58 |
|
75 | 59 | /obj/structure/reagent_dispensers/attackby(obj/item/used_item, mob/user) |
76 | 60 |
|
77 | | - // We do this here to avoid putting the vessel straight into storage. |
78 | | - // This is usually handled by afterattack on /chems. |
79 | | - if(storage && ATOM_IS_OPEN_CONTAINER(used_item) && user.check_intent(I_FLAG_HELP)) |
80 | | - if(used_item.standard_dispenser_refill(user, src)) |
81 | | - return TRUE |
82 | | - if(used_item.standard_pour_into(user, src)) |
83 | | - return TRUE |
84 | | - |
85 | 61 | if(wrenchable && IS_WRENCH(used_item)) |
86 | 62 | unwrenched = !unwrenched |
87 | 63 | visible_message(SPAN_NOTICE("\The [user] wrenches \the [src]'s tap [unwrenched ? "open" : "shut"].")) |
|
92 | 68 |
|
93 | 69 | . = ..() |
94 | 70 |
|
95 | | -/obj/structure/reagent_dispensers/verb/set_amount_dispensed() |
96 | | - set name = "Set amount dispensed" |
97 | | - set category = "Object" |
98 | | - set src in view(1) |
99 | | - if(!CanPhysicallyInteract(usr)) |
100 | | - to_chat(usr, SPAN_NOTICE("You're in no condition to do that!'")) |
101 | | - return |
102 | | - var/N = input("Amount dispensed:","[src]") as null|anything in cached_json_decode(possible_transfer_amounts) |
103 | | - if(!CanPhysicallyInteract(usr)) // because input takes time and the situation can change |
104 | | - to_chat(usr, SPAN_NOTICE("You're in no condition to do that!'")) |
105 | | - return |
106 | | - if (N) |
107 | | - amount_dispensed = N |
108 | | - |
109 | 71 | /obj/structure/reagent_dispensers/explosion_act(severity) |
110 | 72 | . = ..() |
111 | 73 | if(. && (severity == 1) || (severity == 2 && prob(50)) || (severity == 3 && prob(5))) |
|
320 | 282 | //Interactions |
321 | 283 | /obj/structure/reagent_dispensers/get_alt_interactions(var/mob/user) |
322 | 284 | . = ..() |
323 | | - LAZYADD(., /decl/interaction_handler/set_transfer/reagent_dispenser) |
324 | 285 | if(can_toggle_open) |
325 | 286 | LAZYADD(., /decl/interaction_handler/toggle_open/reagent_dispenser) |
326 | 287 |
|
327 | | -//Set amount dispensed |
328 | | -/decl/interaction_handler/set_transfer/reagent_dispenser |
329 | | - expected_target_type = /obj/structure/reagent_dispensers |
330 | | - |
331 | | -/decl/interaction_handler/set_transfer/reagent_dispenser/is_possible(var/atom/target, var/mob/user) |
332 | | - . = ..() |
333 | | - if(.) |
334 | | - var/obj/structure/reagent_dispensers/R = target |
335 | | - return !!R.possible_transfer_amounts |
336 | | - |
337 | | -/decl/interaction_handler/set_transfer/reagent_dispenser/invoked(atom/target, mob/user, obj/item/prop) |
338 | | - var/obj/structure/reagent_dispensers/R = target |
339 | | - R.set_amount_dispensed() |
340 | | - |
341 | 288 | //Allows normal refilling, or toggle back to normal reagent dispenser operation |
342 | 289 | /decl/interaction_handler/toggle_open/reagent_dispenser |
343 | 290 | name = "Toggle refilling cap" |
|
0 commit comments