Merge pull request #4098 from Citadel-Station-13/upstream-merge-32805
[MIRROR] Refactor on_reagent_change to pass through the change type
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
resistance_flags = NONE
|
||||
var/isGlass = TRUE //Whether the 'bottle' is made of glass or not so that milk cartons dont shatter when someone gets hit by it
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/on_reagent_change(changetype)
|
||||
if (gulp_size < 5)
|
||||
gulp_size = 5
|
||||
else
|
||||
@@ -209,7 +209,7 @@
|
||||
item_state = "coffee"
|
||||
spillable = TRUE
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/mug/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/mug/on_reagent_change(changetype)
|
||||
if(reagents.total_volume)
|
||||
icon_state = "tea"
|
||||
else
|
||||
@@ -261,7 +261,7 @@
|
||||
spillable = TRUE
|
||||
isGlass = FALSE
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/on_reagent_change(changetype)
|
||||
if(reagents.total_volume)
|
||||
icon_state = "water_cup"
|
||||
else
|
||||
@@ -289,7 +289,7 @@
|
||||
transfer_fingerprints_to(B)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change(changetype)
|
||||
if (reagents.reagent_list.len)
|
||||
switch(reagents.get_master_reagent_id())
|
||||
if("orangejuice")
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
resistance_flags = ACID_PROOF
|
||||
unique_rename = 1
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/on_reagent_change(changetype)
|
||||
cut_overlays()
|
||||
if(reagents.reagent_list.len)
|
||||
var/datum/reagent/R = reagents.get_master_reagent()
|
||||
@@ -46,7 +46,7 @@
|
||||
volume = 15
|
||||
materials = list(MAT_GLASS=100)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/on_reagent_change(changetype)
|
||||
cut_overlays()
|
||||
|
||||
if (gulp_size < 15)
|
||||
@@ -74,9 +74,9 @@
|
||||
desc = "A shot glass - the universal symbol for bad decisions."
|
||||
return
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/filled/New()
|
||||
..()
|
||||
on_reagent_change()
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/filled/Initialize()
|
||||
. = ..()
|
||||
on_reagent_change(ADD_REAGENT)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/drinkingglass/filled/soda
|
||||
name = "Soda Water"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
container_type = OPENCONTAINER_1
|
||||
possible_transfer_amounts = list(1, 5, 10, 15, 20, 25, 30, 50)
|
||||
volume = 50
|
||||
//Possible_states has the reagent id as key and a list of, in order, the icon_state, the name and the desc as values. Used in the on_reagent_change() to change names, descs and sprites.
|
||||
//Possible_states has the reagent id as key and a list of, in order, the icon_state, the name and the desc as values. Used in the on_reagent_change(changetype) to change names, descs and sprites.
|
||||
var/list/possible_states = list(
|
||||
"ketchup" = list("ketchup", "ketchup bottle", "You feel more American already."),
|
||||
"capsaicin" = list("hotsauce", "hotsauce bottle", "You can almost TASTE the stomach ulcers now!"),
|
||||
@@ -80,7 +80,7 @@
|
||||
var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
|
||||
to_chat(user, "<span class='notice'>You transfer [trans] units of the condiment to [target].</span>")
|
||||
|
||||
/obj/item/reagent_containers/food/condiment/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/condiment/on_reagent_change(changetype)
|
||||
if(!possible_states.len)
|
||||
return
|
||||
if(reagents.reagent_list.len > 0)
|
||||
@@ -126,7 +126,7 @@
|
||||
list_reagents = list("sodiumchloride" = 20)
|
||||
possible_states = list()
|
||||
|
||||
/obj/item/reagent_containers/food/condiment/saltshaker/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/condiment/saltshaker/on_reagent_change(changetype)
|
||||
if(reagents.reagent_list.len == 0)
|
||||
icon_state = "emptyshaker"
|
||||
else
|
||||
@@ -164,7 +164,7 @@
|
||||
list_reagents = list("blackpepper" = 20)
|
||||
possible_states = list()
|
||||
|
||||
/obj/item/reagent_containers/food/condiment/peppermill/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/condiment/peppermill/on_reagent_change(changetype)
|
||||
if(reagents.reagent_list.len == 0)
|
||||
icon_state = "emptyshaker"
|
||||
else
|
||||
@@ -255,7 +255,7 @@
|
||||
src.reagents.trans_to(target, amount_per_transfer_from_this)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/reagent_containers/food/condiment/pack/on_reagent_change()
|
||||
/obj/item/reagent_containers/food/condiment/pack/on_reagent_change(changetype)
|
||||
if(reagents.reagent_list.len > 0)
|
||||
var/main_reagent = reagents.get_master_reagent_id()
|
||||
if(main_reagent in possible_states)
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
. = ..()
|
||||
return
|
||||
|
||||
/obj/item/reagent_containers/glass/bowl/on_reagent_change()
|
||||
/obj/item/reagent_containers/glass/bowl/on_reagent_change(changetype)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
productivity = P
|
||||
max_items = max_storage
|
||||
|
||||
/obj/machinery/biogenerator/on_reagent_change() //When the reagents change, change the icon as well.
|
||||
/obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well.
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/biogenerator/update_icon()
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
push_data()
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/on_reagent_change()
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/on_reagent_change(changetype)
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
var/smoke_radius = 5
|
||||
var/notified = FALSE
|
||||
|
||||
/obj/item/integrated_circuit/reagent/smoke/on_reagent_change()
|
||||
//reset warning
|
||||
notified = FALSE
|
||||
/obj/item/integrated_circuit/reagent/smoke/on_reagent_change(changetype)
|
||||
//reset warning only if we have reagents now
|
||||
if(changetype == ADD_REAGENT)
|
||||
notified = FALSE
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
@@ -48,7 +49,6 @@
|
||||
if(S)
|
||||
S.set_up(reagents, smoke_radius, location, notified)
|
||||
if(!notified)
|
||||
//we have now notified
|
||||
notified = TRUE
|
||||
S.start()
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/on_reagent_change()
|
||||
/obj/item/integrated_circuit/reagent/injector/on_reagent_change(changetype)
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
push_data()
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/on_reagent_change()
|
||||
/obj/item/integrated_circuit/reagent/storage/on_reagent_change(changetype)
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
new /obj/item/stock_parts/cell/potato(Tsec)
|
||||
var/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/S = new(Tsec)
|
||||
S.reagents.add_reagent("whiskey", 15)
|
||||
S.on_reagent_change()
|
||||
S.on_reagent_change(ADD_REAGENT)
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/pingsky
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/reagents
|
||||
@@ -428,7 +427,7 @@
|
||||
reagent_list -= R
|
||||
update_total()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
my_atom.on_reagent_change(DEL_REAGENT)
|
||||
check_ignoreslow(my_atom)
|
||||
check_gofast(my_atom)
|
||||
check_goreallyfast(my_atom)
|
||||
@@ -526,7 +525,7 @@
|
||||
R.volume += amount
|
||||
update_total()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
my_atom.on_reagent_change(ADD_REAGENT)
|
||||
R.on_merge(data, amount)
|
||||
if(!no_react)
|
||||
handle_reactions()
|
||||
@@ -545,7 +544,7 @@
|
||||
|
||||
update_total()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
my_atom.on_reagent_change(ADD_REAGENT)
|
||||
if(!no_react)
|
||||
handle_reactions()
|
||||
if(isliving(my_atom))
|
||||
@@ -587,7 +586,7 @@
|
||||
if(!safety)//So it does not handle reactions when it need not to
|
||||
handle_reactions()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
my_atom.on_reagent_change(REM_REAGENT)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/blood/on_reagent_change()
|
||||
/obj/item/reagent_containers/blood/on_reagent_change(changetype)
|
||||
if(reagents)
|
||||
var/datum/reagent/blood/B = reagents.has_reagent("blood")
|
||||
if(B && B.data && B.data["blood_type"])
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
icon_state = "bottle"
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/on_reagent_change()
|
||||
/obj/item/reagent_containers/glass/bottle/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/update_icon()
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/on_reagent_change()
|
||||
/obj/item/reagent_containers/glass/beaker/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/update_icon()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
mode = SYRINGE_INJECT
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/syringe/on_reagent_change()
|
||||
/obj/item/reagent_containers/syringe/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/syringe/pickup(mob/user)
|
||||
|
||||
Reference in New Issue
Block a user