Files
kiwistation/code/game/objects/items/weapons/paint.dm
T
supersayu a993ce62db Bugfixen and minor changes. Fixes #136.
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.
2013-09-17 18:19:14 -04:00

108 lines
2.6 KiB
Plaintext

//NEVER USE THIS IT SUX -PETETHEGOAT
var/global/list/cached_icons = list()
/obj/item/weapon/paint
name = "Paint Can"
desc = "Used to recolor floors and walls. Can not be removed by the janitor."
icon = 'icons/obj/items.dmi'
icon_state = "paint_neutral"
color = "FFFFFF"
item_state = "paintcan"
w_class = 3.0
var/paintleft = 10
/obj/item/weapon/paint/red
name = "Red paint"
color = "C73232" //"FF0000"
icon_state = "paint_red"
/obj/item/weapon/paint/green
name = "Green paint"
color = "2A9C3B" //"00FF00"
icon_state = "paint_green"
/obj/item/weapon/paint/blue
name = "Blue paint"
color = "5998FF" //"0000FF"
icon_state = "paint_blue"
/obj/item/weapon/paint/yellow
name = "Yellow paint"
color = "CFB52B" //"FFFF00"
icon_state = "paint_yellow"
/obj/item/weapon/paint/violet
name = "Violet paint"
color = "AE4CCD" //"FF00FF"
icon_state = "paint_violet"
/obj/item/weapon/paint/black
name = "Black paint"
color = "333333"
icon_state = "paint_black"
/obj/item/weapon/paint/white
name = "White paint"
color = "FFFFFF"
icon_state = "paint_white"
/obj/item/weapon/paint/anycolor
name = "Any color"
icon_state = "paint_neutral"
attack_self(mob/user as mob)
var/t1 = input(user, "Please select a color:", "Locking Computer", null) in list( "red", "blue", "green", "yellow", "violet", "black", "white")
if ((user.get_active_hand() != src || user.stat || user.restrained()))
return
switch(t1)
if("red")
color = "C73232"
if("blue")
color = "5998FF"
if("green")
color = "2A9C3B"
if("yellow")
color = "CFB52B"
if("violet")
color = "AE4CCD"
if("white")
color = "FFFFFF"
if("black")
color = "333333"
icon_state = "paint_[t1]"
add_fingerprint(user)
return
/obj/item/weapon/paint/afterattack(turf/target, mob/user as mob, proximity)
if(!proximity) return
if(paintleft <= 0)
icon_state = "paint_empty"
return
if(!istype(target) || istype(target, /turf/space))
return
var/ind = "[initial(target.icon)][color]"
if(!cached_icons[ind])
var/icon/overlay = new/icon(initial(target.icon))
overlay.Blend("#[color]",ICON_MULTIPLY)
overlay.SetIntensity(1.4)
target.icon = overlay
cached_icons[ind] = target.icon
paintleft--
else
target.icon = cached_icons[ind]
paintleft--
return
/obj/item/weapon/paint/paint_remover
name = "Paint remover"
icon_state = "paint_neutral"
afterattack(turf/target, mob/user as mob,proximity)
if(!proximity) return
if(istype(target) && target.icon != initial(target.icon))
target.icon = initial(target.icon)
return