Actually plug armor procs to armor modification code

This commit is contained in:
mochi
2020-06-23 09:41:48 +02:00
parent aad3c76e5d
commit 096bc87dd3
13 changed files with 42 additions and 35 deletions

View File

@@ -86,8 +86,8 @@
is_zombie = TRUE
if(H.wear_suit)
var/obj/item/clothing/suit/armor/A = H.wear_suit
if(A.armor && A.armor["melee"])
maxHealth += A.armor["melee"] //That zombie's got armor, I want armor!
if(A.armor && A.armor.getRating("melee"))
maxHealth += A.armor.getRating("melee") //That zombie's got armor, I want armor!
maxHealth += 40
health = maxHealth
name = "blob zombie"

View File

@@ -176,7 +176,7 @@
return 0
var/armor_protection = 0
if(damage_flag)
armor_protection = armor[damage_flag]
armor_protection = armor.getRating(damage_flag)
damage_amount = round(damage_amount * (100 - armor_protection)*0.01, 0.1)
if(overmind && damage_flag)
damage_amount = overmind.blob_reagent_datum.damage_reaction(src, damage_amount, damage_type, damage_flag)

View File

@@ -169,9 +169,9 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \
return
if(is_type_in_typecache(target, goliath_platable_armor_typecache))
var/obj/item/clothing/C = target
var/list/current_armor = C.armor
if(current_armor["melee"] < 60)
current_armor["melee"] = min(current_armor["melee"] + 10, 60)
var/datum/armor/current_armor = C.armor
if(current_armor.getRating("melee") < 60)
C.armor = current_armor.setRating(melee_value = min(current_armor.getRating("melee") + 10, 60))
to_chat(user, "<span class='info'>You strengthen [target], improving its resistance against melee attacks.</span>")
use(1)
else
@@ -180,9 +180,9 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \
var/obj/mecha/working/ripley/D = target
if(D.hides < 3)
D.hides++
D.armor["melee"] = min(D.armor["melee"] + 10, 70)
D.armor["bullet"] = min(D.armor["bullet"] + 5, 50)
D.armor["laser"] = min(D.armor["laser"] + 5, 50)
D.armor = D.armor.setRating(melee_value = min(D.armor.getRating("melee") + 10, 70))
D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating("bullet") + 5, 50))
D.armor = D.armor.setRating(laser_value = min(D.armor.getRating("laser") + 5, 50))
to_chat(user, "<span class='info'>You strengthen [target], improving its resistance against melee attacks.</span>")
D.update_icon()
if(D.hides == 3)

View File

@@ -30,7 +30,7 @@
return 0
var/armor_protection = 0
if(damage_flag)
armor_protection = armor[damage_flag]
armor_protection = armor.getRating(damage_flag)
if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor.
armor_protection = Clamp(armor_protection - armour_penetration, min(armor_protection, 0), 100)
return round(damage_amount * (100 - armor_protection)*0.01, DAMAGE_PRECISION)

View File

@@ -197,7 +197,7 @@
/obj/proc/multitool_menu(mob/user, obj/item/multitool/P)
return "<b>NO MULTITOOL_MENU!</b>"
/obj/proc/linkWith(mob/user, obj/buffer, var/context)
/obj/proc/linkWith(mob/user, obj/buffer, context)
return FALSE
/obj/proc/unlinkFrom(mob/user, obj/buffer)

View File

@@ -80,8 +80,8 @@
O.resistance_flags |= FLAMMABLE //Even fireproof things burn up in lava
if(O.resistance_flags & FIRE_PROOF)
O.resistance_flags &= ~FIRE_PROOF
if(O.armor["fire"] > 50) //obj with 100% fire armor still get slowly burned away.
O.armor["fire"] = 50
if(O.armor.getRating("fire") > 50) //obj with 100% fire armor still get slowly burned away.
O.armor = O.armor.setRating(fire_value = 50)
O.fire_act(10000, 1000)
else if(isliving(thing))

View File

