mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 14:37:04 +01:00
TG container_type refactor
This commit is contained in:
@@ -678,6 +678,16 @@ var/const/INGEST = 2
|
||||
stuff += A.id
|
||||
return english_list(stuff)
|
||||
|
||||
/datum/reagents/proc/log_list()
|
||||
if(!length(reagent_list))
|
||||
return "no reagents"
|
||||
var/list/data = list()
|
||||
for(var/r in reagent_list) //no reagents will be left behind
|
||||
var/datum/reagent/R = r
|
||||
data += "[R.id] ([round(R.volume, 0.1)]u)"
|
||||
//Using IDs because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals.
|
||||
return english_list(data)
|
||||
|
||||
//two helper functions to preserve data across reactions (needed for xenoarch)
|
||||
/datum/reagents/proc/get_data(reagent_id)
|
||||
for(var/datum/reagent/D in reagent_list)
|
||||
@@ -739,6 +749,11 @@ var/const/INGEST = 2
|
||||
break
|
||||
return result
|
||||
|
||||
/datum/reagents/proc/holder_full()
|
||||
if(total_volume >= maximum_volume)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/reagents/Destroy()
|
||||
. = ..()
|
||||
processing_objects -= src
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
if(BL.data && BL.data["viruses"])
|
||||
var/list/viruses = BL.data["viruses"]
|
||||
return viruses[index]
|
||||
return null
|
||||
|
||||
/obj/machinery/computer/pandemic/proc/GetResistancesByIndex(index)
|
||||
if(beaker && beaker.reagents)
|
||||
@@ -40,13 +39,11 @@
|
||||
if(BL.data && BL.data["resistances"])
|
||||
var/list/resistances = BL.data["resistances"]
|
||||
return resistances[index]
|
||||
return null
|
||||
|
||||
/obj/machinery/computer/pandemic/proc/GetVirusTypeByIndex(index)
|
||||
var/datum/disease/D = GetVirusByIndex(index)
|
||||
if(D)
|
||||
return D.GetDiseaseID()
|
||||
return null
|
||||
|
||||
/obj/machinery/computer/pandemic/proc/replicator_cooldown(waittime)
|
||||
wait = 1
|
||||
@@ -175,7 +172,6 @@
|
||||
return
|
||||
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
|
||||
//Prints a nice virus release form. Props to Urbanliner for the layout
|
||||
/obj/machinery/computer/pandemic/proc/print_form(var/datum/disease/advance/D, mob/living/user)
|
||||
@@ -319,12 +315,12 @@
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "pandemic")
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/computer/pandemic/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/reagent_containers) && (I.flags & OPENCONTAINER))
|
||||
if(stat & (NOPOWER|BROKEN)) return
|
||||
if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER))
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(beaker)
|
||||
to_chat(user, "<span class='warning'>A beaker is already loaded into the machine!</span>")
|
||||
return
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
if(default_unfasten_wrench(user, I))
|
||||
return
|
||||
|
||||
if (istype(I, /obj/item/reagent_containers) && (I.flags & OPENCONTAINER) )
|
||||
if (istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER) )
|
||||
if (!beaker)
|
||||
if(!user.drop_item())
|
||||
return 1
|
||||
|
||||
@@ -238,12 +238,4 @@ About the Tools:
|
||||
It simply tells us how much to transfer when
|
||||
'pouring' our reagents into something else.
|
||||
|
||||
atom/proc/is_open_container()
|
||||
Checks atom/var/flags & OPENCONTAINER.
|
||||
If this returns 1 , you can use syringes, beakers etc
|
||||
to manipulate the contents of this object.
|
||||
If it's 0, you'll need to write your own custom reagent
|
||||
transfer code since you will not be able to use the standard
|
||||
tools to manipulate it.
|
||||
|
||||
*/
|
||||
@@ -61,14 +61,6 @@
|
||||
/obj/item/reagent_containers/afterattack(obj/target, mob/user , flag)
|
||||
return
|
||||
|
||||
/obj/item/reagent_containers/proc/reagentlist() //Return reagents in a reagent_container, default to source
|
||||
var/data
|
||||
if(reagents && reagents.reagent_list && reagents.reagent_list.len) //find a reagent list if there is and check if it has entries
|
||||
for(var/datum/reagent/R in reagents.reagent_list) //no reagents will be left behind
|
||||
data += "[R.id]([R.volume] units); " //Using IDs because SOME chemicals(I'm looking at you, chlorhydrate-beer) have the same names as other chemicals.
|
||||
return data
|
||||
else return "No reagents"
|
||||
|
||||
/obj/item/reagent_containers/wash(mob/user, atom/source)
|
||||
if(is_open_container())
|
||||
if(reagents.total_volume >= volume)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
item_state = "atoxinbottle"
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25,30)
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
volume = 30
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/on_reagent_change()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25,30,50)
|
||||
volume = 50
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
|
||||
var/label_text = ""
|
||||
// the fucking asshole who designed this can go die in a fire - Iamgoofball
|
||||
@@ -59,10 +59,10 @@
|
||||
..()
|
||||
if(is_open_container())
|
||||
to_chat(usr, "<span class='notice'>You put the lid on [src].</span>")
|
||||
flags ^= OPENCONTAINER
|
||||
container_type ^= REFILLABLE | DRAINABLE
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You take the lid off [src].</span>")
|
||||
flags |= OPENCONTAINER
|
||||
container_type |= REFILLABLE | DRAINABLE
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/afterattack(obj/target, mob/user, proximity)
|
||||
@@ -262,7 +262,7 @@
|
||||
volume = 100
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25,30,50,100)
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/vial
|
||||
name = "vial"
|
||||
@@ -272,7 +272,7 @@
|
||||
volume = 25
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25)
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
can_assembly = 0
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/drugs
|
||||
@@ -282,7 +282,7 @@
|
||||
amount_per_transfer_from_this = 2
|
||||
possible_transfer_amounts = 2
|
||||
volume = 10
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
can_assembly = 0
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/noreact
|
||||
@@ -293,7 +293,7 @@
|
||||
volume = 50
|
||||
amount_per_transfer_from_this = 10
|
||||
origin_tech = "materials=2;engineering=3;plasmatech=3"
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/noreact/New()
|
||||
..()
|
||||
@@ -307,7 +307,7 @@
|
||||
volume = 300
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25,30,50,100,300)
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
origin_tech = "bluespace=5;materials=4;plasmatech=4"
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/cryoxadone
|
||||
@@ -337,7 +337,7 @@
|
||||
volume = 120
|
||||
armor = list(melee = 10, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
|
||||
slot_flags = SLOT_HEAD
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
|
||||
/obj/item/reagent_containers/glass/bucket/equipped(mob/user, slot)
|
||||
..()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
amount_per_transfer_from_this = 5
|
||||
volume = 30
|
||||
possible_transfer_amounts = list(1,2,3,4,5,10,15,20,25,30)
|
||||
flags = OPENCONTAINER
|
||||
container_type = OPENCONTAINER
|
||||
slot_flags = SLOT_BELT
|
||||
var/ignore_flags = FALSE
|
||||
var/emagged = FALSE
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "cleaner"
|
||||
item_state = "cleaner"
|
||||
flags = OPENCONTAINER | NOBLUDGEON
|
||||
flags = NOBLUDGEON
|
||||
container_type = OPENCONTAINER
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 0
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
volume = 15
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
sharp = 1
|
||||
container_type = TRANSPARENT
|
||||
var/busy = 0
|
||||
var/mode = SYRINGE_DRAW
|
||||
var/projectile_type = /obj/item/projectile/bullet/dart/syringe
|
||||
@@ -78,7 +79,7 @@
|
||||
switch(mode)
|
||||
if(SYRINGE_DRAW)
|
||||
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
if(reagents.holder_full())
|
||||
to_chat(user, "<span class='notice'>The syringe is full.</span>")
|
||||
return
|
||||
|
||||
@@ -91,7 +92,7 @@
|
||||
if(!do_mob(user, target))
|
||||
busy = 0
|
||||
return
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
if(reagents.holder_full())
|
||||
return
|
||||
busy = 0
|
||||
if(L.transfer_blood_to(src, drawn_amount))
|
||||
@@ -104,14 +105,14 @@
|
||||
to_chat(user, "<span class='warning'>[target] is empty!</span>")
|
||||
return
|
||||
|
||||
if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers) && !istype(target,/obj/item/slime_extract))
|
||||
if(!target.is_drawable())
|
||||
to_chat(user, "<span class='warning'>You cannot directly remove reagents from [target]!</span>")
|
||||
return
|
||||
|
||||
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
|
||||
|
||||
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the solution.</span>")
|
||||
if(reagents.total_volume >= reagents.maximum_volume)
|
||||
if(reagents.holder_full())
|
||||
mode=!mode
|
||||
update_icon()
|
||||
|
||||
@@ -120,7 +121,7 @@
|
||||
to_chat(user, "<span class='notice'>[src] is empty.</span>")
|
||||
return
|
||||
|
||||
if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/reagent_containers/food) && !istype(target, /obj/item/slime_extract) && !istype(target, /obj/item/clothing/mask/cigarette) && !istype(target, /obj/item/storage/fancy/cigarettes))
|
||||
if(!L && !target.is_injectable())
|
||||
to_chat(user, "<span class='warning'>You cannot directly fill [target]!</span>")
|
||||
return
|
||||
if(target.reagents.total_volume >= target.reagents.maximum_volume)
|
||||
|
||||
@@ -6,28 +6,22 @@
|
||||
density = 1
|
||||
anchored = 0
|
||||
pressure_resistance = 2*ONE_ATMOSPHERE
|
||||
container_type = DRAINABLE | AMOUNT_VISIBLE
|
||||
|
||||
var/tank_volume = 1000 //In units, how much the dispenser can hold
|
||||
var/reagent_id = "water" //The ID of the reagent that the dispenser uses
|
||||
var/lastrigger = "" // The last person to rig this fuel tank - Stored with the object. Only the last person matter for investigation
|
||||
|
||||
/obj/structure/reagent_dispensers/attackby(obj/item/W, mob/user, params)
|
||||
return
|
||||
/obj/structure/reagent_dispensers/attackby(obj/item/I, mob/user, params)
|
||||
. = ..()
|
||||
if(I.is_refillable())
|
||||
return FALSE //so we can refill them via their afterattack.
|
||||
|
||||
/obj/structure/reagent_dispensers/New()
|
||||
create_reagents(tank_volume)
|
||||
reagents.add_reagent(reagent_id, tank_volume)
|
||||
..()
|
||||
|
||||
/obj/structure/reagent_dispensers/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
if(reagents.total_volume)
|
||||
to_chat(user, "<span class='notice'>It has [reagents.total_volume] units left.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='danger'>It's empty.</span>")
|
||||
|
||||
|
||||
/obj/structure/reagent_dispensers/proc/boom()
|
||||
visible_message("<span class='danger'>[src] ruptures!</span>")
|
||||
chem_splash(loc, 5, list(reagents))
|
||||
|
||||
Reference in New Issue
Block a user