From e3d67c4f7db20930cf8f52a2bfe51a0b872946a2 Mon Sep 17 00:00:00 2001 From: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Date: Wed, 10 Jul 2024 04:34:49 +0100 Subject: [PATCH] Miscellaneous Code Tidying (#26180) * Update items.dm * Update welder.dm * Update energy_melee_weapons.dm * Update items.dm --------- Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com> --- code/game/objects/items.dm | 53 +++++------ code/game/objects/items/tools/welder.dm | 15 ++- .../weapons/melee/energy_melee_weapons.dm | 93 ++++++++++++++----- 3 files changed, 107 insertions(+), 54 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 7042243b7bfc..1ce06dd5cea0 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -73,6 +73,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons /// List of icon states for a given action to override the icon_state. var/list/action_icon_state = list() + /// What materials the item yields when broken down. Some methods will not recover everything (autolathes only recover metal and glass, for example). var/list/materials = list() /// Since any item can now be a piece of clothing, this has to be put here so all items share it. /// This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc. @@ -86,7 +87,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons var/permeability_coefficient = 1 /// for electrical admittance/conductance (electrocution checks and shit) var/siemens_coefficient = 1 - /// How much clothing is slowing you down. Negative values speeds you up + /// How much clothing is slowing you down. Negative values speeds you up. var/slowdown = 0 /// Flat armour reduction, occurs after percentage armour penetration. var/armour_penetration_flat = 0 @@ -141,7 +142,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons var/tool_enabled = TRUE /// How loud are we when we use our tool? var/tool_volume = 50 - /// If this item is a tool, the speed multiplier + /// If this item is a tool, the speed multiplier. Smaller numbers are faster. var/toolspeed = 1 /* Species-specific sprites, concept stolen from Paradise//vg/. @@ -198,7 +199,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons if(isstorage(loc)) //marks all items in storage as being such in_storage = TRUE -// this proc is used to add text for items with ABSTRACT flag after default examine text +/// This proc is used to add text for items with ABSTRACT flag after default examine text. /obj/item/proc/customised_abstract_text(mob/living/carbon/owner) return @@ -278,7 +279,6 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons else msg += "No tech origins detected.
" - if(length(materials)) msg += "Extractable materials:
" for(var/mat in materials) @@ -307,7 +307,8 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons ..() /obj/item/attack_hand(mob/user as mob, pickupfireoverride = FALSE) - if(!user) return 0 + if(!user) + return FALSE if(ishuman(user)) var/mob/living/carbon/human/H = user var/obj/item/organ/external/temp = H.bodyparts_by_name["r_hand"] @@ -315,10 +316,10 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons temp = H.bodyparts_by_name["l_hand"] if(!temp) to_chat(user, "You try to use your hand, but it's missing!") - return 0 + return FALSE if(temp && !temp.is_usable()) to_chat(user, "You try to move your [temp.name], but cannot!") - return 0 + return FALSE if((resistance_flags & ON_FIRE) && !pickupfireoverride) var/mob/living/carbon/human/H = user @@ -356,14 +357,14 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons throwing.finalize(FALSE) if(loc == user) if(HAS_TRAIT(user, TRAIT_I_WANT_BRAINS) || !user.unEquip(src, silent = TRUE)) - return 0 + return FALSE if(flags & ABSTRACT) - return 0 + return FALSE else if(isliving(loc)) - return 0 + return FALSE pickup(user) add_fingerprint(user) @@ -534,25 +535,25 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons playsound(src, pickup_sound, PICKUP_SOUND_VOLUME, ignore_walls = FALSE) /obj/item/proc/item_action_slot_check(slot, mob/user) - return 1 + return TRUE -/// returns 1 if the item is equipped by a mob, 0 otherwise. +/// returns TRUE if the item is equipped by a mob, 0 otherwise. /obj/item/proc/is_equipped() // This might need some error trapping, not sure if get_equipped_items() is safe for non-human mobs. if(!ismob(loc)) - return 0 + return FALSE var/mob/M = loc if(src in M.get_equipped_items()) - return 1 + return TRUE else - return 0 + return FALSE -// 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. +// the mob(M) is attempting to equip this item into the slot passed through as 'slot'. Return TRUE if it can do this and FALSE if it can't. // If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen. -// Set disable_warning to 1 if you wish it to not give you outputs. +// Set disable_warning to FALSE if you wish it to not give you outputs. /obj/item/proc/mob_can_equip(mob/M, slot, disable_warning = FALSE) if(!M) - return 0 + return FALSE return M.can_equip(src, slot, disable_warning) @@ -591,7 +592,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons attack_self(user) /obj/item/proc/IsReflect(def_zone) // This proc determines if and at what% an object will reflect energy projectiles if it's in l_hand,r_hand or wear_suit - return 0 + return FALSE /obj/item/proc/get_loc_turf() var/atom/L = loc @@ -721,16 +722,16 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons in_inventory = FALSE /obj/item/proc/pwr_drain() - return 0 // Process Kill + return FALSE // Process Kill /obj/item/proc/remove_item_from_storage(atom/newLoc) // please use this if you're going to snowflake an item out of a obj/item/storage if(!newLoc) - return 0 + return FALSE if(isstorage(loc)) var/obj/item/storage/S = loc S.remove_from_storage(src,newLoc) - return 1 - return 0 + return TRUE + return FALSE /obj/item/proc/wash(mob/user, atom/source) @@ -743,10 +744,10 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons acid_level = 0 user.visible_message("[user] washes [src] using [source].", \ "You wash [src] using [source].") - return 1 + return TRUE /obj/item/proc/get_crutch_efficiency() // Does an item prop up a human mob and allow them to stand if they are missing a leg/foot? - return 0 + return FALSE /// Return true if you don't want regular throw handling /obj/item/proc/override_throw(mob/user, atom/target) @@ -767,7 +768,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons return FALSE /obj/item/mech_melee_attack(obj/mecha/M) - return 0 + return FALSE /obj/item/proc/openTip(location, control, params, user) openToolTip(user, src, params, title = name, content = "[desc]", theme = "") diff --git a/code/game/objects/items/tools/welder.dm b/code/game/objects/items/tools/welder.dm index afb690efa6e6..3f630bf4a413 100644 --- a/code/game/objects/items/tools/welder.dm +++ b/code/game/objects/items/tools/welder.dm @@ -26,13 +26,20 @@ drop_sound = 'sound/items/handling/weldingtool_drop.ogg' pickup_sound = 'sound/items/handling/weldingtool_pickup.ogg' var/maximum_fuel = 20 - var/requires_fuel = TRUE //Set to FALSE if it doesn't need fuel, but serves equally well as a cost modifier - var/refills_over_time = FALSE //Do we regenerate fuel? + /// Set to FALSE if it doesn't need fuel, but serves equally well as a cost modifier. + var/requires_fuel = TRUE + /// If TRUE, fuel will regenerate over time. + var/refills_over_time = FALSE + /// Sound played when turned on. var/activation_sound = 'sound/items/welderactivate.ogg' + /// Sound played when turned off. var/deactivation_sound = 'sound/items/welderdeactivate.ogg' + /// The brightness of the active flame. var/light_intensity = 2 - var/low_fuel_changes_icon = TRUE//More than one icon_state due to low fuel? - var/progress_flash_divisor = 10 //Length of time between each "eye flash" + /// Does the icon_state change if the fuel is low? + var/low_fuel_changes_icon = TRUE + /// How often does the tool flash the user's eyes? + var/progress_flash_divisor = 1 SECONDS /obj/item/weldingtool/Initialize(mapload) . = ..() diff --git a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm index 811a2f58c210..b06f34ec70b1 100644 --- a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm +++ b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm @@ -1,16 +1,40 @@ +/* CONTENTS: +* 1. GENERIC ENERGY BLADE +* 2. ENERGY AXE +* 3. ENERGY SWORD +* 4. ENERGY SAW +* 5. ENERGY CUTLASS +* 6. HARDLIGHT BLADE +* 7. CLEAVING SAW +*/ +////////////////////////////// +// MARK: GENERIC ENERGY BLADE +////////////////////////////// /obj/item/melee/energy + name = "generic energy blade" + desc = "If you can see this and didn't spawn it in as an admin, make an issue report on GitHub." icon = 'icons/obj/weapons/energy_melee.dmi' var/active = FALSE - var/force_on = 30 //force when active + /// Damage done when active. Does not stack with force_off. + var/force_on = 30 + /// Damage done when thrown while active. Does not stack with throwforce_off. var/throwforce_on = 20 - var/force_off //Used to properly reset the force + /// Used to properly reset the force. + var/force_off + /// Used to properly reset the force. var/throwforce_off - var/faction_bonus_force = 0 //Bonus force dealt against certain factions - var/list/nemesis_factions //Any mob with a faction that exists in this list will take bonus damage/effects - stealthy_audio = TRUE //Most of these are antag weps so we dont want them to be /too/ overt. + /// Bonus damage dealt to any mob belonging to specified factions. + var/faction_bonus_force = 0 + /// Any mob with a faction that exists in this list will take bonus damage/effects. + var/list/nemesis_factions + // Most of these are antag weps so we dont want them to be /too/ overt... + stealthy_audio = TRUE w_class = WEIGHT_CLASS_SMALL + /// Size when active, used to stop you from pocketing it when active. That would be silly. var/w_class_on = WEIGHT_CLASS_BULKY + /// Alternative appearance when active. var/icon_state_on + /// What flavour of shanking you perform when the blade is active. var/list/attack_verb_on = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") hitsound = 'sound/weapons/blade1.ogg' // Probably more appropriate than the previous hitsound. -- Dave usesound = 'sound/weapons/blade1.ogg' @@ -102,6 +126,9 @@ force_on = clamp(force_on + amount, 0, max_amount) force_off = clamp(force_off + amount, 0, max_amount) +////////////////////////////// +// MARK: AXE +////////////////////////////// /obj/item/melee/energy/axe name = "energy axe" desc = "An energised battle axe." @@ -128,6 +155,10 @@ user.visible_message("[user] swings [src] towards [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!") return BRUTELOSS|FIRELOSS +////////////////////////////// +// MARK: SWORD +////////////////////////////// +// Base variant. /obj/item/melee/energy/sword name = "energy sword" desc = "May the force be within you." @@ -158,8 +189,9 @@ /obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(active) return ..() - return 0 + return FALSE +// Borg variant. /obj/item/melee/energy/sword/cyborg var/hitcost = 50 @@ -173,30 +205,14 @@ ..() return -/// Used by medical Syndicate cyborgs -/obj/item/melee/energy/sword/cyborg/saw - name = "energy saw" - desc = "For heavy duty cutting. It has a carbon-fiber blade in addition to a toggleable hard-light edge to dramatically increase sharpness." - force_on = 30 - force = 18 //About as much as a spear - sharp = TRUE - hitsound = 'sound/weapons/circsawhit.ogg' - icon = 'icons/obj/surgery.dmi' - icon_state = "esaw_0" - icon_state_on = "esaw_1" - hitcost = 75 //Costs more than a standard cyborg esword - item_color = null - w_class = WEIGHT_CLASS_NORMAL - light_color = LIGHT_COLOR_WHITE - tool_behaviour = TOOL_SAW - /obj/item/melee/energy/sword/cyborg/saw/New() ..() item_color = null /obj/item/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - return 0 + return FALSE +// Syndicate energy sword. /obj/item/melee/energy/sword/saber /obj/item/melee/energy/sword/saber/blue @@ -265,6 +281,29 @@ return -1 return TRUE +////////////////////////////// +// MARK: SAW +////////////////////////////// +/// Used by medical Syndicate cyborgs +/obj/item/melee/energy/sword/cyborg/saw + name = "energy saw" + desc = "For heavy duty cutting. It has a carbon-fiber blade in addition to a toggleable hard-light edge to dramatically increase sharpness." + force_on = 30 + force = 18 //About as much as a spear + sharp = TRUE + hitsound = 'sound/weapons/circsawhit.ogg' + icon = 'icons/obj/surgery.dmi' + icon_state = "esaw_0" + icon_state_on = "esaw_1" + hitcost = 75 //Costs more than a standard cyborg esword + item_color = null + w_class = WEIGHT_CLASS_NORMAL + light_color = LIGHT_COLOR_WHITE + tool_behaviour = TOOL_SAW + +////////////////////////////// +// MARK: CUTLASS +////////////////////////////// /obj/item/melee/energy/sword/pirate name = "energy cutlass" desc = "Arrrr matey." @@ -274,6 +313,9 @@ light_color = LIGHT_COLOR_RED origin_tech = "combat=3;magnets=4;syndicate=2" +////////////////////////////// +// MARK: HARDLIGHT BLADE +////////////////////////////// /obj/item/melee/energy/blade name = "energy blade" desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal." @@ -299,6 +341,9 @@ /obj/item/melee/energy/proc/nemesis_effects(mob/living/user, mob/living/target) return +////////////////////////////// +// MARK: CLEAVING SAW +////////////////////////////// /obj/item/melee/energy/cleaving_saw name = "cleaving saw" desc = "This saw, effective at drawing the blood of beasts, transforms into a long cleaver that makes use of centrifugal force."