@@ -285,7 +285,7 @@
if(helmet)
helmet.update_light(wearer)
correct_piece.armor["bio"] = 100
correct_piece.armor = correct_piece.armor.setRating(bio_value = 100)
sealing = FALSE
@@ -388,7 +388,7 @@
if(helmet)
helmet.update_light(wearer)
correct_piece.armor["bio"] = armor["bio"]
correct_piece.armor = correct_piece.armor.setRating(bio_value = armor.getRating("bio"))
sealing = FALSE

View File

@@ -9,13 +9,22 @@
multi *= (100 - chest.damage) / 100 //If we have some breaches, lower the armor value.
//TODO check for other armor mods, likely modules, which need to be coded.
if(!armor) //Did we even give them some armor, if this is the case, the list should be initialized from New()
return
var/datum/armor/A = armor
for(var/obj/item/piece in list(gloves, helmet, boots, chest))
if(!istype(piece)) //Do we have the piece
continue
if(islist(armor)) //Did we even give them some armor, if this is the case, the list should be initialized from New()
var/list/L = armor
for(var/armortype in L)
piece.armor[armortype] = L[armortype]*multi
piece.armor = piece.armor.setRating(melee_value = A.getRating("melee") * multi,
bullet_value = A.getRating("bullet") * multi,
laser_value = A.getRating("laser") * multi,
energy_value = A.getRating("energy") * multi,
bomb_value = A.getRating("bomb") * multi,
bio_value = A.getRating("bio") * multi,
rad_value = A.getRating("rad") * multi,
fire_value = A.getRating("fire") * multi,
acid_value = A.getRating("acidd") * multi)
//Perfect place to also add something like shield modules, or any other hit_reaction modules check.

View File

@@ -37,8 +37,7 @@
var/mob/M = has_suit.loc
A.Grant(M)
for(var/armor_type in armor)
has_suit.armor[armor_type] += armor[armor_type]
has_suit.armor = has_suit.armor.attachArmor(armor)
if(user)
to_chat(user, "<span class='notice'>You attach [src] to [has_suit].</span>")
@@ -56,8 +55,7 @@
var/mob/M = has_suit.loc
A.Remove(M)
for(var/armor_type in armor)
has_suit.armor[armor_type] -= armor[armor_type]
has_suit.armor = has_suit.armor.detachArmor(armor)
has_suit = null
if(user)

View File

@@ -72,8 +72,8 @@
if(istype(H.head, /obj/item/clothing/head) && affecting == "head")
// If their head has an armor value, assign headarmor to it, else give it 0.
if(H.head.armor["melee"])
headarmor = H.head.armor["melee"]
if(H.head.armor.getRating("melee"))
headarmor = H.head.armor.getRating("melee")
else
headarmor = 0
else

View File

@@ -134,7 +134,7 @@ emp_act
if(bp && istype(bp ,/obj/item/clothing))
var/obj/item/clothing/C = bp
if(C.body_parts_covered & def_zone.body_part)
protection += C.armor[type]
protection += C.armor.getRating(type)
return protection

View File

@@ -153,16 +153,16 @@
if(def_zone)
if(def_zone == "head")
if(inventory_head)
armorval = inventory_head.armor[type]
armorval = inventory_head.armor.getRating(type)
else
if(inventory_back)
armorval = inventory_back.armor[type]
armorval = inventory_back.armor.getRating(type)
return armorval
else
if(inventory_head)
armorval += inventory_head.armor[type]
armorval += inventory_head.armor.getRating(type)
if(inventory_back)
armorval += inventory_back.armor[type]
armorval += inventory_back.armor.getRating(type)
return armorval * 0.5
/mob/living/simple_animal/pet/dog/corgi/attackby(obj/item/O, mob/user, params)

View File

@@ -62,8 +62,8 @@
is_zombie = TRUE
if(H.wear_suit)
var/obj/item/clothing/suit/armor/A = H.wear_suit
if(A.armor && A.armor["melee"])
maxHealth += A.armor["melee"] //That zombie's got armor, I want armor!
if(A.armor && A.armor.getRating("melee"))
maxHealth += A.armor.getRating("melee") //That zombie's got armor, I want armor!
maxHealth += 200
health = maxHealth
name = "zombie"