Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shield Stuff & Unpushable Shields #19840

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 167,13 @@
/// when mobs are viewing something via a computer, currently used for the helm computer
#define TRAIT_COMPUTER_VIEW "computer_view"

/// This trait makes Check_Shoegrip return TRUE. Used for magboot-like behaviour.
#define TRAIT_SHOE_GRIP "shoe_grip"


/// This trait prevents the mob from being pushed if they aren't on help intent
#define TRAIT_UNPUSHABLE "unpushable"

// IPC OVERLOADER OVERDOSE STATES
#define TRAIT_SOURCE_OVERLOADER "overloader"
#define TRAIT_OVERLOADER_OD_INITIAL "overloader_od_initial"
Expand All @@ -179,9 186,6 @@
/// Traits given by augments
#define TRAIT_SOURCE_AUGMENT "augment"

/// This trait makes Check_Shoegrip return TRUE. Used for magboot-like behaviour.
#define TRAIT_SHOE_GRIP "shoe_grip"

// DISABILITY TRAITS

/// Causes the mob to take twice as long to clot their wounds
Expand Down
25 changes: 17 additions & 8 deletions code/game/gamemodes/changeling/implements/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 75,18 @@
throw_range = 0
throw_speed = 0
can_embed = FALSE
base_block_chance = 70

material_repair_type = null

armor = list(
melee = ARMOR_MELEE_MAJOR,
bullet = ARMOR_BALLISTIC_CARBINE,
laser = ARMOR_LASER_RIFLE,
energy = ARMOR_ENERGY_RESISTANT,
bomb = ARMOR_BOMB_PADDED
)

/// The changeling that made us
var/mob/living/creator

/obj/item/shield/riot/changeling/New()
Expand All @@ -86,6 97,11 @@
STOP_PROCESSING(SSprocessing, src)
return ..()

/obj/item/shield/riot/changeling/handle_damage(mob/user, damage)
. = ..()
if(shield_health == 0)
user.drop_from_inventory(src)

/obj/item/shield/riot/changeling/dropped(mob/user)
. = ..()
visible_message(SPAN_DANGER("With a sickening crunch, [user] reforms their shield into an arm!"),
Expand All @@ -108,13 124,6 @@
host.drop_from_inventory(src)
QDEL_IN(src, 1)

/obj/item/shield/riot/changeling/get_block_chance(mob/user, var/damage, atom/damage_source = null, mob/attacker = null)
if(istype(damage_source, /obj/projectile))
var/obj/projectile/P = damage_source
if((is_sharp(P) && damage > 10) || istype(P, /obj/projectile/beam))
return base_block_chance / 2 //lings still have a 35% chance of blocking these kinds of attacks
return base_block_chance

/obj/item/bone_dart
name = "bone dart"
desc = "A sharp piece of bone in the shape of a small dart."
Expand Down
33 changes: 29 additions & 4 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 248,12 @@
/// Holder var for the item outline filter, null when no outline filter on the item.
var/outline_filter

/// The equipment slots that we need to be equipped to for the item traits to take effect
var/list/trait_slots

/// The traits to add to the mob when we're equipped to the valid slots
var/list/equipped_traits

/obj/item/Initialize(mapload, ...)
. = ..()
if(islist(armor))
Expand All @@ -261,10 267,12 @@

/obj/item/Destroy()
if(ismob(loc))
var/mob/m = loc
m.drop_from_inventory(src)
m.update_inv_r_hand()
m.update_inv_l_hand()
var/mob/wearer = loc
wearer.drop_from_inventory(src)
wearer.update_inv_r_hand()
wearer.update_inv_l_hand()
for(var/trait in equipped_traits)
REMOVE_TRAIT(wearer, trait, ref(src))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably need macro ref here

src.loc = null

if(!QDELETED(action))
Expand Down Expand Up @@ -495,6 503,9 @@

remove_item_verbs(user)

for(var/trait in equipped_traits)
REMOVE_TRAIT(user, trait, ref(src))
Geevies marked this conversation as resolved.
Show resolved Hide resolved

if(item_flags & ITEM_FLAG_HELD_MAP_TEXT)
check_maptext()

Expand Down Expand Up @@ -531,6 542,9 @@
zoom(user)
SEND_SIGNAL(src, COMSIG_ITEM_REMOVE, src)

for(var/trait in equipped_traits)
REMOVE_TRAIT(user, trait, ref(src))
Geevies marked this conversation as resolved.
Show resolved Hide resolved

///Called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
pixel_x = 0
Expand Down Expand Up @@ -610,6 624,9 @@
else
remove_item_verbs(user)

if(slot in trait_slots)
add_equipped_traits_to_mob(user)

//Ěent for observable
SEND_SIGNAL(src, COMSIG_ITEM_REMOVE, src)

Expand Down Expand Up @@ -1361,3 1378,11 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.

/obj/item/proc/gives_weather_protection()
return FALSE

/obj/item/proc/add_equipped_traits_to_mob(var/mob/mob)
for(var/trait in equipped_traits)
ADD_TRAIT(mob, trait, ref(src))
Geevies marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/proc/remove_equipped_traits_from_mob(var/mob/mob)
for(var/trait in equipped_traits)
REMOVE_TRAIT(mob, trait, ref(src))
Geevies marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading