From 5fa8b999ea6c41665b155ec0b818233d7401b249 Mon Sep 17 00:00:00 2001 From: KalevTait <107985691+KalevTait@users.noreply.github.com> Date: Sun, 10 Jul 2022 14:01:16 +0100 Subject: [PATCH] Code Readability - Game (misc) (#18280) * game misc * mecha equipment returns and state * use forceMove instead of setting loc Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> * added #undefs and removed hanging returns Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> --- code/game/area/areas/depot-areas.dm | 2 +- code/game/area/ss13_areas.dm | 2 +- code/game/dna/dna_modifier.dm | 4 +- code/game/dna/mutations/disabilities.dm | 4 +- code/game/dna/mutations/powers.dm | 28 ++++----- code/game/mecha/equipment/mecha_equipment.dm | 25 ++++---- .../mecha/equipment/tools/medical_tools.dm | 46 ++++++-------- .../mecha/equipment/tools/mining_tools.dm | 4 +- .../game/mecha/equipment/tools/other_tools.dm | 27 ++++---- code/game/mecha/equipment/tools/work_tools.dm | 62 ++++++++++--------- code/game/mecha/equipment/weapons/weapons.dm | 59 +++++++----------- code/game/mecha/mech_bay.dm | 10 +-- code/game/mecha/mecha.dm | 16 ++--- code/game/mecha/mecha_construction_paths.dm | 16 ++--- code/game/mecha/mecha_wreckage.dm | 2 +- code/game/shuttle_engines.dm | 6 +- 16 files changed, 149 insertions(+), 164 deletions(-) diff --git a/code/game/area/areas/depot-areas.dm b/code/game/area/areas/depot-areas.dm index eb5c0aaaeb9..691a5d99d48 100644 --- a/code/game/area/areas/depot-areas.dm +++ b/code/game/area/areas/depot-areas.dm @@ -2,7 +2,7 @@ /area/syndicate_depot name = "Suspicious Supply Depot" icon_state = "dark" - tele_proof = 1 + tele_proof = TRUE /area/syndicate_depot/core icon_state = "red" diff --git a/code/game/area/ss13_areas.dm b/code/game/area/ss13_areas.dm index 29d428c694b..8cc7d8e830a 100644 --- a/code/game/area/ss13_areas.dm +++ b/code/game/area/ss13_areas.dm @@ -1382,7 +1382,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/security/prison/prison_break() for(var/obj/structure/closet/secure_closet/brig/temp_closet in src) - temp_closet.locked = 0 + temp_closet.locked = FALSE temp_closet.close() temp_closet.update_icon() for(var/obj/machinery/door_timer/temp_timer in src) diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index b793d38791a..4bf9acf2390 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -64,11 +64,11 @@ use_power = IDLE_POWER_USE idle_power_usage = 50 active_power_usage = 300 - interact_offline = 1 + interact_offline = TRUE var/locked = FALSE var/mob/living/carbon/occupant = null var/obj/item/reagent_containers/glass/beaker = null - var/opened = 0 + var/opened = FALSE var/damage_coeff var/scan_level var/precision_coeff diff --git a/code/game/dna/mutations/disabilities.dm b/code/game/dna/mutations/disabilities.dm index fe15ec9eb99..a1e2a234ac8 100644 --- a/code/game/dna/mutations/disabilities.dm +++ b/code/game/dna/mutations/disabilities.dm @@ -496,8 +496,8 @@ charge_type = "recharge" charge_max = 600 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" var/list/compatible_mobs = list(/mob/living/carbon/human) diff --git a/code/game/dna/mutations/powers.dm b/code/game/dna/mutations/powers.dm index d0dac1597df..f13715d3e4d 100644 --- a/code/game/dna/mutations/powers.dm +++ b/code/game/dna/mutations/powers.dm @@ -303,7 +303,7 @@ charge_max = 1200 clothes_req = FALSE - stat_allowed = FALSE + stat_allowed = CONSCIOUS selection_activated_message = "Your mind grow cold. Click on a target to cast the spell." selection_deactivated_message = "Your mind returns to normal." @@ -374,8 +374,8 @@ charge_type = "recharge" charge_max = 300 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_eat" @@ -480,8 +480,8 @@ charge_type = "recharge" charge_max = 60 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_jump" @@ -573,7 +573,7 @@ charge_max = 1800 clothes_req = FALSE - stat_allowed = FALSE + stat_allowed = CONSCIOUS selection_activated_message = "You body becomes unstable. Click on a target to cast transform into them." selection_deactivated_message = "Your body calms down again." @@ -734,8 +734,8 @@ panel = "Abilities" charge_max = 1800 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_morph" @@ -919,8 +919,8 @@ desc = "Make people understand your thoughts!" charge_max = 0 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_project" @@ -951,8 +951,8 @@ name = "Scan Mind" desc = "Offer people a chance to share their thoughts!" charge_max = 0 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_mindscan" var/list/available_targets = list() @@ -1026,8 +1026,8 @@ desc = "Spy on people from any range!" charge_max = 100 - clothes_req = 0 - stat_allowed = 0 + clothes_req = FALSE + stat_allowed = CONSCIOUS invocation_type = "none" action_icon_state = "genetic_view" diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index 987a210c711..eccb4457f14 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -22,14 +22,11 @@ if(chassis) send_byjax(chassis.occupant,"exosuit.browser","eq_list",chassis.get_equipment_list()) send_byjax(chassis.occupant,"exosuit.browser","equipment_menu",chassis.get_equipment_menu(),"dropdowns") - return 1 - return + return /obj/item/mecha_parts/mecha_equipment/proc/update_equip_info() if(chassis) send_byjax(chassis.occupant,"exosuit.browser","\ref[src]",get_equip_info()) - return 1 - return /obj/item/mecha_parts/mecha_equipment/Destroy()//missiles detonating, teleporter creating singularity? if(chassis) @@ -64,17 +61,17 @@ /obj/item/mecha_parts/mecha_equipment/proc/action_checks(atom/target) if(!target) - return 0 + return FALSE if(!chassis) - return 0 + return FALSE if(!equip_ready) - return 0 + return FALSE if(energy_drain && !chassis.has_charge(energy_drain)) - return 0 - return 1 + return FALSE + return TRUE /obj/item/mecha_parts/mecha_equipment/proc/action(atom/target) - return 0 + return /obj/item/mecha_parts/mecha_equipment/proc/start_cooldown() set_ready_state(0) @@ -83,7 +80,7 @@ /obj/item/mecha_parts/mecha_equipment/proc/do_after_cooldown(atom/target) if(!chassis) - return + return FALSE var/C = chassis.loc set_ready_state(0) chassis.use_power(energy_drain) @@ -94,7 +91,7 @@ /obj/item/mecha_parts/mecha_equipment/proc/do_after_mecha(atom/target, delay) if(!chassis) - return + return FALSE var/C = chassis.loc . = do_after(chassis.occupant, delay, target = target) if(!chassis || chassis.loc != C || src != chassis.selected || !(get_dir(chassis, target) & chassis.dir)) @@ -103,8 +100,8 @@ /obj/item/mecha_parts/mecha_equipment/proc/can_attach(obj/mecha/M) if(istype(M)) if(M.equipment.len[target] will not fit into the sleeper because [target.p_they()] [target.p_are()] buckled to [target.buckled]!") - return + return FALSE if(target.has_buckled_mobs()) occupant_message("[target] will not fit into the sleeper because of the creatures attached to it!") - return + return FALSE if(patient) occupant_message("The sleeper is already occupied!") - return - return 1 + return FALSE + return TRUE /obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/go_out() if(!patient) @@ -192,7 +191,7 @@ /obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/inject_reagent(datum/reagent/R,obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/SG) if(!R || !patient || !SG || !(SG in chassis.equipment)) - return 0 + return var/to_inject = min(R.volume, inject_amount) if(to_inject && patient.reagents.get_reagent_amount(R.id) + to_inject <= inject_amount*2) occupant_message("Injecting [patient] with [to_inject] units of [R.name].") @@ -200,7 +199,6 @@ add_attack_logs(chassis.occupant, patient, "Injected with [name] containing [R], transferred [to_inject] units", R.harmless ? ATKLOG_ALMOSTALL : null) SG.reagents.trans_id_to(patient,R.id,to_inject) update_equip_info() - return /obj/item/mecha_parts/mecha_equipment/medical/sleeper/update_equip_info() if(..()) @@ -208,8 +206,6 @@ send_byjax(chassis.occupant,"msleeper.browser","lossinfo",get_patient_dam()) send_byjax(chassis.occupant,"msleeper.browser","reagents",get_patient_reagents()) send_byjax(chassis.occupant,"msleeper.browser","injectwith",get_available_reagents()) - return 1 - return /obj/item/mecha_parts/mecha_equipment/medical/sleeper/container_resist() go_out() @@ -272,14 +268,13 @@ /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/can_attach(obj/mecha/medical/M) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/get_equip_info() var/output = ..() if(output) return "[output] \[[mode? "Analyze" : "Launch"]\]
\[Syringes: [syringes.len]/[max_syringes] | Reagents: [reagents.total_volume]/[reagents.maximum_volume]\]
Reagents list" - return /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/action(atom/movable/target) if(!action_checks(target)) @@ -343,7 +338,6 @@ mechsyringe.icon_state = initial(mechsyringe.icon_state) mechsyringe.icon = initial(mechsyringe.icon) mechsyringe.update_icon() - return 1 /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/Topic(href,href_list) @@ -382,7 +376,6 @@ if(afilter.get("purge_all")) reagents.clear_reagents() return - return /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/get_reagents_page() var/output = {" @@ -447,57 +440,54 @@ if(syringes.len= 2) occupant_message("The syringe is too far away.") - return 0 + return FALSE for(var/obj/structure/D in S.loc)//Basic level check for structures in the way (Like grilles and windows) if(!(D.CanPass(S,src.loc))) occupant_message("Unable to load syringe.") - return 0 + return FALSE for(var/obj/machinery/door/D in S.loc)//Checks for doors if(!(D.CanPass(S,src.loc))) occupant_message("Unable to load syringe.") - return 0 + return FALSE S.reagents.trans_to(src, S.reagents.total_volume) S.forceMove(src) syringes += S occupant_message("Syringe loaded.") update_equip_info() - return 1 + return TRUE occupant_message("[src] syringe chamber is full.") - return 0 + return FALSE /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/analyze_reagents(atom/A) if(get_dist(src,A) >= 4) occupant_message("The object is too far away.") - return 0 + return FALSE if(!A.reagents || istype(A,/mob)) occupant_message("No reagent info gained from [A].") - return 0 + return FALSE occupant_message("Analyzing reagents...") for(var/datum/reagent/R in A.reagents.reagent_list) if(R.can_synth && add_known_reagent(R.id, R.name)) occupant_message("Reagent analyzed, identified as [R.name] and added to database.") send_byjax(chassis.occupant,"msyringegun.browser","reagents_form",get_reagents_form()) occupant_message("Analysis complete.") - return 1 + return TRUE /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/add_known_reagent(r_id,r_name) if(!(r_id in known_reagents)) known_reagents += r_id known_reagents[r_id] = r_name - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/update_equip_info() if(..()) send_byjax(chassis.occupant,"msyringegun.browser","reagents",get_current_reagents()) send_byjax(chassis.occupant,"msyringegun.browser","reagents_form",get_reagents_form()) - return 1 - return /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/on_reagent_change() ..() update_equip_info() - return /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/process() diff --git a/code/game/mecha/equipment/tools/mining_tools.dm b/code/game/mecha/equipment/tools/mining_tools.dm index 08cf60fb967..ea6cfe9590b 100644 --- a/code/game/mecha/equipment/tools/mining_tools.dm +++ b/code/game/mecha/equipment/tools/mining_tools.dm @@ -88,8 +88,8 @@ /obj/item/mecha_parts/mecha_equipment/drill/can_attach(obj/mecha/M) if(..()) if(istype(M, /obj/mecha/working) || istype(M, /obj/mecha/combat)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/user) target.visible_message("[chassis] is drilling [target] with [src]!", diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index ffb9b1ee155..36a53298742 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -1,6 +1,9 @@ // Teleporter, Gravitational catapult, Armor booster modules, // Repair droid, Tesla Energy relay, Generators +#define MECH_GRAVCAT_MODE_GRAVSLING 1 +#define MECH_GRAVCAT_MODE_GRAVPUSH 2 + ////////////////////////////////////////////// TELEPORTER /////////////////////////////////////////////// /obj/item/mecha_parts/mecha_equipment/teleporter @@ -20,7 +23,7 @@ if(T) chassis.use_power(energy_drain) do_teleport(chassis, T, tele_precision) - return 1 + return /obj/item/mecha_parts/mecha_equipment/teleporter/precise name = "upgraded teleporter" @@ -41,7 +44,7 @@ range = MECHA_MELEE | MECHA_RANGED var/atom/movable/locked var/cooldown_timer = 0 - var/mode = 1 //1 - gravsling 2 - gravpush + var/mode = MECH_GRAVCAT_MODE_GRAVSLING /obj/item/mecha_parts/mecha_equipment/gravcatapult/action(atom/movable/target) if(!action_checks(target)) @@ -50,7 +53,7 @@ occupant_message("[src] is still recharging.") return switch(mode) - if(1) + if(MECH_GRAVCAT_MODE_GRAVSLING) if(!locked) if(!istype(target) || target.anchored) occupant_message("Unable to lock on [target]") @@ -69,7 +72,7 @@ locked = null occupant_message("Lock on [locked] disengaged.") send_byjax(chassis.occupant,"exosuit.browser","\ref[src]",get_equip_info()) - if(2) + if(MECH_GRAVCAT_MODE_GRAVPUSH) var/list/atoms = list() if(isturf(target)) atoms = range(3, target) @@ -85,7 +88,7 @@ var/turf/T = get_turf(target) cooldown_timer = world.time + 3 SECONDS log_game("[key_name(chassis.occupant)] used a Gravitational Catapult in ([T.x],[T.y],[T.z])") - return 1 + return /obj/item/mecha_parts/mecha_equipment/gravcatapult/get_equip_info() @@ -96,7 +99,6 @@ if(href_list["mode"]) mode = text2num(href_list["mode"]) send_byjax(chassis.occupant,"exosuit.browser","\ref[src]",get_equip_info()) - return //////////////////////////// ARMOR BOOSTER MODULES ////////////////////////////////////////////////////////// @@ -115,7 +117,7 @@ /obj/item/mecha_parts/mecha_equipment/anticcw_armor_booster/proc/attack_react(mob/user as mob) if(action_checks(user)) start_cooldown() - return 1 + return TRUE /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster @@ -133,7 +135,7 @@ /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster/proc/projectile_react() if(action_checks(src)) start_cooldown() - return 1 + return TRUE ////////////////////////////////// REPAIR DROID ////////////////////////////////////////////////// @@ -244,7 +246,7 @@ /obj/item/mecha_parts/mecha_equipment/tesla_energy_relay/proc/get_charge() if(equip_ready) //disabled - return + return 0 var/area/A = get_area(chassis) var/pow_chan = get_power_channel(A) if(pow_chan) @@ -385,7 +387,7 @@ else occupant_message("[fuel_name] traces in target minimal! [I] cannot be used as fuel.") - return + return 0 /obj/item/mecha_parts/mecha_equipment/generator/attackby(weapon,mob/user, params) load_fuel(weapon) @@ -413,7 +415,6 @@ chassis.give_power(power_per_cycle) fuel_amount -= min(use_fuel, fuel_amount) update_equip_info() - return 1 /obj/item/mecha_parts/mecha_equipment/generator/nuclear @@ -432,3 +433,7 @@ /obj/item/mecha_parts/mecha_equipment/generator/nuclear/process() if(..()) radiation_pulse(get_turf(src), rad_per_cycle) + + +#undef MECH_GRAVCAT_MODE_GRAVSLING +#undef MECH_GRAVCAT_MODE_GRAVPUSH diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 5f1e452c45d..ef8ca2f09eb 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -1,5 +1,10 @@ + //Hydraulic clamp, Kill clamp, Extinguisher, RCD, Mime RCD, Cable layer. +#define MECH_RCD_MODE_DECONSTRUCT 0 +#define MECH_RCD_MODE_WALL_OR_FLOOR 1 +#define MECH_RCD_MODE_AIRLOCK 2 + /obj/item/mecha_parts/mecha_equipment/hydraulic_clamp name = "hydraulic clamp" desc = "Equipment for engineering exosuits. Lifts objects and loads them into cargo." @@ -13,13 +18,12 @@ /obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/can_attach(obj/mecha/working/ripley/M) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/attach(obj/mecha/M) ..() cargo_holder = M - return /obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/detach(atom/moveto = null) ..() @@ -92,11 +96,11 @@ if(!O.anchored) if(cargo_holder.cargo.len < cargo_holder.cargo_capacity) chassis.visible_message("[chassis] lifts [target] and starts to load it into cargo compartment.") - O.anchored = 1 + O.anchored = TRUE if(do_after_cooldown(target)) cargo_holder.cargo += O - O.loc = chassis - O.anchored = 0 + O.forceMove(chassis) + O.anchored = FALSE occupant_message("[target] successfully loaded.") log_message("Loaded [O]. Cargo compartment capacity: [cargo_holder.cargo_capacity - cargo_holder.cargo.len]") else @@ -119,7 +123,7 @@ else step_away(M,chassis) target.visible_message("[chassis] tosses [target] like a piece of paper.") - return 1 + return /obj/item/mecha_parts/mecha_equipment/extinguisher @@ -134,7 +138,6 @@ create_reagents(1000) reagents.add_reagent("water", 1000) ..() - return /obj/item/mecha_parts/mecha_equipment/extinguisher/action(atom/target) //copypasted from extinguisher. TODO: Rewrite from scratch. if(!action_checks(target) || get_dist(chassis, target)>3) @@ -177,7 +180,7 @@ if(W.loc == my_target) break sleep(2) - return 1 + return /obj/item/mecha_parts/mecha_equipment/extinguisher/get_equip_info() return "[..()] \[[src.reagents.total_volume]\]" @@ -188,8 +191,8 @@ /obj/item/mecha_parts/mecha_equipment/extinguisher/can_attach(obj/mecha/working/M) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/rcd @@ -201,7 +204,7 @@ energy_drain = 250 range = MECHA_MELEE | MECHA_RANGED flags_2 = NO_MAT_REDEMPTION_2 - var/mode = 0 //0 - deconstruct, 1 - wall or floor, 2 - airlock. + var/mode = MECH_RCD_MODE_DECONSTRUCT var/canRwall = 0 toolspeed = 1 usesound = 'sound/items/deconstruct.ogg' @@ -226,7 +229,7 @@ playsound(chassis, 'sound/machines/click.ogg', 50, 1) switch(mode) - if(0) + if(MECH_RCD_MODE_DECONSTRUCT) if(istype(target, /turf/simulated/wall)) if((istype(target, /turf/simulated/wall/r_wall) && !canRwall) || istype(target, /turf/simulated/wall/indestructible)) return 0 @@ -250,7 +253,7 @@ chassis.spark_system.start() qdel(target) playsound(target, usesound, 50, 1) - if(1) + if(MECH_RCD_MODE_WALL_OR_FLOOR) if(istype(target, /turf/space)) var/turf/space/S = target occupant_message("Building Floor...") @@ -265,13 +268,13 @@ F.ChangeTurf(/turf/simulated/wall) playsound(F, usesound, 50, 1) chassis.spark_system.start() - if(2) + if(MECH_RCD_MODE_AIRLOCK) if(istype(target, /turf/simulated/floor)) occupant_message("Building Airlock...") if(do_after_cooldown(target)) chassis.spark_system.start() var/obj/machinery/door/airlock/T = new /obj/machinery/door/airlock(target) - T.autoclose = 1 + T.autoclose = TRUE playsound(target, usesound, 50, 1) playsound(target, 'sound/effects/sparks2.ogg', 50, 1) @@ -281,11 +284,11 @@ if(href_list["mode"]) mode = text2num(href_list["mode"]) switch(mode) - if(0) + if(MECH_RCD_MODE_DECONSTRUCT) occupant_message("Switched RCD to Deconstruct.") - if(1) + if(MECH_RCD_MODE_WALL_OR_FLOOR) occupant_message("Switched RCD to Construct.") - if(2) + if(MECH_RCD_MODE_AIRLOCK) occupant_message("Switched RCD to Construct Airlock.") /obj/item/mecha_parts/mecha_equipment/rcd/get_equip_info() @@ -304,8 +307,8 @@ /obj/item/mecha_parts/mecha_equipment/mimercd/can_attach(obj/mecha/combat/reticence/M) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/mimercd/action(atom/target) if(istype(target, /turf/space/transit))//>implying these are ever made -Sieve @@ -341,13 +344,12 @@ /obj/item/mecha_parts/mecha_equipment/cable_layer/can_attach(obj/mecha/working/M) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/cable_layer/attach() ..() RegisterSignal(chassis, COMSIG_MOVABLE_MOVED, .proc/layCable) - return /obj/item/mecha_parts/mecha_equipment/cable_layer/detach() UnregisterSignal(chassis, COMSIG_MOVABLE_MOVED) @@ -391,26 +393,24 @@ CC.amount = m else occupant_message("There's no more cable on the reel.") - return /obj/item/mecha_parts/mecha_equipment/cable_layer/get_equip_info() var/output = ..() if(output) return "[output] \[Cable: [cable ? cable.amount : 0] m\][(cable && cable.amount) ? "- [!equip_ready?"Dea":"A"]ctivate|Cut" : null]" - return /obj/item/mecha_parts/mecha_equipment/cable_layer/proc/use_cable(amount) if(!cable || cable.amount<1) set_ready_state(1) occupant_message("Cable depleted, [src] deactivated.") log_message("Cable depleted, [src] deactivated.") - return + return FALSE if(cable.amount < amount) occupant_message("No enough cable to finish the task.") - return + return FALSE cable.use(amount) update_equip_info() - return 1 + return TRUE /obj/item/mecha_parts/mecha_equipment/cable_layer/proc/reset() last_piece = null @@ -456,3 +456,7 @@ //NC.mergeConnectedNetworksOnTurf() last_piece = NC return TRUE + +#undef MECH_RCD_MODE_DECONSTRUCT +#undef MECH_RCD_MODE_WALL_OR_FLOOR +#undef MECH_RCD_MODE_AIRLOCK diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 5aaf4ca1560..e2537617d79 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -16,25 +16,25 @@ if(..()) if(istype(M)) if(size > M.maxsize) - return 0 - return 1 - else if(M.emagged == 1) - return 1 - return 0 + return FALSE + return TRUE + else if(M.emagged) + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/proc/get_shot_amount() return projectiles_per_shot /obj/item/mecha_parts/mecha_equipment/weapon/action(target, params) if(!action_checks(target)) - return 0 + return var/turf/curloc = get_turf(chassis) var/turf/targloc = get_turf(target) if(!targloc || !istype(targloc) || !curloc) - return 0 + return if(targloc == curloc) - return 0 + return set_ready_state(0) for(var/i=1 to get_shot_amount()) @@ -62,8 +62,6 @@ log_message("Fired from [name], targeting [target].") add_attack_logs(chassis.occupant, target, "fired a [src]") do_after_cooldown() - return - /obj/item/mecha_parts/mecha_equipment/weapon/energy name = "general energy weapon" size = 2 @@ -171,7 +169,6 @@ add_attack_logs(src, M, "Mecha-shot with [src] (no firer)") if(life <= 0) qdel(src) - return /obj/item/mecha_parts/mecha_equipment/weapon/energy/taser @@ -194,16 +191,16 @@ /obj/item/mecha_parts/mecha_equipment/weapon/honker/can_attach(obj/mecha/combat/honker/M as obj) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/honker/action(target, params) if(!chassis) - return 0 + return if(energy_drain && chassis.get_charge() < energy_drain) - return 0 + return if(!equip_ready) - return 0 + return playsound(chassis, 'sound/items/airhorn.ogg', 100, 1) chassis.occupant_message("HONK") @@ -250,8 +247,8 @@ /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/action_checks(atom/target) if(..()) if(projectiles > 0) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/get_equip_info() return "[..()]\[[projectiles]\][(projectiles < initial(projectiles))?" - Rearm":null]" @@ -266,13 +263,11 @@ send_byjax(chassis.occupant,"exosuit.browser","\ref[src]",get_equip_info()) log_message("Rearmed [name].") playsound(src, 'sound/weapons/gun_interactions/rearm.ogg', 50, 1) - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/Topic(href, href_list) ..() if(href_list["rearm"]) rearm() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/carbine name = "\improper FNX-66 Carbine" @@ -297,8 +292,8 @@ /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/carbine/silenced/can_attach(obj/mecha/combat/reticence/M as obj) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/scattershot name = "\improper LBX AC 10 \"Scattershot\"" @@ -361,7 +356,6 @@ add_attack_logs(chassis.occupant, target, "fired a [src]", ATKLOG_FEW) log_game("[key_name(chassis.occupant)] fired a [src] in [T.x], [T.y], [T.z]") do_after_cooldown() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/heavy name = "\improper SRX-13 Heavy Missile Launcher" @@ -383,7 +377,6 @@ qdel(src) else ..() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/flashbang name = "\improper SGL-6 Flashbang Launcher" @@ -409,7 +402,6 @@ spawn(det_time) F.prime() do_after_cooldown() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/flashbang/clusterbang//Because I am a heartless bastard -Sieve name = "\improper SOB-3 Clusterbang Launcher" @@ -441,8 +433,8 @@ /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/banana_mortar/can_attach(obj/mecha/combat/honker/M as obj) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/banana_mortar/action(target, params) if(!action_checks(target)) @@ -454,7 +446,6 @@ projectiles-- log_message("Bananed from [name], targeting [target]. HONK!") do_after_cooldown() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/mousetrap_mortar @@ -471,21 +462,20 @@ /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/mousetrap_mortar/can_attach(obj/mecha/combat/honker/M as obj) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/mousetrap_mortar/action(target, params) if(!action_checks(target)) return set_ready_state(0) var/obj/item/assembly/mousetrap/M = new projectile(chassis.loc) - M.secured = 1 + M.secured = TRUE playsound(chassis, fire_sound, 60, 1) M.throw_at(target, missile_range, missile_speed) projectiles-- log_message("Launched a mouse-trap from [name], targeting [target]. HONK!") do_after_cooldown() - return /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/bola name = "\improper PCMK-6 Bola Launcher" @@ -503,8 +493,8 @@ /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/bola/can_attach(obj/mecha/combat/gygax/M as obj) if(..()) if(istype(M)) - return 1 - return 0 + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/bola/action(target, params) if(!action_checks(target)) @@ -516,7 +506,6 @@ projectiles-- log_message("Fired from [name], targeting [target].") do_after_cooldown() - return /obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma equip_cooldown = 10 diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 7060ec2350a..ceb24de45c8 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -11,15 +11,15 @@ /obj/machinery/mech_bay_recharge_port name = "mech bay power port" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE dir = EAST icon = 'icons/mecha/mech_bay.dmi' icon_state = "recharge_port" var/obj/mecha/recharging_mecha var/obj/machinery/computer/mech_bay_power_console/recharge_console var/max_charge = 50 - var/on = 0 + var/on = FALSE var/turf/recharging_turf = null /obj/machinery/mech_bay_recharge_port/Initialize(mapload) @@ -112,8 +112,8 @@ /obj/machinery/computer/mech_bay_power_console name = "mech bay power control console" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE icon = 'icons/obj/computer.dmi' icon_keyboard = "tech_key" icon_screen = "recharge_comp" diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index f21d20f6a03..48731b84b83 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -4,9 +4,9 @@ name = "Mecha" desc = "Exosuit" icon = 'icons/mecha/mecha.dmi' - density = 1 //Dense. To raise the heat. - opacity = 1 ///opaque. Menacing. - anchored = 1 //no pulling around. + density = TRUE //Dense. To raise the heat. + opacity = TRUE ///opaque. Menacing. + anchored = TRUE //no pulling around. resistance_flags = FIRE_PROOF | ACID_PROOF layer = MOB_LAYER //icon draw layer infra_luminosity = 15 //byond implementation is bugged. @@ -918,8 +918,8 @@ to_chat(user, "ACCESS DENIED.") return AI.aiRestorePowerRoutine = 0//So the AI initially has power. - AI.control_disabled = 1 - AI.aiRadio.disabledAi = 1 + AI.control_disabled = TRUE + AI.aiRadio.disabledAi = TRUE AI.forceMove(card) occupant = null AI.controlled_mech = null @@ -948,8 +948,8 @@ else if(occupant || dna) //Normal AIs cannot steal mechs! to_chat(user, "Access denied. [name] is [occupant ? "currently occupied" : "secured with a DNA lock"].") return - AI.control_disabled = 0 - AI.aiRadio.disabledAi = 0 + AI.control_disabled = FALSE + AI.aiRadio.disabledAi = FALSE to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.") ai_enter_mech(AI, interaction) @@ -965,7 +965,7 @@ AI.cancel_camera() AI.controlled_mech = src AI.remote_control = src - AI.can_shunt = 0 //ONE AI ENTERS. NO AI LEAVES. + AI.can_shunt = FALSE //ONE AI ENTERS. NO AI LEAVES. to_chat(AI, "[AI.can_dominate_mechs ? "Takeover of [name] complete! You are now permanently loaded onto the onboard computer. Do not attempt to leave the station sector!" \ : "You have been uploaded to a mech's onboard computer."]") to_chat(AI, "Use Middle-Mouse to activate mech functions and equipment. Click normally for AI interactions.") diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm index 8d9611009ca..6836c91420c 100644 --- a/code/game/mecha/mecha_construction_paths.dm +++ b/code/game/mecha/mecha_construction_paths.dm @@ -71,7 +71,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/ripley(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "ripley0" - const_holder.density = 1 + const_holder.density = TRUE const_holder.overlays.len = 0 qdel(src) return @@ -276,7 +276,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/gygax(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "gygax0" - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -551,7 +551,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/firefighter(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "fireripley0" - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -768,7 +768,7 @@ ..(user, "Honker") var/obj/item/mecha_parts/chassis/const_holder = holder const_holder.construct = new /datum/construction/reversible/mecha/honker(const_holder) - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -840,7 +840,7 @@ ..(user, "Reticence") var/obj/item/mecha_parts/chassis/const_holder = holder const_holder.construct = new /datum/construction/reversible/mecha/reticence(const_holder) - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -916,7 +916,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/durand(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "durand0" - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -1194,7 +1194,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/phazon(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "phazon0" - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return @@ -1513,7 +1513,7 @@ const_holder.construct = new /datum/construction/reversible/mecha/odysseus(const_holder) const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "odysseus0" - const_holder.density = 1 + const_holder.density = TRUE qdel(src) return diff --git a/code/game/mecha/mecha_wreckage.dm b/code/game/mecha/mecha_wreckage.dm index 343008a1754..87918c8f3a8 100644 --- a/code/game/mecha/mecha_wreckage.dm +++ b/code/game/mecha/mecha_wreckage.dm @@ -9,7 +9,7 @@ icon = 'icons/mecha/mecha.dmi' density = TRUE anchored = FALSE - opacity = 0 + opacity = FALSE var/list/welder_salvage = list(/obj/item/stack/sheet/plasteel, /obj/item/stack/sheet/metal, /obj/item/stack/rods) var/salvage_num = 5 var/list/crowbar_salvage = list() diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm index 6b3ff950dbe..a2a0fad90cf 100644 --- a/code/game/shuttle_engines.dm +++ b/code/game/shuttle_engines.dm @@ -10,8 +10,8 @@ /obj/structure/shuttle/engine name = "engine" - density = 1 - anchored = 1.0 + density = TRUE + anchored = TRUE /obj/structure/shuttle/engine/heater name = "heater" @@ -24,7 +24,7 @@ /obj/structure/shuttle/engine/propulsion name = "propulsion" icon_state = "propulsion" - opacity = 1 + opacity = TRUE /obj/structure/shuttle/engine/propulsion/burst