mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-26 05:27:39 +01:00
Merge branch 'master' into mobpathfix
This commit is contained in:
@@ -12,27 +12,24 @@
|
||||
my_atom = A
|
||||
|
||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||
if(!chemical_reagents_list)
|
||||
if(!SSchemistry.chemical_reagents)
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
var/paths = typesof(/datum/reagent) - /datum/reagent
|
||||
chemical_reagents_list = list()
|
||||
SSchemistry.chemical_reagents = list()
|
||||
for(var/path in paths)
|
||||
var/datum/reagent/D = new path()
|
||||
if(!D.name)
|
||||
continue
|
||||
chemical_reagents_list[D.id] = D
|
||||
SSchemistry.chemical_reagents[D.id] = D
|
||||
|
||||
/datum/reagents/Destroy()
|
||||
. = ..()
|
||||
if(chemistryProcess)
|
||||
chemistryProcess.active_holders -= src
|
||||
|
||||
STOP_PROCESSING(SSchemistry, src)
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
qdel(R)
|
||||
reagent_list.Cut()
|
||||
reagent_list = null
|
||||
if(my_atom && my_atom.reagents == src)
|
||||
my_atom.reagents = null
|
||||
return ..()
|
||||
|
||||
/* Internal procs */
|
||||
|
||||
@@ -80,41 +77,31 @@
|
||||
return
|
||||
|
||||
/datum/reagents/proc/handle_reactions()
|
||||
if(chemistryProcess)
|
||||
chemistryProcess.mark_for_update(src)
|
||||
|
||||
//returns 1 if the holder should continue reactiong, 0 otherwise.
|
||||
/datum/reagents/proc/process_reactions()
|
||||
if(QDELETED(my_atom)) //No container, no reaction.
|
||||
return 0
|
||||
if(my_atom.flags & NOREACT) // No reactions here
|
||||
return 0
|
||||
|
||||
var/reaction_occured
|
||||
var/list/effect_reactions = list()
|
||||
if(QDELETED(my_atom))
|
||||
return FALSE
|
||||
if(my_atom.flags & NOREACT)
|
||||
return FALSE
|
||||
var/reaction_occurred
|
||||
var/list/eligible_reactions = list()
|
||||
for(var/i in 1 to PROCESS_REACTION_ITER)
|
||||
reaction_occured = 0
|
||||
var/list/effect_reactions = list()
|
||||
do
|
||||
reaction_occurred = FALSE
|
||||
for(var/i in reagent_list)
|
||||
var/datum/reagent/R = i
|
||||
if(SSchemistry.chemical_reactions_by_reagent[R.id]) //VOREStation Edit: unruntiming chems
|
||||
eligible_reactions |= SSchemistry.chemical_reactions_by_reagent[R.id] //VOREStation Edit: unruntiming chems
|
||||
|
||||
//need to rebuild this to account for chain reactions
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
eligible_reactions |= chemical_reactions_list[R.id]
|
||||
|
||||
for(var/datum/chemical_reaction/C in eligible_reactions)
|
||||
for(var/i in eligible_reactions)
|
||||
var/datum/chemical_reaction/C = i
|
||||
if(C.can_happen(src) && C.process(src))
|
||||
effect_reactions |= C
|
||||
reaction_occured = 1
|
||||
|
||||
eligible_reactions.Cut()
|
||||
|
||||
if(!reaction_occured)
|
||||
break
|
||||
|
||||
for(var/datum/chemical_reaction/C in effect_reactions)
|
||||
reaction_occurred = TRUE
|
||||
eligible_reactions.len = 0
|
||||
while(reaction_occurred)
|
||||
for(var/i in effect_reactions)
|
||||
var/datum/chemical_reaction/C = i
|
||||
C.post_reaction(src)
|
||||
|
||||
update_total()
|
||||
return reaction_occured
|
||||
|
||||
/* Holder-to-chemical */
|
||||
|
||||
@@ -136,7 +123,7 @@
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
return 1
|
||||
var/datum/reagent/D = chemical_reagents_list[id]
|
||||
var/datum/reagent/D = SSchemistry.chemical_reagents[id]
|
||||
if(D)
|
||||
var/datum/reagent/R = new D.type()
|
||||
reagent_list += R
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
data["bottleSpritesAmount"] = list(1, 2, 3, 4) //how many bottle sprites there are. Sprites are taken from chemical.dmi and can be found in nano/images/pill.png
|
||||
|
||||
ui = GLOB.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "chem_master.tmpl", src.name, 575, 400)
|
||||
ui.set_initial_data(data)
|
||||
@@ -282,7 +282,7 @@
|
||||
else if(href_list["bottle_sprite"])
|
||||
bottlesprite = href_list["bottle_sprite"]
|
||||
|
||||
GLOB.nanomanager.update_uis(src)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
/obj/machinery/chem_master/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
/proc/initialize_chemical_reagents()
|
||||
var/paths = typesof(/datum/reagent) - /datum/reagent
|
||||
chemical_reagents_list = list()
|
||||
for(var/path in paths)
|
||||
var/datum/reagent/D = new path()
|
||||
if(!D.name)
|
||||
continue
|
||||
chemical_reagents_list[D.id] = D
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -879,3 +879,47 @@ datum/reagent/talum_quem/affect_blood(var/mob/living/carbon/M, var/alien, var/re
|
||||
randmuti(M)
|
||||
M << "<span class='warning'>You feel odd!</span>"
|
||||
M.apply_effect(6 * removed, IRRADIATE, 0)
|
||||
|
||||
/*
|
||||
* Hostile nanomachines.
|
||||
* Unscannable, and commonly all look the same.
|
||||
*/
|
||||
|
||||
/datum/reagent/shredding_nanites
|
||||
name = "Restorative Nanites"
|
||||
id = "shredding_nanites"
|
||||
description = "Miniature medical robots that swiftly restore bodily damage. These ones seem to be malfunctioning."
|
||||
taste_description = "metal"
|
||||
reagent_state = SOLID
|
||||
color = "#555555"
|
||||
metabolism = REM * 4 // Nanomachines. Fast.
|
||||
|
||||
/datum/reagent/shredding_nanites/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
M.adjustBruteLoss(4 * removed)
|
||||
M.adjustOxyLoss(4 * removed)
|
||||
|
||||
/datum/reagent/irradiated_nanites
|
||||
name = "Restorative Nanites"
|
||||
id = "irradiated_nanites"
|
||||
description = "Miniature medical robots that swiftly restore bodily damage. These ones seem to be malfunctioning."
|
||||
taste_description = "metal"
|
||||
reagent_state = SOLID
|
||||
color = "#555555"
|
||||
metabolism = REM * 4
|
||||
|
||||
/datum/reagent/irradiated_nanites/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
radiation_repository.radiate(get_turf(M), 20) // Irradiate people around you.
|
||||
M.radiation = max(M.radiation + 5 * removed, 0) // Irradiate you. Because it's inside you.
|
||||
|
||||
/datum/reagent/neurophage_nanites
|
||||
name = "Restorative Nanites"
|
||||
id = "neurophage_nanites"
|
||||
description = "Miniature medical robots that swiftly restore bodily damage. These ones seem to be completely hostile."
|
||||
taste_description = "metal"
|
||||
reagent_state = SOLID
|
||||
color = "#555555"
|
||||
metabolism = REM * 4
|
||||
|
||||
/datum/reagent/neurophage_nanites/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
M.adjustBrainLoss(2 * removed) // Their job is to give you a bad time.
|
||||
M.adjustBruteLoss(2 * removed)
|
||||
|
||||
@@ -9,16 +9,25 @@
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.species.name != "Promethean")
|
||||
M << "<span class='danger'>Your flesh rapidly mutates!</span>"
|
||||
to_chat(M, "<span class='danger'>Your flesh rapidly mutates!</span>")
|
||||
|
||||
var/list/backup_implants = list()
|
||||
for(var/obj/item/organ/I in H.organs)
|
||||
for(var/obj/item/weapon/implant/backup/BI in I.contents)
|
||||
backup_implants += BI
|
||||
if(backup_implants.len)
|
||||
for(var/obj/item/weapon/implant/backup/BI in backup_implants)
|
||||
BI.forceMove(src)
|
||||
|
||||
H.set_species("Promethean")
|
||||
H.verbs += /mob/living/carbon/human/proc/shapeshifter_select_shape
|
||||
H.verbs += /mob/living/carbon/human/proc/shapeshifter_select_colour
|
||||
H.verbs += /mob/living/carbon/human/proc/shapeshifter_select_hair
|
||||
H.verbs += /mob/living/carbon/human/proc/shapeshifter_select_gender
|
||||
H.verbs += /mob/living/carbon/human/proc/regenerate
|
||||
H.verbs += /mob/living/proc/set_size
|
||||
H.shapeshifter_set_colour("#05FF9B") //They can still change their color.
|
||||
|
||||
if(backup_implants.len)
|
||||
var/obj/item/organ/external/torso = H.get_organ(BP_TORSO)
|
||||
for(var/obj/item/weapon/implant/backup/BI in backup_implants)
|
||||
BI.forceMove(torso)
|
||||
torso.implants += BI
|
||||
|
||||
/datum/chemical_reaction/slime/sapphire_mutation
|
||||
name = "Slime Mutation Toxins"
|
||||
id = "slime_mutation_tox"
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
|
||||
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list
|
||||
// It is filtered into multiple lists within a list.
|
||||
// For example:
|
||||
// chemical_reaction_list["phoron"] is a list of all reactions relating to phoron
|
||||
// Note that entries in the list are NOT duplicated. So if a reaction pertains to
|
||||
// more than one chemical it will still only appear in only one of the sublists.
|
||||
/proc/initialize_chemical_reactions()
|
||||
var/paths = typesof(/datum/chemical_reaction) - /datum/chemical_reaction
|
||||
chemical_reactions_list = list()
|
||||
|
||||
for(var/path in paths)
|
||||
var/datum/chemical_reaction/D = new path()
|
||||
if(D.required_reagents && D.required_reagents.len)
|
||||
var/reagent_id = D.required_reagents[1]
|
||||
if(!chemical_reactions_list[reagent_id])
|
||||
chemical_reactions_list[reagent_id] = list()
|
||||
chemical_reactions_list[reagent_id] += D
|
||||
|
||||
//helper that ensures the reaction rate holds after iterating
|
||||
//Ex. REACTION_RATE(0.3) means that 30% of the reagents will react each chemistry tick (~2 seconds by default).
|
||||
#define REACTION_RATE(rate) (1.0 - (1.0-rate)**(1.0/PROCESS_REACTION_ITER))
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
. = ..()
|
||||
if(spawn_reagent)
|
||||
reagents.add_reagent(spawn_reagent, volume)
|
||||
var/datum/reagent/R = chemical_reagents_list[spawn_reagent]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[spawn_reagent]
|
||||
setLabel(R.name)
|
||||
|
||||
/obj/item/weapon/reagent_containers/chem_disp_cartridge/examine(mob/user)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"), reagent in chemical_reagents_list)
|
||||
/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"), reagent in SSchemistry.chemical_reagents)
|
||||
set name = "Spawn Chemical Dispenser Cartridge"
|
||||
set category = "Admin"
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
if("medium") C = new /obj/item/weapon/reagent_containers/chem_disp_cartridge/medium(usr.loc)
|
||||
if("large") C = new /obj/item/weapon/reagent_containers/chem_disp_cartridge(usr.loc)
|
||||
C.reagents.add_reagent(reagent, C.volume)
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[reagent]
|
||||
C.setLabel(R.name)
|
||||
log_admin("[key_name(usr)] spawned a [size] reagent container containing [reagent] at ([usr.x],[usr.y],[usr.z])")
|
||||
|
||||
@@ -55,12 +55,12 @@
|
||||
C.loc = src
|
||||
cartridges[C.label] = C
|
||||
cartridges = sortAssoc(cartridges)
|
||||
GLOB.nanomanager.update_uis(src)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
/obj/machinery/chemical_dispenser/proc/remove_cartridge(label)
|
||||
. = cartridges[label]
|
||||
cartridges -= label
|
||||
GLOB.nanomanager.update_uis(src)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
/obj/machinery/chemical_dispenser/attackby(obj/item/weapon/W, mob/user)
|
||||
if(W.is_wrench())
|
||||
@@ -106,7 +106,7 @@
|
||||
user.drop_from_inventory(RC)
|
||||
RC.loc = src
|
||||
to_chat(user, "<span class='notice'>You set \the [RC] on \the [src].</span>")
|
||||
GLOB.nanomanager.update_uis(src) // update all UIs attached to src
|
||||
SSnanoui.update_uis(src) // update all UIs attached to src
|
||||
|
||||
else
|
||||
return ..()
|
||||
@@ -140,7 +140,7 @@
|
||||
data["chemicals"] = chemicals
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = GLOB.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "chem_disp.tmpl", ui_title, 390, 680)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
process_tick = 15
|
||||
. = 0
|
||||
for(var/id in dispense_reagents)
|
||||
var/datum/reagent/R = chemical_reagents_list[id]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[id]
|
||||
if(!R)
|
||||
crash_with("[src] at [x],[y],[z] failed to find reagent '[id]'!")
|
||||
dispense_reagents -= id
|
||||
@@ -25,7 +25,7 @@
|
||||
C.reagents.add_reagent(id, to_restore)
|
||||
. = 1
|
||||
if(.)
|
||||
GLOB.nanomanager.update_uis(src)
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
/obj/machinery/chemical_dispenser
|
||||
dispense_reagents = list(
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
for(var/T in reagent_ids)
|
||||
reagent_volumes[T] = volume
|
||||
var/datum/reagent/R = chemical_reagents_list[T]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[T]
|
||||
reagent_names += R.name
|
||||
|
||||
START_PROCESSING(SSobj, src)
|
||||
@@ -112,14 +112,14 @@
|
||||
if(t)
|
||||
playsound(loc, 'sound/effects/pop.ogg', 50, 0)
|
||||
mode = t
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[reagent_ids[mode]]
|
||||
usr << "<span class='notice'>Synthesizer is now producing '[R.name]'.</span>"
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
|
||||
var/datum/reagent/R = SSchemistry.chemical_reagents[reagent_ids[mode]]
|
||||
|
||||
user << "<span class='notice'>It is currently producing [R.name] and has [reagent_volumes[reagent_ids[mode]]] out of [volume] units left.</span>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user