Skip to content

Commit

Permalink
refactor this
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveloopers committed Jun 24, 2024
1 parent 81717a2 commit 8993eab
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 16 deletions.
22 changes: 8 additions & 14 deletions code/datums/diseases/xeno_transformation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,16 @@
var/turf/turf = get_turf(affected_mob)
var/area/area = get_area(turf)
gibs(turf)
var/mob/living/carbon/xenomorph/drone/xeno = new()
xeno.forceMove(turf)
xeno.set_hive_and_update(XENO_HIVE_FERAL)
if(ismonkey(affected_mob))
new /mob/living/simple_animal/hostile/alien/ravager(turf)
qdel(affected_mob)
xeno.free_for_ghosts(TRUE)
else
var/mob/living/carbon/human/H = affected_mob
H.Alienize(XENO_T3_CASTES)
affected_mob.mind.transfer_to(xeno, TRUE)

src.cure()
qdel(affected_mob)

if(istype(area, /area/almayer/medical/containment))
if(!GLOB.chemical_data.DDI_experiment_done)
GLOB.chemical_data.DDI_experiment_done = TRUE

ai_announcement("Notice: Unidentified lifesign detected at research containment, analyzing data...")
sleep(10 SECONDS)
GLOB.chemical_data.update_credits(20)
var/datum/techtree/tree = GET_TREE(TREE_MARINE)
tree.add_points(20)
ai_announcement("Notice: Lifesign concluded to be the product of DNA Disintegrating, research data logged. 20 tech points and research credits awarded.")

GLOB.ddi_experiment.trigger(xeno)
2 changes: 0 additions & 2 deletions code/modules/reagents/chemical_research/Chemical-Research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ GLOBAL_DATUM_INIT(chemical_data, /datum/chemical_data, new)
var/clearance_level = 1
var/clearance_x_access = FALSE
var/reached_x_access = FALSE
var/DDI_experiment_done = FALSE
var/has_new_properties = FALSE
var/research_allocation_amount = 5
var/list/research_documents = list()
Expand Down Expand Up @@ -156,4 +155,3 @@ GLOBAL_DATUM_INIT(chemical_data, /datum/chemical_data, new)
clue["text"] = chem.name

return clue

42 changes: 42 additions & 0 deletions code/modules/reagents/chemical_research/research-events.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
GLOBAL_DATUM_INIT(ddi_experiment, /datum/research_event/ddi_experiment, new)

/datum/research_event/ddi_experiment
var/DDI_experiment_triggered = FALSE
var/DDI_experiment_xeno = null
var/timer
var/total_points_given = 0

/datum/research_event/ddi_experiment/proc/trigger(xeno)
if(DDI_experiment_triggered)
return
DDI_experiment_triggered = TRUE
DDI_experiment_xeno = xeno

ai_announcement("Notice: Unidentified lifesign detected at research containment created through DNA disintegration, analyzing data...")
sleep(5 SECONDS)
ai_announcement("Notice: Lifeform biostructural data can be analyzed further for tech point reward at a rate of 1 tech point per minute.")

timer = world.time
START_PROCESSING(SSprocessing, src)

/datum/research_event/ddi_experiment/process(delta_time)
if(total_points_given >= 20)
STOP_PROCESSING(SSprocessing, src)
ai_announcement("Notice: Lifeform biostructural data fully analyzed, 20 total tech points and research credits awarded. Recommend termination of lifeform.")
return

var/mob/living/carbon/xenomorph/xeno = DDI_experiment_xeno
var/area/xeno_loc = get_area(xeno.loc)

if(!xeno || xeno.stat == DEAD || !istype(xeno_loc, /area/almayer/medical/containment))
if(total_points_given < 20)
ai_announcement("Notice: Lifeform terminated or missing, biostructrual data not fully analyzed. Only [total_points_given] out of [20] tech and research points awarded.")
STOP_PROCESSING(SSprocessing, src)
return

if(world.time >= timer + 1 MINUTES)
timer = world.time
GLOB.chemical_data.update_credits(1)
var/datum/techtree/tree = GET_TREE(TREE_MARINE)
tree.add_points(1)
total_points_given++
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,7 @@
#include "code\modules\reagents\Chemistry-Vessel.dm"
#include "code\modules\reagents\chemical_research\Chemical-Research.dm"
#include "code\modules\reagents\chemical_research\generated_reagents.dm"
#include "code\modules\reagents\chemical_research\research-events.dm"
#include "code\modules\reagents\chemistry_machinery\acid_harness.dm"
#include "code\modules\reagents\chemistry_machinery\autodispenser.dm"
#include "code\modules\reagents\chemistry_machinery\centrifuge.dm"
Expand Down

0 comments on commit 8993eab

Please sign in to comment.