From 1c3dcb791ec19c181acaeab0fbf2607e5feffbc3 Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Fri, 31 May 2024 18:13:55 +0200
Subject: [PATCH] Very minor code stuff (#2645)
---
.../code/modules/overmap/armour/nano_pump.dm | 23 +++-------
.../code/modules/overmap/armour/nano_well.dm | 16 +++++--
.../modules/overmap/fighters/_fighters.dm | 45 ++++++++++++-------
3 files changed, 49 insertions(+), 35 deletions(-)
diff --git a/nsv13/code/modules/overmap/armour/nano_pump.dm b/nsv13/code/modules/overmap/armour/nano_pump.dm
index 377d9f07175..a6bb758fdba 100644
--- a/nsv13/code/modules/overmap/armour/nano_pump.dm
+++ b/nsv13/code/modules/overmap/armour/nano_pump.dm
@@ -228,29 +228,20 @@
ui.set_autoupdate(TRUE)
/obj/machinery/armour_plating_nanorepair_pump/ui_act(action, params, datum/tgui/ui)
- if(..())
+ . = ..()
+ if(.)
return
- if(!(in_range(src, usr) | IsAdminGhost(usr)))
+ if(!(in_range(src, usr) || IsAdminGhost(usr)))
return
var/adjust = text2num(params["adjust"])
if(action == "armour_allocation")
if(isnum(adjust))
- armour_allocation = adjust
- if(armour_allocation > 100 - structure_allocation)
- armour_allocation = 100 - structure_allocation
- return
- if(armour_allocation <= 0)
- armour_allocation = 0
- return
+ armour_allocation = CLAMP(adjust, 0, 100 - structure_allocation)
+ return TRUE
if(action == "structure_allocation")
if(isnum(adjust))
- structure_allocation = adjust
- if(structure_allocation > 100 - armour_allocation)
- structure_allocation = 100 - armour_allocation
- return
- if(structure_allocation <= 0)
- structure_allocation = 0
- return
+ structure_allocation = CLAMP(adjust, 0, 100 - armour_allocation)
+ return TRUE
/obj/machinery/armour_plating_nanorepair_pump/ui_data(mob/user)
var/list/data = list()
diff --git a/nsv13/code/modules/overmap/armour/nano_well.dm b/nsv13/code/modules/overmap/armour/nano_well.dm
index 241f095de8e..7005822ea59 100644
--- a/nsv13/code/modules/overmap/armour/nano_well.dm
+++ b/nsv13/code/modules/overmap/armour/nano_well.dm
@@ -352,16 +352,16 @@ Starting Materials
ui.set_autoupdate(TRUE)
/obj/machinery/armour_plating_nanorepair_well/ui_act(action, params, datum/tgui/ui)
- if(..())
+ . = ..()
+ if(.)
return
if(!(in_range(src, usr) || IsAdminGhost(usr)))
return
var/adjust = text2num(params["adjust"])
if(action == "power_allocation")
if(isnum(adjust))
- power_allocation = adjust
- adjust = CLAMP(adjust, 0, maximum_power_allocation)
- return
+ power_allocation = CLAMP(adjust, 0, maximum_power_allocation)
+ return TRUE
switch(action)
if("iron")
if(material_tier != 0)
@@ -371,6 +371,7 @@ Starting Materials
return
else
material_tier = 1
+ . = TRUE
if("plasteel")
if(material_tier != 0)
@@ -380,6 +381,7 @@ Starting Materials
return
else
material_tier = 2
+ . = TRUE
if("ferrotitanium")
if(material_tier != 0)
@@ -389,6 +391,7 @@ Starting Materials
return
else
material_tier = 3
+ . = TRUE
if("durasteel")
if(material_tier != 0)
@@ -398,6 +401,7 @@ Starting Materials
return
else
material_tier = 4
+ . = TRUE
if("duranium")
if(material_tier != 0)
@@ -407,6 +411,7 @@ Starting Materials
return
else
material_tier = 5
+ . = TRUE
if("purge")
if(resourcing_system)
@@ -427,6 +432,7 @@ Starting Materials
var/current_temp = env.return_temperature()
env.set_temperature(current_temp + 25)
air_update_turf()
+ . = TRUE
if("unload")
if(resourcing_system)
@@ -437,6 +443,7 @@ Starting Materials
else
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
materials.retrieve_all(get_turf(usr))
+ . = TRUE
if("toggle")
if(material_tier == 0)
@@ -445,6 +452,7 @@ Starting Materials
playsound(src, sound, 100, 1)
else
resourcing_system = !resourcing_system
+ . = TRUE
/obj/machinery/armour_plating_nanorepair_well/ui_data(mob/user)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
diff --git a/nsv13/code/modules/overmap/fighters/_fighters.dm b/nsv13/code/modules/overmap/fighters/_fighters.dm
index 7b930cdfd01..543c4bf5cd7 100644
--- a/nsv13/code/modules/overmap/fighters/_fighters.dm
+++ b/nsv13/code/modules/overmap/fighters/_fighters.dm
@@ -82,7 +82,8 @@ Been a mess since 2018, we'll fix it someday (probably)
/obj/structure/overmap/small_craft/key_down(key, client/user)
if(disruption && prob(min(95, disruption)))
- to_chat(src, "The controls buzz angrily.")
+ if(user)
+ to_chat(user, "The controls buzz angrily!")
playsound(helm, 'sound/machines/buzz-sigh.ogg', 75, 1)
return
. = ..()
@@ -195,18 +196,20 @@ Been a mess since 2018, we'll fix it someday (probably)
return data
/obj/structure/overmap/small_craft/ui_act(action, params, datum/tgui/ui)
- if(..() || ((usr != pilot) && (!IsAdminGhost(usr))))
+ . = ..()
+ if(. || ((usr != pilot) && (!IsAdminGhost(usr))))
return
if(disruption && prob(min(95, disruption)))
- to_chat(src, "The controls buzz angrily.")
+ to_chat(usr, "The controls buzz angrily!")
relay('sound/machines/buzz-sigh.ogg')
- return
+ return TRUE
var/atom/movable/target = locate(params["id"])
switch(action)
if("examine")
if(!target)
return
to_chat(usr, "[target.desc]")
+ . = TRUE
if("eject_hardpoint")
if(!target)
return
@@ -218,6 +221,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
to_chat(usr, "")
loadout.dump_contents(FC)
+ . = TRUE
if("kick")
if(!target)
return
@@ -239,6 +244,7 @@ Been a mess since 2018, we'll fix it someday (probably)
canopy_open = FALSE
toggle_canopy()
stop_piloting(L)
+ . = TRUE
if("fuel_pump")
var/obj/item/fighter_component/apu/APU = loadout.get_slot(HARDPOINT_SLOT_APU)
if(!APU)
@@ -246,9 +252,11 @@ Been a mess since 2018, we'll fix it someday (probably)
return
var/obj/item/fighter_component/engine/engine = loadout.get_slot(HARDPOINT_SLOT_ENGINE)
if(!engine)
- to_chat(usr, "You can't send fuel to an APU that isn't installed.")
+ to_chat(usr, "[src] does not have an engine installed!")
+ return
APU.toggle_fuel_line()
playsound(src, 'nsv13/sound/effects/fighters/warmup.ogg', 100, FALSE)
+ . = TRUE
if("battery")
var/obj/item/fighter_component/battery/battery = loadout.get_slot(HARDPOINT_SLOT_BATTERY)
if(!battery)
@@ -256,6 +264,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
battery.toggle()
to_chat(usr, "You flip the battery switch.")
+ . = TRUE
if("apu")
var/obj/item/fighter_component/apu/APU = loadout.get_slot(HARDPOINT_SLOT_APU)
if(!APU)
@@ -263,17 +272,20 @@ Been a mess since 2018, we'll fix it someday (probably)
return
APU.toggle()
playsound(src, 'nsv13/sound/effects/fighters/warmup.ogg', 100, FALSE)
+ . = TRUE
if("ignition")
var/obj/item/fighter_component/engine/engine = loadout.get_slot(HARDPOINT_SLOT_ENGINE)
if(!engine)
to_chat(usr, "[src] does not have an engine installed!")
return
engine.try_start()
+ . = TRUE
if("canopy_lock")
var/obj/item/fighter_component/canopy/canopy = loadout.get_slot(HARDPOINT_SLOT_CANOPY)
if(!canopy)
return
toggle_canopy()
+ . = TRUE
if("docking_mode")
var/obj/item/fighter_component/docking_computer/DC = loadout.get_slot(HARDPOINT_SLOT_DOCKING)
if(!DC || !istype(DC))
@@ -282,33 +294,34 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "You [DC.docking_mode ? "disengage" : "engage"] [src]'s docking computer.")
DC.docking_mode = !DC.docking_mode
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("brakes")
toggle_brakes()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("inertial_dampeners")
toggle_inertia()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("weapon_safety")
toggle_safety()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("target_lock")
relay('nsv13/sound/effects/fighters/switch.ogg')
dump_locks()
- return
+ return TRUE
if("mag_release")
if(!mag_lock)
return
mag_lock.abort_launch()
+ . = TRUE
if("master_caution")
set_master_caution(FALSE)
- return
+ return TRUE
if("show_dradis")
dradis?.ui_interact(usr)
- return
+ return TRUE
if("toggle_ftl")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -316,6 +329,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
ftl.toggle()
relay('nsv13/sound/effects/fighters/switch.ogg')
+ . = TRUE
if("anchor_ftl")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -327,6 +341,7 @@ Been a mess since 2018, we'll fix it someday (probably)
else
to_chat(usr, "Unable to update telemetry. Ensure you are in proximity to a Seegson FTL drive.")
relay('nsv13/sound/effects/fighters/switch.ogg')
+ . = TRUE
if("return_jump")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -342,7 +357,7 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "Unable to comply. Target beacon is currently in FTL transit.")
return
ftl.jump(dest)
- return
+ return TRUE
if("set_name")
var/new_name = stripped_input(usr, message="What do you want to name \
your fighter? Keep in mind that particularly terrible names may be \
@@ -351,10 +366,10 @@ Been a mess since 2018, we'll fix it someday (probably)
return
message_admins("[key_name_admin(usr)] renamed a fighter to [new_name] [ADMIN_LOOKUPFLW(src)].")
name = new_name
- return
+ return TRUE
if("toggle_maintenance")
maintenance_mode = !maintenance_mode
- return
+ return TRUE
relay('nsv13/sound/effects/fighters/switch.ogg')