Files
Bubberstation/code/modules/hydroponics/hydroitemcode.dm
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

158 lines
6.5 KiB
Plaintext

/* Hydroponic Item Procs and Stuff
* Contains:
* Sunflowers Novaflowers Nettle Deathnettle Corncob
*/
//Sun/Novaflower
/obj/item/weapon/grown/sunflower/attack(mob/M as mob, mob/user as mob)
M << "<font color='green'><b> [user] smacks you with a sunflower!</font><font color='yellow'><b>FLOWER POWER<b></font>"
user << "<font color='green'> Your sunflower's </font><font color='yellow'><b>FLOWER POWER</b></font><font color='green'> strikes [M]</font>"
/obj/item/weapon/grown/novaflower/attack(mob/living/carbon/M as mob, mob/user as mob)
if(!..()) return
if(istype(M, /mob/living))
M << "\red You are heated by the warmth of the of the [name]!"
M.bodytemperature += potency/2 * TEMPERATURE_DAMAGE_COEFFICIENT
/obj/item/weapon/grown/novaflower/afterattack(atom/A as mob|obj, mob/user as mob,proximity)
if(!proximity) return
if(endurance > 0)
endurance -= rand(1,(endurance/3)+1)
else
usr << "All the petals have fallen off the [name] from violent whacking."
del(src)
/obj/item/weapon/grown/novaflower/pickup(mob/living/carbon/human/user as mob)
if(!user.gloves)
user << "\red The [name] burns your bare hand!"
user.adjustFireLoss(rand(1,5))
//Nettle
/obj/item/weapon/grown/nettle/pickup(mob/living/carbon/human/user as mob)
if(!user.gloves)
user << "\red The nettle burns your bare hand!"
if(istype(user, /mob/living/carbon/human))
var/organ = ((user.hand ? "l_":"r_") + "arm")
var/datum/limb/affecting = user.get_organ(organ)
if(affecting.take_damage(0,force))
user.update_damage_overlays(0)
else
user.take_organ_damage(0,force)
/obj/item/weapon/grown/nettle/afterattack(atom/A as mob|obj, mob/user as mob,proximity)
if(!proximity) return
if(force > 0)
force -= rand(1,(force/3)+1) // When you whack someone with it, leaves fall off
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
else
usr << "All the leaves have fallen off the nettle from violent whacking."
del(src)
/obj/item/weapon/grown/nettle/changePotency(newValue) //-QualityVan
potency = newValue
force = round((5+potency/5), 1)
//Deathnettle
/obj/item/weapon/grown/deathnettle/pickup(mob/living/carbon/human/user as mob)
if(!user.gloves)
if(istype(user, /mob/living/carbon/human))
var/organ = ((user.hand ? "l_":"r_") + "arm")
var/datum/limb/affecting = user.get_organ(organ)
if(affecting.take_damage(0,force))
user.update_damage_overlays(0)
else
user.take_organ_damage(0,force)
if(prob(50))
user.Paralyse(5)
user << "\red You are stunned by the Deathnettle when you try picking it up!"
/obj/item/weapon/grown/deathnettle/attack(mob/living/carbon/M as mob, mob/user as mob)
if(!..()) return
if(istype(M, /mob/living))
M << "\red You are stunned by the powerful acid of the Deathnettle!"
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Had the [src.name] used on them by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] on [M.name] ([M.ckey])</font>")
log_attack("<font color='red'> [user.name] ([user.ckey]) used the [src.name] on [M.name] ([M.ckey])</font>")
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
M.eye_blurry += force/7
if(prob(20))
M.Paralyse(force/6)
M.Weaken(force/15)
M.drop_item()
/obj/item/weapon/grown/deathnettle/afterattack(atom/A as mob|obj, mob/user as mob,proximity)
if(!proximity) return
if (force > 0)
force -= rand(1,(force/3)+1) // When you whack someone with it, leaves fall off
else
usr << "All the leaves have fallen off the deathnettle from violent whacking."
del(src)
/obj/item/weapon/grown/deathnettle/changePotency(newValue) //-QualityVan
potency = newValue
force = round((5+potency/2.5), 1)
//Corncob
/obj/item/weapon/corncob/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/weapon/circular_saw) || istype(W, /obj/item/weapon/hatchet) || istype(W, /obj/item/weapon/kitchen/utensil/knife))
user << "<span class='notice'>You use [W] to fashion a pipe out of the corn cob!</span>"
new /obj/item/clothing/mask/cigarette/pipe/cobpipe (user.loc)
del(src)
return
//Bluespace Tomatoes
/obj/item/weapon/reagent_containers/food/snacks/grown/bluespacetomato/throw_impact(atom/hit_atom)
..()
var/mob/M = usr
var/outer_teleport_radius = potency/10 //Plant potency determines radius of teleport.
var/inner_teleport_radius = potency/15
var/list/turfs = new/list()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
if(inner_teleport_radius < 1) //Wasn't potent enough, it just splats.
new/obj/effect/decal/cleanable/oil(src.loc)
src.visible_message("<span class='notice'>The [src.name] has been squashed.</span>","<span class='moderate'>You hear a smack.</span>")
del(src)
return
for(var/turf/T in orange(M,outer_teleport_radius))
if(T in orange(M,inner_teleport_radius)) continue
if(istype(T,/turf/space)) continue
if(T.density) continue
if(T.x>world.maxx-outer_teleport_radius || T.x<outer_teleport_radius) continue
if(T.y>world.maxy-outer_teleport_radius || T.y<outer_teleport_radius) continue
turfs += T
if(!turfs.len)
var/list/turfs_to_pick_from = list()
for(var/turf/T in orange(M,outer_teleport_radius))
if(!(T in orange(M,inner_teleport_radius)))
turfs_to_pick_from += T
turfs += pick(/turf in turfs_to_pick_from)
var/turf/picked = pick(turfs)
if(!isturf(picked)) return
switch(rand(1,2))//Decides randomly to teleport the thrower or the throwee.
if(1) // Teleports the person who threw the tomato.
s.set_up(3, 1, M)
s.start()
new/obj/effect/decal/cleanable/molten_item(M.loc) //Leaves a pile of goo behind for dramatic effect.
M.loc = picked //
sleep(1)
s.set_up(3, 1, M)
s.start() //Two set of sparks, one before the teleport and one after.
if(2) //Teleports mob the tomato hit instead.
for(var/mob/A in get_turf(hit_atom))//For the mobs in the tile that was hit...
s.set_up(3, 1, A)
s.start()
new/obj/effect/decal/cleanable/molten_item(A.loc) //Leave a pile of goo behind for dramatic effect...
A.loc = picked//And teleport them to the chosen location.
sleep(1)
s.set_up(3, 1, A)
s.start()
new/obj/effect/decal/cleanable/oil(src.loc)
src.visible_message("<span class='notice'>The [src.name] has been squashed, causing a distortion in space-time.</span>","<span class='moderate'>You hear a splat and a crackle.</span>")
del(src)
return