Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LC4492 committed Nov 22, 2023
2 parents 6b2ecb1 + b98d603 commit 45ef7c6
Show file tree
Hide file tree
Showing 63 changed files with 1,864 additions and 1,327 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
// Subsystems shutdown in the reverse of the order they initialize in
// The numbers just define the ordering, they are meaningless otherwise.

#define SS_INIT_PROFILER 86
#define SS_INIT_INPUT 85
#define SS_INIT_TOPIC 83
#define SS_INIT_LOBBYART 82
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
#define TRAIT_IMMOBILIZED "immobilized"
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"
/// Apply this to identify a mob as merged with weeds
#define TRAIT_MERGED_WITH_WEEDS "merged_with_weeds"

// SPECIES TRAITS
/// Knowledge of Yautja technology
Expand Down
22 changes: 0 additions & 22 deletions code/__HELPERS/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,10 @@
all_jobs += new jobtype
return all_jobs


/proc/get_all_centcom_jobs() return list()

//gets the actual job rank (ignoring alt titles)
//this is used solely for sechuds
/obj/proc/GetJobRealName()
if (!istype(src,/obj/item/card/id)) return
var/obj/item/card/id/I = src
if(I.rank in GLOB.joblist) return I.rank
if(I.assignment in GLOB.joblist) return I.assignment
return "Unknown"

/proc/get_all_job_icons() return GLOB.joblist + list("Prisoner")//For all existing HUD icons

/obj/proc/GetJobName() //Used in secHUD icon generation
var/obj/item/card/id/I = src
if(istype(I))
var/job_icons = get_all_job_icons()
var/centcom = get_all_centcom_jobs()

if(I.assignment in job_icons) return I.assignment//Check if the job has a hud icon
if(I.rank in job_icons) return I.rank
if(I.assignment in centcom) return "Centcom"//Return with the NT logo if it is a Centcom job
if(I.rank in centcom) return "Centcom"
return "Unknown" //Return unknown if none of the above apply

/proc/get_actual_job_name(mob/M)
if(!M)
return null
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
var/obj/structure/S = A
S.do_climb(src, mods)
return TRUE
else if(!(isitem(A) && get_dist(src, A) <= 1) && client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_SWAP_HANDS)
else if(!(isitem(A) && get_dist(src, A) <= 1) && (client && (client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_SWAP_HANDS)))
swap_hand()
return TRUE

Expand Down
2 changes: 2 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,5 @@ This maintains a list of ip addresses that are able to bypass topic filtering.
protection = CONFIG_ENTRY_HIDDEN|CONFIG_ENTRY_LOCKED

/datum/config_entry/flag/guest_ban

/datum/config_entry/flag/auto_profile
8 changes: 4 additions & 4 deletions code/controllers/subsystem/hijack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ SUBSYSTEM_DEF(hijack)

