mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 20:47:10 +01:00
Merge remote-tracking branch 'upstream/master' into botany-rework
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 5
|
||||
active_power_usage = 100
|
||||
flags = OPENCONTAINER | NOREACT
|
||||
flags = OPENCONTAINER
|
||||
var/operating = 0 // Is it on?
|
||||
var/dirty = 0 // = {0..100} Does it need cleaning?
|
||||
var/broken = 0 // ={0,1,2} How broken is it???
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
/obj/machinery/kitchen_machine/New()
|
||||
create_reagents(100)
|
||||
reagents.set_reacting(FALSE)
|
||||
if(!available_recipes)
|
||||
available_recipes = new
|
||||
acceptable_items = new
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 5
|
||||
active_power_usage = 100
|
||||
flags = NOREACT
|
||||
var/max_n_of_items = 1500
|
||||
var/icon_on = "smartfridge"
|
||||
var/icon_off = "smartfridge-off"
|
||||
@@ -25,6 +24,8 @@
|
||||
|
||||
/obj/machinery/smartfridge/New()
|
||||
..()
|
||||
create_reagents()
|
||||
reagents.set_reacting(FALSE)
|
||||
component_parts = list()
|
||||
var/obj/item/weapon/circuitboard/smartfridge/board = new(null)
|
||||
board.set_type(type)
|
||||
|
||||
@@ -149,8 +149,6 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
del(D)
|
||||
if(garbageCollector)
|
||||
garbageCollector.dels_count++
|
||||
if(QDEL_HINT_PUTINPOOL) //qdel will put this object in the pool.
|
||||
PlaceInPool(D,0)
|
||||
if(QDEL_HINT_FINDREFERENCE)//qdel will, if TESTING is enabled, display all references to this object, then queue the object for deletion.
|
||||
#ifdef TESTING
|
||||
D.find_references(remove_from_queue = FALSE)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
mouse_opacity = 0
|
||||
simulated = 0
|
||||
anchored = 1
|
||||
flags = NOREACT
|
||||
icon = LIGHTING_ICON
|
||||
layer = LIGHTING_LAYER
|
||||
invisibility = INVISIBILITY_LIGHTING
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
|
||||
/*
|
||||
/tg/station13 /datum Pool:
|
||||
---------------------------------
|
||||
By RemieRichards
|
||||
|
||||
Creation/Deletion is laggy, so let's reduce reuse and recycle!
|
||||
|
||||
Usage:
|
||||
|
||||
To get a object, just call
|
||||
- PoolOrNew(type, arg) if you only want to pass one argument to New(), usually loc
|
||||
- PoolOrNew(type, list) if you want to pass multiple arguments to New()
|
||||
|
||||
To put a object back in the pool, call PlaceInPool(object)
|
||||
This will call destroy on the object, set its loc to null,
|
||||
and reset all of its vars to their default
|
||||
|
||||
You can override your object's destroy to return QDEL_HINT_PUTINPOOL
|
||||
to ensure its always placed in this pool (this will only be acted on if qdel calls destroy, and destroy will not get called twice)
|
||||
|
||||
For almost all pooling purposes, it is better to use the QDEL hint than to pool it directly with PlaceInPool
|
||||
|
||||
*/
|
||||
|
||||
var/global/list/GlobalPool = list()
|
||||
|
||||
//You'll be using this proc 90% of the time.
|
||||
//It grabs a type from the pool if it can
|
||||
//And if it can't, it creates one
|
||||
//The pool is flexible and will expand to fit
|
||||
//The new created atom when it eventually
|
||||
//Goes into the pool
|
||||
|
||||
//Second argument can be a single arg
|
||||
//Or a list of arguments
|
||||
//Either way it gets passed to new
|
||||
|
||||
/proc/PoolOrNew(get_type,second_arg)
|
||||
if(!get_type)
|
||||
return
|
||||
|
||||
. = GetFromPool(get_type,second_arg)
|
||||
|
||||
if(!.)
|
||||
if(ispath(get_type))
|
||||
if(islist(second_arg))
|
||||
. = new get_type (arglist(second_arg))
|
||||
else
|
||||
. = new get_type (second_arg)
|
||||
|
||||
|
||||
/proc/GetFromPool(get_type,second_arg)
|
||||
if(!get_type)
|
||||
return
|
||||
|
||||
if(isnull(GlobalPool[get_type]))
|
||||
return
|
||||
|
||||
if(length(GlobalPool[get_type]) == 0)
|
||||
return
|
||||
|
||||
var/datum/pooled = pop(GlobalPool[get_type])
|
||||
if(pooled)
|
||||
var/atom/movable/AM
|
||||
if(istype(pooled, /atom/movable))
|
||||
AM = pooled
|
||||
|
||||
if(islist(second_arg))
|
||||
if(AM)
|
||||
AM.loc = second_arg[1] //we need to do loc setting explicetly before even calling New() to replicate new()'s behavior
|
||||
pooled.New(arglist(second_arg))
|
||||
|
||||
else
|
||||
if(AM)
|
||||
AM.loc = second_arg
|
||||
pooled.New(second_arg)
|
||||
|
||||
return pooled
|
||||
|
||||
|
||||
/proc/PlaceInPool(datum/diver, destroy = 1)
|
||||
if(!istype(diver))
|
||||
return
|
||||
|
||||
if(diver in GlobalPool[diver.type])
|
||||
return
|
||||
|
||||
if(!GlobalPool[diver.type])
|
||||
GlobalPool[diver.type] = list()
|
||||
|
||||
GlobalPool[diver.type] |= diver
|
||||
|
||||
if(destroy)
|
||||
diver.Destroy()
|
||||
|
||||
diver.ResetVars()
|
||||
|
||||
var/list/exclude = list("animate_movement", "contents", "loc", "locs", "parent_type", "vars", "verbs", "type")
|
||||
var/list/pooledvariables = list()
|
||||
//thanks to clusterfack @ /vg/station for these two procs
|
||||
/datum/proc/createVariables()
|
||||
pooledvariables[type] = new/list()
|
||||
var/list/exclude = global.exclude + args
|
||||
|
||||
for(var/key in vars)
|
||||
if(key in exclude)
|
||||
continue
|
||||
pooledvariables[type][key] = initial(vars[key])
|
||||
|
||||
/datum/proc/ResetVars()
|
||||
if(!pooledvariables[type])
|
||||
createVariables(args)
|
||||
|
||||
for(var/key in pooledvariables[type])
|
||||
vars[key] = pooledvariables[type][key]
|
||||
|
||||
/atom/movable/ResetVars()
|
||||
..()
|
||||
loc = null
|
||||
contents = initial(contents) //something is really wrong if this object still has stuff in it by this point
|
||||
|
||||
/image/ResetVars()
|
||||
..()
|
||||
loc = null
|
||||
@@ -52,12 +52,12 @@
|
||||
|
||||
to_chat(user, "You inject the solution into the power cell.")
|
||||
|
||||
if(S.reagents.has_reagent("plasma", 5))
|
||||
if(S.reagents.has_reagent("plasma", 5) || S.reagents.has_reagent("plasma_dust", 5))
|
||||
|
||||
rigged = 1
|
||||
|
||||
log_admin("LOG: [user.name] ([user.ckey]) injected a power cell with plasma, rigging it to explode.")
|
||||
message_admins("LOG: [user.name] ([user.ckey]) injected a power cell with plasma, rigging it to explode.")
|
||||
log_admin("LOG: [key_name(user)] injected a power cell with plasma, rigging it to explode.")
|
||||
message_admins("LOG: [key_name_admin(user)] injected a power cell with plasma, rigging it to explode.")
|
||||
|
||||
S.reagents.clear_reagents()
|
||||
|
||||
|
||||
@@ -674,10 +674,10 @@
|
||||
|
||||
to_chat(user, "You inject the solution into the [src].")
|
||||
|
||||
if(S.reagents.has_reagent("plasma", 5))
|
||||
if(S.reagents.has_reagent("plasma", 5) || S.reagents.has_reagent("plasma_dust", 5))
|
||||
|
||||
log_admin("LOG: [user.name] ([user.ckey]) injected a light with plasma, rigging it to explode.")
|
||||
message_admins("LOG: [user.name] ([user.ckey]) injected a light with plasma, rigging it to explode.")
|
||||
log_admin("LOG: [key_name(user)] injected a light with plasma, rigging it to explode.")
|
||||
message_admins("LOG: [key_name_admin(user)] injected a light with plasma, rigging it to explode.")
|
||||
|
||||
rigged = 1
|
||||
|
||||
|
||||
@@ -246,9 +246,9 @@
|
||||
|
||||
/obj/item/ammo_casing/shotgun/dart/New()
|
||||
..()
|
||||
flags |= NOREACT
|
||||
flags |= OPENCONTAINER
|
||||
create_reagents(30)
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/ammo_casing/shotgun/dart/attackby()
|
||||
return
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
qdel(S)
|
||||
D.icon_state = "syringeproj"
|
||||
D.name = "syringe"
|
||||
D.flags |= NOREACT
|
||||
D.reagents.set_reacting(FALSE)
|
||||
playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
|
||||
|
||||
for(var/i=0, i<6, i++)
|
||||
|
||||
@@ -87,7 +87,7 @@ obj/item/projectile/bullet/saw/incen/Move()
|
||||
..()
|
||||
var/turf/location = get_turf(src)
|
||||
if(location)
|
||||
PoolOrNew(/obj/effect/hotspot, location)
|
||||
new /obj/effect/hotspot(location)
|
||||
location.hotspot_expose(700, 50, 1)
|
||||
|
||||
/obj/item/projectile/bullet/saw/incen/on_hit(atom/target, blocked = 0)
|
||||
|
||||
@@ -243,8 +243,8 @@
|
||||
|
||||
/obj/item/projectile/bullet/dart/New()
|
||||
..()
|
||||
flags |= NOREACT
|
||||
create_reagents(50)
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/projectile/bullet/dart/on_hit(var/atom/target, var/blocked = 0, var/hit_zone)
|
||||
if(iscarbon(target))
|
||||
@@ -260,7 +260,7 @@
|
||||
target.visible_message("<span class='danger'>The [name] was deflected!</span>", \
|
||||
"<span class='userdanger'>You were protected against the [name]!</span>")
|
||||
..(target, blocked, hit_zone)
|
||||
flags &= ~NOREACT
|
||||
reagents.set_reacting(TRUE)
|
||||
reagents.handle_reactions()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@ var/const/INGEST = 2
|
||||
var/atom/my_atom = null
|
||||
var/chem_temp = 300
|
||||
var/list/datum/reagent/addiction_list = new/list()
|
||||
var/flags
|
||||
|
||||
/datum/reagents/New(maximum=100)
|
||||
/datum/reagents/New(maximum = 100)
|
||||
maximum_volume = maximum
|
||||
|
||||
if(!(flags & REAGENT_NOREACT))
|
||||
processing_objects |= src
|
||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||
if(!chemical_reagents_list)
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
@@ -288,11 +290,24 @@ var/const/INGEST = 2
|
||||
od_chems.Add(R.id)
|
||||
return od_chems
|
||||
|
||||
/datum/reagents/proc/process()
|
||||
if(flags & REAGENT_NOREACT)
|
||||
processing_objects -= src
|
||||
return
|
||||
|
||||
/datum/reagents/proc/reagent_on_tick()
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
R.on_tick()
|
||||
return
|
||||
|
||||
/datum/reagents/proc/set_reacting(react = TRUE)
|
||||
if(react)
|
||||
// Order is important, process() can remove from processing if
|
||||
// the flag is present
|
||||
flags &= ~(REAGENT_NOREACT)
|
||||
processing_objects |= src
|
||||
else
|
||||
processing_objects -= src
|
||||
flags |= REAGENT_NOREACT
|
||||
|
||||
/*
|
||||
if(!target) return
|
||||
var/total_transfered = 0
|
||||
@@ -337,7 +352,7 @@ var/const/INGEST = 2
|
||||
update_total()
|
||||
|
||||
/datum/reagents/proc/handle_reactions()
|
||||
if(my_atom.flags & NOREACT)
|
||||
if(flags & REAGENT_NOREACT)
|
||||
return //Yup, no reactions here. No siree.
|
||||
|
||||
var/reaction_occured = 0
|
||||
@@ -731,7 +746,7 @@ atom/proc/create_reagents(max_vol)
|
||||
|
||||
/datum/reagents/Destroy()
|
||||
. = ..()
|
||||
processing_objects.Remove(src)
|
||||
processing_objects -= src
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
qdel(R)
|
||||
reagent_list.Cut()
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
if(!possible_transfer_amounts)
|
||||
verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT
|
||||
create_reagents(volume)
|
||||
processing_objects.Add(src)
|
||||
if(spawned_disease)
|
||||
var/datum/disease/F = new spawned_disease(0)
|
||||
var/list/data = list("viruses" = list(F), "blood_colour" = "#A10808")
|
||||
@@ -38,11 +37,6 @@
|
||||
if(list_reagents)
|
||||
reagents.add_reagent_list(list_reagents)
|
||||
|
||||
/obj/item/weapon/reagent_containers/process()
|
||||
if(reagents)
|
||||
reagents.reagent_on_tick()
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/ex_act()
|
||||
if(reagents)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
|
||||
@@ -290,7 +290,11 @@
|
||||
materials = list(MAT_GLASS=500)
|
||||
volume = 50
|
||||
amount_per_transfer_from_this = 10
|
||||
flags = OPENCONTAINER | NOREACT
|
||||
flags = OPENCONTAINER
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/noreact/New()
|
||||
..()
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/bluespace
|
||||
name = "bluespace beaker"
|
||||
|
||||
Reference in New Issue
Block a user