mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-02 21:11:57 +00:00
Adjusts the click code to not use client/Click(). The code is largely unchanged, except that it allows the compiler default behaviour of calling atom/Click(), and then forwards the call to mob/ClickOn(). I had some reports that melee combat mixed with movement was behaving oddly, and I believe it may be due to the use of client/Click; the byond documentation says that redefining client/Click() causes additional overhead, and it isn't strictly necessary. Alters the way double clicks are handled, in an attempt to better handle clickspam, as often occurs during pitched combat. This may also be responsible for the above, but I don't know. Inserts proximity (aka flag) checks in all afterattack() procs. The old assumption was that unless an item used the USEDELAY flag, afterattack() was only called when adjacent, but this is no longer true. This led to beakers, soap, crayons, etc, all being usable at all ranges. Removes the NODELAY flag, which was unused. Removes all existing uses of the USEDELAY flag so that it can be readded to things that need extra delay. Removes the hand_* procs, previously used by restrained actions. Instead, the mob helper mob/RestrainedClickOn() has abosrbed basically all the functionality they were used for, which is really only monkeys with jungle fever. Adds a special case of the Adjacency() proc for doors. This fixes #136, airlocks being unreachable due to border fire doors. However, this only takes us back to the unpleasant position where you have to open-hand the door, switch to a crowbar, and pry open the firedoor; it still needs a better fix.
70 lines
2.2 KiB
Plaintext
70 lines
2.2 KiB
Plaintext
/obj/item/weapon/hand_labeler
|
|
name = "hand labeler"
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "labeler0"
|
|
item_state = "flight"
|
|
var/label = null
|
|
var/labels_left = 30
|
|
var/mode = 0
|
|
|
|
|
|
/obj/item/weapon/hand_labeler/afterattack(atom/A, mob/user,proximity)
|
|
if(!proximity) return
|
|
if(!mode) //if it's off, give up.
|
|
return
|
|
if(A == loc) // if placing the labeller into something (e.g. backpack)
|
|
return // don't set a label
|
|
|
|
if(!labels_left)
|
|
user << "<span class='notice'>No labels left.</span>"
|
|
return
|
|
if(!label || !length(label))
|
|
user << "<span class='notice'>No text set.</span>"
|
|
return
|
|
if(length(A.name) + length(label) > 64)
|
|
user << "<span class='notice'>Label too big.</span>"
|
|
return
|
|
if(ishuman(A))
|
|
user << "<span class='notice'>You can't label humans.</span>"
|
|
return
|
|
if(issilicon(A))
|
|
user << "<span class='notice'>You can't label cyborgs.</span>"
|
|
return
|
|
|
|
user.visible_message("<span class='notice'>[user] labels [A] as [label].</span>", \
|
|
"<span class='notice'>You label [A] as [label].</span>")
|
|
A.name = "[A.name] ([label])"
|
|
labels_left--
|
|
|
|
|
|
/obj/item/weapon/hand_labeler/attack_self(mob/user)
|
|
mode = !mode
|
|
icon_state = "labeler[mode]"
|
|
if(mode)
|
|
user << "<span class='notice'>You turn on [src].</span>"
|
|
//Now let them chose the text.
|
|
var/str = copytext(reject_bad_text(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
|
if(!str || !length(str))
|
|
user << "<span class='notice'>Invalid text.</span>"
|
|
return
|
|
label = str
|
|
user << "<span class='notice'>You set the text to '[str]'.</span>"
|
|
else
|
|
user << "<span class='notice'>You turn off [src].</span>"
|
|
|
|
/obj/item/weapon/hand_labeler/attackby(obj/item/I as obj, mob/user as mob)
|
|
..()
|
|
if(istype(I, /obj/item/hand_labeler_refill))
|
|
user << "<span class='notice'>You insert [I] into [src].</span>"
|
|
user.drop_item()
|
|
del(I)
|
|
labels_left = initial(labels_left)
|
|
return
|
|
|
|
/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 = 1.0 |