diff --git a/code/__DEFINES/_ss220.dm b/code/__DEFINES/_ss220.dm index 0cf3257d7da9..91b0dea342cc 100644 --- a/code/__DEFINES/_ss220.dm +++ b/code/__DEFINES/_ss220.dm @@ -1,5 +1,39 @@ #define MODPACK_CHAT_BADGES +#ifdef SEC_LEVEL_GREEN +#undef SEC_LEVEL_GREEN +#endif +#ifdef SEC_LEVEL_BLUE +#undef SEC_LEVEL_BLUE +#endif +#ifdef SEC_LEVEL_VIOLET +#undef SEC_LEVEL_VIOLET +#endif +#ifdef SEC_LEVEL_ORANGE +#undef SEC_LEVEL_ORANGE +#endif +#ifdef SEC_LEVEL_RED +#undef SEC_LEVEL_RED +#endif +#ifdef SEC_LEVEL_GAMMA +#undef SEC_LEVEL_GAMMA +#endif +#ifdef SEC_LEVEL_EPSILON +#undef SEC_LEVEL_EPSILON +#endif +#ifdef SEC_LEVEL_DELTA +#undef SEC_LEVEL_DELTA +#endif + +#define SEC_LEVEL_GREEN 0 +#define SEC_LEVEL_BLUE 1 +#define SEC_LEVEL_VIOLET 2 +#define SEC_LEVEL_ORANGE 3 +#define SEC_LEVEL_RED 4 +#define SEC_LEVEL_GAMMA 5 +#define SEC_LEVEL_EPSILON 6 +#define SEC_LEVEL_DELTA 7 + // TODO: someday preferences will use TGUI and you will probably be able to move it to modular_ss220\_defines220\code\preferences_defines.dm /// Interacts with the toggles220 bitflag #define PREFTOGGLE_TOGGLE220 220 diff --git a/code/controllers/subsystem/non_firing/SSmapping.dm b/code/controllers/subsystem/non_firing/SSmapping.dm index 1b07dae138de..ca5592181358 100644 --- a/code/controllers/subsystem/non_firing/SSmapping.dm +++ b/code/controllers/subsystem/non_firing/SSmapping.dm @@ -16,6 +16,10 @@ SUBSYSTEM_DEF(mapping) var/datum/lavaland_theme/lavaland_theme ///What primary cave theme we have picked for cave generation today. var/cave_theme + // Tells if all maintenance airlocks have emergency access enabled + var/maint_all_access = FALSE + // Tells if all station airlocks have emergency access enabled + var/station_all_access = FALSE /// A mapping of environment names to MILLA environment IDs. var/list/environments @@ -356,5 +360,41 @@ SUBSYSTEM_DEF(mapping) log_world("Ruin loader finished with [budget] left to spend.") +/datum/controller/subsystem/mapping/proc/make_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.emergency = TRUE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been removed.") + maint_all_access = TRUE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled")) + +/datum/controller/subsystem/mapping/proc/revoke_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.emergency = FALSE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been re-added.") + maint_all_access = FALSE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled")) + +/datum/controller/subsystem/mapping/proc/make_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.emergency = TRUE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been removed due to an ongoing crisis. Trespassing laws still apply unless ordered otherwise by Command staff.") + station_all_access = TRUE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "enabled")) + +/datum/controller/subsystem/mapping/proc/revoke_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.emergency = FALSE + D.update_icon() + GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been re-added. Seek station AI or a colleague's assistance if you are stuck.") + station_all_access = FALSE + SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "disabled")) + /datum/controller/subsystem/mapping/Recover() flags |= SS_NO_INIT diff --git a/code/datums/weather/weather_types/radiation_storm.dm b/code/datums/weather/weather_types/radiation_storm.dm index ccb43e11a816..4cb7314c4ab4 100644 --- a/code/datums/weather/weather_types/radiation_storm.dm +++ b/code/datums/weather/weather_types/radiation_storm.dm @@ -38,9 +38,9 @@ /datum/weather/rad_storm/telegraph() ..() status_alarm(TRUE) - pre_maint_all_access = GLOB.maint_all_access - if(!GLOB.maint_all_access) - make_maint_all_access() + pre_maint_all_access = SSmapping.maint_all_access + if(!SSmapping.maint_all_access) + SSmapping.make_maint_all_access() /datum/weather/rad_storm/weather_act(mob/living/L) if(!prob(60)) @@ -74,7 +74,7 @@ status_alarm(FALSE) if(!pre_maint_all_access) GLOB.minor_announcement.Announce("The radiation threat has passed. Please return to your workplaces. Door access resetting momentarily.", "Anomaly Alert") - addtimer(CALLBACK(SSweather, GLOBAL_PROC_REF(revoke_maint_all_access)), 10 SECONDS) // Bit of time to get out / break into somewhere. + addtimer(CALLBACK(SSmapping, TYPE_PROC_REF(/datum/controller/subsystem/mapping, revoke_maint_all_access)), 10 SECONDS) // Bit of time to get out / break into somewhere. else GLOB.minor_announcement.Announce("The radiation threat has passed. Please return to your workplaces.", "Anomaly Alert") diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 441b31198b22..9ae9a8a0da4b 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -177,13 +177,13 @@ if("Red Alert") INVOKE_ASYNC(SSsecurity_level, TYPE_PROC_REF(/datum/controller/subsystem/security_level, set_level), SEC_LEVEL_RED) if("Grant Emergency Maintenance Access") - make_maint_all_access() + SSmapping.make_maint_all_access() if("Revoke Emergency Maintenance Access") - revoke_maint_all_access() + SSmapping.revoke_maint_all_access() if("Activate Station-Wide Emergency Access") - make_station_all_access() + SSmapping.make_station_all_access() if("Deactivate Station-Wide Emergency Access") - revoke_station_all_access() + SSmapping.revoke_station_all_access() if("Emergency Response Team") if(is_ert_blocked()) atom_say("All Emergency Response Teams are dispatched and can not be called at this time.") @@ -215,43 +215,3 @@ /obj/machinery/keycard_auth/proc/is_ert_blocked() return SSticker.mode && SSticker.mode.ert_disabled - -GLOBAL_VAR_INIT(maint_all_access, 0) -GLOBAL_VAR_INIT(station_all_access, 0) - -// Why are these global procs? -/proc/make_maint_all_access() - for(var/area/station/maintenance/A in world) // Why are these global lists? AAAAAAAAAAAAAA - for(var/obj/machinery/door/airlock/D in A) - D.emergency = 1 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been removed.") - GLOB.maint_all_access = 1 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled")) - -/proc/revoke_maint_all_access() - for(var/area/station/maintenance/A in world) - for(var/obj/machinery/door/airlock/D in A) - D.emergency = 0 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on maintenance and external airlocks have been re-added.") - GLOB.maint_all_access = 0 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled")) - -/proc/make_station_all_access() - for(var/obj/machinery/door/airlock/D in GLOB.airlocks) - if(is_station_level(D.z)) - D.emergency = 1 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been removed due to an ongoing crisis. Trespassing laws still apply unless ordered otherwise by Command staff.") - GLOB.station_all_access = 1 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "enabled")) - -/proc/revoke_station_all_access() - for(var/obj/machinery/door/airlock/D in GLOB.airlocks) - if(is_station_level(D.z)) - D.emergency = 0 - D.update_icon() - GLOB.minor_announcement.Announce("Access restrictions on all station airlocks have been re-added. Seek station AI or a colleague's assistance if you are stuck.") - GLOB.station_all_access = 0 - SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency station access", "disabled")) diff --git a/modular_ss220/_misc/_misc.dme b/modular_ss220/_misc/_misc.dme index 6e7ae4f13e7f..0873e8fa8bf7 100644 --- a/modular_ss220/_misc/_misc.dme +++ b/modular_ss220/_misc/_misc.dme @@ -5,3 +5,4 @@ #include "code/icons.dm" #include "code/pronouns.dm" #include "code/ss220_general_config.dm" +#include "code/area.dm" diff --git a/modular_ss220/_misc/code/area.dm b/modular_ss220/_misc/code/area.dm new file mode 100644 index 000000000000..7d3c0b602f14 --- /dev/null +++ b/modular_ss220/_misc/code/area.dm @@ -0,0 +1,8 @@ +/area/proc/has_power_alarm() + return !poweralm + +/area/proc/has_atmos_alarm() + return atmosalm != ATMOS_ALARM_NONE + +/area/proc/has_fire_alarm() + return fire diff --git a/modular_ss220/aesthetics/firealarm/icons/firealarm.dmi b/modular_ss220/aesthetics/firealarm/icons/firealarm.dmi index ae288310c251..bd06202e2aee 100644 Binary files a/modular_ss220/aesthetics/firealarm/icons/firealarm.dmi and b/modular_ss220/aesthetics/firealarm/icons/firealarm.dmi differ diff --git a/modular_ss220/modular_ss220.dme b/modular_ss220/modular_ss220.dme index 3a61d9ef6079..b706d43c3dfe 100644 --- a/modular_ss220/modular_ss220.dme +++ b/modular_ss220/modular_ss220.dme @@ -84,6 +84,7 @@ #include "shuttles/_shuttles.dme" #include "redis220/_redis220.dme" #include "robolimbs/_robolimbs.dme" +#include "security_levels/_security_levels.dme" // --- PRIME --- // // #define MODPACK_MAIN_ONLY @@ -107,3 +108,8 @@ ---------------------------------------------------------------------*/ // #include "crit_rework/_crit_rework.dme" + +// --- TESTING --- // +#ifdef UNIT_TESTS +#include "unit_tests/_unit_tests.dme" +#endif diff --git a/modular_ss220/objects/_objects.dme b/modular_ss220/objects/_objects.dme index df38bb801967..48e60b9985dd 100644 --- a/modular_ss220/objects/_objects.dme +++ b/modular_ss220/objects/_objects.dme @@ -47,3 +47,4 @@ #include "code/components.dm" #include "code/airlock_painter.dm" #include "code/animalhide.dm" +#include "code/airlock.dm" diff --git a/modular_ss220/objects/code/airlock.dm b/modular_ss220/objects/code/airlock.dm new file mode 100644 index 000000000000..afbf3b702904 --- /dev/null +++ b/modular_ss220/objects/code/airlock.dm @@ -0,0 +1,99 @@ +#define EMERGENCY_NONE 0 +#define EMERGENCY_STATION_WIDE (1<<0) +#define EMERGENCY_MAINTENANCE (1<<1) +#define EMERGENCY_MANUAL (1<<2) +#define EMERGENCY_ALARM (1<<3) + +/obj/machinery/door/airlock + var/alarm_sensitive = TRUE + var/emergency_handling = FALSE + var/emergency_reason = EMERGENCY_NONE + +/obj/machinery/door/airlock/Initialize() + . = ..() + if(is_station_level(z)) + emergency_handling = TRUE + if(has_constant_processing()) + START_PROCESSING(SSmachines, src) + +/obj/machinery/door/airlock/process() + if(emergency_handling) + if(alarm_sensitive) + var/area/this_area = get_area(src) + if(SSsecurity_level.get_current_level_as_number() == SEC_LEVEL_ORANGE \ + && (this_area.has_power_alarm() || this_area.has_atmos_alarm() || this_area.has_fire_alarm())) + set_emergency_reason(EMERGENCY_ALARM) + else + reset_emergency_reason(EMERGENCY_ALARM) + var/old_emergency = emergency + emergency = emergency_reason != EMERGENCY_NONE + if(emergency != old_emergency) + update_icon() + . = ..() + return has_constant_processing() || . + +/obj/machinery/door/airlock/toggle_emergency_status(mob/user) + . = ..() + if(emergency) + set_emergency_reason(EMERGENCY_MANUAL) + else + emergency_handling = FALSE + +/obj/machinery/door/airlock/proc/set_emergency_reason(reason) + emergency_handling = TRUE + emergency_reason |= reason + +/obj/machinery/door/airlock/proc/reset_emergency_reason(reason) + emergency_handling = TRUE + emergency_reason &= ~reason + +/obj/machinery/door/airlock/proc/has_constant_processing() + return alarm_sensitive && is_station_level(z) + +/obj/machinery/door/airlock/abductor + alarm_sensitive = FALSE + +/obj/machinery/door/airlock/cult + alarm_sensitive = FALSE + +/obj/machinery/door/airlock/external + alarm_sensitive = FALSE + +/obj/machinery/door/airlock/external_no_weld + alarm_sensitive = FALSE + +/obj/machinery/door/airlock/highsecurity + alarm_sensitive = FALSE + +/obj/machinery/door/airlock/vault + alarm_sensitive = FALSE + +/datum/controller/subsystem/mapping/make_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.set_emergency_reason(EMERGENCY_MAINTENANCE) + . = ..() + +/datum/controller/subsystem/mapping/revoke_maint_all_access() + for(var/area/station/maintenance/A in existing_station_areas) + for(var/obj/machinery/door/airlock/D in A) + D.reset_emergency_reason(EMERGENCY_MAINTENANCE) + . = ..() + +/datum/controller/subsystem/mapping/make_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.set_emergency_reason(EMERGENCY_STATION_WIDE) + . = ..() + +/datum/controller/subsystem/mapping/revoke_station_all_access() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.reset_emergency_reason(EMERGENCY_STATION_WIDE) + . = ..() + +#undef EMERGENCY_NONE +#undef EMERGENCY_STATION_WIDE +#undef EMERGENCY_MAINTENANCE +#undef EMERGENCY_MANUAL +#undef EMERGENCY_ALARM diff --git a/modular_ss220/security_levels/_security_levels.dm b/modular_ss220/security_levels/_security_levels.dm new file mode 100644 index 000000000000..acaf1d8457a0 --- /dev/null +++ b/modular_ss220/security_levels/_security_levels.dm @@ -0,0 +1,4 @@ +/datum/modpack/security_levels + name = "Дополнительные коды на станции" + desc = "Добавляет оранжевый и фиолетовый коды в игру" + author = "Maxiemar" diff --git a/modular_ss220/security_levels/_security_levels.dme b/modular_ss220/security_levels/_security_levels.dme new file mode 100644 index 000000000000..542f376d6d71 --- /dev/null +++ b/modular_ss220/security_levels/_security_levels.dme @@ -0,0 +1,4 @@ +#include "_security_levels.dm" + +#include "code/security_level_datums.dm" +#include "code/SSsecurity_level.dm" diff --git a/modular_ss220/security_levels/code/SSsecurity_level.dm b/modular_ss220/security_levels/code/SSsecurity_level.dm new file mode 100644 index 000000000000..81f25c9f665d --- /dev/null +++ b/modular_ss220/security_levels/code/SSsecurity_level.dm @@ -0,0 +1,13 @@ +/datum/controller/subsystem/security_level/Initialize() + var/list/sorted_levels = list() + for(var/security_level_type in subtypesof(/datum/security_level)) + var/datum/security_level/new_level = new security_level_type + sorted_levels[list("number" = num2text(new_level.number_level, 1), "level" = new_level)] = null // this shit adds list to a list + sorted_levels = sortByKey(sorted_levels, "number") + + SSsecurity_level.available_levels.Cut(); + for(var/security_level_entry in sorted_levels) + var/datum/security_level/level = security_level_entry["level"] + SSsecurity_level.available_levels[level.name] = level + + return ..() diff --git a/modular_ss220/security_levels/code/security_level_datums.dm b/modular_ss220/security_levels/code/security_level_datums.dm new file mode 100644 index 000000000000..59dcc27ad9fa --- /dev/null +++ b/modular_ss220/security_levels/code/security_level_datums.dm @@ -0,0 +1,36 @@ +/** + * VIOLET + * + * Medical threat + */ +/datum/security_level/violet + name = "violet" + number_level = SEC_LEVEL_VIOLET + elevating_to_sound = 'sound/misc/notice1.ogg' + ai_announcement_sound = 'sound/AI/blue.ogg' // TODO: to update + color = "darkviolet" + lowering_to_announcement_title = "ВНИМАНИЕ! Уровень угрозы понижен до ФИОЛЕТОВОГО." + lowering_to_announcement_text = "В настоящее время действуют процедуры Фиолетового кода. Медицинский персонал должен получить распоряжения от руководителя отдела. Немедицинский персонал обязан выполнять все соответствующие инструкции медицинского персонала." + elevating_to_announcement_title = "Внимание! Уровень угрозы повышен до ФИОЛЕТОВОГО." + elevating_to_announcement_text = "Возникла серьезная медицинская угроза экипажу станции. Медицинский персонал должен получить распоряжения от руководителя отдела. Немедицинский персонал обязан выполнять все соответствующие инструкции медицинского персонала." + +/** + * ORANGE + * + * Engineering emergency + */ +/datum/security_level/orange + name = "orange" + number_level = SEC_LEVEL_ORANGE + elevating_to_sound = 'sound/misc/notice1.ogg' + ai_announcement_sound = 'sound/AI/blue.ogg' // TODO: to update + color = "gold" + lowering_to_announcement_title = "ВНИМАНИЕ! Уровень угрозы понижен до ОРАНЖЕВОГО." + lowering_to_announcement_text = "В настоящее время действуют процедуры Оранжевого кода. Инженерный персонал должен получить распоряжения от руководителя отдела. Неинженерный персонал обязан покинуть аварийные помещения и выполнять все соответствующие инструкции инженерного персонала." + elevating_to_announcement_title = "Внимание! Уровень угрозы повышен до ОРАНЖЕВОГО." + elevating_to_announcement_text = "Произошла серьезная техническая авария. Инженерный персонал должен получить распоряжения от руководителя отдела. Неинженерный персонал обязан покинуть аварийные помещения и выполнять все соответствующие инструкции инженерного персонала." + +/datum/security_level/orange/pre_change() + for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + if(is_station_level(D.z)) + D.emergency_handling = TRUE diff --git a/modular_ss220/unit_tests/_unit_tests.dm b/modular_ss220/unit_tests/_unit_tests.dm new file mode 100644 index 000000000000..8f2f60e3a195 --- /dev/null +++ b/modular_ss220/unit_tests/_unit_tests.dm @@ -0,0 +1,4 @@ +/datum/modpack/unit_tests + name = "Тестирование" + desc = "Здесь тестируется все, что стоит протестировать" + author = "Maxiemar" diff --git a/modular_ss220/unit_tests/_unit_tests.dme b/modular_ss220/unit_tests/_unit_tests.dme new file mode 100644 index 000000000000..914dcab04345 --- /dev/null +++ b/modular_ss220/unit_tests/_unit_tests.dme @@ -0,0 +1,3 @@ +#include "_unit_tests.dm" + +#include "code/security_levels.dm" diff --git a/modular_ss220/unit_tests/code/security_levels.dm b/modular_ss220/unit_tests/code/security_levels.dm new file mode 100644 index 000000000000..b150e633e8ec --- /dev/null +++ b/modular_ss220/unit_tests/code/security_levels.dm @@ -0,0 +1,19 @@ +/datum/unit_test/security_levels + +/datum/unit_test/security_levels/Run() + security_levels_order() + +/datum/unit_test/security_levels/proc/security_levels_order() + var/expected = list( + new /datum/security_level/green, + new /datum/security_level/blue, + new /datum/security_level/violet, + new /datum/security_level/orange, + new /datum/security_level/red, + new /datum/security_level/gamma, + new /datum/security_level/epsilon, + new /datum/security_level/delta + ).Join(", ") + var/actual = SSsecurity_level.available_levels.Join(", ") + if(actual != expected) + Fail("Security levels order is invalid.\nExpected: [expected]\nActual: [actual]") diff --git a/paradise.dme b/paradise.dme index 1bc9cc1362c5..d2794186698f 100644 --- a/paradise.dme +++ b/paradise.dme @@ -24,7 +24,6 @@ #include "code\__DEFINES\_protection.dm" #include "code\__DEFINES\_readme.dm" #include "code\__DEFINES\_spacemandmm.dm" -#include "code\__DEFINES\_ss220.dm" #include "code\__DEFINES\_tgs_defines.dm" #include "code\__DEFINES\_tick.dm" #include "code\__DEFINES\_versions.dm" @@ -147,6 +146,7 @@ #include "code\__DEFINES\dcs\dcs_flags.dm" #include "code\__DEFINES\dcs\dcs_helpers.dm" #include "code\__DEFINES\dcs\signals.dm" +#include "code\__DEFINES\_ss220.dm" #include "code\__HELPERS\_logging.dm" #include "code\__HELPERS\_string_lists.dm" #include "code\__HELPERS\AnimationLibrary.dm"