Skip to content

Commit

Permalink
Converting config to a decl system.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 15, 2024
1 parent 4fb5baa commit f833866
Show file tree
Hide file tree
Showing 168 changed files with 3,007 additions and 2,249 deletions.
6 changes: 3 additions & 3 deletions code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
#define FLASH_PROTECTION_MODERATE 2
#define FLASH_PROTECTION_MAJOR 3

#define ANIMAL_SPAWN_DELAY round(config.respawn_delay / 6)
#define DRONE_SPAWN_DELAY round(config.respawn_delay / 3)
#define ANIMAL_SPAWN_DELAY round(get_config_value(/decl/config/num/respawn_delay) / 6)
#define DRONE_SPAWN_DELAY round(get_config_value(/decl/config/num/respawn_delay) / 3)

// Incapacitation flags, used by the mob/proc/incapacitated() proc
#define INCAPACITATION_NONE 0
Expand Down Expand Up @@ -330,7 +330,7 @@ var/global/list/dexterity_levels = list(
#define INJECTION_PORT 2
#define INJECTION_PORT_DELAY 3 SECONDS // used by injectors to apply delay due to searching for a port on the injectee's suit

#define ADJUSTED_GLIDE_SIZE(DELAY) (NONUNIT_CEILING((WORLD_ICON_SIZE / max((DELAY), world.tick_lag) * world.tick_lag) - world.tick_lag, 1) + (config.glide_size_delay))
#define ADJUSTED_GLIDE_SIZE(DELAY) (NONUNIT_CEILING((WORLD_ICON_SIZE / max((DELAY), world.tick_lag) * world.tick_lag) - world.tick_lag, 1) + (get_config_value(/decl/config/num/movement_glide_size)))

#define PREF_MEM_RECORD "memory"
#define PREF_SEC_RECORD "sec_record"
Expand Down
3 changes: 3 additions & 0 deletions code/_helpers/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,8 @@
/proc/cmp_gripper_asc(datum/inventory_slot/gripper/a, datum/inventory_slot/gripper/b)
return a.hand_sort_priority - b.hand_sort_priority

/proc/cmp_decl_uid_asc(decl/a, decl/b)
return sorttext(b.uid, a.uid)

/proc/cmp_inventory_slot_desc(datum/inventory_slot/a, datum/inventory_slot/b)
return b.quick_equip_priority - a.quick_equip_priority
2 changes: 1 addition & 1 deletion code/_helpers/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
/proc/SecondsToTicks(var/seconds)
return seconds * 10

/proc/round_is_spooky(var/spookiness_threshold = config.cult_ghostwriter_req_cultists)
/proc/round_is_spooky(var/spookiness_threshold = get_config_value(/decl/config/num/cult_ghostwriter_req_cultists))
var/decl/special_role/cult = GET_DECL(/decl/special_role/cultist)
return (cult.current_antagonists.len > spookiness_threshold)

Expand Down
28 changes: 14 additions & 14 deletions code/_helpers/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""

/proc/log_admin(text)
global.admin_log.Add(text)
if (config.log_admin)
if (get_config_value(/decl/config/toggle/log_admin))
game_log("ADMIN", text)

/proc/log_debug(text)
if (config.log_debug)
if (get_config_value(/decl/config/toggle/log_debug))
game_log("DEBUG", text)
to_debug_listeners(text)

Expand All @@ -58,47 +58,47 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""
to_chat(C, "[prefix]: [text]")

/proc/log_game(text)
if (config.log_game)
if (get_config_value(/decl/config/toggle/log_game))
game_log("GAME", text)

/proc/log_vote(text)
if (config.log_vote)
if (get_config_value(/decl/config/toggle/log_vote))
game_log("VOTE", text)

/proc/log_access(text)
if (config.log_access)
if (get_config_value(/decl/config/toggle/log_access))
game_log("ACCESS", text)

/proc/log_say(text)
if (config.log_say)
if (get_config_value(/decl/config/toggle/log_say))
game_log("SAY", text)

/proc/log_ooc(text)
if (config.log_ooc)
if (get_config_value(/decl/config/toggle/log_ooc))
game_log("OOC", text)

/proc/log_whisper(text)
if (config.log_whisper)
if (get_config_value(/decl/config/toggle/log_whisper))
game_log("WHISPER", text)

/proc/log_emote(text)
if (config.log_emote)
if (get_config_value(/decl/config/toggle/log_emotes))
game_log("EMOTE", text)

/proc/log_attack(text)
if (config.log_attack)
if (get_config_value(/decl/config/toggle/log_attack))
game_log("ATTACK", text)

/proc/log_adminsay(text)
if (config.log_adminchat)
if (get_config_value(/decl/config/toggle/log_adminchat))
game_log("ADMINSAY", text)

/proc/log_adminwarn(text)
if (config.log_adminwarn)
if (get_config_value(/decl/config/toggle/log_adminwarn))
game_log("ADMINWARN", text)

/proc/log_pda(text)
if (config.log_pda)
if (get_config_value(/decl/config/toggle/log_pda))
game_log("PDA", text)

/proc/log_misc(text)
Expand All @@ -114,7 +114,7 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""
//This replaces world.log so it displays both in DD and the file
/proc/log_world(text)
to_world_log(text) //this comes before the config check because it can't possibly runtime
if(config.log_world_output)
if(get_config_value(/decl/config/toggle/log_world_output))
game_log("DD_OUTPUT", text)

//pretty print a direction bitflag, can be useful for debugging.
Expand Down
12 changes: 7 additions & 5 deletions code/_helpers/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var/global/religion_name = null

/proc/station_name()
if(!global.using_map)
return config.server_name
return get_config_value(/decl/config/text/server_name)
if (global.using_map.station_name)
return global.using_map.station_name

Expand Down Expand Up @@ -90,8 +90,9 @@ var/global/religion_name = null
if(5)
global.using_map.station_name += pick(global.numbers_as_words)

if (config && config.server_name)
world.name = "[config.server_name]: [name]"
var/config_server_name = get_config_value(/decl/config/text/server_name)
if (config_server_name)
world.name = "[config_server_name]: [name]"
else
world.name = global.using_map.station_name

Expand All @@ -100,8 +101,9 @@ var/global/religion_name = null
/proc/world_name(var/name)
global.using_map.station_name = name

if (config && config.server_name)
world.name = "[config.server_name]: [name]"
var/config_server_name = get_config_value(/decl/config/text/server_name)
if (config_server_name)
world.name = "[config_server_name]: [name]"
else
world.name = name

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
next_move = max(world.time + timeout, next_move)

/mob/proc/canClick()
if(config.no_click_cooldown || next_move <= world.time)
if(get_config_value(/decl/config/toggle/no_click_cooldown) || next_move <= world.time)
return 1
return 0

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if(!canClick()) return
setClickCooldown(DEFAULT_QUICK_COOLDOWN)

// You are responsible for checking config.ghost_interaction when you override this function
// You are responsible for checking ghost_interaction when you override this function
// Not all of them require checking, see below
var/list/modifiers = params2list(params)
if(modifiers["alt"])
Expand Down
10 changes: 6 additions & 4 deletions code/_onclick/hud/screen/screen_click_catcher.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
var/global/list/click_catchers
/proc/get_click_catchers()
if(!global.click_catchers)
var/client_max_x = get_config_value(/decl/config/num/clients/max_client_view_x)
var/client_max_y = get_config_value(/decl/config/num/clients/max_client_view_y)
global.click_catchers = list()
var/ox = -(round(config.max_client_view_x*0.5))
for(var/i = 0 to config.max_client_view_x)
var/oy = -(round(config.max_client_view_y*0.5))
var/ox = -(round(client_max_x*0.5))
for(var/i = 0 to client_max_x)
var/oy = -(round(client_max_y*0.5))
var/tx = ox + i
for(var/j = 0 to config.max_client_view_y)
for(var/j = 0 to client_max_y)
var/ty = oy + j
var/obj/screen/click_catcher/CC = new
CC.screen_loc = "CENTER[tx < 0 ? tx : "+[tx]"],CENTER[ty < 0 ? ty : "+[ty]"]"
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/autotransfer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var/global/datum/controller/transfer_controller/transfer_controller
var/timerbuffer = 0 //buffer for time check

/datum/controller/transfer_controller/New()
timerbuffer = config.vote_autotransfer_initial
timerbuffer = get_config_value(/decl/config/num/vote_autotransfer_initial)
START_PROCESSING(SSprocessing, src)

/datum/controller/transfer_controller/Destroy()
Expand All @@ -14,7 +14,7 @@ var/global/datum/controller/transfer_controller/transfer_controller
/datum/controller/transfer_controller/Process()
if (time_till_transfer_vote() <= 0)
SSvote.initiate_vote(/datum/vote/transfer, automatic = 1)
timerbuffer += config.vote_autotransfer_interval
timerbuffer += get_config_value(/decl/config/num/vote_autotransfer_interval)

/datum/controller/transfer_controller/proc/time_till_transfer_vote()
return timerbuffer - round_duration_in_ticks - (1 MINUTE)
Loading

0 comments on commit f833866

Please sign in to comment.