diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index cf73d207a6..5e0669880c 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -23,8 +23,9 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define ON_BORDER_1 (1<<9) // item has priority to check when entering or leaving #define DROPDEL_1 (1<<10) // When dropped, it calls qdel on itself #define PREVENT_CLICK_UNDER_1 (1<<11) //Prevent clicking things below it on the same turf eg. doors/ fulltile windows -#define HOLOGRAM_1 (1<<12) -#define TESLA_IGNORE_1 (1<<13) // TESLA_IGNORE grants immunity from being targeted by tesla-style electricity +#define NO_EMP_WIRES_1 (1<<12) +#define HOLOGRAM_1 (1<<13) +#define TESLA_IGNORE_1 (1<<14) // TESLA_IGNORE grants immunity from being targeted by tesla-style electricity //turf-only flags @@ -65,7 +66,3 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define ACID_PROOF (1<<5) //acid stuck on it doesn't melt it. #define INDESTRUCTIBLE (1<<6) //doesn't take damage #define FREEZE_PROOF (1<<7) //can't be frozen - -#define EMP_PROTECT_SELF (1<<0) -#define EMP_PROTECT_CONTENTS (1<<1) -#define EMP_PROTECT_WIRES (1<<2) diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm index 1f4739491a..f8287cf34e 100644 --- a/code/__DEFINES/obj_flags.dm +++ b/code/__DEFINES/obj_flags.dm @@ -9,6 +9,7 @@ #define ON_BLUEPRINTS (1<<5) //Are we visible on the station blueprints at roundstart? #define UNIQUE_RENAME (1<<6) // can you customize the description/name of the thing? #define USES_TGUI (1<<7) //put on things that use tgui on ui_interact instead of custom/old UI. +#define FROZEN (1<<8) // If you add new ones, be sure to add them to /obj/Initialize as well for complete mapping support @@ -18,6 +19,8 @@ #define IN_INVENTORY (1<<1) //is this item equipped into an inventory slot or hand of a mob? used for tooltips #define FORCE_STRING_OVERRIDE (1<<2) // used for tooltips #define NEEDS_PERMIT (1<<3) //Used by security bots to determine if this item is safe for public use. +#define SLOWS_WHILE_IN_HAND (1<<4) +#define NO_MAT_REDEMPTION (1<<5) // Stops you from putting things like an RCD or other items into an ORM or protolathe for materials. // Flags for the clothing_flags var on /obj/item/clothing diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 7caa28642e..9a8a249159 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1072,19 +1072,19 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0 // Used to make the frozen item visuals for Freon. if(resistance_flags & FREEZE_PROOF) return - if(!(flags_2 & FROZEN_2)) + if(!(obj_flags & FROZEN)) name = "frozen [name]" add_atom_colour(GLOB.freon_color_matrix, TEMPORARY_COLOUR_PRIORITY) alpha -= 25 - flags_2 |= FROZEN_2 + obj_flags |= FROZEN //Assumes already frozed /obj/proc/make_unfrozen() - if(flags_2 & FROZEN_2) + if(obj_flags & FROZEN) name = replacetext(name, "frozen ", "") remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, GLOB.freon_color_matrix) alpha += 25 - flags_2 &= ~FROZEN_2 + obj_flags &= ~FROZEN //Converts an icon to base64. Operates by putting the icon in the iconCache savefile, diff --git a/code/datums/components/earhealing.dm b/code/datums/components/earhealing.dm new file mode 100644 index 0000000000..79303ff701 --- /dev/null +++ b/code/datums/components/earhealing.dm @@ -0,0 +1,30 @@ +// An item worn in the ear slot with this component will heal your ears each +// Life() tick, even if normally your ears would be too damaged to heal. + +/datum/component/earhealing + var/mob/living/carbon/wearer + +/datum/component/earhealing/Initialize() + if(!isitem(parent)) + return COMPONENT_INCOMPATIBLE + RegisterSignal(list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/equippedChanged) + +/datum/component/earhealing/proc/equippedChanged(mob/living/carbon/user, slot) + if (slot == SLOT_EARS && istype(user)) + if (!wearer) + START_PROCESSING(SSobj, src) + wearer = user + else + if (wearer) + STOP_PROCESSING(SSobj, src) + wearer = null + +/datum/component/earhealing/process() + if (!wearer) + STOP_PROCESSING(SSobj, src) + return + if(!wearer.has_trait(TRAIT_DEAF)) + var/obj/item/organ/ears/ears = wearer.getorganslot(ORGAN_SLOT_EARS) + if (ears) + ears.deaf = max(ears.deaf - 1, (ears.ear_damage < UNHEALING_EAR_DAMAGE ? 0 : 1)) // Do not clear deafness while above the unhealing ear damage threshold + ears.ear_damage = max(ears.ear_damage - 0.1, 0) diff --git a/code/datums/components/wearertargeting.dm b/code/datums/components/wearertargeting.dm new file mode 100644 index 0000000000..adf8acceb9 --- /dev/null +++ b/code/datums/components/wearertargeting.dm @@ -0,0 +1,26 @@ +// A dummy parent type used for easily making components that target an item's wearer rather than the item itself. + +/datum/component/wearertargeting + var/datum/component/mobhook + var/list/valid_slots = list() + var/list/signals = list() + var/datum/callback/callback = CALLBACK(GLOBAL_PROC, .proc/pass) + var/mobtype = /mob/living + +/datum/component/wearertargeting/Initialize() + if(!isitem(parent)) + return COMPONENT_INCOMPATIBLE + RegisterSignal(list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/checkMobHook) + +/datum/component/wearertargeting/Destroy() + QDEL_NULL(mobhook) + return ..() + +/datum/component/wearertargeting/proc/checkMobHook(mob/user, slot) + if ((slot in valid_slots) && istype(user, mobtype)) + if (mobhook && mobhook.parent != user) + QDEL_NULL(mobhook) + if (!mobhook) + mobhook = user.AddComponent(/datum/component/redirect, signals, callback) + else + QDEL_NULL(mobhook) diff --git a/code/datums/components/wet_floor.dm b/code/datums/components/wet_floor.dm index afba151b9f..0baddd87eb 100644 --- a/code/datums/components/wet_floor.dm +++ b/code/datums/components/wet_floor.dm @@ -117,7 +117,7 @@ decrease = max(0, decrease) if((is_wet() & TURF_WET_ICE) && t > T0C) //Ice melts into water! for(var/obj/O in T.contents) - if(O.flags_2 & FROZEN_2) + if(O.obj_flags & FROZEN) O.make_unfrozen() add_wet(TURF_WET_WATER, max_time_left()) dry(TURF_WET_ICE) diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 96adece298..3a047b20a1 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -194,7 +194,7 @@ equip_cooldown = 10 energy_drain = 250 range = MELEE|RANGED - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION var/mode = 0 //0 - deconstruct, 1 - wall or floor, 2 - airlock. /obj/item/mecha_parts/mecha_equipment/rcd/Initialize() diff --git a/code/game/objects/items/RCD.dm b/code/game/objects/items/RCD.dm index 7c54acbca9..5aeefc2fcd 100644 --- a/code/game/objects/items/RCD.dm +++ b/code/game/objects/items/RCD.dm @@ -129,7 +129,7 @@ RLD lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' max_matter = 160 - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION has_ammobar = TRUE var/mode = 1 var/ranged = FALSE diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 72481f335d..4e2b0baf75 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -30,7 +30,7 @@ user.forceMove(R) playsound(src, 'sound/items/zip.ogg', 15, 1, -3) return (OXYLOSS) - ..() + ..() // Bluespace bodybag @@ -41,7 +41,7 @@ icon_state = "bluebodybag_folded" unfoldedbag_path = /obj/structure/closet/body_bag/bluespace w_class = WEIGHT_CLASS_SMALL - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION /obj/item/bodybag/bluespace/examine(mob/user) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index ea332c77de..4c96bf3b84 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -60,7 +60,7 @@ lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi' flags_1 = NOBLUDGEON_1 - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION var/prox_check = TRUE //If the emag requires you to be in range /obj/item/card/emag/bluespace diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm index 560a972ee8..b43051b772 100644 --- a/code/game/objects/items/holy_weapons.dm +++ b/code/game/objects/items/holy_weapons.dm @@ -436,7 +436,7 @@ slot_flags = null hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND /obj/item/nullrod/tribal_knife/Initialize(mapload) . = ..() diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index d2665be1b0..361e81135e 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -44,7 +44,7 @@ icon_state = "holdingpack" item_state = "holdingpack" resistance_flags = FIRE_PROOF - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 60, "acid" = 50) component_type = /datum/component/storage/concrete/bluespace/bag_of_holding diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index a75d0aa0d9..4846ee8582 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -77,7 +77,7 @@ name = "trash bag of holding" desc = "The latest and greatest in custodial convenience, a trashbag that is capable of holding vast quantities of garbage." icon_state = "bluetrashbag" - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION /obj/item/storage/bag/trash/bluespace/ComponentInitialize() . = ..() diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 75cef4e92c..65ed2281f0 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -72,7 +72,7 @@ /obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback) ..() - if(flags_2 & FROZEN_2) + if(obj_flags & FROZEN) visible_message("[src] shatters into a million pieces!") qdel(src) diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 2fc582229d..538fcdc8de 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -160,7 +160,7 @@ for(var/obj/I in contents) if(I.resistance_flags & FREEZE_PROOF) return - if(!(I.flags_2 & FROZEN_2)) //let it go + if(!(I.obj_flags & FROZEN)) I.make_frozen_visual() for(var/mob/living/L in contents) if(L.bodytemperature <= 50) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index dcfc1d41f6..6d62172f8e 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -188,7 +188,7 @@ //melting if(isobj(AM) && air && air.temperature > T0C) var/obj/O = AM - if(O.flags_2 & FROZEN_2) + if(O.obj_flags & FROZEN) O.make_unfrozen() /turf/proc/is_plasteel_floor() diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 4de5219d7d..5f56e1b91b 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -99,7 +99,7 @@ inhand_x_dimension = 64 inhand_y_dimension = 64 actions_types = list() - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND var/datum/action/innate/dash/cult/jaunt var/datum/action/innate/cult/spin2win/linked_action var/spinning = FALSE diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index cc6344cf06..09504c60b7 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -24,7 +24,7 @@ armour_penetration = 1000 resistance_flags = INDESTRUCTIBLE anchored = TRUE - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND var/team = WHITE_TEAM var/reset_cooldown = 0 var/anyonecanpickup = TRUE diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 6758f7aac7..2b5ed79d7b 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1251,7 +1251,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) if(H.back) . += H.back.slowdown for(var/obj/item/I in H.held_items) - if(I.flags_2 & SLOWS_WHILE_IN_HAND_2) + if(I.item_flags & SLOWS_WHILE_IN_HAND) . += I.slowdown var/stambufferinfluence = (H.bufferedstam*(100/H.stambuffer))*0.2 //CIT CHANGE - makes stamina buffer influence movedelay var/health_deficiency = ((100 + stambufferinfluence) - H.health + (H.getStaminaLoss()*0.75))//CIT CHANGE - reduces the impact of staminaloss on movement speed and makes stamina buffer influence movedelay diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index 66b6ba26b8..3106a9e510 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -13,7 +13,7 @@ w_class = WEIGHT_CLASS_NORMAL // No running around with open laptops in hands. - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND screen_on = 0 // Starts closed var/start_open = TRUE // unless this var is set to 1 diff --git a/code/modules/projectiles/guns/ballistic/laser_gatling.dm b/code/modules/projectiles/guns/ballistic/laser_gatling.dm index 8d309a13bb..db5beb21ed 100644 --- a/code/modules/projectiles/guns/ballistic/laser_gatling.dm +++ b/code/modules/projectiles/guns/ballistic/laser_gatling.dm @@ -110,7 +110,7 @@ fire_sound = 'sound/weapons/laser.ogg' mag_type = /obj/item/ammo_box/magazine/internal/minigun casing_ejector = FALSE - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = NEEDS_PERMIT | SLOWS_WHILE_IN_HAND var/obj/item/minigunpack/ammo_pack /obj/item/gun/ballistic/minigun/Initialize() @@ -145,5 +145,3 @@ /obj/item/gun/ballistic/minigun/dropped(mob/living/user) ammo_pack.attach_gun(user) - - diff --git a/code/modules/projectiles/guns/magic/staff.dm b/code/modules/projectiles/guns/magic/staff.dm index c58d452043..4b3905721f 100644 --- a/code/modules/projectiles/guns/magic/staff.dm +++ b/code/modules/projectiles/guns/magic/staff.dm @@ -2,7 +2,7 @@ slot_flags = ITEM_SLOT_BACK lefthand_file = 'icons/mob/inhands/weapons/staves_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/staves_righthand.dmi' - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NEEDS_PERMIT | NO_MAT_REDEMPTION /obj/item/gun/magic/staff/change name = "staff of change" diff --git a/code/modules/research/xenobiology/crossbreeding/burning.dm b/code/modules/research/xenobiology/crossbreeding/burning.dm index 6d00a6d4e6..db83ea2963 100644 --- a/code/modules/research/xenobiology/crossbreeding/burning.dm +++ b/code/modules/research/xenobiology/crossbreeding/burning.dm @@ -392,7 +392,7 @@ Burning extracts: throw_speed = 2 force = 15 //Heavy, but hard to wield. attack_verb = list("bashed","pounded","slammed") - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND /obj/effect/proc_holder/spell/targeted/shapeshift/slimeform @@ -417,4 +417,4 @@ Burning extracts: /mob/living/simple_animal/slime/transformedslime/Reproduce() //Just in case. to_chat(src, "I can't reproduce...") - return \ No newline at end of file + return diff --git a/code/modules/surgery/organs/ears.dm b/code/modules/surgery/organs/ears.dm index fff342a101..c54d3bb532 100644 --- a/code/modules/surgery/organs/ears.dm +++ b/code/modules/surgery/organs/ears.dm @@ -27,14 +27,9 @@ // genetic deafness prevents the body from using the ears, even if healthy if(C.has_trait(TRAIT_DEAF)) deaf = max(deaf, 1) - else - if(C.ears && (C.ears.flags_2 & HEALS_EARS_2)) - deaf = max(deaf - 1, 1) - ear_damage = max(ear_damage - 0.1, 0) - // if higher than UNHEALING_EAR_DAMAGE, no natural healing occurs. - if(ear_damage < UNHEALING_EAR_DAMAGE) - ear_damage = max(ear_damage - 0.05, 0) - deaf = max(deaf - 1, 0) + else if(ear_damage < UNHEALING_EAR_DAMAGE) // if higher than UNHEALING_EAR_DAMAGE, no natural healing occurs. + ear_damage = max(ear_damage - 0.05, 0) + deaf = max(deaf - 1, 0) /obj/item/organ/ears/proc/restoreEars() deaf = 0 diff --git a/html/changelogs/AutoChangeLog-pr-6573.yml b/html/changelogs/AutoChangeLog-pr-6573.yml new file mode 100644 index 0000000000..565f505337 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-6573.yml @@ -0,0 +1,4 @@ +author: "Naksu" +delete-after: True +changes: + - code_imp: "More flags have been moved to their appropriate places" diff --git a/html/changelogs/AutoChangeLog-pr-6574.yml b/html/changelogs/AutoChangeLog-pr-6574.yml new file mode 100644 index 0000000000..26ded8adac --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-6574.yml @@ -0,0 +1,5 @@ +author: "Naksu" +delete-after: True +changes: + - code_imp: "HEALS_EARS_2 is removed in favor of the earhealing component" + - code_imp: "wearertargeting component is available to subtype for components that want to target the wearer of an item rather than the item itself" diff --git a/modular_citadel/code/game/objects/ids.dm b/modular_citadel/code/game/objects/ids.dm index dc8f38bd25..f07d0ea23b 100644 --- a/modular_citadel/code/game/objects/ids.dm +++ b/modular_citadel/code/game/objects/ids.dm @@ -55,7 +55,7 @@ lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi' flags_1 = NOBLUDGEON_1 - flags_2 = NO_MAT_REDEMPTION_2 + item_flags = NO_MAT_REDEMPTION color = rgb(35, 20, 11) /obj/item/card/emag @@ -71,4 +71,4 @@ var/obj/item/card/emag_broken/junk = new(user.loc) junk.add_fingerprint(user) qdel(src) - return \ No newline at end of file + return diff --git a/modular_citadel/code/game/objects/items/melee/eutactic_blades.dm b/modular_citadel/code/game/objects/items/melee/eutactic_blades.dm index 9573e8706d..f2e2cee4a7 100644 --- a/modular_citadel/code/game/objects/items/melee/eutactic_blades.dm +++ b/modular_citadel/code/game/objects/items/melee/eutactic_blades.dm @@ -254,7 +254,7 @@ armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 100, acid = 70) resistance_flags = FIRE_PROOF var/brightness_on = 6 //TWICE AS BRIGHT AS A REGULAR ESWORD - flags_2 = SLOWS_WHILE_IN_HAND_2 + item_flags = SLOWS_WHILE_IN_HAND /obj/item/twohanded/hypereutactic/pre_altattackby(atom/A, mob/living/user, params) //checks if it can do right click memes altafterattack(A, user, TRUE, params) @@ -453,4 +453,4 @@ update_icon() /obj/item/twohanded/hypereutactic/toy/rainbow/AltClick(mob/living/user) - return \ No newline at end of file + return diff --git a/tgstation.dme b/tgstation.dme index b29a630ed0..761405f883 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -348,6 +348,7 @@ #include "code\datums\components\stationloving.dm" #include "code\datums\components\swarming.dm" #include "code\datums\components\thermite.dm" +#include "code\datums\components\wearertargeting.dm" #include "code\datums\components\wet_floor.dm" #include "code\datums\components\decals\blood.dm" #include "code\datums\components\storage\storage.dm"