mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-19 14:02:26 +00:00
* refactor: Attack chain, initial setup. * migrate curtain to make dreamchecker happy * update thurible * don't call attacked_by separately for legacy attack chain * remove duplicate proc * condense similar code, put allowances for legacy code in new procs * update docs, include diagram source * add comment on how to update diagram * fix admonition * mindflayer updates * remove commented out code * clarify all steps * after_attack should be overridable * whoops * retrofit recent changes * duh, can't restrict this yet because of tool_acts * i hate ore bags with the fire of a thousand suns * return correct value for object attack logic * Various cleanups. We don't want to attempt to pull stuff out of `/obj/item/attackby`, because those pieces are part of the related objects' migrations, not `/obj/item` itself. Attempting to do this causes knockon effects where things expected to call e.g. `/obj/item/storage/attackby` in the call chain were not ferried over to the new item interaction code, because the related objects hadn't actually been migrated over yet. I've used refactoring /obj/vehicle as the example for migrating `attackby` methods instead. * simplify some argument names * fuck it * make it do the thing * Rename CI module call * Prove that CI works * improve test output * aaand fix it again * fix curtain tool interactions * fix compile error * fix compile error * Better docs, introduce migration plan tool.
96 lines
3.5 KiB
Plaintext
96 lines
3.5 KiB
Plaintext
#define LABEL_MODE_OFF 0
|
|
#define LABEL_MODE_NORMAL 1
|
|
#define LABEL_MODE_GOAL 2
|
|
|
|
/obj/item/hand_labeler
|
|
name = "hand labeler"
|
|
desc = "A combined label printer, applicator, and remover, all in a single portable device. Designed to be easy to operate and use."
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "labeler0"
|
|
item_state = "flight"
|
|
var/label = null
|
|
var/labels_left = 30
|
|
var/mode = LABEL_MODE_OFF
|
|
|
|
/obj/item/hand_labeler/afterattack__legacy__attackchain(atom/A, mob/user, proximity)
|
|
if(!proximity)
|
|
return
|
|
if(mode == LABEL_MODE_OFF) //if it's off, give up.
|
|
return
|
|
|
|
if(!labels_left)
|
|
to_chat(user, "<span class='warning'>No labels left!</span>")
|
|
return
|
|
if(!label || !length(label))
|
|
to_chat(user, "<span class='warning'>No text set!</span>")
|
|
return
|
|
if(ismob(A))
|
|
to_chat(user, "<span class='warning'>You can't label creatures!</span>") // use a collar
|
|
return
|
|
|
|
if(mode == LABEL_MODE_GOAL)
|
|
if(istype(A, /obj/item))
|
|
to_chat(user, "<span class='warning'>Put it in a personal crate instead!</span>")
|
|
return
|
|
user.visible_message("<span class='notice'>[user] labels [A] as part of a secondary goal for [label].</span>", \
|
|
"<span class='notice'>You label [A] as part of a secondary goal for [label].</span>")
|
|
A.AddComponent(/datum/component/label/goal, label)
|
|
return
|
|
|
|
if(length(A.name) + length(label) > 64)
|
|
to_chat(user, "<span class='warning'>Label too big!</span>")
|
|
return
|
|
|
|
user.visible_message("<span class='notice'>[user] labels [A] as [label].</span>", \
|
|
"<span class='notice'>You label [A] as [label].</span>")
|
|
investigate_log("[key_name(user)] ([ADMIN_FLW(user,"FLW")]) labelled \"[A]\" ([ADMIN_VV(A, "VV")]) with \"[label]\" at [COORD(A.loc)] [ADMIN_JMP(A)].", INVESTIGATE_RENAME) // Investigate goes BEFORE rename so the original name is preserved in the log
|
|
A.AddComponent(/datum/component/label, label)
|
|
playsound(A, 'sound/items/handling/component_pickup.ogg', 20, TRUE)
|
|
labels_left--
|
|
|
|
/obj/item/hand_labeler/attack_self__legacy__attackchain(mob/user as mob)
|
|
// off -> normal
|
|
// normal or goal -> off
|
|
mode = !mode
|
|
icon_state = "labeler[mode]"
|
|
if(mode)
|
|
to_chat(user, "<span class='notice'>You turn on \the [src].</span>")
|
|
//Now let them chose the text.
|
|
var/str = reject_bad_text(tgui_input_text(user,"Label text?", "Set label"))
|
|
if(!str || !length(str))
|
|
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
|
return
|
|
label = str
|
|
to_chat(user, "<span class='notice'>You set the text to '[str]'.</span>")
|
|
else
|
|
to_chat(user, "<span class='notice'>You turn off \the [src].</span>")
|
|
|
|
/obj/item/hand_labeler/attackby__legacy__attackchain(obj/item/I, mob/user, params)
|
|
if(istype(I, /obj/item/hand_labeler_refill))
|
|
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
|
user.drop_item()
|
|
qdel(I)
|
|
labels_left = initial(labels_left) //Yes, it's capped at its initial value
|
|
else if(istype(I, /obj/item/card/id))
|
|
var/obj/item/card/id/id = I
|
|
if(istype(id, /obj/item/card/id/guest) || !id.registered_name)
|
|
to_chat(user, "<span class='warning'>Invalid ID card.</span>")
|
|
return
|
|
label = id.registered_name
|
|
mode = LABEL_MODE_GOAL
|
|
to_chat(user, "<span class='notice'>You configure the hand labeler with [I].</span>")
|
|
icon_state = "labeler1"
|
|
|
|
|
|
/obj/item/hand_labeler_refill
|
|
name = "hand labeler paper roll"
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
desc = "A roll of paper. Use it on a hand labeler to refill it."
|
|
icon_state = "labeler_refill"
|
|
item_state = "electropack"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
#undef LABEL_MODE_OFF
|
|
#undef LABEL_MODE_NORMAL
|
|
#undef LABEL_MODE_GOAL
|