diff --git a/code/__defines/_tick.dm b/code/__defines/_tick.dm index 2c33329a612..deb6e555a84 100644 --- a/code/__defines/_tick.dm +++ b/code/__defines/_tick.dm @@ -30,5 +30,5 @@ //time of day but automatically adjusts to the server going into the next day within the same round. //for when you need a reliable time number that doesn't depend on byond time. -#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK)) +#define REALTIMEOFDAY (world.timeofday + ((1 DAY) * MIDNIGHT_ROLLOVER_CHECK)) #define MIDNIGHT_ROLLOVER_CHECK ( global.rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : global.midnight_rollovers ) diff --git a/code/__defines/lists.dm b/code/__defines/lists.dm index 9935dab6b5c..1975c8ee7f5 100644 --- a/code/__defines/lists.dm +++ b/code/__defines/lists.dm @@ -32,6 +32,9 @@ // Reads L or an empty list if L is not a list. Note: Does NOT assign, L may be an expression. #define SANITIZE_LIST(L) ( islist(L) ? L : list() ) +/// Inserts `I` at the end of the list (NOT LAZYLIST) L. If I is a list, it will insert the list itself as an entry, rather than adding each item in I. +#define ADD_LIST_AS_ENTRY(L, I) (L[++L.len] = I) // NOTE: THIS MUST ONLY EVER REFERENCE `I` ONCE; THIS IS A MACRO AND EACH VARIABLE USAGE IS A LITERAL EXPANSION + // The above but for alists. Prefixed with A_ because inserting "A" randomly in the name just made it confusing #define A_LAZYINITLIST(AL) if (!AL) { AL = alist(); } #define A_UNSETEMPTY(AL) if(!length(AL)) { AL = null; } diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index faba544b1ba..3721efb82c0 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -184,8 +184,6 @@ #define PIXEL_MULTIPLIER WORLD_ICON_SIZE/32 -#define MIDNIGHT_ROLLOVER 864000 //number of deciseconds in a day - //Error handler defines #define ERROR_USEFUL_LEN 2 diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index f084ad999bb..94a6ab1bf7d 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -401,12 +401,6 @@ temps[direction] = rstats return temps -/proc/MinutesToTicks(var/minutes) - return SecondsToTicks(60 * minutes) - -/proc/SecondsToTicks(var/seconds) - return seconds * 10 - /proc/window_flash(var/client_or_usr) if (!client_or_usr) return diff --git a/code/_onclick/hud/screen/screen_intent.dm b/code/_onclick/hud/screen/screen_intent.dm index f3fba3b8563..3c99a3d7748 100644 --- a/code/_onclick/hud/screen/screen_intent.dm +++ b/code/_onclick/hud/screen/screen_intent.dm @@ -70,7 +70,7 @@ requires_ui_style = FALSE apply_screen_overlay = FALSE var/intent_width = 16 - var/intent_height = 16 + var/intent_height = 16 // currently unused var/list/intent_selectors /obj/screen/intent/Initialize(mapload, mob/_owner, decl/ui_style/ui_style, ui_color, ui_alpha, ui_cat) diff --git a/code/datums/mil_ranks.dm b/code/datums/mil_ranks.dm index 29a14bc5e98..b907d46f610 100644 --- a/code/datums/mil_ranks.dm +++ b/code/datums/mil_ranks.dm @@ -69,11 +69,7 @@ */ /datum/mil_rank var/name = "Unknown" - var/name_short // Abbreviation of the name. Should be null if the - // rank doesn't usually serve as a prefix to the individual's name. - var/list/accessory //type of accesory that will be equipped by job code with this rank - var/sort_order = 0 // A numerical equivalent of the rank used to indicate its order when compared to other datums: eg e-1 = 1, o-1 = 11 - -//Returns short designation (yes shorter than name_short), like E1, O3 etc. -/datum/mil_rank/proc/grade() - return sort_order \ No newline at end of file + /// Abbreviation of the name. Should be null if the rank doesn't usually serve as a prefix to the individual's name. + var/name_short + ///type of accesory that will be equipped by job code with this rank + var/list/accessory diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index e2441adeb53..b2858a7308e 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -37,7 +37,7 @@ var/global/list/areas = list() /// Disables constructing or using APCs in this area. var/always_unpowered = FALSE - var/atmosalm = 0 + var/atmosalm = /obj/machinery/alarm::DANGER_NONE var/power_equip = 1 // Status var/power_light = 1 var/power_environ = 1 @@ -48,8 +48,6 @@ var/global/list/areas = list() var/oneoff_light = 0 var/oneoff_environ = 0 var/has_gravity = TRUE - /// If FALSE, this area is unable to have its gravity overridden by a gravity generator. Used on /area/space. - var/can_have_gravity = TRUE var/air_doors_activated = FALSE var/obj/machinery/apc/apc @@ -193,7 +191,7 @@ var/global/list/areas = list() return cameras /area/proc/atmosalert(danger_level, var/alarm_source) - if (danger_level == 0) + if (danger_level == /obj/machinery/alarm::DANGER_NONE) atmosphere_alarm.clearAlarm(src, alarm_source) else atmosphere_alarm.triggerAlarm(src, alarm_source, severity = danger_level) @@ -204,10 +202,10 @@ var/global/list/areas = list() danger_level = max(danger_level, AA.danger_level) if(danger_level != atmosalm) - if (danger_level < 1 && atmosalm >= 1) + if (danger_level < /obj/machinery/alarm::DANGER_WARN && atmosalm >= /obj/machinery/alarm::DANGER_WARN) //closing the doors on red and opening on green provides a bit of hysteresis that will hopefully prevent fire doors from opening and closing repeatedly due to noise air_doors_open() - else if (danger_level >= 2 && atmosalm < 2) + else if (danger_level >= /obj/machinery/alarm::DANGER_DANGER && atmosalm < /obj/machinery/alarm::DANGER_DANGER) air_doors_close() atmosalm = danger_level diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index 4acbcff8b72..43614e9f209 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -116,31 +116,45 @@ var/global/list/datum/access/priv_all_access_datums /proc/get_all_access_datums() - if(!priv_all_access_datums) - priv_all_access_datums = init_subtypes(/datum/access) - priv_all_access_datums = dd_sortedObjectList(priv_all_access_datums) + if(!global.priv_all_access_datums) + global.priv_all_access_datums = init_subtypes(/datum/access) + global.priv_all_access_datums = dd_sortedObjectList(global.priv_all_access_datums) - return priv_all_access_datums.Copy() + return global.priv_all_access_datums.Copy() var/global/list/datum/access/priv_all_access_datums_id /proc/get_all_access_datums_by_id() - if(!priv_all_access_datums_id) - priv_all_access_datums_id = list() + if(!global.priv_all_access_datums_id) + global.priv_all_access_datums_id = list() for(var/datum/access/A in get_all_access_datums()) - priv_all_access_datums_id["[A.id]"] = A + global.priv_all_access_datums_id["[A.id]"] = A - return priv_all_access_datums_id.Copy() + return global.priv_all_access_datums_id.Copy() -var/global/list/datum/access/priv_all_access_datums_region +var/global/alist/priv_all_access_datums_region +/// Returns an alist of all region indices -> their associated access datums. /proc/get_all_access_datums_by_region() - if(!priv_all_access_datums_region) - priv_all_access_datums_region = list() + RETURN_TYPE(/alist) + if(!global.priv_all_access_datums_region) + global.priv_all_access_datums_region = alist() for(var/datum/access/A in get_all_access_datums()) - if(!priv_all_access_datums_region[A.region]) - priv_all_access_datums_region[A.region] = list() - priv_all_access_datums_region[A.region] += A + if(!global.priv_all_access_datums_region[A.region]) + global.priv_all_access_datums_region[A.region] = alist() + global.priv_all_access_datums_region[A.region] += A - return priv_all_access_datums_region.Copy() + return global.priv_all_access_datums_region.Copy() + +var/global/alist/priv_all_access_datums_region_names +/// Returns an alist of all region names -> their associated access datums. +/proc/get_all_access_datums_by_region_name() + RETURN_TYPE(/alist) + if(!global.priv_all_access_datums_region_names) + global.priv_all_access_datums_region_names = alist() + for(var/region_index, region_data in get_all_access_datums_by_region()) + var/region_name = get_access_region_name(region_index) + global.priv_all_access_datums_region_names[region_name] = region_data + + return global.priv_all_access_datums_region_names.Copy() /proc/get_access_ids(var/access_types = ACCESS_TYPE_ALL) . = list() @@ -191,7 +205,7 @@ var/global/list/priv_region_access var/list/region = priv_region_access["[code]"] return islist(region) ? region.Copy() : list() -/proc/get_region_accesses_name(var/code) +/proc/get_access_region_name(var/code) switch(code) if(ACCESS_REGION_ALL) return "All" diff --git a/code/game/machinery/_machines_base/machinery.dm b/code/game/machinery/_machines_base/machinery.dm index eb27136f261..bf6673bab4c 100644 --- a/code/game/machinery/_machines_base/machinery.dm +++ b/code/game/machinery/_machines_base/machinery.dm @@ -31,12 +31,6 @@ Class Variables: panel_open (num) Whether the panel is open - uid (num) - Unique id of machine across all machines. - - gl_uid (global num) - Next uid value in sequence - stat (bitflag) Machine status bit flags. Possible bit flags: @@ -112,9 +106,7 @@ Class Procs: var/list/uncreated_component_parts = list(/obj/item/stock_parts/power/apc) /// null - no max. list(type part = number max). var/list/maximum_component_parts = list(/obj/item/stock_parts = 10) - var/uid var/panel_open = FALSE - var/static/gl_uid = 1 /// Can the machine be interacted with while de-powered. var/interact_offline = FALSE /// sound played on successful interface use diff --git a/code/game/machinery/_machines_base/stock_parts/access_lock.dm b/code/game/machinery/_machines_base/stock_parts/access_lock.dm index 8d6b4aec8ce..c63ed31025f 100644 --- a/code/game/machinery/_machines_base/stock_parts/access_lock.dm +++ b/code/game/machinery/_machines_base/stock_parts/access_lock.dm @@ -80,18 +80,19 @@ var/list/data = list() var/list/regions = list() if(!autoset) - for(var/i in ACCESS_REGION_MIN to ACCESS_REGION_MAX) //code/game/jobs/_access_defs.dm - var/list/region = list() + for(var/region_name, access_data in get_all_access_datums_by_region_name()) var/list/accesses = list() - for(var/j in get_region_accesses(i)) - var/list/access = list() - access["name"] = get_access_desc(j) - access["id"] = j - access["req"] = conf_access && (j in conf_access) - accesses[++accesses.len] = access - region["name"] = get_region_accesses_name(i) - region["accesses"] = accesses - regions[++regions.len] = region + for(var/datum/access/access_datum in access_data) + // += or Add would add each individual entry + ADD_LIST_AS_ENTRY(accesses, list( + "name" = access_datum.desc, + "id" = access_datum.id, + "req" = LAZYISIN(conf_access, access_datum.id) + )) + ADD_LIST_AS_ENTRY(regions, list( + "name" = region_name, + "accesses" = accesses + )) data["regions"] = regions data["oneAccess"] = one_access data["locked"] = locked diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 5b72753a9e6..0ef2d44e1db 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -65,15 +65,18 @@ directional_offset = @'{"NORTH":{"y":-21}, "SOUTH":{"y":21}, "EAST":{"x":-21}, "WEST":{"x":21}}' var/alarm_id = null - var/breach_detection = 1 // Whether to use automatic breach detection or not + var/breach_detection = TRUE // Whether to use automatic breach detection or not var/frequency = 1439 var/alarm_frequency = 1437 - var/remote_control = 0 - var/rcon_setting = 2 + /// If TRUE, remote controllers like the atmos control computer can control the air alarm; if FALSE, they can only view it. + /// Typically auto-set by rcon_setting. + var/remote_control = FALSE + /// On RCON_AUTO, remote control is enabled when danger_level is DANGER_DANGER. + var/rcon_setting = RCON_AUTO var/rcon_remote_override_access = list(access_ce) - var/locked = 1 - var/aidisabled = 0 - var/shorted = 0 + var/locked = TRUE + var/aidisabled = FALSE + var/shorted = FALSE var/mode = AALARM_MODE_SCRUBBING var/screen = AALARM_SCREEN_MAIN @@ -89,14 +92,17 @@ var/list/TLV = list() // stands for Threshold Limit Value, since it handles exposure amounts var/list/trace_gas = list() //list of other gases that this air alarm is able to detect - var/danger_level = 0 - var/pressure_dangerlevel = 0 - var/oxygen_dangerlevel = 0 - var/co2_dangerlevel = 0 - var/temperature_dangerlevel = 0 - var/other_dangerlevel = 0 + var/const/DANGER_NONE = 0 + var/const/DANGER_WARN = 1 + var/const/DANGER_DANGER = 2 // danger, danger, circuits ready + var/danger_level = DANGER_NONE + var/pressure_dangerlevel = DANGER_NONE + var/oxygen_dangerlevel = DANGER_NONE + var/co2_dangerlevel = DANGER_NONE + var/temperature_dangerlevel = DANGER_NONE + var/other_dangerlevel = DANGER_NONE var/environment_type = /decl/environment_data - var/report_danger_level = 1 + var/report_danger_level = TRUE /obj/machinery/alarm/cold target_temperature = T0C+4 @@ -215,14 +221,14 @@ //atmos computer remote controll stuff switch(rcon_setting) if(RCON_NO) - remote_control = 0 + remote_control = FALSE if(RCON_AUTO) if(danger_level == 2) - remote_control = 1 + remote_control = TRUE else - remote_control = 0 + remote_control = FALSE if(RCON_YES) - remote_control = 1 + remote_control = TRUE return @@ -318,10 +324,10 @@ /obj/machinery/alarm/proc/get_danger_level(var/current_value, var/list/danger_levels) if((current_value >= danger_levels[4] && danger_levels[4] > 0) || current_value <= danger_levels[1]) - return 2 + return DANGER_DANGER if((current_value > danger_levels[3] && danger_levels[3] > 0) || current_value < danger_levels[2]) - return 1 - return 0 + return DANGER_WARN + return DANGER_NONE /obj/machinery/alarm/on_update_icon() // Broken or deconstructed states @@ -477,7 +483,7 @@ /obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = global.default_topic_state) var/data[0] var/remote_connection = istype(state, /datum/topic_state/remote) // Remote connection means we're non-adjacent/connecting from another computer - var/remote_access = remote_connection && CanInteract(user, state) // Remote access means we also have the privilege to alter the air alarm. + var/remote_access = remote_control && remote_connection && CanInteract(user, state) // Remote access means we also have the privilege to alter the air alarm. data["locked"] = locked && !issilicon(user) data["remote_connection"] = remote_connection @@ -923,14 +929,14 @@ FIRE ALARM if(src.timing) if(src.time > 0) - src.time = src.time - ((world.timeofday - last_process)/10) + src.time = src.time - ((REALTIMEOFDAY - last_process)/(1 SECOND)) else src.alarm() src.time = 0 src.timing = 0 STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF) src.updateDialog() - last_process = world.timeofday + last_process = REALTIMEOFDAY if(locate(/obj/fire) in loc) alarm() @@ -988,7 +994,7 @@ FIRE ALARM . = TOPIC_REFRESH else if (href_list["time"]) src.timing = text2num(href_list["time"]) - last_process = world.timeofday + last_process = REALTIMEOFDAY START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF) . = TOPIC_REFRESH else if (href_list["tp"]) diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 65ecb25cd2e..e498a6c8739 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -59,10 +59,7 @@ /obj/machinery/computer/air_control/proc/get_console_data() if(sensor_info) var/list/temp = list() - if(input_tag || output_tag) - data["control"] = 1 - else - data["control"] = 0 + data["control"] = !!(input_tag || output_tag) if(!sensor_name && sensor_tag) temp += list("long_name" = sensor_tag) diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index bb0801f80b5..0fc2b9e7277 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -139,7 +139,7 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) if(get_port()) add_overlay("can-connector") - var/tank_pressure = return_pressure() + var/tank_pressure = air_contents?.return_pressure() if(tank_pressure < 10) add_overlay("can-o0") else if(tank_pressure < ONE_ATMOSPHERE) @@ -205,18 +205,6 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) if(holding) holding.update_icon() -/obj/machinery/portable_atmospherics/canister/proc/return_temperature() - var/datum/gas_mixture/GM = return_air() - if(GM?.total_volume>0) - return GM.temperature - return 0 - -/obj/machinery/portable_atmospherics/canister/proc/return_pressure() - var/datum/gas_mixture/GM = return_air() - if(GM?.total_volume>0) - return GM.return_pressure() - return 0 - /obj/machinery/portable_atmospherics/canister/bullet_act(var/obj/item/projectile/Proj) if(!(Proj.atom_damage_type == BRUTE || Proj.atom_damage_type == BURN)) return @@ -258,8 +246,8 @@ EMPTY_CANISTER(hydrogen, /obj/machinery/portable_atmospherics/canister/hydrogen) data["name"] = name data["canLabel"] = can_label ? 1 : 0 data["portConnected"] = get_port() ? 1 : 0 - data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0) - data["releasePressure"] = round(release_pressure ? release_pressure : 0) + data["tankPressure"] = round(air_contents.return_pressure()) + data["releasePressure"] = round(release_pressure) data["minReleasePressure"] = round(0.1 ATM) data["maxReleasePressure"] = round(10 ATM) data["valveOpen"] = valve_open ? 1 : 0 diff --git a/code/game/machinery/bodyscanner_console.dm b/code/game/machinery/bodyscanner_console.dm index f8864ab712e..90f5d54f7c7 100644 --- a/code/game/machinery/bodyscanner_console.dm +++ b/code/game/machinery/bodyscanner_console.dm @@ -58,10 +58,7 @@ /obj/machinery/body_scanconsole/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) if(connected && connected.occupant) data["scanEnabled"] = TRUE - if(ishuman(connected.occupant)) - data["isCompatible"] = TRUE - else - data["isCompatible"] = FALSE + data["isCompatible"] = ishuman(connected.occupant) else data["scanEnabled"] = FALSE diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index b19b2f20f18..88a240fc9c2 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -175,11 +175,11 @@ About the new airlock wires panel: return src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2) /obj/machinery/door/airlock/proc/loseMainPower() - main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + (1 MINUTE) // If backup power is permanently disabled then activate in 10 seconds if possible, otherwise it's already enabled or a timer is already running if(backup_power_lost_until == -1 && !backupPowerCablesCut()) - backup_power_lost_until = world.time + SecondsToTicks(10) + backup_power_lost_until = world.time + (10 SECONDS) // Disable electricity if required if(electrified_until && isAllPowerLoss()) @@ -188,7 +188,7 @@ About the new airlock wires panel: update_icon() /obj/machinery/door/airlock/proc/loseBackupPower() - backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + (1 MINUTE) // Disable electricity if required if(electrified_until && isAllPowerLoss()) @@ -231,7 +231,7 @@ About the new airlock wires panel: else shockedby += text("\[[time_stamp()]\] - EMP)") message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]." - src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration) + src.electrified_until = duration == -1 ? -1 : world.time + (duration SECONDS) . = 1 if(feedback && message) @@ -939,8 +939,8 @@ About the new airlock wires panel: if(AM.blocks_airlock()) if(world.time > next_beep_at) playsound(src.loc, close_failure_blocked, 30, 0, -3) - next_beep_at = world.time + SecondsToTicks(10) - close_door_at = world.time + 6 + next_beep_at = world.time + (10 SECONDS) + close_door_at = world.time + (0.6 SECONDS) return FALSE for(var/turf/turf in locs) @@ -1082,7 +1082,7 @@ About the new airlock wires panel: spawn(0) open() if(prob(40/severity)) - var/duration = SecondsToTicks(30 / severity) + var/duration = (30 SECONDS) / severity if(electrified_until > -1 && (duration + world.time) > electrified_until) electrify(duration) ..() diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index f0f98def655..e19d8b18cc7 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -19,13 +19,13 @@ icon_state = "frame" desc = "A remote control for a door." initial_access = list(access_brig) - anchored = TRUE // can't pick it up - density = FALSE // can walk through it. - var/releasetime = 0 // when world.timeofday reaches it - release the prisoner - var/timing = 1 // boolean, true/1 timer is on, false/0 means it's not timing + anchored = TRUE // can't pick it up + density = FALSE // can walk through it. + var/releasetime = 0 // when REALTIMEOFDAY reaches it - release the prisoner + var/timing = TRUE // boolean, true/1 timer is on, false/0 means it's not timing var/picture_state // icon_state of alert picture, if not displaying text/numbers - var/list/obj/machinery/targets = list() var/timetoset = 0 // Used to set releasetime upon starting the timer + var/list/obj/machinery/targets = list() maptext_height = 26 maptext_width = 32 @@ -57,18 +57,10 @@ // update the door_timer window and the icon /obj/machinery/door_timer/Process() if(stat & (NOPOWER|BROKEN)) return - if(src.timing) - - // poorly done midnight rollover - // (no seriously there's gotta be a better way to do this) - var/timeleft = timeleft() - if(timeleft > 1e5) - src.releasetime = 0 - - - if(world.timeofday > src.releasetime) - src.timer_end(TRUE) // open doors, reset timer, clear status screen, broadcast to sec HUDs - src.timing = 0 + if(timing) + if(timeleft() <= 0) + timer_end(TRUE) // open doors, reset timer, clear status screen, broadcast to sec HUDs + timing = FALSE src.update_icon() @@ -77,7 +69,6 @@ return - // open/closedoor checks if door_timer has power, if so it checks if the // linked door is open/closed (by density) then opens it/closes it. @@ -86,8 +77,7 @@ if(stat & (NOPOWER|BROKEN)) return 0 // Set releasetime - releasetime = world.timeofday + timetoset - + releasetime = REALTIMEOFDAY + timetoset //set timing timing = 1 @@ -104,49 +94,39 @@ C.queue_icon_update() return 1 - // Opens and unlocks doors, power check -/obj/machinery/door_timer/proc/timer_end(var/broadcast_to_huds = 0) - if(stat & (NOPOWER|BROKEN)) return 0 +/obj/machinery/door_timer/proc/timer_end(var/broadcast_to_huds = FALSE) + if(stat & (NOPOWER|BROKEN)) + return FALSE // Reset releasetime releasetime = 0 - //reset timing - timing = 0 + timing = FALSE if (broadcast_to_huds) broadcast_security_hud_message("The timer for [id_tag] has expired.", src) for(var/obj/machinery/door/window/brigdoor/door in targets) - if(!door.density) continue + if(!door.density) + continue spawn(0) door.open() for(var/obj/structure/closet/secure_closet/brig/C in targets) - if(C.broken) continue - if(C.opened) continue - C.locked = 0 + if(C.broken || C.opened) + continue + C.locked = FALSE C.queue_icon_update() - return 1 - + return TRUE // Check for releasetime timeleft /obj/machinery/door_timer/proc/timeleft() - . = round((releasetime - world.timeofday)/10) + . = round((releasetime - REALTIMEOFDAY)/(1 SECOND)) if(. < 0) . = 0 -// Set timetoset -/obj/machinery/door_timer/proc/timeset(var/seconds) - timetoset = seconds * 10 - - if(timetoset <= 0) - timetoset = 0 - - return - /obj/machinery/door_timer/interface_interact(var/mob/user) ui_interact(user) return TRUE @@ -154,7 +134,7 @@ /obj/machinery/door_timer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/list/data = list() - var/timeval = timing ? timeleft() : timetoset/10 + var/timeval = timing ? timeleft() : timetoset / (1 SECOND) data["timing"] = timing data["minutes"] = round(timeval/60) data["seconds"] = timeval % 60 @@ -189,7 +169,7 @@ timer_end() else timer_start() - if(timetoset > 18000) + if(timetoset > (30 MINUTES)) log_and_message_admins("has started a brig timer over 30 minutes in length!") . = TOPIC_REFRESH @@ -200,12 +180,11 @@ if (href_list["adjust"]) timetoset += text2num(href_list["adjust"]) - timetoset = clamp(timetoset, 0, 36000) + timetoset = clamp(timetoset, 0, 1 HOUR) . = TOPIC_REFRESH update_icon() - //icon update function // if NOPOWER, display blank // if BROKEN, display blue screen of death icon AI uses @@ -228,8 +207,6 @@ if(maptext) maptext = "" update_display("Set","Time") // would be nice to have some default printed text - return - // Adds an icon in case the screen is broken/off, stolen from status_display.dm /obj/machinery/door_timer/proc/set_picture(var/state) @@ -237,7 +214,6 @@ overlays.Cut() overlays += image('icons/obj/status_display.dmi', icon_state=picture_state) - //Checks to see if there's 1 line or 2, adds text-icons-numbers/letters over display // Stolen from status_display /obj/machinery/door_timer/proc/update_display(var/line1, var/line2) @@ -247,24 +223,6 @@ if(maptext != new_text) maptext = new_text - -//Actual string input to icon display for loop, with 5 pixel x offsets for each letter. -//Stolen from status_display -/obj/machinery/door_timer/proc/texticon(var/tn, var/px = 0, var/py = 0) - var/image/I = image('icons/obj/status_display.dmi', "blank") - var/len = length(tn) - - for(var/d = 1 to len) - var/char = copytext(tn, len-d+1, len-d+2) - if(char == " ") - continue - var/image/ID = image('icons/obj/status_display.dmi', icon_state=char) - ID.pixel_x = -(d-1)*5 + px - ID.pixel_y = py - I.overlays += ID - return I - - /obj/machinery/door_timer/cell_1 name = "Cell 1" id_tag = "Cell 1" diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index edd7f125381..cc28f19f2c2 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -38,11 +38,8 @@ /obj/machinery/flasher/attackby(obj/item/used_item, mob/user) if(IS_WIRECUTTER(used_item)) add_fingerprint(user, 0, used_item) - src.disable = !src.disable - if (src.disable) - user.visible_message("[user] has disconnected \the [src]'s flashbulb!", "You disconnect \the [src]'s flashbulb!") - if (!src.disable) - user.visible_message("[user] has connected \the [src]'s flashbulb!", "You connect \the [src]'s flashbulb!") + disable = !disable + user.visible_message(SPAN_WARNING("\The [user] has [disable ? "disconnected" : "reconnected"] \the [src]'s flashbulb!"), SPAN_WARNING("You [disable ? "disconnect" : "reconnect"] \the [src]'s flashbulb!")) return TRUE else return ..() diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm index 7482f522af6..1f8f099fd5c 100644 --- a/code/game/machinery/oxygen_pump.dm +++ b/code/game/machinery/oxygen_pump.dm @@ -195,22 +195,17 @@ data["releasePressure"] = 0 data["defaultReleasePressure"] = 0 data["maxReleasePressure"] = 0 - data["maskConnected"] = 0 - data["tankInstalled"] = 0 + data["tankInstalled"] = FALSE // this is the data which will be sent to the ui - if(tank) - data["tankPressure"] = round(tank.air_contents.return_pressure() ? tank.air_contents.return_pressure() : 0) + else + var/tank_pressure = tank.air_contents.return_pressure() + data["tankPressure"] = round(tank_pressure ? tank_pressure : 0) data["releasePressure"] = round(tank.distribute_pressure ? tank.distribute_pressure : 0) data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE) data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE) - data["maskConnected"] = 0 - data["tankInstalled"] = 1 - - if(!breather) - data["maskConnected"] = 0 - if(breather) - data["maskConnected"] = 1 + data["tankInstalled"] = TRUE + data["maskConnected"] = !!breather // update the ui if it exists, returns null if no ui is passed/found ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) diff --git a/code/game/objects/effects/overlays.dm b/code/game/objects/effects/overlays.dm index 38cd105e6d0..146baea3704 100644 --- a/code/game/objects/effects/overlays.dm +++ b/code/game/objects/effects/overlays.dm @@ -4,16 +4,6 @@ /obj/effect/overlay/singularity_pull() return -/obj/effect/overlay/beam//Not actually a projectile, just an effect. - name="beam" - icon='icons/effects/beam.dmi' - icon_state= "b_beam" - var/tmp/atom/BeamSource - -/obj/effect/overlay/beam/Initialize() - . = ..() - QDEL_IN(src, 1 SECOND) - /obj/effect/overlay/palmtree_r name = "Palm tree" icon = 'icons/misc/beach2.dmi' diff --git a/code/game/objects/items/__item.dm b/code/game/objects/items/__item.dm index d9164b23c5e..2a8d149f734 100644 --- a/code/game/objects/items/__item.dm +++ b/code/game/objects/items/__item.dm @@ -711,10 +711,6 @@ RAISE_EVENT(/decl/observ/mob_equipped, user, src, slot) RAISE_EVENT(/decl/observ/item_equipped, src, user, slot) -// As above but for items being equipped to an active module on a robot. -/obj/item/proc/equipped_robot(var/mob/user) - return - //the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't. //Set disable_warning to 1 if you wish it to not give you outputs. //Set ignore_equipped to 1 if you wish to ignore covering checks etc. when this item is already equipped. diff --git a/code/game/objects/items/devices/gps.dm b/code/game/objects/items/devices/gps.dm index fa29f431665..5413be88195 100644 --- a/code/game/objects/items/devices/gps.dm +++ b/code/game/objects/items/devices/gps.dm @@ -100,10 +100,6 @@ var/global/list/all_gps_units = list() if(holder?.client && _compass) holder.client.screen -= _compass -/obj/item/gps/equipped_robot() - . = ..() - update_holder() - /obj/item/gps/equipped() . = ..() update_holder() diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 58437b40dcb..791857f636a 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -28,7 +28,6 @@ var/active = FALSE var/active_parry_chance = 15 - var/active_throwforce = 20 var/active_armour_pen = 50 var/active_edge = 1 var/active_sharp = 1 @@ -36,6 +35,7 @@ var/active_hitsound = 'sound/weapons/blade1.ogg' var/active_sound = 'sound/weapons/saberon.ogg' VAR_PROTECTED/_active_base_attack_force = 30 + VAR_PROTECTED/_active_thrown_force_multiplier = 2/3 var/inactive_sound = 'sound/weapons/saberoff.ogg' @@ -93,9 +93,10 @@ obj_flags |= OBJ_FLAG_NO_STORAGE set_sharp(active_sharp) set_edge(active_edge) - base_parry_chance = active_parry_chance - armor_penetration = active_armour_pen - hitsound = active_hitsound + base_parry_chance = active_parry_chance + armor_penetration = active_armour_pen + hitsound = active_hitsound + _thrown_force_multiplier = _active_thrown_force_multiplier w_class = max(w_class, ITEM_SIZE_NORMAL) slot_flags &= ~SLOT_POCKET @@ -107,9 +108,10 @@ obj_flags &= ~OBJ_FLAG_NO_STORAGE set_sharp(initial(sharp)) set_edge(initial(edge)) - base_parry_chance = initial(base_parry_chance) - armor_penetration = initial(armor_penetration) - hitsound = initial(hitsound) + base_parry_chance = initial(base_parry_chance) + armor_penetration = initial(armor_penetration) + hitsound = initial(hitsound) + _thrown_force_multiplier = initial(_thrown_force_multiplier) w_class = initial(w_class) slot_flags = initial(slot_flags) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index f128e44b16f..eaea88c34e7 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -404,7 +404,6 @@ . = ..(user) if(reinf_material) . += SPAN_NOTICE("It is reinforced with the [reinf_material.solid_name] lattice.") - if (reinf_material) switch (construction_state) if (CONSTRUCTION_STATE_NO_FRAME) . += SPAN_WARNING("The window is not in the frame.") diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 77017eee5f6..dbce3b0808b 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -44,11 +44,7 @@ var/global/list/adminhelp_ignored_words = list("unknown","the","a","an","of","mo msg += "[original_word] (CL) " continue else - var/mob/found = ckeys[word] - if(!found) - found = surnames[word] - if(!found) - found = forenames[word] + var/mob/found = ckeys[word] || surnames[word] || forenames[word] if(found) if(!(found in mobs_found)) mobs_found += found diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index e39ed6b84fa..480a29e1301 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -452,12 +452,7 @@ if (!theme) theme = /datum/exoplanet_theme - var/daycycle = alert("Should the planet have a day-night cycle?","Day Night Cycle", "Yes", "No") - - if (daycycle == "Yes") - daycycle = TRUE - else - daycycle = FALSE + var/daycycle = alert("Should the planet have a day-night cycle?","Day Night Cycle", "Yes", "No") == "Yes" var/last_chance = alert("Spawn exoplanet?", "Final Confirmation", "Yes", "Cancel") diff --git a/code/modules/alarm/alarm.dm b/code/modules/alarm/alarm.dm index 61ae60e38c6..eaa513f0a58 100644 --- a/code/modules/alarm/alarm.dm +++ b/code/modules/alarm/alarm.dm @@ -57,7 +57,7 @@ sources_assoc[source] = AS // Currently only non-0 durations can be altered (normal alarms VS EMP blasts) if(AS.duration) - duration = SecondsToTicks(duration) + duration = duration SECONDS AS.duration = duration AS.severity = severity diff --git a/code/modules/backgrounds/citizenship/_citizenship.dm b/code/modules/backgrounds/citizenship/_citizenship.dm index e16cc9455ac..e2fc47164f9 100644 --- a/code/modules/backgrounds/citizenship/_citizenship.dm +++ b/code/modules/backgrounds/citizenship/_citizenship.dm @@ -1,7 +1,7 @@ /decl/background_detail/citizenship abstract_type = /decl/background_detail/citizenship category = /decl/background_category/citizenship - var/ruling_body = "Other Faction" + var/ruling_body = "Other Faction" // currently unused? todo: display this or remove it? nothing seems to actually set it... var/capital var/size_heading = "Systems" var/size_value diff --git a/code/modules/clothing/spacesuits/rig/modules/computer.dm b/code/modules/clothing/spacesuits/rig/modules/computer.dm index 68570144c14..673ecb204be 100644 --- a/code/modules/clothing/spacesuits/rig/modules/computer.dm +++ b/code/modules/clothing/spacesuits/rig/modules/computer.dm @@ -66,10 +66,7 @@ /obj/item/rig_module/ai_container/Process() if(integrated_ai) var/obj/item/rig/rig = get_rig() - if(rig && rig.ai_override_enabled) - integrated_ai.get_rig_stats = 1 - else - integrated_ai.get_rig_stats = 0 + integrated_ai.get_rig_stats = rig?.ai_override_enabled /mob/living/Stat() . = ..() diff --git a/code/modules/crafting/stack_recipes/_recipe_getter.dm b/code/modules/crafting/stack_recipes/_recipe_getter.dm index 41bfffc954e..cf79001263d 100644 --- a/code/modules/crafting/stack_recipes/_recipe_getter.dm +++ b/code/modules/crafting/stack_recipes/_recipe_getter.dm @@ -16,7 +16,6 @@ /* * Recipe retrieval proc. */ -var/global/list/cached_recipes = list() /proc/get_stack_recipes(decl/material/mat, decl/material/reinf_mat, stack_type, tool_type, flat = FALSE) // No recipes for holograms or fluids. @@ -25,8 +24,9 @@ var/global/list/cached_recipes = list() #ifndef UNIT_TEST // key creation is SLOW and in unit testing almost every call to this will be a cache fail // Check if we've cached this before. + var/static/alist/cached_recipes = alist() var/key = jointext(list((mat?.name || "base"), (reinf_mat?.name || "base"), (stack_type || "base"), (tool_type || "base")), "-") - . = global.cached_recipes[key] + . = cached_recipes[key] #endif if(!.) @@ -49,5 +49,5 @@ var/global/list/cached_recipes = list() for(var/group_name in grouped_recipes) . += new /datum/stack_recipe_list(group_name, grouped_recipes[group_name]) #ifndef UNIT_TEST // associative list insertion is SLOW and in unit testing almost every call to this will be a cache fail - global.cached_recipes[key] = . + cached_recipes[key] = . #endif diff --git a/code/modules/geology/_strata.dm b/code/modules/geology/_strata.dm index 24acb2d824d..411da879d3d 100644 --- a/code/modules/geology/_strata.dm +++ b/code/modules/geology/_strata.dm @@ -3,15 +3,23 @@ var/list/base_materials var/list/ores_sparse var/list/ores_rich - var/default_strata_candidate = FALSE + var/const/STRATA_RANDOM_NEVER = 0 + var/const/STRATA_RANDOM_PLANET = BITFLAG(0) + var/const/STRATA_RANDOM_LEVEL = BITFLAG(1) + var/const/STRATA_RANDOM_ANY = STRATA_RANDOM_PLANET | STRATA_RANDOM_LEVEL + var/default_strata_candidate = STRATA_RANDOM_NEVER var/maximum_temperature = INFINITY /decl/strata/proc/is_valid_exoplanet_strata(var/datum/planetoid_data/planet) + if(!(default_strata_candidate & STRATA_RANDOM_PLANET)) + return FALSE if(istype(planet.atmosphere)) return planet.atmosphere.temperature <= maximum_temperature return TCMB <= maximum_temperature /decl/strata/proc/is_valid_level_stratum(datum/level_data/level_data) + if(!(default_strata_candidate & STRATA_RANDOM_LEVEL)) + return FALSE var/temperature_to_check = istype(level_data.exterior_atmosphere) ? level_data.exterior_atmosphere.temperature : level_data.exterior_atmos_temp return (temperature_to_check || TCMB) <= maximum_temperature diff --git a/code/modules/geology/strata_igneous.dm b/code/modules/geology/strata_igneous.dm index 7c6a77e9e0e..9ee95452521 100644 --- a/code/modules/geology/strata_igneous.dm +++ b/code/modules/geology/strata_igneous.dm @@ -1,12 +1,12 @@ /decl/strata/igneous name = "igneous rock" base_materials = list(/decl/material/solid/stone/basalt) - default_strata_candidate = TRUE + default_strata_candidate = STRATA_RANDOM_ANY ores_rich = list( /decl/material/solid/gemstone/diamond, /decl/material/solid/quartz, /decl/material/solid/graphite, - /decl/material/solid/densegraphite, + /decl/material/solid/densegraphite, /decl/material/solid/metal/gold, /decl/material/solid/quartz, /decl/material/solid/metal/platinum, diff --git a/code/modules/geology/strata_metamorphic.dm b/code/modules/geology/strata_metamorphic.dm index a1eeced227a..aefa322cfbc 100644 --- a/code/modules/geology/strata_metamorphic.dm +++ b/code/modules/geology/strata_metamorphic.dm @@ -1,7 +1,7 @@ /decl/strata/metamorphic name = "metamorphic rock" base_materials = list(/decl/material/solid/stone/marble) - default_strata_candidate = TRUE + default_strata_candidate = STRATA_RANDOM_ANY ores_rich = list( /decl/material/solid/quartz, /decl/material/solid/graphite, diff --git a/code/modules/geology/strata_permafrost.dm b/code/modules/geology/strata_permafrost.dm index ee157faa20d..994587ba5cc 100644 --- a/code/modules/geology/strata_permafrost.dm +++ b/code/modules/geology/strata_permafrost.dm @@ -18,4 +18,5 @@ /decl/material/solid/ice/hydrate/krypton, /decl/material/solid/ice/hydrate/xenon, ) + default_strata_candidate = STRATA_RANDOM_PLANET maximum_temperature = T0C diff --git a/code/modules/geology/strata_sedimentary.dm b/code/modules/geology/strata_sedimentary.dm index 27f229ce298..0e502aa7135 100644 --- a/code/modules/geology/strata_sedimentary.dm +++ b/code/modules/geology/strata_sedimentary.dm @@ -1,7 +1,7 @@ /decl/strata/sedimentary name = "sedimentary rock" base_materials = list(/decl/material/solid/stone/sandstone) - default_strata_candidate = TRUE + default_strata_candidate = STRATA_RANDOM_ANY ores_rich = list( /decl/material/solid/pitchblende, /decl/material/solid/pyrite, diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm index af1d79e8cbd..055fd84cd2e 100644 --- a/code/modules/hydroponics/seed_machines.dm +++ b/code/modules/hydroponics/seed_machines.dm @@ -126,25 +126,17 @@ data["geneMasks"] = SSplants.gene_masked_list data["activity"] = active data["degradation"] = degradation - - if(loaded_disk) - data["disk"] = 1 - else - data["disk"] = 0 - - if(seed) - data["loaded"] = "[seed.name]" - else - data["loaded"] = 0 + data["disk"] = !!loaded_disk + data["loaded"] = seed?.name || FALSE if(genetics) - data["hasGenetics"] = 1 + data["hasGenetics"] = TRUE data["sourceName"] = genetics.display_name if(!genetics.roundstart) data["sourceName"] += " (variety #[genetics.uid])" else - data["hasGenetics"] = 0 - data["sourceName"] = 0 + data["hasGenetics"] = FALSE + data["sourceName"] = FALSE ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) diff --git a/code/modules/hydroponics/trays/tray_soil.dm b/code/modules/hydroponics/trays/tray_soil.dm index 7e74e1aa014..0f077fba242 100644 --- a/code/modules/hydroponics/trays/tray_soil.dm +++ b/code/modules/hydroponics/trays/tray_soil.dm @@ -168,7 +168,7 @@ plant_health = seed.get_trait(TRAIT_ENDURANCE) if(isnull(default_pixel_y)) default_pixel_y = rand(-12,12) - if(isnull(default_pixel_y)) + if(isnull(default_pixel_x)) default_pixel_x = rand(-12,12) reset_offsets(0) if(seed) diff --git a/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm b/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm index 95df86b82f9..06bc29a8462 100644 --- a/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm +++ b/code/modules/maps/template_types/random_exoplanet/planetoid_data.dm @@ -17,7 +17,7 @@ ///Preferred height for all the planet z-levels. Null means it's up to each z-levels. Not reliable for telling the height of the levels under this planet. var/height ///Preferred amount of vertically connected z-levels for this planets. Null means it's up to each z-levels. - var/tallness = 1 + var/tallness = 1 // unused, seems to be made redundant by /datum/map_template/planetoid/tallness ///Topmost level data datum id of the root z stack (ID only, because this datum has an uncontrolled lifetime, and we don't want dangling refs) var/topmost_level_id ///Level data id for the level that's considered to be the planet's surface. In other words, the topmost firm ground level of the root z stack. diff --git a/code/modules/materials/material_metabolism.dm b/code/modules/materials/material_metabolism.dm index 71714cf27fb..dcbed9dec06 100644 --- a/code/modules/materials/material_metabolism.dm +++ b/code/modules/materials/material_metabolism.dm @@ -87,8 +87,6 @@ removed = inhale_met if(!removed) removed = metabolism - if(!removed) - removed = metabolism removed = M.get_adjusted_metabolism(removed) //adjust effective amounts - removed, dose, and max_dose - for mob size diff --git a/code/modules/mob/living/silicon/robot/component.dm b/code/modules/mob/living/silicon/robot/component.dm index 45a09beca26..f6d49a565a1 100644 --- a/code/modules/mob/living/silicon/robot/component.dm +++ b/code/modules/mob/living/silicon/robot/component.dm @@ -74,13 +74,13 @@ return (installed == 1) && (brute_damage + burn_damage < max_damage) && (!idle_usage || powered) /datum/robot_component/proc/update_power_state() - if(toggled == 0) - powered = 0 + if(!toggled) + powered = FALSE return if(owner.cell_use_power(idle_usage)) - powered = 1 + powered = TRUE else - powered = 0 + powered = FALSE // ARMOUR // Protects the cyborg from damage. Usually first module to be hit diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index b5508d6d221..ceed4ab9ed0 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -271,7 +271,7 @@ if(!(alarm.alarm_z() in SSmapping.get_connected_levels(my_z))) return // Didn't actually hear it as far as we're concerned. if(!next_alarm_notice) - next_alarm_notice = world.time + SecondsToTicks(10) + next_alarm_notice = world.time + (10 SECONDS) var/list/alarms = queued_alarms[alarm_handler] if(was_raised) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 7a546009a86..872835bafbd 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -562,43 +562,6 @@ english_only - whether to use traditional english letters only (for use in NanoU /mob/proc/ssd_check() return !client && !teleop && (last_ckey || !ai) -/mob/proc/try_teleport(var/area/thearea) - if(istype(thearea, /list)) - var/list/area_list = thearea - thearea = area_list[1] - var/list/L = list() - for(var/turf/T in get_area_turfs(thearea)) - if(!T.density) - var/clear = 1 - for(var/obj/O in T) - if(O.density) - clear = 0 - break - if(clear) - L+=T - - if(buckled) - buckled = null - - var/attempt = null - var/success = 0 - var/turf/end - var/candidates = L.Copy() - while(L.len) - attempt = pick(L) - success = Move(attempt) - if(!success) - L.Remove(attempt) - else - end = attempt - break - - if(!success) - end = pick(candidates) - forceMove(end) - - return end - //Tries to find the mob's email. /proc/find_email(real_name) for(var/mob/mob in global.living_mob_list_) diff --git a/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm b/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm index 070f698817a..680f6241059 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/access_decrypter.dm @@ -137,19 +137,21 @@ else if(RFID && RFID.stored_card) var/obj/item/card/id/id_card = RFID.stored_card var/list/regions = list() - for(var/i = ACCESS_REGION_MIN; i <= ACCESS_REGION_MAX; i++) + for(var/region_name, access_data in get_all_access_datums_by_region_name()) var/list/accesses = list() - for(var/access in get_region_accesses(i)) - if (get_access_desc(access)) - accesses.Add(list(list( - "desc" = replacetext(get_access_desc(access), " ", " "), - "ref" = access, - "allowed" = (access in id_card.access) ? 1 : 0, - "blocked" = ((access in PRG.restricted_access_codes) || ((access in PRG.skill_restricted_access_codes_master) && PRG.operator_skill < SKILL_PROF)) ? 1 : 0))) - - regions.Add(list(list( - "name" = get_region_accesses_name(i), - "accesses" = accesses))) + for(var/datum/access/access_datum in access_data) + if (!access_datum.desc) + continue + // += or Add would add each individual entry + ADD_LIST_AS_ENTRY(accesses, list( + "desc" = replacetext(access_datum.desc, " ", " "), + "ref" = access_datum.id, + "allowed" = (access_datum.id in id_card.access), + "blocked" = ((access_datum.id in PRG.restricted_access_codes) || ((access_datum.id in PRG.skill_restricted_access_codes_master) && PRG.operator_skill < SKILL_PROF)) ? 1 : 0)) + + ADD_LIST_AS_ENTRY(regions, list( + "name" = region_name, + "accesses" = accesses)) data["regions"] = regions ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index af9339b6a13..e7ec4d640e7 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -75,18 +75,20 @@ data["all_centcom_access"] = all_centcom_access else var/list/regions = list() - for(var/i = 1; i <= 8; i++) + for(var/region_name, access_data in get_all_access_datums_by_region_name()) var/list/accesses = list() - for(var/access in get_region_accesses(i)) - if (get_access_desc(access)) - accesses.Add(list(list( - "desc" = replacetext(get_access_desc(access), " ", " "), - "ref" = access, - "allowed" = (access in id_card.access) ? 1 : 0))) + for(var/datum/access/access_datum in access_data) + if (!access_datum.desc) + continue + // += or Add would add each individual entry + ADD_LIST_AS_ENTRY(accesses, list( + "desc" = replacetext(access_datum.desc, " ", " "), + "ref" = access_datum.id, + "allowed" = LAZYISIN(id_card.access, access_datum.id))) - regions.Add(list(list( - "name" = get_region_accesses_name(i), - "accesses" = accesses))) + ADD_LIST_AS_ENTRY(regions, list( + "name" = region_name, + "accesses" = accesses)) data["regions"] = regions ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open) diff --git a/code/modules/modular_computers/file_system/programs/engineering/atmos_control.dm b/code/modules/modular_computers/file_system/programs/engineering/atmos_control.dm index c1e691ad90e..995fc28cc69 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/atmos_control.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/atmos_control.dm @@ -80,9 +80,9 @@ continue var/danger_level = max(alarm.danger_level, alarm.alarm_area.atmosalm) - if(danger_level == 2) + if(danger_level == /obj/machinery/alarm::DANGER_DANGER) alarmsAlert[++alarmsAlert.len] = list("name" = alarm_name, "ref"= "\ref[alarm]", "danger" = danger_level) - else if(danger_level == 1) + else if(danger_level == /obj/machinery/alarm::DANGER_WARN) alarmsDanger[++alarmsDanger.len] = list("name" = alarm_name, "ref"= "\ref[alarm]", "danger" = danger_level) else alarms[++alarms.len] = list("name" = alarm_name, "ref"= "\ref[alarm]", "danger" = danger_level) diff --git a/code/modules/modular_computers/file_system/programs/generic/records.dm b/code/modules/modular_computers/file_system/programs/generic/records.dm index 0305f32e421..b8e5f428e8d 100644 --- a/code/modules/modular_computers/file_system/programs/generic/records.dm +++ b/code/modules/modular_computers/file_system/programs/generic/records.dm @@ -98,7 +98,7 @@ to_chat(usr, SPAN_WARNING("Network error.")) return var/list/accesses = get_access(usr) - if(!network.get_mainframes_by_role(MF_ROLE_CREW_RECORDS, accesses)) + if(!length(network.get_mainframes_by_role(MF_ROLE_CREW_RECORDS, accesses))) to_chat(usr, SPAN_WARNING("You may not have access to generate new crew records, or there may not be a crew record mainframe active on the network.")) return active_record = new/datum/computer_file/report/crew_record() diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index b3afab56119..7a9e0cd3b96 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -165,8 +165,6 @@ damprob = stability_effect ? 80 : 100 if(prob(damprob)) take_damage(1) - if(prob(damprob)) - take_damage(1) ..() /obj/item/organ/internal/brain/take_damage(damage, damage_type = BRUTE, damage_flags, inflicter, armor_pen = 0, silent, do_update_health) diff --git a/code/modules/overmap/ships/ship.dm b/code/modules/overmap/ships/ship.dm index 133c506ffa6..d5e82b416ed 100644 --- a/code/modules/overmap/ships/ship.dm +++ b/code/modules/overmap/ships/ship.dm @@ -121,9 +121,16 @@ var/global/const/OVERMAP_SPEED_CONSTANT = (1 SECOND) ..() -/obj/effect/overmap/visitable/ship/proc/burn() +/obj/effect/overmap/visitable/ship/proc/burn(partial_power) + partial_power = clamp(partial_power, 0, 1) + . = 0 for(var/datum/extension/ship_engine/E in engines) - . += E.burn() + . += E.burn(partial_power) + +/obj/effect/overmap/visitable/ship/proc/get_exhaust_velocity() + . = 0 + for(var/datum/extension/ship_engine/E in engines) + . += E.get_exhaust_velocity() /obj/effect/overmap/visitable/ship/can_burn() if(halted) diff --git a/code/modules/overmap/ships/ship_physics.dm b/code/modules/overmap/ships/ship_physics.dm index 28e71cf1f5b..0dca944659e 100644 --- a/code/modules/overmap/ships/ship_physics.dm +++ b/code/modules/overmap/ships/ship_physics.dm @@ -4,10 +4,8 @@ // to get a ship's total *possible* approxiamte delta v, use get_total_delta_v(). // partial power is used with burn() in order to only do partial burns. /obj/effect/overmap/visitable/ship/get_delta_v(var/real_burn = FALSE, var/partial_power = 1) - var/total_exhaust_velocity = 0 partial_power = clamp(partial_power, 0, 1) - for(var/datum/extension/ship_engine/E in engines) - total_exhaust_velocity += real_burn ? E.burn(partial_power) : E.get_exhaust_velocity() + var/total_exhaust_velocity = real_burn ? burn(partial_power) : get_exhaust_velocity() var/vessel_mass = get_vessel_mass() // special note here // get_instant_wet_mass() returns kg diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 01ab115896a..af50b411ee5 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -208,10 +208,7 @@ data["secondaryOutletPressure"] = circ2.air2.return_pressure() data["secondaryOutletTemperature"] = circ2.air2.temperature - if(circ1 && circ2) - data["circConnected"] = 1 - else - data["circConnected"] = 0 + data["circConnected"] = !!(circ1 && circ2) // update the ui if it exists, returns null if no ui is passed/found diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 13b739cf041..2e1513d8061 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -78,7 +78,6 @@ var/selector_sound = 'sound/weapons/guns/selector.ogg' //aiming system stuff - var/tmp/list/mob/living/aim_targets //List of who yer targeting. var/tmp/last_safety_check = -INFINITY var/safety_state = 1 var/has_safety = TRUE @@ -501,7 +500,7 @@ disp_mod += 0.5 //accuracy bonus from aiming - if (aim_targets && (target in aim_targets)) + if (user.aiming?.aiming_at == target) //If you aim at someone beforehead, it'll hit more often. //Kinda balanced by fact you need like 2 seconds to aim //As opposed to no-delay pew pew diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm index 43478d11594..359d016f914 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic.dm @@ -83,9 +83,9 @@ if(mag.remaining) add_overlay("[icon_state]_ammo") -/obj/item/gun/magnetic/proc/show_ammo(var/mob/user) +/obj/item/gun/magnetic/proc/get_ammo_string(mob/user, distance) if(loaded) - to_chat(user, "It has \a [loaded] loaded.") + return SPAN_NOTICE("It has \a [loaded] loaded.") /obj/item/gun/magnetic/get_examine_strings(mob/user, distance, infix, suffix) . = ..() @@ -97,6 +97,9 @@ . += SPAN_NOTICE("The capacitor charge indicator is [SPAN_ORANGE("amber")].") else . += SPAN_NOTICE("The capacitor charge indicator is [SPAN_GREEN("green")].") + var/ammo_string = get_ammo_string(user, distance) + if(ammo_string) + . += ammo_string /obj/item/gun/magnetic/attackby(var/obj/item/used_item, var/mob/user) diff --git a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm index 30bb71cea69..127b3ff7ca3 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm @@ -33,12 +33,12 @@ // Not going to check type repeatedly, if you code or varedit // load_type and get runtime errors, don't come crying to me. -/obj/item/gun/magnetic/railgun/show_ammo(var/mob/user) +/obj/item/gun/magnetic/railgun/get_ammo_string(mob/user, distance) var/obj/item/rcd_ammo/ammo = loaded if (ammo) - to_chat(user, "There are [ammo.remaining] shot\s remaining in \the [loaded].") + return SPAN_NOTICE("There [ammo.remaining == 1 ? "is" : "are"] [ammo.remaining] shot\s remaining in \the [loaded].") else - to_chat(user, "There is nothing loaded.") + return SPAN_NOTICE("There is nothing loaded.") /obj/item/gun/magnetic/railgun/check_ammo() var/obj/item/rcd_ammo/ammo = loaded diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index d36ec1783cc..48adb41fa7c 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -78,9 +78,9 @@ var/fire_sound var/fire_sound_vol = 50 var/fire_sound_vol_silenced = 10 - var/miss_sounds - var/ricochet_sounds - var/list/impact_sounds //for different categories, IMPACT_MEAT etc + var/miss_sounds // CURRENTLY UNUSED + var/ricochet_sounds // CURRENTLY UNUSED + var/list/impact_sounds //for different categories, IMPACT_MEAT etc. CURRENTLY UNUSED var/shrapnel_type = /obj/item/shard/shrapnel var/vacuum_traversal = 1 //Determines if the projectile can exist in vacuum, if false, the projectile will be deleted if it enters vacuum. diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index e94f5926a34..ec1c968a885 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -47,9 +47,9 @@ /obj/item/projectile/bullet/attack_mob(var/mob/target_mob, var/distance, var/miss_modifier) if(penetrating > 0 && damage > 20 && prob(damage)) - mob_passthrough_check = 1 + mob_passthrough_check = TRUE else - mob_passthrough_check = 0 + mob_passthrough_check = FALSE . = ..() if(. == 1 && isliving(target_mob)) var/mob/living/squish = target_mob diff --git a/code/modules/projectiles/targeting/targeting_overlay.dm b/code/modules/projectiles/targeting/targeting_overlay.dm index c0bb7ce8a7b..4009d24cfe0 100644 --- a/code/modules/projectiles/targeting/targeting_overlay.dm +++ b/code/modules/projectiles/targeting/targeting_overlay.dm @@ -55,6 +55,7 @@ to_chat(owner, aim_message) if(aiming_at) to_chat(aiming_at, "You are [message].") + /obj/aiming_overlay/Process() if(!owner) qdel(src) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 49527c33cdb..32ed9077eeb 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -273,10 +273,7 @@ var/global/list/diversion_junctions = list() return TOPIC_HANDLED if(href_list["pump"]) - if(text2num(href_list["pump"])) - mode = 1 - else - mode = 0 + mode = !!text2num(href_list["pump"]) update_icon() . = TOPIC_REFRESH diff --git a/code/modules/salvage/salvage.dm b/code/modules/salvage/salvage.dm index ecf3196f883..24801642b5d 100644 --- a/code/modules/salvage/salvage.dm +++ b/code/modules/salvage/salvage.dm @@ -14,7 +14,8 @@ if(!ispath(salvaged_type, /obj/item)) return INITIALIZE_HINT_QDEL // TODO: grab partial initial matter from the salvage type. - icon_rotation = rand(-45, 45) + if(do_rotation) + icon_rotation = rand(-45, 45) name = "[pick("busted", "broken", "shattered", "scrapped")] [salvaged_type::name]" w_class = salvaged_type::w_class diff --git a/code/modules/salvage/structure.dm b/code/modules/salvage/structure.dm index 1d71f206157..330f6083737 100644 --- a/code/modules/salvage/structure.dm +++ b/code/modules/salvage/structure.dm @@ -4,7 +4,7 @@ tool_interaction_flags = TOOL_INTERACTION_DECONSTRUCT material = /decl/material/solid/metal/steel var/frame_type = /obj/machinery/constructable_frame/machine_frame - var/work_skill = SKILL_CONSTRUCTION + var/work_skill = SKILL_CONSTRUCTION // currently unused /obj/structure/salvage/proc/get_salvageable_components() return diff --git a/code/modules/sprite_accessories/tails/_accessory_tail.dm b/code/modules/sprite_accessories/tails/_accessory_tail.dm index 031e7ac4079..44d3c41facb 100644 --- a/code/modules/sprite_accessories/tails/_accessory_tail.dm +++ b/code/modules/sprite_accessories/tails/_accessory_tail.dm @@ -35,8 +35,6 @@ color_blend = ICON_MULTIPLY var/icon_animation_states - var/hair_state - var/hair_blend = ICON_ADD /decl/sprite_accessory/tail/none name = "Default Tail" diff --git a/code/modules/turbolift/turbolift.dm b/code/modules/turbolift/turbolift.dm index f343dce1d98..5619388fdf9 100644 --- a/code/modules/turbolift/turbolift.dm +++ b/code/modules/turbolift/turbolift.dm @@ -85,10 +85,7 @@ return 0 target_floor = queued_floors[1] queued_floors -= target_floor - if(current_floor_index < floors.Find(target_floor)) - moving_upwards = 1 - else - moving_upwards = 0 + moving_upwards = (current_floor_index < floors.Find(target_floor)) if(doors_are_open()) if(!doors_closing) diff --git a/maps/shaded_hills/levels/strata.dm b/maps/shaded_hills/levels/strata.dm index 54781d0f5dc..7ea08f8512e 100644 --- a/maps/shaded_hills/levels/strata.dm +++ b/maps/shaded_hills/levels/strata.dm @@ -2,7 +2,7 @@ /decl/strata/shaded_hills name = "mountainous rock" base_materials = list(/decl/material/solid/stone/basalt) - default_strata_candidate = FALSE + default_strata_candidate = STRATA_RANDOM_NEVER // this is for a specific map ores_sparse = list( /decl/material/solid/quartz, /decl/material/solid/graphite, diff --git a/mods/content/integrated_electronics/components/logic.dm b/mods/content/integrated_electronics/components/logic.dm index ee09979abce..65445d8995a 100644 --- a/mods/content/integrated_electronics/components/logic.dm +++ b/mods/content/integrated_electronics/components/logic.dm @@ -123,21 +123,18 @@ outputs = list("Q" = IC_PINTYPE_BOOLEAN,"!Q" = IC_PINTYPE_BOOLEAN) activators = list("pulse in C" = IC_PINTYPE_PULSE_IN, "pulse out Q" = IC_PINTYPE_PULSE_OUT, "pulse out !Q" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH - var/lstate=FALSE + var/latch_state = FALSE /obj/item/integrated_circuit/logic/binary/gdlatch/do_work() - var/datum/integrated_io/A = inputs[1] - var/datum/integrated_io/B = inputs[2] - var/datum/integrated_io/O = outputs[1] - var/datum/integrated_io/Q = outputs[2] - if(B.data) - if(A.data) - lstate=TRUE - else - lstate=FALSE - - O.data = lstate ? TRUE : FALSE - Q.data = !lstate ? TRUE : FALSE + var/datum/integrated_io/data_pin = inputs[1] + var/datum/integrated_io/load_pin = inputs[2] + var/datum/integrated_io/Q_pin = outputs[1] + var/datum/integrated_io/Qnot_pin = outputs[2] + if(load_pin.data) + latch_state = !!data_pin.data + + Q_pin.data = latch_state + Qnot_pin.data = !latch_state if(get_pin_data(IC_OUTPUT, 1)) activate_pin(2) else diff --git a/mods/content/supermatter/structures/supermatter_crystal.dm b/mods/content/supermatter/structures/supermatter_crystal.dm index 8bc697cd896..284f6d4e695 100644 --- a/mods/content/supermatter/structures/supermatter_crystal.dm +++ b/mods/content/supermatter/structures/supermatter_crystal.dm @@ -539,11 +539,8 @@ var/global/list/supermatter_delam_accent_sounds = list( var/effect = max(0, min(200, power * config_hallucination_power * sqrt( 1 / max(1,get_dist(subject, src)))) ) subject.adjust_hallucination(effect, 0.25 * effect) - if(power) - var/size_calc = max((power / 200), 1) //this needs to be a decently small value, but not TOO small. - animate_filter("outline", list(size = size_calc)) - if(!power) - animate_filter("outline", list(size = 0)) + var/size_calc = power ? max(power / 200, 1) : 0 //this needs to be a decently small value if we have power, but not TOO small. + animate_filter("outline", list(size = size_calc)) color = color_matrix_contrast(Interpolate(1, 5, clamp( (damage - emergency_point) / (explosion_point - emergency_point), 0, 1))) diff --git a/mods/species/ascent/items/guns.dm b/mods/species/ascent/items/guns.dm index 99a76ce5351..e9e42dd733a 100644 --- a/mods/species/ascent/items/guns.dm +++ b/mods/species/ascent/items/guns.dm @@ -60,9 +60,10 @@ if(isrobot(loc) || istype(loc, /obj/item/rig_module)) return loc.get_cell() -/obj/item/gun/magnetic/railgun/flechette/ascent/show_ammo(var/mob/user) +/obj/item/gun/magnetic/railgun/flechette/ascent/get_ammo_string(mob/user, distance) var/obj/item/cell/cell = get_cell() - to_chat(user, "There are [cell ? floor(cell.charge/charge_per_shot) : 0] shot\s remaining.") + var/shots_left = cell ? floor(cell.charge/charge_per_shot) : 0 + return SPAN_NOTICE("There [shots_left == 1 ? "is" : "are"] [shots_left] shot\s remaining.") /obj/item/gun/magnetic/railgun/flechette/ascent/check_ammo() var/obj/item/cell/cell = get_cell() diff --git a/mods/species/serpentid/datum/species.dm b/mods/species/serpentid/datum/species.dm index f01a3f4c746..9e3e5aed99d 100644 --- a/mods/species/serpentid/datum/species.dm +++ b/mods/species/serpentid/datum/species.dm @@ -126,8 +126,7 @@ if(!part) image_key += "0" continue - if(part) - image_key += "[part.bodytype.get_icon_cache_uid(part.owner)]" + image_key += "[part.bodytype.get_icon_cache_uid(part.owner)]" if(!BP_IS_PROSTHETIC(part) && (part.status & ORGAN_DEAD)) image_key += "2" else