diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index c23622ad65..2e8005e631 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -1,12 +1,16 @@ /obj/item/shield name = "shield" + icon = 'icons/obj/items_and_weapons.dmi' block_chance = 50 armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 70) + var/transparent = FALSE // makes beam projectiles pass through the shield + +/obj/item/shield/proc/on_shield_block(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK) + return TRUE /obj/item/shield/riot name = "riot shield" desc = "A shield adept at blocking blunt objects from connecting with the torso of the shield wielder." - icon = 'icons/obj/items_and_weapons.dmi' icon_state = "riot" lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' @@ -19,6 +23,19 @@ materials = list(MAT_GLASS=7500, MAT_METAL=1000) attack_verb = list("shoved", "bashed") var/cooldown = 0 //shield bash cooldown. based on world.time + transparent = TRUE + max_integrity = 75 + +/obj/item/shield/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(transparent && (hitby.pass_flags & PASSGLASS)) + return FALSE + if(attack_type == THROWN_PROJECTILE_ATTACK) + final_block_chance += 30 + if(attack_type == LEAP_ATTACK) + final_block_chance = 100 + . = ..() + if(.) + on_shield_block(owner, hitby, attack_text, damage, attack_type) /obj/item/shield/riot/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/melee/baton)) @@ -26,14 +43,40 @@ user.visible_message("[user] bashes [src] with [W]!") playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1) cooldown = world.time + else if(istype(W, /obj/item/stack/sheet/mineral/titanium)) + if(obj_integrity >= max_integrity) + to_chat(user, "[src] is already in perfect condition.") + else + var/obj/item/stack/sheet/mineral/titanium/T = W + T.use(1) + obj_integrity = max_integrity + to_chat(user, "You repair [src] with [T].") else return ..() -/obj/item/shield/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(attack_type == THROWN_PROJECTILE_ATTACK) - final_block_chance += 30 - if(attack_type == LEAP_ATTACK) - final_block_chance = 100 +/obj/item/shield/riot/examine(mob/user) + . = ..() + var/healthpercent = round((obj_integrity/max_integrity) * 100, 1) + switch(healthpercent) + if(50 to 99) + . += "It looks slightly damaged." + if(25 to 50) + . += "It appears heavily damaged." + if(0 to 25) + . += "It's falling apart!" + +/obj/item/shield/riot/proc/shatter(mob/living/carbon/human/owner) + playsound(owner, 'sound/effects/glassbr3.ogg', 100) + new /obj/item/shard((get_turf(src))) + +/obj/item/shield/riot/on_shield_block(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK) + if(obj_integrity <= damage) + var/turf/T = get_turf(owner) + T.visible_message("[hitby] destroys [src]!") + shatter(owner) + qdel(src) + return FALSE + take_damage(damage) return ..() /obj/item/shield/riot/roman @@ -43,11 +86,18 @@ item_state = "roman_shield" lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' + transparent = FALSE + max_integrity = 65 /obj/item/shield/riot/roman/fake desc = "Bears an inscription on the inside: \"Romanes venio domus\". It appears to be a bit flimsy." block_chance = 0 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0) + max_integrity = 30 + +/obj/item/shield/riot/roman/shatter(mob/living/carbon/human/owner) + playsound(owner, 'sound/effects/grillehit.ogg', 100) + new /obj/item/stack/sheet/metal(get_turf(src)) /obj/item/shield/riot/buckler name = "wooden buckler" @@ -59,11 +109,17 @@ materials = list() resistance_flags = FLAMMABLE block_chance = 30 + transparent = FALSE + max_integrity = 55 + +/obj/item/shield/riot/buckler/shatter(mob/living/carbon/human/owner) + playsound(owner, 'sound/effects/bang.ogg', 50) + new /obj/item/stack/sheet/mineral/wood(get_turf(src)) + /obj/item/shield/energy name = "energy combat shield" desc = "A shield that reflects almost all energy projectiles, but is useless against physical attacks. It can be retracted, expanded, and stored anywhere." - icon = 'icons/obj/items_and_weapons.dmi' lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' w_class = WEIGHT_CLASS_TINY @@ -91,7 +147,7 @@ /obj/item/shield/energy/attack_self(mob/living/carbon/human/user) if(clumsy_check && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - to_chat(user, "You beat yourself in the head with [src].") + to_chat(user, "You beat yourself in the head with [src]!") user.take_bodypart_damage(5) active = !active icon_state = "[base_icon_state][active]" @@ -101,21 +157,20 @@ throwforce = on_throwforce throw_speed = on_throw_speed w_class = WEIGHT_CLASS_BULKY - playsound(user, 'sound/weapons/saberon.ogg', 35, 1) + playsound(user, 'sound/weapons/saberon.ogg', 35, TRUE) to_chat(user, "[src] is now active.") else force = initial(force) throwforce = initial(throwforce) throw_speed = initial(throw_speed) w_class = WEIGHT_CLASS_TINY - playsound(user, 'sound/weapons/saberoff.ogg', 35, 1) + playsound(user, 'sound/weapons/saberoff.ogg', 35, TRUE) to_chat(user, "[src] can now be concealed.") add_fingerprint(user) /obj/item/shield/riot/tele name = "telescopic shield" desc = "An advanced riot shield made of lightweight materials that collapses for easy storage." - icon = 'icons/obj/items_and_weapons.dmi' icon_state = "teleriot0" lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' @@ -135,7 +190,7 @@ /obj/item/shield/riot/tele/attack_self(mob/living/user) active = !active icon_state = "teleriot[active]" - playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1) + playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, TRUE) if(active) force = 8