Skip to content

Commit

Permalink
Very minor code stuff (#2645)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaFire15 authored May 31, 2024
1 parent 982e666 commit 1c3dcb7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 35 deletions.
23 changes: 7 additions & 16 deletions nsv13/code/modules/overmap/armour/nano_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 12 additions & 4 deletions nsv13/code/modules/overmap/armour/nano_well.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -371,6 +371,7 @@ Starting Materials
return
else
material_tier = 1
. = TRUE

if("plasteel")
if(material_tier != 0)
Expand All @@ -380,6 +381,7 @@ Starting Materials
return
else
material_tier = 2
. = TRUE

if("ferrotitanium")
if(material_tier != 0)
Expand All @@ -389,6 +391,7 @@ Starting Materials
return
else
material_tier = 3
. = TRUE

if("durasteel")
if(material_tier != 0)
Expand All @@ -398,6 +401,7 @@ Starting Materials
return
else
material_tier = 4
. = TRUE

if("duranium")
if(material_tier != 0)
Expand All @@ -407,6 +411,7 @@ Starting Materials
return
else
material_tier = 5
. = TRUE

if("purge")
if(resourcing_system)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
45 changes: 30 additions & 15 deletions nsv13/code/modules/overmap/fighters/_fighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<span class='warning'>The controls buzz angrily!</span>")
playsound(helm, 'sound/machines/buzz-sigh.ogg', 75, 1)
return
. = ..()
Expand Down Expand Up @@ -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, "<span class='warning'>The controls buzz angrily!</span>")
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, "<span class='notice'>[target.desc]</span>")
. = TRUE
if("eject_hardpoint")
if(!target)
return
Expand All @@ -218,6 +221,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
to_chat(usr, "<span class='notice>You uninstall [target.name] from [src].</span>")
loadout.remove_hardpoint(FC, FALSE)
. = TRUE
if("dump_hardpoint")
if(!target)
return
Expand All @@ -229,6 +233,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
to_chat(usr, "<span class='notice>You dump [target.name]'s contents.</span>")
loadout.dump_contents(FC)
. = TRUE
if("kick")
if(!target)
return
Expand All @@ -239,41 +244,48 @@ 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)
to_chat(usr, "<span class='warning'>You can't send fuel to an APU that isn't installed.</span>")
return
var/obj/item/fighter_component/engine/engine = loadout.get_slot(HARDPOINT_SLOT_ENGINE)
if(!engine)
to_chat(usr, "<span class='warning'>You can't send fuel to an APU that isn't installed.</span>")
to_chat(usr, "<span class='warning'>[src] does not have an engine installed!</span>")
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)
to_chat(usr, "<span class='warning'>[src] does not have a battery installed!</span>")
return
battery.toggle()
to_chat(usr, "You flip the battery switch.</span>")
. = TRUE
if("apu")
var/obj/item/fighter_component/apu/APU = loadout.get_slot(HARDPOINT_SLOT_APU)
if(!APU)
to_chat(usr, "<span class='warning'>[src] does not have an APU installed!</span>")
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, "<span class='warning'>[src] does not have an engine installed!</span>")
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))
Expand All @@ -282,40 +294,42 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "<span class='notice'>You [DC.docking_mode ? "disengage" : "engage"] [src]'s docking computer.</span>")
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)
to_chat(usr, "<span class='warning'>FTL unit not properly installed.</span>")
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)
Expand All @@ -327,6 +341,7 @@ Been a mess since 2018, we'll fix it someday (probably)
else
to_chat(usr, "<span class='warning'>Unable to update telemetry. Ensure you are in proximity to a Seegson FTL drive.</span>")
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)
Expand All @@ -342,7 +357,7 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "<span class='warning'>Unable to comply. Target beacon is currently in FTL transit.</span>")
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 \
Expand All @@ -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')

Expand Down

0 comments on commit 1c3dcb7

Please sign in to comment.