Tweaks/fixes for fruit effects.

This commit is contained in:
Zuhayr
2015-01-24 12:49:11 +10:30
parent b791c92c6e
commit 7bc70f46b0
3 changed files with 75 additions and 63 deletions
+51 -19
View File
@@ -115,12 +115,45 @@ proc/populate_seed_list()
// Special traits.
var/produces_power // Can be used to make a battery.
var/thorny // Harvested thorns can act as syringes for injecting plant reagents.
var/juicy // When thrown, causes a splatter decal.
var/thorny // Can cause damage/inject reagents when thrown or handled.
var/explosive // When thrown, acts as a grenade.
var/teleporting // Uses the bluespace tomato effect.
var/splat_type = /obj/effect/decal/cleanable/tomato_smudge
// Adds reagents to a target.
/datum/seed/proc/do_thorns(var/mob/living/carbon/human/target)
if(!istype(target))
return
var/datum/organ/external/affecting = target.get_organ(pick("l_foot","r_foot","l_leg","r_leg","l_hand","r_hand","l_arm", "r_arm","head","chest","groin"))
var/damage = 0
if(carnivorous == 2)
target << "<span class='danger'>The thorns pierce your flesh greedily!</span>"
damage = potency/2
else
if(affecting)
target << "<span class='danger'>Several thorns dig deeply into your [affecting.display_name]!</span>"
else
target << "<span class='danger'>Several thorns dig deeply into your flesh!</span>"
damage = potency/5
if(affecting)
affecting.take_damage(damage, 0)
affecting.add_autopsy_data("Thorns",damage)
else
target.adjustBruteLoss(damage)
target.UpdateDamageIcon()
target.updatehealth()
// Inject some chems.
if(chems && chems.len)
target << "<span class='danger'>You feel something seeping into your flesh!</span>"
for(var/rid in chems)
var/injecting = min(5,max(1,potency/5))
target.reagents.add_reagent(rid,injecting)
//Applies an effect to a target atom.
/datum/seed/proc/thrown_at(var/obj/item/thrown,var/atom/target)
@@ -130,11 +163,10 @@ proc/populate_seed_list()
splatted = apply_special_effect(target,thrown)
else if(istype(target,/turf))
splatted = 1
for(var/mob/living/M in target,thrown)
for(var/mob/living/M in target.contents)
apply_special_effect(M)
if(juicy && splatted)
if(thrown.reagents)
thrown.reagents.reaction(get_turf(target))
for(var/atom/hit_atom in get_turf(target))
@@ -147,33 +179,33 @@ proc/populate_seed_list()
/datum/seed/proc/apply_special_effect(var/mob/living/target,var/obj/item/thrown)
var/impact = 1
// Thorns have a chance of injecting reagents.
if(thorny && prob(50))
target << "<span class='danger'>Several thorns are embedded in your flesh!</span>"
//Todo: cause brute, transfer some reagents over.
if(thorny && prob(potency*5))
do_thorns(target)
// Bluespace tomato code copied over from grown.dm.
if(teleporting)
//Plant potency determines radius of teleport.
var/outer_teleport_radius = potency/10
var/outer_teleport_radius = potency/5
var/inner_teleport_radius = potency/15
var/list/turfs
var/list/turfs = list()
if(inner_teleport_radius > 0)
turfs = orange(target,outer_teleport_radius) - orange(target,inner_teleport_radius)
for(var/turf/T in orange(target,outer_teleport_radius))
if(get_dist(target,T) >= inner_teleport_radius)
turfs |= T
if(!turfs.len)
target.visible_message("<span class='notice'>The [thrown.name] has been squashed.</span>","<span class='moderate'>You hear a smack.</span>")
del(thrown)
return
if(turfs.len)
// Moves the mob, causes sparks.
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, get_turf(target))
s.start()
var/turf/picked = get_turf(pick(turfs)) // Just in case...
new/obj/effect/decal/cleanable/molten_item(get_turf(target)) // Leave a pile of goo behind for dramatic effect...
target.loc = picked // And teleport them to the chosen location.
// Moves the mob, causes sparks.
var/turf/picked = pick(turfs)
new/obj/effect/decal/cleanable/molten_item(picked) //Leave a pile of goo behind for dramatic effect...
target.loc = picked//And teleport them to the chosen location.
impact = 1
impact = 1
return impact
+1 -32
View File
@@ -107,38 +107,7 @@
// FEED ME, SEYMOUR.
if(buckled_mob && seed && (buckled_mob.stat != DEAD)) //Don't bother with a dead mob.
var/mob/living/M = buckled_mob
if(!istype(M)) return
var/mob/living/carbon/human/H = buckled_mob
// Drink some blood/cause some brute.
if(seed.carnivorous == 2)
buckled_mob << "<span class='danger'>\The [src] pierces your flesh greedily!</span>"
var/damage = rand(round(seed.potency/2),seed.potency)
if(!istype(H))
H.adjustBruteLoss(damage)
return
var/datum/organ/external/affecting = H.get_organ(pick("l_foot","r_foot","l_leg","r_leg","l_hand","r_hand","l_arm", "r_arm","head","chest","groin"))
if(affecting)
affecting.take_damage(damage, 0)
if(affecting.parent)
affecting.parent.add_autopsy_data("[plant_damage_noun]", damage)
else
H.adjustBruteLoss(damage)
H.UpdateDamageIcon()
H.updatehealth()
// Inject some chems.
if(seed.chems && seed.chems.len && istype(H))
H << "<span class='danger'>You feel something seeping into your skin!</span>"
for(var/rid in seed.chems)
var/injecting = min(5,max(1,seed.potency/5))
H.reagents.add_reagent(rid,injecting)
seed.do_thorns(buckled_mob)
/obj/effect/plantsegment/proc/update()
if(!seed) return
@@ -62,26 +62,37 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(seed && seed.produces_power)
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(C.use(5))
//TODO: generalize this.
user << "<span class='notice'>You add some cable to the [src.name] and slide it inside the battery encasing.</span>"
var/obj/item/weapon/cell/potato/pocell = new /obj/item/weapon/cell/potato(user.loc)
pocell.maxcharge = src.potency * 10
pocell.charge = pocell.maxcharge
del(src)
return
if(seed && seed.produces_power && istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(C.use(5))
//TODO: generalize this.
user << "<span class='notice'>You add some cable to the [src.name] and slide it inside the battery encasing.</span>"
var/obj/item/weapon/cell/potato/pocell = new /obj/item/weapon/cell/potato(get_turf(user))
if(src.loc == user && !(user.l_hand && user.r_hand) && istype(user,/mob/living/carbon/human))
user.put_in_hands(pocell)
pocell.maxcharge = src.potency * 10
pocell.charge = pocell.maxcharge
del(src)
return
/obj/item/weapon/reagent_containers/food/snacks/grown/attack_self(mob/user as mob)
if(!seed || !seed.spread != 1)
if(!seed)
return
if(istype(user.loc,/turf/space))
return
if(user.a_intent == "hurt")
user.visible_message("<span class='danger'>\The [user] squashes \the [src]!</span>")
seed.thrown_at(src,user)
sleep(-1)
if(src) del(src)
return
if(seed.spread == 0)
return
// TODO: Generalize.
var/obj/effect/glowshroom/planted = new /obj/effect/glowshroom(user.loc)
planted.delay = 50