Skip to content

Commit

Permalink
Purges some flags_item flags and tidies flags_atom bitshifts (#12878)
Browse files Browse the repository at this point in the history
Co-authored-by: TiviPlus <[email protected]>
  • Loading branch information
TiviPlus and TiviPlus authored May 3, 2023
1 parent 22d3af9 commit d7f11dc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 49 deletions.
57 changes: 27 additions & 30 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@

//flags_atom

#define NOINTERACT (1<<3) // You can't interact with it, at all. Useful when doing certain animations.
#define CONDUCT (1<<4) // conducts electricity (metal etc.)
#define ON_BORDER (1<<5) // 'border object'. item has priority to check when entering or leaving
#define NOBLOODY (1<<6) // Don't want a blood overlay on this one.
#define DIRLOCK (1<<7) // movable atom won't change direction when Moving()ing. Useful for items that have several dir states.
#define INITIALIZED (1<<8) //Whether /atom/Initialize() has already run for the object
#define NODECONSTRUCT (1<<9)
#define OVERLAY_QUEUED (1<<10)
#define PREVENT_CLICK_UNDER (1<<11) //Prevent clicking things below it on the same turf
#define CRITICAL_ATOM (1<<12) //Use when this shouldn't be obscured by large icons.
#define NOINTERACT (1<<0) // You can't interact with it, at all. Useful when doing certain animations.
#define CONDUCT (1<<1) // conducts electricity (metal etc.)
#define ON_BORDER (1<<2) // 'border object'. item has priority to check when entering or leaving
#define NOBLOODY (1<<3) // Don't want a blood overlay on this one.
#define DIRLOCK (1<<4) // movable atom won't change direction when Moving()ing. Useful for items that have several dir states.
#define INITIALIZED (1<<5) //Whether /atom/Initialize() has already run for the object
#define NODECONSTRUCT (1<<6)
#define OVERLAY_QUEUED (1<<7)
#define PREVENT_CLICK_UNDER (1<<8) //Prevent clicking things below it on the same turf
#define CRITICAL_ATOM (1<<9) //Use when this shouldn't be obscured by large icons.
///Does not cascade explosions to its contents.
#define PREVENT_CONTENTS_EXPLOSION (1<<13)
#define PREVENT_CONTENTS_EXPLOSION (1<<10)
/// was this spawned by an admin? used for stat tracking stuff.
#define ADMIN_SPAWNED (1<<14)
#define ADMIN_SPAWNED (1<<11)
/// Can this atom be bumped attack
#define BUMP_ATTACKABLE (1<<15)
#define BUMP_ATTACKABLE (1<<12)
///This atom will not be qdeled when a shuttle lands on it; it will just move onto the shuttle tile. It will stay on the ground when the shuttle takes off
#define SHUTTLE_IMMUNE (1<<16)
#define SHUTTLE_IMMUNE (1<<13)
/// Should we use the initial icon for display? Mostly used by overlay only objects
#define HTML_USE_INITAL_ICON_1 (1<<21)
#define HTML_USE_INITAL_ICON_1 (1<<14)

//turf-only flags
#define AI_BLOCKED (1<<0) //Prevent ai from going onto this turf
Expand All @@ -63,22 +63,19 @@
#define TWOHANDED (1<<3) // The item is twohanded.
#define WIELDED (1<<4) // The item is wielded with both hands.
#define ITEM_ABSTRACT (1<<5) //The item is abstract (grab, powerloader_clamp, etc)
#define BEING_REMOVED (1<<6) //Cuffs
#define DOES_NOT_NEED_HANDS (1<<7) //Dont need hands to use it
#define SYNTH_RESTRICTED (1<<8) //Prevents synths from wearing items with this flag
#define IMPEDE_JETPACK (1<<9) //Reduce the range of jetpack
#define DRAINS_XENO (1<<10) //Enables the item to collect resource for chem_booster component
#define CAN_BUMP_ATTACK (1<<11) //Item triggers bump attack
#define NO_VACUUM (1<<12) //Roomba won't eat this
#define IS_DEPLOYABLE (1<<13) //Item can be deployed into a machine
#define DEPLOY_ON_INITIALIZE (1<<14)
#define IS_DEPLOYED (1<<15) //If this is on an item, said item is currently deployed
#define DEPLOYED_NO_PICKUP (1<<16) //Disables deployed item pickup
#define DEPLOYED_NO_ROTATE (1<<17) //Disables deployed item rotation abilities to rotate.
#define DEPLOYED_WRENCH_DISASSEMBLE (1<<18) //If this is on an item, the item can only be disassembled using a wrench once deployed.
#define FULLY_WIELDED (1<<19) //If the item is properly wielded. Used for guns
#define DOES_NOT_NEED_HANDS (1<<6) //Dont need hands to use it
#define SYNTH_RESTRICTED (1<<7) //Prevents synths from wearing items with this flag
#define IMPEDE_JETPACK (1<<8) //Reduce the range of jetpack
#define CAN_BUMP_ATTACK (1<<9) //Item triggers bump attack
#define IS_DEPLOYABLE (1<<10) //Item can be deployed into a machine
#define DEPLOY_ON_INITIALIZE (1<<11)
#define IS_DEPLOYED (1<<12) //If this is on an item, said item is currently deployed
#define DEPLOYED_NO_PICKUP (1<<13) //Disables deployed item pickup
#define DEPLOYED_NO_ROTATE (1<<14) //Disables deployed item rotation abilities to rotate.
#define DEPLOYED_WRENCH_DISASSEMBLE (1<<15) //If this is on an item, the item can only be disassembled using a wrench once deployed.
#define FULLY_WIELDED (1<<16) //If the item is properly wielded. Used for guns
///If a holster has underlay sprites
#define HAS_UNDERLAY (1<<20)
#define HAS_UNDERLAY (1<<17)

//==========================================================================================

Expand Down
2 changes: 0 additions & 2 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,7 @@ GLOBAL_LIST_INIT(bitfields, list(
"ITEM_ABSTRACT" = ITEM_ABSTRACT,
"DOES_NOT_NEED_HANDS" = DOES_NOT_NEED_HANDS,
"SYNTH_RESTRICTED" = SYNTH_RESTRICTED,
"DRAINS_XENO" = DRAINS_XENO,
"CAN_BUMP_ATTACK" = CAN_BUMP_ATTACK,
"NO_VACUUM" = NO_VACUUM,
"IS_DEPLOYABLE" = IS_DEPLOYABLE,
"DEPLOYED_NO_PICKUP" = DEPLOYED_NO_PICKUP,
"DEPLOYED_NO_ROTATE" = DEPLOYED_NO_ROTATE,
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/chem_booster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
wearer.balloon_alert(wearer, "You need to be holding a harvester")
return

if(!CHECK_BITFIELD(held_item.flags_item, DRAINS_XENO))
if(!held_item.GetComponent(/datum/component/harvester))
wearer.balloon_alert(wearer, "You need to be holding a harvester")
return

Expand Down
10 changes: 2 additions & 8 deletions code/game/objects/items/restraints.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@


/mob/living/carbon/proc/resist_restraints(obj/item/restraints/cuffs)
if(CHECK_BITFIELD(cuffs.flags_item, BEING_REMOVED))
to_chat(src, span_warning("You're already attempting to remove [cuffs]!"))
if(do_actions)
balloon_alert(src, "busy")
return

ENABLE_BITFIELD(cuffs.flags_item, BEING_REMOVED)

visible_message(span_warning("[src] attempts to remove [cuffs]!"),
span_notice("You attempt to remove [cuffs]... (This will take around [DisplayTimeText(cuffs.breakouttime)] and you need to stand still.)"))

if(!do_after(src, cuffs.breakouttime, FALSE, target = src))
to_chat(src, span_warning("You fail to remove [cuffs]!"))
DISABLE_BITFIELD(cuffs.flags_item, BEING_REMOVED)
return FALSE

visible_message(span_danger("[src] manages to remove [cuffs]!"),
span_notice("You successfully remove [cuffs]."))

DISABLE_BITFIELD(cuffs.flags_item, BEING_REMOVED)

dropItemToGround(cuffs) //This will call UnEquip() > update_handcuffed() > UnregisterSignal()
2 changes: 0 additions & 2 deletions code/game/objects/items/weapons/blades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
force = 60
attack_speed = 12
w_class = WEIGHT_CLASS_BULKY
flags_item = DRAINS_XENO

var/codex_info = {"<b>Reagent info:</b><BR>
Bicaridine - heal your target for 10 brute. Usable on both dead and living targets.<BR>
Expand Down Expand Up @@ -219,7 +218,6 @@
item_state = "vali_knife"
force = 25
throwforce = 15
flags_item = DRAINS_XENO

var/codex_info = {"<b>Reagent info:</b><BR>
Bicaridine - heal your target for 10 brute. Usable on both dead and living targets.<BR>
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
force = 32
force_wielded = 60
throwforce = 60
flags_item = DRAINS_XENO | TWOHANDED
flags_item = TWOHANDED

/obj/item/weapon/twohanded/spear/tactical/harvester/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -397,7 +397,7 @@
attack_speed = 24
sharp = IS_SHARP_ITEM_BIG
w_class = WEIGHT_CLASS_BULKY
flags_item = DRAINS_XENO | TWOHANDED
flags_item = TWOHANDED

/// Lists the information in the codex
var/codex_info = {"<b>Reagent info:</b><BR>
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/machinery/roomba.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
SIGNAL_HANDLER
var/sucked_one = FALSE
for(var/obj/item/sucker in loc)
if(sucker.flags_item & NO_VACUUM)
if(sucker.anchored)
continue
sucked_one = TRUE
sucker.store_in_cryo()
Expand Down Expand Up @@ -154,6 +154,6 @@

/obj/machinery/roomba/valhalla/suck_items()
for(var/obj/item/sucker in loc)
if(sucker.flags_item & NO_VACUUM)
if(sucker.anchored)
continue
qdel(sucker)
2 changes: 0 additions & 2 deletions code/game/objects/structures/stool_bed_chair_nest/bed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ GLOBAL_LIST_EMPTY(activated_medevac_stretchers)
to_chat(user, span_warning("[src]'s interface is locked! Only a Squad Leader, Corpsman, or Medical Officer can unlock it now."))
return
user.drop_held_item()
flags_item |= NO_VACUUM
anchored = TRUE
planted = TRUE
to_chat(user, span_warning("You plant and activate [src]."))
Expand All @@ -628,7 +627,6 @@ GLOBAL_LIST_EMPTY(activated_medevac_stretchers)
to_chat(user, span_warning("[src]'s interface is locked! Only a Squad Leader, Corpsman, or Medical Officer can unlock it now."))
return
if(planted)
flags_item &= ~NO_VACUUM
anchored = FALSE
planted = FALSE
to_chat(user, span_warning("You retrieve and deactivate [src]."))
Expand Down

0 comments on commit d7f11dc

Please sign in to comment.