Skip to content

Commit

Permalink
Merge Upstream 12.01.2025 (#1743)
Browse files Browse the repository at this point in the history
This pull request merges upstream/master. Resolve possible conflicts
manually and make sure all the changes are applied correctly.

## Changelog
:cl: ParadiseSS13
fix: Теперь ночное освещение действительно экономит энергию. <!-- night
shift lighting actually saves power now
(www.github.com/ParadiseSS13/Paradise/pull/27770) -->
add: Хирургический компьютер теперь показывает нужный инструмент для
каждого этапа операции, а также отображает все активные операции у
пациента. <!-- The surgical computer now displays the tool needed for
each step, as well as listing out all active surgeries on a patient.
(www.github.com/ParadiseSS13/Paradise/pull/27755) -->
/:cl:

## Summary by Sourcery

Update canister pressure appearance logic and improve surgery computer
information display. Reduce power usage of lights in nightshift mode.

Bug Fixes:
- Fix night shift lighting power saving.
- Surgical computer now shows the correct tool for each surgery step and
displays all active surgeries on a patient.

Enhancements:
- Improve canister pressure display logic.
  • Loading branch information
Legendaxe authored Jan 12, 2025
2 parents 213d24d + 563d001 commit c5e9a11
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 161 deletions.
6 changes: 3 additions & 3 deletions code/__DEFINES/tools_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#define TOOL_DRILL "drill"
#define TOOL_SCALPEL "scalpel"
#define TOOL_SAW "saw"
#define TOOL_BONESET "bonesetter"
#define TOOL_BONEGEL "bonegel"
#define TOOL_FIXOVEIN "fixovein"
#define TOOL_BONESET "bone setter"
#define TOOL_BONEGEL "bone gel"
#define TOOL_FIXOVEIN "fix-o-vein"

GLOBAL_LIST_INIT(surgery_tool_behaviors, list(
TOOL_RETRACTOR,
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
//When a borg is activated, it can choose which AI it wants to be slaved to
/proc/active_ais()
. = list()
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
if(A.stat == DEAD)
continue
if(A.control_disabled)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ SUBSYSTEM_DEF(ticker)
end_of_round_info += "<BR>"

//Silicon laws report
for(var/mob/living/silicon/ai/aiPlayer in GLOB.mob_list)
for(var/mob/living/silicon/ai/aiPlayer in GLOB.ai_list)
var/ai_ckey = safe_get_ckey(aiPlayer)

if(aiPlayer.stat != DEAD)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To draw a rune, use a ritual dagger.
keyword = set_keyword
var/image/blood = image(loc = src)
blood.override = 1
for(var/mob/living/silicon/ai/AI in GLOB.player_list)
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
AI.client.images += blood

/obj/effect/rune/examine(mob/user)
Expand Down
14 changes: 10 additions & 4 deletions code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
// Blast you, imperial measurement system
occupantData["btCelsius"] = occupant.bodytemperature - T0C
occupantData["btFaren"] = ((occupant.bodytemperature - T0C) * (9.0/5.0))+ 32
occupantData["activeSurgeries"] = list()

if(ishuman(occupant) && !(NO_BLOOD in occupant.dna.species.species_traits))
var/mob/living/carbon/human/H = occupant
Expand All @@ -127,15 +128,20 @@
occupantData["bloodType"] = occupant.dna.blood_type
if(length(occupant.surgeries))
occupantData["inSurgery"] = 1

for(var/datum/surgery/procedure in occupant.surgeries)
occupantData["surgeryName"] = "[capitalize(procedure.name)]"
var/datum/surgery_step/surgery_step = procedure.get_surgery_step()
var/surgery_desc = "[capitalize(surgery_step.get_step_information(procedure))]"
var/surgery_desc = "[capitalize(surgery_step.get_step_information(procedure, TRUE))]"
if(surgery_step.repeatable)
var/datum/surgery_step/next = procedure.get_surgery_next_step()
if(next)
surgery_desc += " or [capitalize(next.get_step_information(procedure))]"
occupantData["stepName"] = surgery_desc
surgery_desc += " or [capitalize(next.get_step_information(procedure, TRUE))]"

occupantData["activeSurgeries"] += list(list(
"name" = "[capitalize(procedure.name)]",
"step" = surgery_desc,
"location" = capitalize(parse_zone(procedure.location)),
))

data["occupant"] = occupantData
data["verbose"] = verbose
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/enginepicker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
new G(T) //Spawns the switch-selected engine on the chosen beacon's turf

var/ailist[] = list()
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
ailist += A
if(length(ailist))
var/mob/living/silicon/ai/announcer = pick(ailist)
Expand Down
88 changes: 29 additions & 59 deletions code/modules/atmospherics/machinery/portable/canister.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@

GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())

#define HOLDING_TANK (1<<0)
#define CONNECTED_PORT (1<<1)
#define LOW_PRESSURE (1<<2)
#define NORMAL_PRESSURE (1<<3)
#define HIGH_PRESSURE (1<<4)
#define EXTREME_PRESSURE (1<<5)
#define NEW_COLOR (1<<6)
#define RESET (LOW_PRESSURE | NEW_COLOR)
#define LOW_PRESSURE 0
#define NORMAL_PRESSURE 1
#define HIGH_PRESSURE 2
#define EXTREME_PRESSURE 3

/obj/machinery/atmospherics/portable/canister
name = "canister"
Expand All @@ -71,9 +67,6 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
var/list/canister_color //variable that stores colours
var/list/color_index // list which stores tgui color indexes for the recoloring options, to enable previously-set colors to show up right

//lists for check_change()
var/list/old_color

//passed to the ui to render the color lists
var/list/colorcontainer

Expand All @@ -85,7 +78,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
power_state = NO_POWER_USE
interact_offline = TRUE
var/release_log = ""
var/update_flag = NONE
var/current_pressure_appearance

/obj/machinery/atmospherics/portable/canister/Initialize(mapload)
. = ..()
Expand All @@ -97,8 +90,6 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
"quart" = "none"
)

old_color = list()

colorcontainer = list(
"prim" = list(
"options" = GLOB.canister_icon_container.possiblemaincolor,
Expand Down Expand Up @@ -130,47 +121,25 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
if(isAntag(user))
. += "<span class='notice'>Canisters can be damaged, spilling their contents into the air, or you can just leave the release valve open.</span>"

/obj/machinery/atmospherics/portable/canister/proc/check_change()
var/old_flag = update_flag
update_flag = NONE
if(holding_tank)
update_flag |= HOLDING_TANK
if(connected_port)
update_flag |= CONNECTED_PORT

var/tank_pressure = air_contents.return_pressure()
/obj/machinery/atmospherics/portable/canister/proc/pressure_to_appearance(tank_pressure)
if(tank_pressure < 10)
update_flag |= LOW_PRESSURE
return LOW_PRESSURE
else if(tank_pressure < ONE_ATMOSPHERE)
update_flag |= NORMAL_PRESSURE
else if(tank_pressure < 15*ONE_ATMOSPHERE)
update_flag |= HIGH_PRESSURE
return NORMAL_PRESSURE
else if(tank_pressure < 15 * ONE_ATMOSPHERE)
return HIGH_PRESSURE
else
update_flag |= EXTREME_PRESSURE

if(list2params(old_color) != list2params(canister_color))
update_flag |= NEW_COLOR
old_color = canister_color.Copy()

if(update_flag == old_flag)
return FALSE
return TRUE
return EXTREME_PRESSURE

/obj/machinery/atmospherics/portable/canister/update_icon_state()
/*
(note: colors has to be applied every icon update)
*/

// Colors has to be applied every icon update
if(stat & BROKEN)
icon_state = "[canister_color["prim"]]-1"//yes, I KNOW the colours don't reflect when the can's borked, whatever.
return

if(icon_state != canister_color["prim"])
icon_state = canister_color["prim"]

if(!check_change()) //Returns FALSE if no change needed to icons.
return

/obj/machinery/atmospherics/portable/canister/update_overlays()
. = ..()
if(stat & BROKEN)
Expand All @@ -183,22 +152,20 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
continue
. += canister_color[C]

if(update_flag & HOLDING_TANK)
if(holding_tank)
. += "can-open"
if(update_flag & CONNECTED_PORT)
if(connected_port)
. += "can-connector"
if(update_flag & LOW_PRESSURE)

if(current_pressure_appearance == LOW_PRESSURE)
. += "can-o0"
if(update_flag & NORMAL_PRESSURE)
else if(current_pressure_appearance == NORMAL_PRESSURE)
. += "can-o1"
else if(update_flag & HIGH_PRESSURE)
else if(current_pressure_appearance == HIGH_PRESSURE)
. += "can-o2"
else if(update_flag & EXTREME_PRESSURE)
else if(current_pressure_appearance == EXTREME_PRESSURE)
. += "can-o3"

update_flag &= ~RESET //the flag NEW_COLOR represents change, not states. As such, we have to reset them to be able to detect a change on the next go.
return

/obj/machinery/atmospherics/portable/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..()
if(exposed_temperature > temperature_resistance)
Expand Down Expand Up @@ -234,8 +201,15 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())

T.blind_release_air(expelled_gas)

/obj/machinery/atmospherics/portable/canister/proc/sync_pressure_appearance()
var/new_pressure_appearance = pressure_to_appearance(air_contents.return_pressure())
if(current_pressure_appearance != new_pressure_appearance)
current_pressure_appearance = new_pressure_appearance
update_icon()

/obj/machinery/atmospherics/portable/canister/process_atmos()
..()
sync_pressure_appearance()
var/datum/milla_safe/canister_process/milla = new()
milla.invoke_async(src)

Expand Down Expand Up @@ -265,8 +239,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
var/datum/gas_mixture/removed = canister.air_contents.remove(transfer_moles)

environment.merge(removed)
canister.update_icon()

canister.sync_pressure_appearance()

if(canister.air_contents.return_pressure() < 1)
canister.can_label = TRUE
Expand Down Expand Up @@ -357,6 +330,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
name = T
else
name = "canister"
update_appearance(UPDATE_NAME)
else
to_chat(ui.user, "<span class='warning'>As you attempted to rename it the pressure rose!</span>")
. = FALSE
Expand Down Expand Up @@ -424,9 +398,9 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
color_index[ctype] = newcolor
newcolor++ // javascript starts arrays at 0, byond (for some reason) starts them at 1, this converts JS values to byond values
canister_color[ctype] = colorcontainer[ctype]["options"][newcolor]["icon"]
update_icon()

add_fingerprint(ui.user)
update_icon()

/obj/machinery/atmospherics/portable/canister/atmos_init()
. = ..()
Expand Down Expand Up @@ -532,11 +506,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
new /obj/item/stack/sheet/metal(drop_location(), 3)
qdel(src)

#undef HOLDING_TANK
#undef CONNECTED_PORT
#undef LOW_PRESSURE
#undef NORMAL_PRESSURE
#undef HIGH_PRESSURE
#undef EXTREME_PRESSURE
#undef NEW_COLOR
#undef RESET
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
air_contents.react()
return

update_icon()

/obj/machinery/atmospherics/portable/Destroy()
SSair.atmos_machinery -= src
disconnect()
Expand Down Expand Up @@ -70,6 +68,8 @@

anchored = TRUE //Prevent movement

update_icon()

return TRUE

/obj/machinery/atmospherics/portable/disconnect()
Expand All @@ -81,6 +81,8 @@
connected_port.connected_device = null
connected_port = null

update_icon()

return TRUE

/obj/machinery/atmospherics/portable/portableConnectorReturnAir()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/communications_blackout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Ionospheri:%? MCayj^j<.3-BZZZZZZT", \
"#4nd%;f4y6,>?%-BZZZZZZZT")

for(var/mob/living/silicon/ai/A in GLOB.player_list) //AIs are always aware of communication blackouts.
for(var/mob/living/silicon/ai/A in GLOB.ai_list) //AIs are always aware of communication blackouts.
to_chat(A, "<br>")
to_chat(A, "<span class='warning'><b>[alert]</b></span>")
to_chat(A, "<br>")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/money_spam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
last_spam_time = world.time

if(prob(50)) //Give the AI an increased chance to intercept the message
for(var/mob/living/silicon/ai/ai in GLOB.mob_list)
for(var/mob/living/silicon/ai/ai in GLOB.ai_list)
// Allows other AIs to intercept the message but the AI won't intercept their own message.
if(ai.aiPDA != P && ai.aiPDA != src)
ai.show_message("<i>Intercepted message from <b>[sender]</b></i> (Unknown / spam?) <i>to <b>[P:owner]</b>: [message]</i>")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/silicon/ai/ai_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
var/pickedName = null
while(!pickedName)
pickedName = pick(GLOB.ai_names)
for(var/mob/living/silicon/ai/A in GLOB.mob_list)
if(A.real_name == pickedName && length(possibleNames) > 1) //fixing the theoretically possible infinite loop
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
if(A.real_name == pickedName && length(possibleNames) > 1) // fixing the theoretically possible infinite loop
possibleNames -= pickedName
pickedName = null

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
/mob/new_player/proc/AnnounceArrival(mob/living/carbon/human/character, rank, join_message)
if(SSticker.current_state == GAME_STATE_PLAYING)
var/ailist[] = list()
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
if(A.announce_arrivals)
ailist += A
if(length(ailist))
Expand Down Expand Up @@ -445,7 +445,7 @@
/mob/new_player/proc/AnnounceCyborg(mob/living/character, rank, join_message)
if(SSticker.current_state == GAME_STATE_PLAYING)
var/ailist[] = list()
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
ailist += A
if(length(ailist))
var/mob/living/silicon/ai/announcer = pick(ailist)
Expand Down
5 changes: 3 additions & 2 deletions code/modules/power/lights.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
layer = FLY_LAYER
max_integrity = 100
power_state = ACTIVE_POWER_USE
idle_power_consumption = 2 //when in low power mode
idle_power_consumption = 10 //when in low power mode
active_power_consumption = 20 //when in full power mode
power_channel = PW_CHANNEL_LIGHTING //Lights are calc'd via area so they dont need to be in the machine list
var/base_state = "tube" // Base description and icon_state
Expand Down Expand Up @@ -553,7 +553,8 @@
burnout()
return

change_power_mode(ACTIVE_POWER_USE)
change_power_mode(nightshift_enabled ? IDLE_POWER_USE : ACTIVE_POWER_USE)

update_icon()
set_light(BR, PO, CO)
if(play_sound)
Expand Down
7 changes: 4 additions & 3 deletions code/modules/surgery/abstract_steps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@
QDEL_LIST_CONTENTS(branches_init)
return ..()

/datum/surgery_step/proxy/get_step_information(datum/surgery/surgery)
/datum/surgery_step/proxy/get_step_information(datum/surgery/surgery, with_tools = FALSE)
var/datum/surgery_step/cur = surgery.get_surgery_next_step()
var/step_names = list()
for(var/datum/surgery/surg in branches_init)
step_names += surg.get_surgery_step()
step_names += cur // put this one on the end
var/datum/surgery_step/surg_step = surg.get_surgery_step()
step_names += surg_step.get_step_information(surgery, with_tools)
step_names += cur.get_step_information(surgery, with_tools) // put this one on the end

return english_list(step_names, "Nothing...? If you see this, tell a coder.", ", or ")

Expand Down
Loading

0 comments on commit c5e9a11

Please sign in to comment.