Reworking harness verbs.

This commit is contained in:
MistakeNot4892
2022-08-27 20:29:05 +10:00
parent 38361e5a5f
commit a617360eb0
3 changed files with 48 additions and 18 deletions

View File

@@ -5,6 +5,7 @@
desc = "A rough-walled, shallow den dug into the earth."
density = FALSE
opacity = FALSE
layer = ABOVE_TURF_LAYER
/obj/structure/animal_den/Initialize()
icon_state = "den[rand(1,3)]"

View File

@@ -4,7 +4,7 @@
max_w_class = ITEMSIZE_LARGE
max_storage_space = INVENTORY_STANDARD_SPACE
var/obj/item/gps/attached_gps
var/obj/item/clothing/accessory/armor/attached_plate
var/obj/item/clothing/accessory/attached_plate
var/obj/item/radio/attached_radio
/obj/item/storage/internal/animal_harness/Initialize()
@@ -53,20 +53,6 @@
W.forceMove(loc)
user.visible_message(SPAN_NOTICE("\The [user] attaches \the [W] to \the [loc]'s harness."))
attached_gps = W
loc.verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_gps
return TRUE
// Attach an armor plate.
if(istype(W, /obj/item/clothing/accessory/armor))
if(attached_plate)
to_chat(user, SPAN_WARNING("There is already \a [attached_plate] inside \the [loc]'s harness."))
else if(user.unEquip(W))
W.forceMove(loc)
user.visible_message(SPAN_NOTICE("\The [user] secures \the [W] inside \the [loc]'s harness."))
attached_plate = W
var/mob/living/simple_mob/animal/sif/grafadreka/trained/drake = loc
drake.armor = attached_plate.armor
loc.verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_plate
return TRUE
// Attach a radio.
@@ -77,11 +63,28 @@
W.forceMove(loc)
user.visible_message(SPAN_NOTICE("\The [user] attaches \the [W] to \the [loc]'s harness."))
attached_radio = W
loc.verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_radio
return TRUE
// Attach an armor plate.
if(istype(W, /obj/item/clothing/accessory/armor) || istype(W, /obj/item/clothing/accessory/material/makeshift))
if(attached_plate)
to_chat(user, SPAN_WARNING("There is already \a [attached_plate] inside \the [loc]'s harness."))
else if(user.unEquip(W))
W.forceMove(loc)
user.visible_message(SPAN_NOTICE("\The [user] secures \the [W] inside \the [loc]'s harness."))
attached_plate = W
var/mob/living/simple_mob/animal/sif/grafadreka/trained/drake = loc
drake.recalculate_armor()
return TRUE
. = ..()
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/recalculate_armor()
armor = list()
if(harness?.attached_plate)
for(var/armor_key in harness.attached_plate.armor)
armor[armor_key] = max(original_armor[armor_key], harness.attached_plate.armor[armor_key])
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_plate()
set name = "Remove Attached Plate"
set category = "IC"

View File

@@ -12,6 +12,7 @@
if(ispath(harness))
harness = new harness(src)
harness.attached_radio = new /obj/item/radio(src)
regenerate_harness_verbs()
. = ..()
/mob/living/simple_mob/animal/sif/grafadreka/trained/Destroy()
@@ -86,7 +87,32 @@
return ..()
// Open our storage, if we have it.
if(harness)
return harness.attackby(O, user)
if(harness?.attackby(O, user))
regenerate_harness_verbs()
return TRUE
return ..()
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/regenerate_harness_verbs()
if(!harness)
verbs -= list(
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_gps,
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_plate,
/mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_radio
)
return
if(harness.attached_gps)
verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_gps
else
verbs -= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_gps
if(harness.attached_plate)
verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_plate
else
verbs -= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_plate
if(harness.attached_radio)
verbs |= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_radio
else
verbs -= /mob/living/simple_mob/animal/sif/grafadreka/trained/proc/remove_attached_radio