mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
* Refactors armor into dedicated subtypes * start * most tg things * pain (#18584) * shit * non-mod changes * compile Co-authored-by: John Doe <gamingskeleton3@gmail.com> * #18291 * compile fix * ??? Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Co-authored-by: John Doe <gamingskeleton3@gmail.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
23 lines
807 B
Plaintext
23 lines
807 B
Plaintext
/// Get the atom's armor reference
|
|
/atom/proc/get_armor()
|
|
RETURN_TYPE(/datum/armor)
|
|
return (armor ||= get_armor_by_type(armor_type))
|
|
|
|
/// Helper to get a specific rating for the atom's armor
|
|
/atom/proc/get_armor_rating(damage_type)
|
|
var/datum/armor/armor = get_armor()
|
|
return armor.get_rating(damage_type)
|
|
|
|
/// Sets the armor of this atom to the specified armor
|
|
/atom/proc/set_armor(datum/armor/armor)
|
|
if(src.armor == armor)
|
|
return
|
|
if(!(src.armor?.type in GLOB.armor_by_type))
|
|
qdel(src.armor)
|
|
src.armor = ispath(armor) ? get_armor_by_type(armor) : armor
|
|
|
|
/// Helper to update the atom's armor to a new armor with the specified rating
|
|
/atom/proc/set_armor_rating(damage_type, rating)
|
|
var/datum/armor/armor = get_armor()
|
|
set_armor(armor.generate_new_with_specific(list("[damage_type]" = rating)))
|