Adds container types INJECTABLE and DRAWABLE
This commit is contained in:
+44
-53
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
NOTE: IF YOU UPDATE THE REAGENT-SYSTEM, ALSO UPDATE THIS README.
|
||||
**NOTE: IF YOU UPDATE THE REAGENT-SYSTEM, ALSO UPDATE THIS README.**
|
||||
|
||||
```
|
||||
Structure: /////////////////// //////////////////////////
|
||||
// Mob or object // -------> // Reagents var (datum) // Is a reference to the datum that holds the reagents.
|
||||
/////////////////// //////////////////////////
|
||||
@@ -12,18 +12,14 @@ Structure: /////////////////// //////////////////////////
|
||||
V V V
|
||||
|
||||
reagents (datums) Reagents. I.e. Water , cryoxadone or mercury.
|
||||
```
|
||||
|
||||
# Random important notes:
|
||||
An objects on_reagent_change will be called every time the objects reagents change. Useful if you want to update the objects icon etc.
|
||||
|
||||
Random important notes:
|
||||
|
||||
An objects on_reagent_change will be called every time the objects reagents change.
|
||||
Useful if you want to update the objects icon etc.
|
||||
|
||||
About the Holder:
|
||||
|
||||
The holder (reagents datum) is the datum that holds a list of all reagents
|
||||
currently in the object.It also has all the procs needed to manipulate reagents
|
||||
|
||||
# About the Holder:
|
||||
The holder (reagents datum) is the datum that holds a list of all reagents currently in the object.It also has all the procs needed to manipulate reagents
|
||||
```
|
||||
remove_any(var/amount)
|
||||
This proc removes reagents from the holder until the passed amount
|
||||
is matched. It'll try to remove some of ALL reagents contained.
|
||||
@@ -115,13 +111,11 @@ About the Holder:
|
||||
my_atom
|
||||
This is the atom the holder is 'in'. Useful if you need to find the location.
|
||||
(i.e. for explosions)
|
||||
```
|
||||
|
||||
|
||||
About Reagents:
|
||||
|
||||
Reagents are all the things you can mix and fille in bottles etc. This can be anything from
|
||||
rejuvs over water to ... iron. Each reagent also has a few procs - i'll explain those below.
|
||||
|
||||
# About Reagents:
|
||||
Reagents are all the things you can mix and fille in bottles etc. This can be anything from rejuvs over water to ... iron. Each reagent also has a few procs - i'll explain those below.
|
||||
```
|
||||
reaction_mob(var/mob/M, var/method=TOUCH)
|
||||
This is called by the holder's reation proc.
|
||||
This version is only called when the reagent
|
||||
@@ -149,9 +143,10 @@ About Reagents:
|
||||
If you dont, the chemical will stay in the mob forever -
|
||||
unless you write your own piece of code to slowly remove it.
|
||||
(Should be pretty easy, 1 line of code)
|
||||
```
|
||||
|
||||
Important variables:
|
||||
|
||||
## Important variables:
|
||||
```
|
||||
holder
|
||||
This variable contains a reference to the holder the chemical is 'in'
|
||||
|
||||
@@ -173,17 +168,12 @@ About Reagents:
|
||||
This is a hexadecimal color that represents the reagent outside of containers,
|
||||
you define it as "#RRGGBB", or, red green blue. You can also define it using the
|
||||
rgb() proc, which returns a hexadecimal value too. The color is black by default.
|
||||
```
|
||||
A good website for color calculations: http://www.psyclops.com/tools/rgb/
|
||||
|
||||
A good website for color calculations: http://www.psyclops.com/tools/rgb/
|
||||
|
||||
|
||||
|
||||
|
||||
About Recipes:
|
||||
|
||||
Recipes are simple datums that contain a list of required reagents and a result.
|
||||
They also have a proc that is called when the recipe is matched.
|
||||
|
||||
# About Recipes:
|
||||
Recipes are simple datums that contain a list of required reagents and a result. They also have a proc that is called when the recipe is matched.
|
||||
```
|
||||
on_reaction(var/datum/reagents/holder, var/created_volume)
|
||||
This proc is called when the recipe is matched.
|
||||
You'll want to add explosions etc here.
|
||||
@@ -219,22 +209,21 @@ About Recipes:
|
||||
|
||||
required_temp
|
||||
This is the required temperature.
|
||||
```
|
||||
|
||||
|
||||
About the Tools:
|
||||
|
||||
By default, all atom have a reagents var - but its empty. if you want to use an object for the chem.
|
||||
system you'll need to add something like this in its new proc:
|
||||
|
||||
# About the Tools:
|
||||
By default, all atom have a reagents var - but its empty. if you want to use an object for the chem. system you'll need to add something like this in its new proc:
|
||||
```
|
||||
var/datum/reagents/R = new/datum/reagents(100) <<<<< create a new datum , 100 is the maximum_volume of the new holder datum.
|
||||
reagents = R <<<<< assign the new datum to the objects reagents var
|
||||
R.my_atom = src <<<<< set the holders my_atom to src so that we know where we are.
|
||||
|
||||
This can also be done by calling a convenience proc:
|
||||
atom/proc/create_reagents(var/max_volume)
|
||||
```
|
||||
|
||||
Other important stuff:
|
||||
|
||||
## Other important stuff:
|
||||
```
|
||||
amount_per_transfer_from_this var
|
||||
This var is mostly used by beakers and bottles.
|
||||
It simply tells us how much to transfer when
|
||||
@@ -248,20 +237,22 @@ About the Tools:
|
||||
transfer code since you will not be able to use the standard
|
||||
tools to manipulate it.
|
||||
|
||||
*/
|
||||
atom/proc/is_injectable()
|
||||
Checks if something can be injected to.
|
||||
If this returns 1, you can use syringes and droppers
|
||||
to draw from and add to the contents of this object.
|
||||
|
||||
atom/proc/is_drawable()
|
||||
Checks if something can be drawn from.
|
||||
If this returns 1, you can use syringes and droppers
|
||||
to draw from the contents of this object.
|
||||
```
|
||||
|
||||
# GOON CHEMS README:
|
||||
Credit goes to Cogwerks, and all the other goonstation coders for the original idea and implementation of this over at goonstation.
|
||||
|
||||
|
||||
|
||||
/* GOON CHEMS README:
|
||||
|
||||
Credit goes to Cogwerks, and all the other goonstation coders
|
||||
for the original idea and implementation of this over at goonstation.
|
||||
|
||||
THE REQUESTED DON'T PORT LIST: IF YOU PORT THESE THE GOONS WILL MURDER US IN OUR SLEEP SO PLEASE DON'T KTHX - Iamgoofball
|
||||
Any of the Secret Chems
|
||||
Goon in-joke chems (Eg. Cat Drugs, Hairgrownium)
|
||||
Liquid Electricity
|
||||
Rajajajah
|
||||
|
||||
*/
|
||||
- THE REQUESTED DON'T PORT LIST: IF YOU PORT THESE THE GOONS WILL MURDER US IN OUR SLEEP SO PLEASE DON'T KTHX - Iamgoofball
|
||||
- Any of the Secret Chems
|
||||
- Goon in-joke chems (Eg. Cat Drugs, Hairgrownium)
|
||||
- Liquid Electricity
|
||||
- Rajajajah
|
||||
@@ -17,7 +17,7 @@
|
||||
to_chat(user, "<span class='notice'>[target] is full.</span>")
|
||||
return
|
||||
|
||||
if(!target.is_open_container() && !ismob(target) && !istype(target,/obj/item/weapon/reagent_containers/food) && !istype(target, /obj/item/clothing/mask/cigarette)) //You can inject humans and food but you cant remove the shit.
|
||||
if(!target.is_injectable())
|
||||
to_chat(user, "<span class='warning'>You cannot directly fill [target]!</span>")
|
||||
return
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
else
|
||||
|
||||
if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers))
|
||||
if(!target.is_drawable(FALSE)) //No drawing from mobs here
|
||||
to_chat(user, "<span class='notice'>You cannot directly remove reagents from [target].</span>")
|
||||
return
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
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
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
to_chat(user, "<span class='notice'>[src] is empty.</span>")
|
||||
return
|
||||
|
||||
if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/weapon/reagent_containers/food) && !istype(target, /obj/item/slime_extract) && !istype(target, /obj/item/clothing/mask/cigarette) && !istype(target, /obj/item/weapon/storage/fancy/cigarettes))
|
||||
if(!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)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
icon_state = "water"
|
||||
density = 1
|
||||
anchored = 0
|
||||
container_type = DRAWABLE
|
||||
pressure_resistance = 2*ONE_ATMOSPHERE
|
||||
obj_integrity = 300
|
||||
max_integrity = 300
|
||||
|
||||
Reference in New Issue
Block a user