switch(announce)
if(1)
marine_announcement("Emergency fuel replenishment at 25 percent. Lifeboat emergency early launch now available.[marine_warning_areas ? "\nTo increase speed restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
marine_announcement("Emergency fuel replenishment is at 25 percent. Lifeboat emergency early launch is now available.[marine_warning_areas ? "\nTo increase speed, restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
if(2)
marine_announcement("Emergency fuel replenishment at 50 percent.[marine_warning_areas ? "\nTo increase speed restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
marine_announcement("Emergency fuel replenishment is at 50 percent.[marine_warning_areas ? "\nTo increase speed, restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
if(3)
marine_announcement("Emergency fuel replenishment at 75 percent.[marine_warning_areas ? "\nTo increase speed restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
marine_announcement("Emergency fuel replenishment is at 75 percent.[marine_warning_areas ? "\nTo increase speed, restore power to the following areas: [marine_warning_areas]" : " All fueling areas operational."]", HIJACK_ANNOUNCE)
if(4)
marine_announcement("Emergency fuel replenishment at 100 percent. Safe utilization of lifeboats now possible.", HIJACK_ANNOUNCE)
marine_announcement("Emergency fuel replenishment is at 100 percent. Safe utilization of lifeboats and pods is now possible.", HIJACK_ANNOUNCE)
if(!admin_sd_blocked)
addtimer(CALLBACK(src, PROC_REF(unlock_self_destruct)), 8 SECONDS)

Expand Down
74 changes: 74 additions & 0 deletions code/controllers/subsystem/profiler.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#define PROFILER_FILENAME "profiler.json"
#define SENDMAPS_FILENAME "sendmaps.json"

SUBSYSTEM_DEF(profiler)
name = "Profiler"
init_order = SS_INIT_PROFILER
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
wait = 300 SECONDS
var/fetch_cost = 0
var/write_cost = 0

/datum/controller/subsystem/profiler/stat_entry(msg)
msg += "F:[round(fetch_cost,1)]ms"
msg += "|W:[round(write_cost,1)]ms"
return msg

/datum/controller/subsystem/profiler/Initialize()
if(CONFIG_GET(flag/auto_profile))
StartProfiling()
else
StopProfiling() //Stop the early start profiler
return SS_INIT_SUCCESS

/datum/controller/subsystem/profiler/OnConfigLoad()
if(CONFIG_GET(flag/auto_profile))
StartProfiling()
can_fire = TRUE
else
StopProfiling()
can_fire = FALSE

/datum/controller/subsystem/profiler/fire()
DumpFile()

/datum/controller/subsystem/profiler/Shutdown()
if(CONFIG_GET(flag/auto_profile))
DumpFile(allow_yield = FALSE)
world.Profile(PROFILE_CLEAR, type = "sendmaps")
return ..()

/datum/controller/subsystem/profiler/proc/StartProfiling()
world.Profile(PROFILE_START)
world.Profile(PROFILE_START, type = "sendmaps")

/datum/controller/subsystem/profiler/proc/StopProfiling()
world.Profile(PROFILE_STOP)
world.Profile(PROFILE_STOP, type = "sendmaps")

/datum/controller/subsystem/profiler/proc/DumpFile(allow_yield = TRUE)
var/timer = TICK_USAGE_REAL
var/current_profile_data = world.Profile(PROFILE_REFRESH, format = "json")
var/current_sendmaps_data = world.Profile(PROFILE_REFRESH, type = "sendmaps", format="json")
fetch_cost = MC_AVERAGE(fetch_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
if(allow_yield)
CHECK_TICK

if(!length(current_profile_data)) //Would be nice to have explicit proc to check this
stack_trace("Warning, profiling stopped manually before dump.")
var/prof_file = file("[GLOB.log_directory]/[PROFILER_FILENAME]")
if(fexists(prof_file))
fdel(prof_file)
if(!length(current_sendmaps_data)) //Would be nice to have explicit proc to check this
stack_trace("Warning, sendmaps profiling stopped manually before dump.")
var/sendmaps_file = file("[GLOB.log_directory]/[SENDMAPS_FILENAME]")
if(fexists(sendmaps_file))
fdel(sendmaps_file)

timer = TICK_USAGE_REAL
WRITE_FILE(prof_file, current_profile_data)
WRITE_FILE(sendmaps_file, current_sendmaps_data)
write_cost = MC_AVERAGE(write_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))

#undef PROFILER_FILENAME
#undef SENDMAPS_FILENAME
2 changes: 2 additions & 0 deletions code/datums/components/weed_food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
merged = TRUE

ADD_TRAIT(parent_mob, TRAIT_UNDENSE, XENO_WEED_TRAIT)
ADD_TRAIT(parent_mob, TRAIT_MERGED_WITH_WEEDS, XENO_WEED_TRAIT)
parent_mob.anchored = TRUE
parent_mob.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
parent_mob.plane = FLOOR_PLANE
Expand Down Expand Up @@ -288,6 +289,7 @@
UnregisterSignal(absorbing_weeds, COMSIG_PARENT_QDELETING)
absorbing_weeds = null

REMOVE_TRAIT(parent_mob, TRAIT_MERGED_WITH_WEEDS, XENO_WEED_TRAIT)
parent_mob.anchored = FALSE
parent_mob.mouse_opacity = MOUSE_OPACITY_ICON
parent_mob.plane = GAME_PLANE
Expand Down
34 changes: 21 additions & 13 deletions code/datums/looping_sounds/_looping_sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
/// Has the looping started yet?
var/loop_started = FALSE

/**
* Let's you make a "loud" sound that "projects." IE you can hear this sound from a further distance away.
* Think of like an air raid siren. They're loud if you're close yeah... but you can hear them from mad far away, bruv
* with a longer "falloff distance." Fixes the extra_range stuff
*/
var/is_sound_projecting = FALSE
///only applicable to is_sound_projecting: max range till sound volume starts dropping as distance increases
var/falloff_distance = 50

/* // as of yet unused varen \\
/// How much the sound will be affected by falloff per tile.
Expand Down Expand Up @@ -130,19 +139,18 @@
sound_to_play.channel = get_free_channel()
sound_to_play.volume = volume_override || volume //Use volume as fallback if theres no override
SEND_SOUND(parent, sound_to_play)
else
playsound(
parent,
sound_to_play,
volume,
vary,
extra_range//,
// falloff_exponent = falloff_exponent,
// pressure_affected = pressure_affected,
// ignore_walls = ignore_walls,
// falloff_distance = falloff_distance,
// use_reverb = use_reverb
)
return
if (is_sound_projecting)
playsound(parent, sound_to_play, volume, vary, extra_range, VOLUME_SFX, 0, 0, falloff_distance)
return

playsound(
parent,
sound_to_play,
volume,
vary,
extra_range
)

/// Returns the sound we should now be playing.
/datum/looping_sound/proc/get_sound(_mid_sounds)
Expand Down
3 changes: 3 additions & 0 deletions code/datums/looping_sounds/misc_sounds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/looping_sound/looping_launch_announcement_alarm
mid_sounds = list('sound/vehicles/Dropships/single_alarm_brr_dropship_1.ogg' = 1)
start_sound = list('sound/vehicles/Dropships/single_alarm_brr_dropship_1.ogg' = 1)
Loading

0 comments on commit 45ef7c6

Please sign in to comment.