mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-26 17:41:05 +00:00
* Defines damage flags. (#53158) * Defines damage flags. (Hopefully without 50+ commits) Co-authored-by: TemporalOroboros <TemporalOroboros@gmail.com>
282 lines
10 KiB
Plaintext
282 lines
10 KiB
Plaintext
/obj/item/shield
|
|
name = "shield"
|
|
icon = 'icons/obj/shields.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_state = "riot"
|
|
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
|
slot_flags = ITEM_SLOT_BACK
|
|
force = 10
|
|
throwforce = 5
|
|
throw_speed = 2
|
|
throw_range = 3
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
custom_materials = list(/datum/material/glass=7500, /datum/material/iron=1000)
|
|
attack_verb_continuous = list("shoves", "bashes")
|
|
attack_verb_simple = list("shove", "bash")
|
|
var/cooldown = 0 //shield bash cooldown. based on world.time
|
|
transparent = TRUE
|
|
max_integrity = 75
|
|
material_flags = MATERIAL_NO_EFFECTS
|
|
|
|
/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))
|
|
if(cooldown < world.time - 25)
|
|
user.visible_message("<span class='warning'>[user] bashes [src] with [W]!</span>")
|
|
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, TRUE)
|
|
cooldown = world.time
|
|
else if(istype(W, /obj/item/stack/sheet/mineral/titanium))
|
|
if (obj_integrity >= max_integrity)
|
|
to_chat(user, "<span class='warning'>[src] is already in perfect condition.</span>")
|
|
else
|
|
var/obj/item/stack/sheet/mineral/titanium/T = W
|
|
T.use(1)
|
|
obj_integrity = max_integrity
|
|
to_chat(user, "<span class='notice'>You repair [src] with [T].</span>")
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/shield/riot/examine(mob/user)
|
|
. = ..()
|
|
var/healthpercent = round((obj_integrity/max_integrity) * 100, 1)
|
|
switch(healthpercent)
|
|
if(50 to 99)
|
|
. += "<span class='info'>It looks slightly damaged.</span>"
|
|
if(25 to 50)
|
|
. += "<span class='info'>It appears heavily damaged.</span>"
|
|
if(0 to 25)
|
|
. += "<span class='warning'>It's falling apart!</span>"
|
|
|
|
/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("<span class='warning'>[hitby] destroys [src]!</span>")
|
|
shatter(owner)
|
|
qdel(src)
|
|
return FALSE
|
|
take_damage(damage)
|
|
return ..()
|
|
|
|
/obj/item/shield/riot/roman
|
|
name = "\improper Roman shield"
|
|
desc = "Bears an inscription on the inside: <i>\"Romanes venio domus\"</i>."
|
|
icon_state = "roman_shield"
|
|
inhand_icon_state = "roman_shield"
|
|
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
|
transparent = FALSE
|
|
custom_materials = list(/datum/material/iron=8500)
|
|
max_integrity = 65
|
|
|
|
/obj/item/shield/riot/roman/fake
|
|
desc = "Bears an inscription on the inside: <i>\"Romanes venio domus\"</i>. 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"
|
|
desc = "A medieval wooden buckler."
|
|
icon_state = "buckler"
|
|
inhand_icon_state = "buckler"
|
|
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
|
custom_materials = list(/datum/material/wood = MINERAL_MATERIAL_AMOUNT * 10)
|
|
resistance_flags = FLAMMABLE
|
|
block_chance = 30
|
|
transparent = FALSE
|
|
max_integrity = 55
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
|
|
/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/riot/flash
|
|
name = "strobe shield"
|
|
desc = "A shield with a built in, high intensity light capable of blinding and disorienting suspects. Takes regular handheld flashes as bulbs."
|
|
icon_state = "flashshield"
|
|
inhand_icon_state = "flashshield"
|
|
var/obj/item/assembly/flash/handheld/embedded_flash
|
|
|
|
/obj/item/shield/riot/flash/Initialize()
|
|
. = ..()
|
|
embedded_flash = new(src)
|
|
|
|
/obj/item/shield/riot/flash/ComponentInitialize()
|
|
. = .. ()
|
|
AddElement(/datum/element/update_icon_updates_onmob)
|
|
|
|
/obj/item/shield/riot/flash/attack(mob/living/M, mob/user)
|
|
. = embedded_flash.attack(M, user)
|
|
update_icon()
|
|
|
|
/obj/item/shield/riot/flash/attack_self(mob/living/carbon/user)
|
|
. = embedded_flash.attack_self(user)
|
|
update_icon()
|
|
|
|
/obj/item/shield/riot/flash/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 (. && !embedded_flash.burnt_out)
|
|
embedded_flash.activate()
|
|
update_icon()
|
|
|
|
|
|
/obj/item/shield/riot/flash/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/assembly/flash/handheld))
|
|
var/obj/item/assembly/flash/handheld/flash = W
|
|
if(flash.burnt_out)
|
|
to_chat(user, "<span class='warning'>No sense replacing it with a broken bulb!</span>")
|
|
return
|
|
else
|
|
to_chat(user, "<span class='notice'>You begin to replace the bulb...</span>")
|
|
if(do_after(user, 20, target = user))
|
|
if(flash.burnt_out || !flash || QDELETED(flash))
|
|
return
|
|
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
|
qdel(embedded_flash)
|
|
embedded_flash = flash
|
|
flash.forceMove(src)
|
|
update_icon()
|
|
return
|
|
..()
|
|
|
|
/obj/item/shield/riot/flash/emp_act(severity)
|
|
. = ..()
|
|
embedded_flash.emp_act(severity)
|
|
update_icon()
|
|
|
|
/obj/item/shield/riot/flash/update_icon_state()
|
|
if(!embedded_flash || embedded_flash.burnt_out)
|
|
icon_state = "riot"
|
|
inhand_icon_state = "riot"
|
|
else
|
|
icon_state = "flashshield"
|
|
inhand_icon_state = "flashshield"
|
|
|
|
/obj/item/shield/riot/flash/examine(mob/user)
|
|
. = ..()
|
|
if (embedded_flash?.burnt_out)
|
|
. += "<span class='info'>The mounted bulb has burnt out. You can try replacing it with a new one.</span>"
|
|
|
|
/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."
|
|
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
|
w_class = WEIGHT_CLASS_TINY
|
|
attack_verb_continuous = list("shoves", "bashes")
|
|
attack_verb_simple = list("shove", "bash")
|
|
throw_range = 5
|
|
force = 3
|
|
throwforce = 3
|
|
throw_speed = 3
|
|
base_icon_state = "eshield" // [base_icon_state]1 for expanded, [base_icon_state]0 for contracted
|
|
var/on_force = 10
|
|
var/on_throwforce = 8
|
|
var/on_throw_speed = 2
|
|
var/active = 0
|
|
var/clumsy_check = TRUE
|
|
|
|
/obj/item/shield/energy/Initialize()
|
|
. = ..()
|
|
icon_state = "[base_icon_state]0"
|
|
|
|
/obj/item/shield/energy/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
|
|
|
|
/obj/item/shield/energy/IsReflect()
|
|
return (active)
|
|
|
|
/obj/item/shield/energy/attack_self(mob/living/carbon/human/user)
|
|
if(clumsy_check && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
|
to_chat(user, "<span class='userdanger'>You beat yourself in the head with [src]!</span>")
|
|
user.take_bodypart_damage(5)
|
|
active = !active
|
|
icon_state = "[base_icon_state][active]"
|
|
|
|
if(active)
|
|
force = on_force
|
|
throwforce = on_throwforce
|
|
throw_speed = on_throw_speed
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
playsound(user, 'sound/weapons/saberon.ogg', 35, TRUE)
|
|
to_chat(user, "<span class='notice'>[src] is now active.</span>")
|
|
else
|
|
force = initial(force)
|
|
throwforce = initial(throwforce)
|
|
throw_speed = initial(throw_speed)
|
|
w_class = WEIGHT_CLASS_TINY
|
|
playsound(user, 'sound/weapons/saberoff.ogg', 35, TRUE)
|
|
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
|
|
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_state = "teleriot0"
|
|
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
|
custom_materials = list(/datum/material/iron = 3600, /datum/material/glass = 3600, /datum/material/silver = 270, /datum/material/titanium = 180)
|
|
slot_flags = null
|
|
force = 3
|
|
throwforce = 3
|
|
throw_speed = 3
|
|
throw_range = 4
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
var/active = 0
|
|
|
|
/obj/item/shield/riot/tele/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
|
|
|
|
/obj/item/shield/riot/tele/attack_self(mob/living/user)
|
|
active = !active
|
|
icon_state = "teleriot[active]"
|
|
playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
|
|
|
if(active)
|
|
force = 8
|
|
throwforce = 5
|
|
throw_speed = 2
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
slot_flags = ITEM_SLOT_BACK
|
|
to_chat(user, "<span class='notice'>You extend \the [src].</span>")
|
|
else
|
|
force = 3
|
|
throwforce = 3
|
|
throw_speed = 3
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
slot_flags = null
|
|
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
|
|
add_fingerprint(user)
|