Skip to content

Commit

Permalink
sm delam cooldown
Browse files Browse the repository at this point in the history
it seems to work I guess
  • Loading branch information
MosleyTheMalO committed Apr 23, 2024
1 parent 87e3393 commit 22b61db
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 8 deletions.
3 changes: 2 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ GLOBAL_LIST_INIT(admin_verbs_fun, list(
/client/proc/admin_away,
// /client/proc/spawn_floor_cluwne,
/client/proc/cmd_admin_toggle_fov, //CIT CHANGE - FOV
/client/proc/roll_dices //CIT CHANGE - Adds dice verb
/client/proc/roll_dices, //CIT CHANGE - Adds dice verb
/client/proc/override_sm_delam //SPLURT change - Adds SM toggle
))
GLOBAL_PROTECT(admin_verbs_fun)
GLOBAL_LIST_INIT(admin_verbs_spawn, list(/datum/admins/proc/spawn_atom, /datum/admins/proc/podspawn_atom, /datum/admins/proc/spawn_cargo, /datum/admins/proc/spawn_objasmob, /client/proc/respawn_character))
Expand Down
8 changes: 5 additions & 3 deletions config/splurt/general.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ WEIGHTED_STATION_TRAITS
# default is 24
#BASE_SAVE_SLOTS 24

# SM delamination
# Comment to make the SM not explode
SM_DELAMINATION
# SM delamination cooldown
# Configures tha amount of rounds that need to pass from the previous delam for another to happen again
# If commented or 0 will enable delaminations every round
# If -1 disables delams indefinitely
#SM_DELAMINATION_COOLDOWN 0

# Protolathe access
# Comment to make protolathes and mechfabs use their access locks
Expand Down
1 change: 1 addition & 0 deletions modular_splurt/code/_globalvars/sm_delam.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GLOBAL_VAR(delam_override) // Overides the config for delamination
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
/datum/config_entry/number/base_save_slots
default = DEFAULT_SAVE_SLOTS

/datum/config_entry/flag/sm_delamination
/datum/config_entry/number/sm_delamination_cooldown
default = 0
min_val = -1

/datum/config_entry/flag/protolock_all_access

Expand Down
15 changes: 15 additions & 0 deletions modular_splurt/code/modules/admin/verbs/sm_delam.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/client/proc/override_sm_delam()
set category = "Admin.Fun"
set name = "Toggle SM delam"
set desc = "Toggles this round's SM delam mode."

switch(GLOB.delam_override)
if(TRUE)
GLOB.delam_override = FALSE
if(FALSE)
GLOB.delam_override = null
else
GLOB.delam_override = TRUE

log_admin("[key_name(usr)] [isnull(GLOB.delam_override) ? "reset the SM delam to follow the config's rules. It is [check_sm_delam() ? "ON" : "OFF"] for the round" : "has forced the SM delam [GLOB.delam_override ? "ON" : "OFF"]"] for the round.")
message_admins("[ADMIN_LOOKUPFLW(usr)] [isnull(GLOB.delam_override) ? "reset the SM delam to follow the config's rules. It is [check_sm_delam() ? "ON" : "OFF"] for the round" : "has forced the SM delam [GLOB.delam_override ? "ON" : "OFF"]"] for the round.")
6 changes: 4 additions & 2 deletions modular_splurt/code/modules/power/reactor/rbmk.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/obj/machinery/atmospherics/components/trinary/nuclear_reactor/meltdown()
if(CONFIG_GET(flag/sm_delamination))
if(check_sm_delam())
write_sm_delam()
return ..()
shut_down()
stop_relay(CHANNEL_REACTOR_ALERT)
Expand All @@ -19,7 +20,8 @@
qdel(src)

/obj/machinery/atmospherics/components/trinary/nuclear_reactor/blowout()
if(CONFIG_GET(flag/sm_delamination))
if(check_sm_delam())
write_sm_delam()
return ..()
shut_down()
stop_relay(CHANNEL_REACTOR_ALERT)
Expand Down
31 changes: 30 additions & 1 deletion modular_splurt/code/modules/power/supermatter/supermatter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,32 @@ Custom Bombcaps:
#define EXPLOSION_MODIFIER_MEDIUM 0.5
#define EXPLOSION_MODIFIER_LARGE 0.75

// Check if the SM Can explode at all or not
/proc/check_sm_delam()
switch(GLOB.delam_override)
if(TRUE)
return TRUE
if(FALSE)
return FALSE

var/cooldown_sm = CONFIG_GET(number/sm_delamination_cooldown)

// If fully disabled
if(cooldown_sm == -1)
return FALSE

// Check if the cooldown is still active
if(!rustg_file_exists("data/last_sm_delam.txt"))
return TRUE
var/last_sm_delam = text2num(rustg_file_read("data/last_sm_delam.txt"))
if(GLOB.round_id > last_sm_delam + cooldown_sm)
return TRUE
return FALSE

// Proc to log the round in which the sm or another engine goes boom
/proc/write_sm_delam()
rustg_file_write("data/last_sm_delam.txt", "[GLOB.round_id]")

// Let's turn the base explosion power down a little...
/obj/machinery/power/supermatter_crystal
explosion_power = 22
Expand Down Expand Up @@ -56,7 +82,7 @@ Custom Bombcaps:
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "delam", /datum/mood_event/delam)

// Don't explode if we no allow
if(!CONFIG_GET(flag/sm_delamination))
if(!check_sm_delam())
investigate_log("has attempted a delamination, but the config disallows it", INVESTIGATE_SUPERMATTER)
priority_announce("Supermatter privileges revoked. Current crew is deemed unsuitable to handle a highly hazardous engine. More training is required.", "SIMULATION TERMINATED")
var/skill_issue_sound = pick('modular_splurt/sound/voice/boowomp.ogg', 'modular_splurt/sound/effects/fart_reverb.ogg')
Expand All @@ -71,6 +97,9 @@ Custom Bombcaps:
qdel(src)
return

// Log if it explodes
write_sm_delam()

// Replace the singularity and tesla delaminations with an EMP pulse. It's hard to achieve this without deliberate sabotage.
if(combined_gas > MOLE_PENALTY_THRESHOLD || power > POWER_PENALTY_THRESHOLD)
investigate_log("has reached critical mass, causing an EMP.", INVESTIGATE_SUPERMATTER)
Expand Down
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4406,6 +4406,7 @@
#include "modular_splurt\code\__HELPERS\spawns.dm"
#include "modular_splurt\code\__HELPERS\text.dm"
#include "modular_splurt\code\__HELPERS\unsorted.dm"
#include "modular_splurt\code\_globalvars\sm_delam.dm"
#include "modular_splurt\code\_globalvars\tgui.dm"
#include "modular_splurt\code\_globalvars\lists\character_directory.dm"
#include "modular_splurt\code\_globalvars\lists\global_lewd.dm"
Expand Down Expand Up @@ -4648,6 +4649,7 @@
#include "modular_splurt\code\modules\admin\verbs\one_click_antag.dm"
#include "modular_splurt\code\modules\admin\verbs\pray.dm"
#include "modular_splurt\code\modules\admin\verbs\randomverbs.dm"
#include "modular_splurt\code\modules\admin\verbs\sm_delam.dm"
#include "modular_splurt\code\modules\admin\verbs\vpnbunker.dm"
#include "modular_splurt\code\modules\antagonists\_common\antag_spawner.dm"
#include "modular_splurt\code\modules\antagonists\bloodsucker\datum_bloodsucker.dm"
Expand Down

0 comments on commit 22b61db

Please sign in to comment.