Skip to content

Commit

Permalink
Facility upgrades (#1644)
Browse files Browse the repository at this point in the history
* Initial changes

* Facility upgrades!

* Max bullet ammo upgrade + some fixes/tweaks

* Fix bulletes

* More upgrades, dynamic cost, more LOB points

* Some fixes

* Fix healing upgrade

* Some adjustments

* Oopsie

* Bonus to earned abno understanding on low agent pop

* Display value of heal increase is fixed

* Meltdown count scales with agent pop

* Extra cores only need the midnight being done in time limit.

* Tiny "fix"

* Logs console displays understanding level

* Agent stats upgrade has dynamic cost now

* Agent stats upgrade applies to all living agents on purchase

* Oopsie

* All conflicts fixed

* oop

* Command core quick fix

* Melt time upgrade dynamic cost

* Tiny buff

* Command core suppression tweaks

* FIX AOE BULLETS

* Fixes pale fixer teleport, hopefuly

* Records run text fix

* Don't swap abnos that are being worked

* Assorted twewaks and fixes for records core

* qdel check

* More core options at the start

* Tweak records core

* Added connected structures system to abnos; Minor tweaks.

* Core suppression "code refactor"

* A better core suppression code refactor

* Even more core stuff; Added persistent info on cores

* Proper desc and run text for day 47 core

* This should fix CC core.

* Day 47 proper requirements

* Minor spelling mistake

* Minor fixes to records core

* Various fixes

* fix..?

* Tweaks to upgrades

* Manager camera fixes

* All keter ordeals

* Fix text alignment

* Keter requirements only check the agent players

* Manager camera + holo commands code improvement

* Tiny fix

* Training core description is now more accurate

* Fix connected structures

* Fixes

* Training core during Keter is inverted

* Keter text fix

* PBird perch fix

* Command core fix

* Insane examine text fix

* Nobody Is connected structure
  • Loading branch information
EgorDinamit authored Dec 6, 2023
1 parent a6ae770 commit b9577a1
Show file tree
Hide file tree
Showing 49 changed files with 1,090 additions and 383 deletions.
1 change: 1 addition & 0 deletions ModularTegustation/tegu_items/gadgets/manager_bullets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

/datum/status_effect/interventionshield/on_apply()
. = ..()
shieldhealth = GetFacilityUpgradeValue(UPGRADE_BULLET_SHIELD_HEALTH)
owner.add_overlay(statuseffectvisual)
owner.visible_message(span_notice("[owner]s shield activates!"))
RegisterSignal(owner, COMSIG_MOB_APPLY_DAMGE, .proc/OnApplyDamage) //stolen from caluan
Expand Down
14 changes: 7 additions & 7 deletions ModularTegustation/tegu_items/gadgets/unpowered.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
var/max_commands = 5
//Command Types that can be deployed. Listed in order of commandtype.
var/list/commandtypes = list(
/obj/effect/temp_visual/HoloCommand/commandMove,
/obj/effect/temp_visual/HoloCommand/commandWarn,
/obj/effect/temp_visual/HoloCommand/commandGaurd,
/obj/effect/temp_visual/HoloCommand/commandHeal,
/obj/effect/temp_visual/HoloCommand/commandFightA,
/obj/effect/temp_visual/HoloCommand/commandFightB
/obj/effect/temp_visual/holo_command/command_move,
/obj/effect/temp_visual/holo_command/command_warn,
/obj/effect/temp_visual/holo_command/command_guard,
/obj/effect/temp_visual/holo_command/command_heal,
/obj/effect/temp_visual/holo_command/command_fight_a,
/obj/effect/temp_visual/holo_command/command_fight_b,
)

/obj/item/commandprojector/attack_self(mob/user)
Expand Down Expand Up @@ -104,7 +104,7 @@
/obj/item/commandprojector/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
if(cooldown <= world.time)
for(var/obj/effect/temp_visual/HoloCommand/V in get_turf(target))
for(var/obj/effect/temp_visual/holo_command/V in get_turf(target))
qdel(V)
return
if(current_commands >= max_commands)
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1070,3 +1070,7 @@
#define COMSIG_FEAR_EFFECT "fear_effect"
///Whenever the season is changed through god of the seasons or its E.G.O.
#define COMSIG_GLOB_SEASON_CHANGE "!change_season"

// Ordeal signals
// When the ordeal ends; (/datum/ordeal)
#define COMSIG_GLOB_ORDEAL_END "!ordeal_end"
20 changes: 20 additions & 0 deletions code/__DEFINES/facility_upgrades.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// How many LOB points you can get from working abnos to the maximum understanding
#define MAX_ABNO_LOB_POINTS 18

// Bullets. These defines are also used in manager_camera.dm
#define HP_BULLET "HP Bullet"
#define SP_BULLET "SP Bullet"
#define RED_BULLET "RED Shield Bullet"
#define WHITE_BULLET "WHITE Shield Bullet"
#define BLACK_BULLET "BLACK Shield Bullet"
#define PALE_BULLET "PALE Shield Bullet"
#define YELLOW_BULLET "Qliphoth Intervention Bullet"
// Bullet upgrades.
#define UPGRADE_BULLET_COUNT "Maximum Bullet Count"
#define UPGRADE_BULLET_HEAL "Bullet Healing Amount"
#define UPGRADE_BULLET_SHIELD_HEALTH "Bullet Shield Health"
// Agent upgrades
#define UPGRADE_AGENT_STATS "Agent Starting Attributes Bonus"
// Abnormality upgrades
#define UPGRADE_ABNO_QUEUE_COUNT "Abnormality Extraction Amount"
#define UPGRADE_ABNO_MELT_TIME "Abnormality Meltdown Bonus Duration"
17 changes: 17 additions & 0 deletions code/__DEFINES/lobotomy_corp.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Names of core suppressions */
// Normal ones
#define CONTROL_CORE_SUPPRESSION "Control Core Suppression"
#define INFORMATION_CORE_SUPPRESSION "Information Core Suppression"
#define SAFETY_CORE_SUPPRESSION "Safety Core Suppression"
#define TRAINING_CORE_SUPPRESSION "Training Core Suppression"
#define COMMAND_CORE_SUPPRESSION "Central Command Core Suppression"
#define WELFARE_CORE_SUPPRESSION "Welfare Core Suppression"
#define DISCIPLINARY_CORE_SUPPRESSION "Disciplinary Core Suppression"
#define RECORDS_CORE_SUPPRESSION "Records Core Suppression"
#define EXTRACTION_CORE_SUPPRESSION "Extraction Core Suppression"
// Keter
#define DAY46_CORE_SUPPRESSION "Proving Oneself"
#define DAY47_CORE_SUPPRESSION "Fatigue and Waiting"
#define DAY48_CORE_SUPPRESSION "Regret and Atonement"
#define DAY49_CORE_SUPPRESSION "Freedom and Redemption"
#define DAY50_CORE_SUPPRESSION "Tree of Light"
26 changes: 26 additions & 0 deletions code/__HELPERS/lobotomy_corp.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// Returns list of all living agents that can work
/proc/AllLivingAgents()
. = list()
for(var/mob/living/carbon/human/H in GLOB.player_list)
if(H.stat == DEAD)
continue
if(!(H.mind.assigned_role in GLOB.security_positions))
continue
if(HAS_TRAIT(H, TRAIT_WORK_FORBIDDEN))
continue
. += H

/// Returns amount of available agents that can work
/proc/AvailableAgentCount()
. = 0
for(var/mob/living/carbon/human/H in AllLivingAgents())
if(!H.client)
continue
if(!H.mind)
continue
. += 1

/* Core Suppression helpers */
/// Returns core suppression by path if its effects are active
/proc/GetCoreSuppression(datum/suppression/CS = null)
return locate(CS) in SSlobotomy_corp.active_core_suppressions
4 changes: 2 additions & 2 deletions code/__HELPERS/priority_announce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
return

// All your text is gone. Enjoy.
if(istype(SSlobotomy_corp.core_suppression, /datum/suppression/information))
var/datum/suppression/information/I = SSlobotomy_corp.core_suppression
var/datum/suppression/information/I = GetCoreSuppression(/datum/suppression/information)
if(istype(I))
text = Gibberish(text, TRUE, I.gibberish_value)

var/announcement
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/abnormality_queue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SUBSYSTEM_DEF(abnormality_queue)
if(!LAZYLEN(possible_abnormalities[lev]))
continue
picking_abno |= possible_abnormalities[lev]
for(var/i = 1 to 3)
for(var/i = 1 to GetFacilityUpgradeValue(UPGRADE_ABNO_QUEUE_COUNT))
if(!LAZYLEN(picking_abno))
break
var/chosen_abno = pickweight(picking_abno)
Expand Down
40 changes: 32 additions & 8 deletions code/controllers/subsystem/lobotomy_corp.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Meltdown types
#define MELTDOWN_NORMAL 1
#define MELTDOWN_GRAY 2
#define MELTDOWN_GOLD 3
Expand Down Expand Up @@ -54,6 +55,8 @@ SUBSYSTEM_DEF(lobotomy_corp)
var/list/current_ordeals = list()
// Currently running core suppression
var/datum/suppression/core_suppression = null
// List of active core suppressions; Different from above, as there can only be one "main" core
var/list/active_core_suppressions = list()
// List of available core suppressions for manager to choose
var/list/available_core_suppressions = list()
// State of the core suppression
Expand All @@ -62,6 +65,8 @@ SUBSYSTEM_DEF(lobotomy_corp)
var/list/work_logs = list()
// Work logs, but from agent perspective. Used mainly for round-end report
var/list/work_stats = list()
// List of facility upgrade datums
var/list/upgrades = list()

// PE available to be spent
var/available_box = 0
Expand All @@ -86,13 +91,17 @@ SUBSYSTEM_DEF(lobotomy_corp)
/// Amount of abnormalities that agents achieved full understanding on
var/understood_abnos = 0
/// The amount of core suppression options that will be available
var/max_core_options = 2
var/max_core_options = 3
/// Points used for facility upgrades
var/lob_points = 2

/datum/controller/subsystem/lobotomy_corp/Initialize(timeofday)
. = ..()
addtimer(CALLBACK(src, .proc/SetGoal), 5 MINUTES)
addtimer(CALLBACK(src, .proc/InitializeOrdeals), 60 SECONDS)
addtimer(CALLBACK(src, .proc/PickPotentialSuppressions), 60 SECONDS)
for(var/F in subtypesof(/datum/facility_upgrade))
upgrades += new F

/datum/controller/subsystem/lobotomy_corp/proc/SetGoal()
var/player_mod = GLOB.clients.len * 0.15
Expand Down Expand Up @@ -126,6 +135,12 @@ SUBSYSTEM_DEF(lobotomy_corp)
continue
if(extra_core && !initial(C.after_midnight))
cores -= core_type
continue
// Create to see if it meets requirements and becomes available
C = new core_type()
if(!C.available)
cores -= core_type
qdel(C)
for(var/i = 1 to max_core_options)
if(!LAZYLEN(cores))
break
Expand Down Expand Up @@ -159,6 +174,7 @@ SUBSYSTEM_DEF(lobotomy_corp)
for(var/obj/machinery/computer/abnormality_auxiliary/A in GLOB.abnormality_auxiliary_consoles)
A.audible_message("<span class='userdanger'>Core Suppression options have been disabled for this shift!</span>")
playsound(get_turf(A), 'sound/machines/dun_don_alert.ogg', 100, TRUE, 14)
A.selected_core_type = null
A.updateUsrDialog()
available_core_suppressions = list()
if(announce)
Expand Down Expand Up @@ -200,6 +216,7 @@ SUBSYSTEM_DEF(lobotomy_corp)
if(goal_reached || box_goal == 0)
return
if(available_box + goal_boxes >= box_goal)
AddLobPoints(4, "Quota Reward")
available_box -= box_goal - goal_boxes // Leftover is drained
goal_reached = TRUE
priority_announce("The energy production goal has been reached.", "Energy Production", sound='sound/misc/notice2.ogg')
Expand Down Expand Up @@ -233,10 +250,7 @@ SUBSYSTEM_DEF(lobotomy_corp)
qliphoth_meltdown_affected -= TETH_LEVEL
qliphoth_meter = 0
var/abno_amount = all_abnormality_datums.len
var/player_count = 0
for(var/mob/player in GLOB.player_list)
if(isliving(player) && (player.mind?.assigned_role in GLOB.security_positions))
player_count += 1
var/player_count = AvailableAgentCount()
qliphoth_max = (player_count > 1 ? 4 : 3) + round(player_count * 0.8) // Some extra help on non solo rounds
qliphoth_state += 1
for(var/datum/abnormality/A in all_abnormality_datums)
Expand All @@ -255,14 +269,16 @@ SUBSYSTEM_DEF(lobotomy_corp)
if(ran_ordeal)
return
InitiateMeltdown(qliphoth_meltdown_amount, FALSE)
qliphoth_meltdown_amount = max(1, round(abno_amount * CONFIG_GET(number/qliphoth_meltdown_percent)))
// Less agents will decrease meltdown count, but more - increase it
var/agent_mod = 0.4 + (player_count * 0.1)
qliphoth_meltdown_amount = clamp(round(abno_amount * CONFIG_GET(number/qliphoth_meltdown_percent) * agent_mod), 1, abno_amount * 0.5)

/datum/controller/subsystem/lobotomy_corp/proc/InitiateMeltdown(meltdown_amount = 1, forced = TRUE, type = MELTDOWN_NORMAL, min_time = 60, max_time = 90, alert_text = "Qliphoth meltdown occured in containment zones of the following abnormalities:", alert_sound = 'sound/effects/meltdownAlert.ogg')
// Honestly, I wish I could do it another way, but oh well
if(istype(core_suppression, /datum/suppression/command))
var/datum/suppression/command/C = GetCoreSuppression(/datum/suppression/command)
if(istype(C))
// All abno levels melt
forced = TRUE
var/datum/suppression/command/C = core_suppression
meltdown_amount += C.meltdown_count_increase
min_time = round(min_time * C.meltdown_time_multiplier)
max_time = round(max_time * C.meltdown_time_multiplier)
Expand Down Expand Up @@ -328,3 +344,11 @@ SUBSYSTEM_DEF(lobotomy_corp)
next_ordeal = null
RollOrdeal()
return TRUE // Very sloppy, but will do for now

/// Adds LOB points and notifies players via aux consoles
/datum/controller/subsystem/lobotomy_corp/proc/AddLobPoints(amount = 1, message = "UNKNOWN")
lob_points += amount
for(var/obj/machinery/computer/abnormality_auxiliary/A in GLOB.abnormality_auxiliary_consoles)
A.audible_message("<span class='notice'>[round(amount, 0.1)] LOB point[amount > 1 ? "s" : ""] deposited! Reason: [message].</span>")
playsound(get_turf(A), 'sound/machines/twobeep_high.ogg', 20, TRUE)
A.updateUsrDialog()
31 changes: 31 additions & 0 deletions code/controllers/subsystem/persistence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define FILE_AGENT_REP "data/AgentReputation.json"
#define FILE_PE_QUOTA "data/PEQuota.json"
#define FILE_ABNO_PICKS "data/AbnormalityRates.json"
#define FILE_CORE_SUPPRESSIONS "data/ClearedCores.json"

#define KEEP_ROUNDS_MAP 3

Expand All @@ -28,6 +29,8 @@ SUBSYSTEM_DEF(persistence)
var/list/obj/structure/sign/painting/painting_frames = list()
var/list/paintings = list()
var/list/abno_rates = list()
/// List of ckeys with list of core suppression names that they have cleared before
var/list/cleared_core_suppressions = list()

/datum/controller/subsystem/persistence/Initialize()
LoadPoly()
Expand All @@ -42,6 +45,7 @@ SUBSYSTEM_DEF(persistence)
if(SSmaptype.maptype in list("standard", "skeld", "fishing", "wonderlabs"))
LoadPEStatus()
LoadAbnoPicks()
LoadClearedCores()
LoadRandomizedRecipes()
LoadPaintings()
load_custom_outfits()
Expand Down Expand Up @@ -419,6 +423,33 @@ SUBSYSTEM_DEF(persistence)
fdel(FILE_ABNO_PICKS)
text2file(json_encode(abno_rates), FILE_ABNO_PICKS)

/datum/controller/subsystem/persistence/proc/LoadClearedCores()
var/json = file2text(FILE_CORE_SUPPRESSIONS)
if(!json)
var/json_file = file(FILE_CORE_SUPPRESSIONS)
if(!fexists(json_file))
WARNING("Failed to load cleared cores. File likely corrupt.")
return
return
cleared_core_suppressions = json_decode(json)

/datum/controller/subsystem/persistence/proc/UpdateClearedCores(datum/suppression/S)
if(!istype(S))
return

for(var/mob/living/carbon/human/H in GLOB.player_list)
if(H.stat == DEAD)
continue
if(!H.client || !H.ckey)
continue

if(!islist(cleared_core_suppressions[H.ckey]))
cleared_core_suppressions[H.ckey] = list()
cleared_core_suppressions[H.ckey] |= S.name

fdel(FILE_CORE_SUPPRESSIONS)
text2file(json_encode(cleared_core_suppressions), FILE_CORE_SUPPRESSIONS)

/datum/controller/subsystem/persistence/proc/LoadRandomizedRecipes()
var/json_file = file("data/RandomizedChemRecipes.json")
var/json
Expand Down
25 changes: 24 additions & 1 deletion code/datums/abnormality/datum/abnormality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
var/list/transferable_var
///if the abno spawns with a slime radio or not
var/abno_radio = FALSE
// Object = list(x tile offset, y tile offset)
/// List of connected structures; Used to teleport and delete them when abnormality is swapped or deleted
var/list/connected_structures = list()

/datum/abnormality/New(obj/effect/landmark/abnormality_spawn/new_landmark, mob/living/simple_animal/hostile/abnormality/new_type = null)
if(!istype(new_landmark))
Expand All @@ -78,11 +81,14 @@
SSlobotomy_corp.all_abnormality_datums -= src
for(var/datum/ego_datum/ED in ego_datums)
qdel(ED)
for(var/atom/A in connected_structures)
qdel(A)
QDEL_NULL(landmark)
QDEL_NULL(current)
ego_datums = null
landmark = null
current = null
connected_structures = null
..()

/datum/abnormality/proc/RespawnAbno()
Expand Down Expand Up @@ -190,11 +196,17 @@
overload_chance[user.ckey] = max(overload_chance[user.ckey] + overload_chance_amount, overload_chance_limit)

/datum/abnormality/proc/UpdateUnderstanding(percent)
if (understanding != max_understanding) // This should render "full_understood" not required.
// Lower agent pop gets a bonus
var/agent_count = AvailableAgentCount()
if(agent_count <= 5 && percent)
percent *= 1 + (3 / agent_count)

if(understanding != max_understanding) // This should render "full_understood" not required.
understanding = clamp((understanding + (max_understanding*percent/100)), 0, max_understanding)
if (understanding == max_understanding) // Checks for max understanding after the fact
current.gift_chance *= 1.5
SSlobotomy_corp.understood_abnos++
SSlobotomy_corp.AddLobPoints(MAX_ABNO_LOB_POINTS / SSabnormality_queue.rooms_start, "Abnormality Understanding")
else if(understanding == max_understanding && percent < 0) // If we're max and we reduce, undo the count.
understanding = clamp((understanding + (max_understanding*percent/100)), 0, max_understanding)
if (understanding != max_understanding) // Checks for max understanding after the fact
Expand Down Expand Up @@ -287,6 +299,8 @@
return FALSE
if(istype(target.current) && !target.current.IsContained())
return FALSE
if(working || target.working)
return FALSE
// A very silly method to get the objects in the cell
var/list/objs_src = view(7, landmark)
var/list/objs_target = view(7, target.landmark)
Expand Down Expand Up @@ -331,6 +345,15 @@
C1.c_tag = "Containment zone: [target.name]"
if(C2)
C2.c_tag = "Containment zone: [name]"
// Move structures
for(var/atom/movable/A in connected_structures)
A.forceMove(get_turf(landmark))
A.x += connected_structures[A][1]
A.y += connected_structures[A][2]
for(var/atom/movable/A in target.connected_structures)
A.forceMove(get_turf(target.landmark))
A.x += connected_structures[A][1]
A.y += connected_structures[A][2]
// And finally, move abnormalities around
if(current)
current.forceMove(get_turf(landmark))
Expand Down
Loading

0 comments on commit b9577a1

Please sign in to comment.