Files
Bubberstation/code/datums/components/armor_plate.dm
SkyratBot 52dbce8997 [MIRROR] Improper forced qdel cleanup, some expanded del all verbs [MDB IGNORE] (#13384)
* Improper forced qdel cleanup,  some expanded del all verbs (#66595)

* Removes all supurfolus uses of QDEL_HINT_LETMELIVE

This define exists to allow abstract, sturucturally important things to
opt out of being qdeleted.
It does not exist to be a "Immune to everything" get out of jail free
card.
We have systems for this, and it's not appropriate here.

This change is inherently breaking, because things might be improperly
qdeling these things. Those issues will need to be resolved in future,
as they pop up

* Changes all needless uses of COMSIG_PARENT_PREQDELETED

It exists for things that want to block the qdel. If that's not you,
don't use it

* Adds force and hard del verbs, for chip and break glass cases
respectively

The harddel verb comes with two options before it's run, to let you
tailor it to your level of fucked

* Damn you nova

Adds proper parent returns instead of . = ..()

Co-authored-by: Seth Scherer <supernovaa41@ gmx.com>

* Ensures immortality talismans cannot delete their human if something goes fuckey. Thanks ath/oro for pointing this out

Co-authored-by: Seth Scherer <supernovaa41@ gmx.com>

* Improper forced qdel cleanup,  some expanded del all verbs

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Seth Scherer <supernovaa41@ gmx.com>
2022-05-07 14:22:06 +01:00

99 lines
3.4 KiB
Plaintext

/datum/component/armor_plate
var/amount = 0
var/maxamount = 3
var/upgrade_item = /obj/item/stack/sheet/animalhide/goliath_hide
var/datum/armor/added_armor = list(MELEE = 10)
var/upgrade_name
/datum/component/armor_plate/Initialize(_maxamount,obj/item/_upgrade_item,datum/armor/_added_armor)
if(!isobj(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine)
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/applyplate)
RegisterSignal(parent, COMSIG_PARENT_QDELETING, .proc/dropplates)
if(istype(parent, /obj/vehicle/sealed/mecha/working/ripley))
RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/apply_mech_overlays)
if(_maxamount)
maxamount = _maxamount
if(_upgrade_item)
upgrade_item = _upgrade_item
if(_added_armor)
if(islist(_added_armor))
added_armor = getArmor(arglist(_added_armor))
else if (istype(_added_armor, /datum/armor))
added_armor = _added_armor
else
stack_trace("Invalid type [_added_armor.type] passed as _armor_item argument to armorplate component")
else
added_armor = getArmor(arglist(added_armor))
var/obj/item/typecast = upgrade_item
upgrade_name = initial(typecast.name)
/datum/component/armor_plate/proc/examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
//upgrade_item could also be typecast here instead
if(ismecha(parent))
if(amount)
if(amount < maxamount)
examine_list += span_notice("Its armor is enhanced with [amount] [upgrade_name].")
else
examine_list += span_notice("It's wearing a fearsome carapace entirely composed of [upgrade_name] - its pilot must be an experienced monster hunter.")
else
examine_list += span_notice("It has attachment points for strapping monster hide on for added protection.")
else
if(amount)
examine_list += span_notice("It has been strengthened with [amount]/[maxamount] [upgrade_name].")
else
examine_list += span_notice("It can be strengthened with up to [maxamount] [upgrade_name].")
/datum/component/armor_plate/proc/applyplate(datum/source, obj/item/I, mob/user, params)
SIGNAL_HANDLER
if(!istype(I,upgrade_item))
return
if(amount >= maxamount)
to_chat(user, span_warning("You can't improve [parent] any further!"))
return
if(istype(I,/obj/item/stack))
I.use(1)
else
if(length(I.contents))
to_chat(user, span_warning("[I] cannot be used for armoring while there's something inside!"))
return
qdel(I)
var/obj/O = parent
amount++
O.armor = O.armor.attachArmor(added_armor)
if(ismecha(O))
var/obj/vehicle/sealed/mecha/R = O
R.update_appearance()
to_chat(user, span_info("You strengthen [R], improving its resistance against melee, bullet and laser damage."))
else
SEND_SIGNAL(O, COMSIG_ARMOR_PLATED, amount, maxamount)
to_chat(user, span_info("You strengthen [O], improving its resistance against melee attacks."))
/datum/component/armor_plate/proc/dropplates(datum/source, force)
SIGNAL_HANDLER
if(ismecha(parent)) //items didn't drop the plates before and it causes erroneous behavior for the time being with collapsible helmets
for(var/i in 1 to amount)
new upgrade_item(get_turf(parent))
/datum/component/armor_plate/proc/apply_mech_overlays(obj/vehicle/sealed/mecha/mech, list/overlays)
SIGNAL_HANDLER
if(amount)
var/overlay_string = "ripley-g"
if(amount >= 3)
overlay_string += "-full"
if(!LAZYLEN(mech.occupants))
overlay_string += "-open"
overlays += overlay_string