added bee stuff, will post documentation for it on the forums. features include: place an apiary on a hydro tray to cultivate bees, bees auto breed and spread (if they have enough food), bees give slight accumulative boosts to nearby plants, bee hives produce honey and honeycomb added manual to explain beekeeping, rampaging bees can do a lot of damage but anything with bio protection will reduce likelihood of being stung

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2013-03-09 23:38:54 +10:00
parent d3658f56a8
commit b13c634293
9 changed files with 589 additions and 20 deletions
+184
View File
@@ -0,0 +1,184 @@
/obj/effect/bee
name = "bees"
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "bees1"
var/strength = 1
var/feral = 0
var/mut = 0
var/toxic = 0
var/turf/target_turf
var/mob/target_mob
var/obj/machinery/apiary/parent
pass_flags = PASSGRILLE|PASSTABLE
/obj/effect/bee/New(loc, var/obj/machinery/apiary/new_parent)
..()
processing_objects.Add(src)
parent = new_parent
/obj/effect/bee/Del()
processing_objects.Remove(src)
if(parent)
parent.owned_bee_swarms.Remove(src)
..()
/obj/effect/bee/process()
//if we're strong enough, sting some people
var/overrun = strength - 5 + feral / 2
if(prob(max( overrun * 10 + feral * 10, 0)))
var/mob/living/carbon/human/M = locate() in src.loc
if(M)
var/sting_prob = 100
var/obj/item/clothing/worn_suit = M.wear_suit
var/obj/item/clothing/worn_helmet = M.head
if(worn_suit)
sting_prob -= worn_suit.armor["bio"]
if(worn_helmet)
sting_prob -= worn_helmet.armor["bio"]
if( prob(sting_prob) && (M.stat == CONSCIOUS || (M.stat == UNCONSCIOUS && prob(25))) )
M.apply_damage(overrun / 2 + mut / 2, BRUTE)
M.apply_damage(overrun / 2 + toxic / 2, TOX)
M << "\red You have been stung!"
M.flash_pain()
//if we're chasing someone, get a little bit angry
if(target_mob && prob(10))
feral++
//calm down a little bit
var/move_prob = 40
if(feral > 0)
if(prob(feral * 10))
feral -= 1
else
//if feral is less than 0, we're becalmed by smoke or steam
if(feral < 0)
feral += 1
if(target_mob)
target_mob = null
target_turf = null
if(strength > 5)
//calm down and spread out a little
var/obj/effect/bee/B = new(get_turf(pick(orange(src,1))))
B.strength = rand(1,5)
src.strength -= B.strength
if(src.strength <= 5)
src.icon_state = "bees[src.strength]"
B.icon_state = "bees[B.strength]"
if(src.parent)
B.parent = src.parent
src.parent.owned_bee_swarms.Add(B)
//make some noise
if(prob(0.5))
src.visible_message("\blue [pick("Buzzzz.","Hmmmmm.","Bzzz.")]")
//smoke, water and steam calms us down
var/calming = 0
var/list/calmers = list(/obj/effect/effect/chem_smoke, /obj/effect/effect/water, /obj/effect/effect/foam, /obj/effect/effect/steam, /obj/effect/mist)
for(var/this_type in calmers)
var/obj/effect/check_effect = locate() in src.loc
if(check_effect.type == this_type)
calming = 1
break
if(calming)
if(feral > 0)
src.visible_message("\blue The bees calm down!")
feral = -10
target_mob = null
target_turf = null
for(var/obj/effect/bee/B in src.loc)
if(B == src)
continue
if(feral > 0)
src.strength += B.strength
del(B)
src.icon_state = "bees[src.strength]"
if(strength > 5)
icon_state = "bees_swarm"
else if(prob(10))
//make the other swarm of bees stronger, then move away
var/total_bees = B.strength + src.strength
if(total_bees < 10)
B.strength = min(5, total_bees)
src.strength = total_bees - B.strength
B.icon_state = "bees[B.strength]"
if(src.strength <= 0)
del(src)
return
src.icon_state = "bees[B.strength]"
var/turf/simulated/floor/T = get_turf(get_step(src, pick(1,2,4,8)))
density = 1
if(T.Enter(src, get_turf(src)))
src.loc = T
density = 0
break
if(target_mob)
if(target_mob in view(src,7))
target_turf = get_turf(target_mob)
else
for(var/mob/living/carbon/M in view(src,7))
target_mob = M
break
if(target_turf)
var/turf/next_turf = get_step(src.loc, get_dir(src,target_turf))
//hacky, but w/e
var/old_density = -1
if(target_mob && get_dist(src, target_mob) <= 1)
old_density = target_mob.density
target_mob.density = 0
density = 1
if(next_turf.Enter(src, get_turf(src)))
src.loc = next_turf
density = 0
if(src.loc == target_turf)
target_turf = null
if(target_mob && old_density != -1)
target_mob.density = old_density
else
//find some flowers, harvest
//angry bee swarms don't hang around
if(feral > 0)
move_prob = 60
else if(feral < 0)
move_prob = 0
else
var/obj/machinery/hydroponics/H = locate() in src.loc
if(H)
if(H.planted && !H.dead && H.myseed)
move_prob = 1
//chance to wander around
if(prob(move_prob))
var/turf/simulated/floor/T = get_turf(get_step(src, pick(1,2,4,8)))
density = 1
if(T.Enter(src, get_turf(src)))
src.loc = T
density = 0
pixel_x = rand(-12,12)
pixel_y = rand(-12,12)
if(!parent && prob(10))
strength -= 1
if(strength <= 0)
del(src)
else if(strength <= 5)
icon_state = "bees[strength]"
//debugging
/*icon_state = "[strength]"
if(strength > 5)
icon_state = "unknown"*/
+238
View File
@@ -0,0 +1,238 @@
//http://www.youtube.com/watch?v=-1GadTfGFvU
//i could have done these as just an ordinary plant, but fuck it - there would have been too much snowflake code
/obj/machinery/apiary
name = "apiary tray"
icon = 'icons/obj/hydroponics.dmi'
icon_state = "hydrotray3"
density = 1
anchored = 1
var/nutrilevel = 0
var/yieldmod = 1
var/mut = 1
var/toxic = 0
var/dead = 0
var/health = -1
var/maxhealth = 100
var/lastcycle = 0
var/cycledelay = 100
var/harvestable_honey = 0
var/beezeez = 0
var/swarming = 0
var/bees_in_hive = 0
var/list/owned_bee_swarms = list()
//overwrite this after it's created if the apiary needs a custom machinery sprite
/obj/machinery/apiary/New()
..()
overlays += image('icons/obj/apiary_bees_etc.dmi', icon_state="apiary")
/obj/machinery/apiary/bullet_act(var/obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(istype(Proj ,/obj/item/projectile/energy/floramut))
mut++
else if(istype(Proj ,/obj/item/projectile/energy/florayield))
if(!yieldmod)
yieldmod += 1
//world << "Yield increased by 1, from 0, to a total of [myseed.yield]"
else if (prob(1/(yieldmod * yieldmod) *100))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2...
yieldmod += 1
//world << "Yield increased by 1, to a total of [myseed.yield]"
else
..()
return
/obj/machinery/apiary/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/queen_bee))
if(health > 0)
user << "\red There is already a queen in there."
else
health = 10
nutrilevel += 10
user.drop_item()
del(O)
user << "\blue You carefully insert the queen into [src], she gets busy making a hive."
bees_in_hive = 0
else if(istype(O, /obj/item/beezeez))
beezeez += 100
nutrilevel += 10
user.drop_item()
if(health > 0)
user << "\blue You insert [O] into [src]. A relaxed humming appears to pick up."
else
user << "\blue You insert [O] into [src]. Now it just needs some bees."
del(O)
else if(istype(O, /obj/item/weapon/minihoe))
if(health > 0)
user << "\red <b>You begin to dislodge the apiary from the tray, the bees don't like that.</b>"
angry_swarm(user)
else
user << "\blue You begin to dislodge the dead apiary from the tray."
if(do_after(user, 50))
new /obj/machinery/hydroponics(src.loc)
new /obj/item/apiary(src.loc)
user << "\red You dislodge the apiary from the tray."
del(src)
else if(istype(O, /obj/item/weapon/bee_net))
var/obj/item/weapon/bee_net/N = O
if(N.caught_bees > 0)
user << "\blue You empty the bees into the apiary."
bees_in_hive += N.caught_bees
N.caught_bees = 0
else
user << "\blue There are no more bees in the net."
else if(istype(O, /obj/item/weapon/reagent_containers/glass))
var/obj/item/weapon/reagent_containers/glass/G = O
if(harvestable_honey > 0)
if(health > 0)
user << "\red You begin to harvest the honey. The bees don't seem to like it."
angry_swarm()
else
user << "\blue You begin to harvest the honey."
if(do_after(user,50))
G.reagents.add_reagent("honey",harvestable_honey)
harvestable_honey = 0
user << "\blue You successfully harvest the honey."
else
user << "\blue There is no honey left to harvest."
else
angry_swarm()
..()
/obj/machinery/apiary/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
else
return 0
/obj/machinery/apiary/process()
if(swarming > 0)
swarming -= 1
if(swarming <= 0)
for(var/obj/effect/bee/B in src.loc)
bees_in_hive += B.strength
del(B)
else if(bees_in_hive < 10)
for(var/obj/effect/bee/B in src.loc)
bees_in_hive += B.strength
del(B)
if(world.time > (lastcycle + cycledelay))
lastcycle = world.time
if(health < 0)
return
//magical bee formula
if(beezeez > 0)
beezeez -= 1
nutrilevel += 2
health += 1
toxic = max(0, toxic - 1)
//handle nutrients
nutrilevel -= bees_in_hive / 10 + owned_bee_swarms.len / 5
if(nutrilevel > 0)
bees_in_hive += 1 * yieldmod
if(health < maxhealth)
health++
else
//nutrilevel is less than 1, so we're effectively subtracting here
health += max(nutrilevel - 1, round(-health / 2))
bees_in_hive += max(nutrilevel - 1, round(-bees_in_hive / 2))
if(owned_bee_swarms.len)
var/obj/effect/bee/B = pick(owned_bee_swarms)
B.target_turf = get_turf(src)
//clear out some toxins
if(toxic > 0)
toxic -= 1
health -= 1
if(health <= 0)
return
//make a bit of honey
if(harvestable_honey < 50)
harvestable_honey += 0.5
//make some new bees
if(bees_in_hive >= 10 && prob(bees_in_hive * 10))
var/obj/effect/bee/B = new(get_turf(src), src)
owned_bee_swarms.Add(B)
B.mut = mut
B.toxic = toxic
bees_in_hive -= 1
//find some plants, harvest
for(var/obj/machinery/hydroponics/H in view(7, src))
if(H.planted && !H.dead && H.myseed && prob(owned_bee_swarms.len * 10))
if(mut < H.mutmod - 1)
mut = H.mutmod - 1
else if(mut > H.mutmod - 1)
H.mutmod = mut
//flowers give us pollen (nutrients)
if(H.myseed.type == /obj/item/seeds/harebell || H.myseed.type == /obj/item/seeds/sunflowerseed)
src.nutrilevel++
H.nutrilevel++
//have a few beneficial effects on nearby plants
if(prob(10))
H.lastcycle -= 5
if(prob(10))
H.myseed.lifespan = max(initial(H.myseed.lifespan) * 1.5, H.myseed.lifespan + 1)
if(prob(10))
H.myseed.endurance = max(initial(H.myseed.endurance) * 1.5, H.myseed.endurance + 1)
if(H.toxic && prob(10))
H.toxic = min(0, H.toxic - 1)
toxic++
/obj/machinery/apiary/proc/die()
if(owned_bee_swarms.len)
var/obj/effect/bee/B = pick(owned_bee_swarms)
B.target_turf = get_turf(src)
B.strength -= 1
if(B.strength <= 0)
del(B)
else if(B.strength <= 5)
B.icon_state = "bees[B.strength]"
bees_in_hive = 0
health = 0
/obj/machinery/apiary/proc/angry_swarm(var/mob/M)
for(var/obj/effect/bee/B in owned_bee_swarms)
B.feral = 50
B.target_mob = M
swarming = 25
while(bees_in_hive > 0)
var/spawn_strength = bees_in_hive
if(bees_in_hive >= 5)
spawn_strength = 6
var/obj/effect/bee/B = new(get_turf(src), src)
B.target_mob = M
B.strength = spawn_strength
B.feral = 5
B.mut = mut
B.toxic = toxic
bees_in_hive -= spawn_strength
/obj/machinery/apiary/verb/harvest_honeycomb()
set src in oview(1)
set name = "Harvest honeycomb"
set category = "Object"
while(health > 15)
health -= 15
var/obj/item/weapon/reagent_containers/food/snacks/honeycomb/H = new(src.loc)
if(toxic > 0)
H.reagents.add_reagent("toxin", toxic)
usr << "\blue You harvest the honeycomb from the hive. There is a wild buzzing!"
angry_swarm(usr)
+124
View File
@@ -0,0 +1,124 @@
/obj/item/queen_bee
name = "queen bee packet"
desc = "Place her into an apiary so she can get busy."
icon = 'icons/obj/seeds.dmi'
icon_state = "seed-kudzu"
w_class = 1
/obj/item/weapon/bee_net
name = "bee net"
desc = "For catching rogue bees."
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "bee_net"
item_state = "bedsheet"
w_class = 3
var/caught_bees = 0
/obj/item/weapon/bee_net/attack_self(mob/user as mob)
var/turf/T = get_step(get_turf(user), user.dir)
for(var/obj/effect/bee/B in T)
if(B.feral < 0)
caught_bees += B.strength
del(B)
user.visible_message("\blue [user] nets some bees.","\blue You net up some of the becalmed bees.")
else
user.visible_message("\red [user] swings at some bees, they don't seem to like it.","\red You swing at some bees, they don't seem to like it.")
B.feral = 5
B.target_mob = user
/obj/item/weapon/bee_net/verb/empty_bees()
set src in usr
set name = "Empty bee net"
set category = "Object"
var/mob/living/carbon/M
if(iscarbon(usr))
M = usr
while(caught_bees > 0)
//release a few super massive swarms
while(caught_bees > 5)
var/obj/effect/bee/B = new(src.loc)
B.feral = 5
B.target_mob = M
B.strength = 6
B.icon_state = "bees_swarm"
caught_bees -= 6
//what's left over
var/obj/effect/bee/B = new(src.loc)
B.strength = caught_bees
B.icon_state = "bees[B.strength]"
B.feral = 5
B.target_mob = M
caught_bees = 0
/obj/item/apiary
name = "moveable apiary"
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "apiary_item"
item_state = "giftbag"
w_class = 5
/obj/item/beezeez
name = "bottle of BeezEez"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle17"
flags = FPRINT | TABLEPASS
toxicity = 4
PestKillStr = 0
New()
src.pixel_x = rand(-5.0, 5)
src.pixel_y = rand(-5.0, 5)
/obj/item/weapon/reagent_containers/food/snacks/honeycomb
name = "honeycomb"
icon_state = "honeycomb"
desc = "Dripping with sugary sweetness."
New()
..()
/obj/item/weapon/reagent_containers/food/snacks/honeycomb/New()
..()
reagents.add_reagent("honey",10)
reagents.add_reagent("nutriment", 0.5)
reagents.add_reagent("sugar", 2)
bitesize = 2
/datum/reagent/honey
name = "Honey"
id = "honey"
description = "A golden yellow syrup, loaded with sugary sweetness."
color = "#FFFF00"
/obj/item/weapon/book/manual/hydroponics_beekeeping
name = "The Ins and Outs of Apiculture - A Precise Art"
icon_state ="bookHydroponicsBees"
author = "Beekeeper Dave"
title = "The Ins and Outs of Apiculture - A Precise Art"
dat = {"<html>
<head>
<style>
h1 {font-size: 18px; margin: 15px 0px 5px;}
h2 {font-size: 15px; margin: 15px 0px 5px;}
li {margin: 2px 0px 2px 15px;}
ul {list-style: none; margin: 5px; padding: 0px;}
ol {margin: 5px; padding: 0px 15px;}
</style>
</head>
<body>
<h3>Raising Bees</h3>
Bees are loving but fickle creatures. Don't mess with their hive and stay away from any clusters of them, and you'll avoid their ire.
Sometimes, you'll need to dig around in there for those delicious sweeties though - in that case make sure you wear sealed protection gear
and carry an extinguisher or smoker with you - any bees chasing you, once calmed down, can thusly be netted and returned safely to the hive.<br.
<br>
Beezeez is a cure-all panacea for them, but use it too much and the hive may grow to apocalyptic proportions. Other than that, bees are excellent pets
for all the family and are excellent caretakers of one's garden: having a hive or two around will aid in the longevity and growth rate of plants,
and aid them in fighting off poisons and disease.
</body>
</html>
"}
+39 -20
View File
@@ -1,4 +1,4 @@
#define SPEED_MULTIPLIER 0.5
#define HYDRO_SPEED_MULTIPLIER 0.25
/obj/machinery/hydroponics
name = "hydroponics tray"
@@ -38,6 +38,14 @@
..()
return
/obj/machinery/hydroponics/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
else
return 0
obj/machinery/hydroponics/process()
if(myseed && (myseed.loc != src))
@@ -47,42 +55,42 @@ obj/machinery/hydroponics/process()
lastcycle = world.time
if(planted && !dead)
// Advance age
age += 1 * SPEED_MULTIPLIER
age += 1 * HYDRO_SPEED_MULTIPLIER
//Nutrients//////////////////////////////////////////////////////////////
// Nutrients deplete slowly
if(nutrilevel > 0)
if(prob(50))
nutrilevel -= 1 * SPEED_MULTIPLIER
nutrilevel -= 1 * HYDRO_SPEED_MULTIPLIER
// Lack of nutrients hurts non-weeds
if(nutrilevel <= 0 && myseed.plant_type != 1)
health -= rand(1,3) * SPEED_MULTIPLIER
health -= rand(1,3) * HYDRO_SPEED_MULTIPLIER
//Water//////////////////////////////////////////////////////////////////
// Drink random amount of water
waterlevel = max(waterlevel - rand(1,6) * SPEED_MULTIPLIER, 0)
waterlevel = max(waterlevel - rand(1,6) * HYDRO_SPEED_MULTIPLIER, 0)
// If the plant is dry, it loses health pretty fast, unless mushroom
if(waterlevel <= 10 && myseed.plant_type != 2)
health -= rand(0,1) * SPEED_MULTIPLIER
health -= rand(0,1) * HYDRO_SPEED_MULTIPLIER
if(waterlevel <= 0)
health -= rand(0,2) * SPEED_MULTIPLIER
health -= rand(0,2) * HYDRO_SPEED_MULTIPLIER
// Sufficient water level and nutrient level = plant healthy
else if(waterlevel > 10 && nutrilevel > 0)
health += rand(1,2) * SPEED_MULTIPLIER
health += rand(1,2) * HYDRO_SPEED_MULTIPLIER
if(prob(5)) //5 percent chance the weed population will increase
weedlevel += 1 * SPEED_MULTIPLIER
weedlevel += 1 * HYDRO_SPEED_MULTIPLIER
//Toxins/////////////////////////////////////////////////////////////////
// Too much toxins cause harm, but when the plant drinks the contaiminated water, the toxins disappear slowly
if(toxic >= 40 && toxic < 80)
health -= 1 * SPEED_MULTIPLIER
toxic -= rand(1,10) * SPEED_MULTIPLIER
health -= 1 * HYDRO_SPEED_MULTIPLIER
toxic -= rand(1,10) * HYDRO_SPEED_MULTIPLIER
else if(toxic >= 80) // I don't think it ever gets here tbh unless above is commented out
health -= 3 * SPEED_MULTIPLIER
toxic -= rand(1,10) * SPEED_MULTIPLIER
health -= 3 * HYDRO_SPEED_MULTIPLIER
toxic -= rand(1,10) * HYDRO_SPEED_MULTIPLIER
else if(toxic < 0) // Make sure it won't go overoboard
toxic = 0
@@ -93,11 +101,11 @@ obj/machinery/hydroponics/process()
pestlevel = 10
else if(pestlevel >= 5)
health -= 1 * SPEED_MULTIPLIER
health -= 1 * HYDRO_SPEED_MULTIPLIER
// If it's a weed, it doesn't stunt the growth
if(weedlevel >= 5 && myseed.plant_type != 1 )
health -= 1 * SPEED_MULTIPLIER
health -= 1 * HYDRO_SPEED_MULTIPLIER
//Health & Age///////////////////////////////////////////////////////////
@@ -109,12 +117,12 @@ obj/machinery/hydroponics/process()
else if(health <= 0)
dead = 1
harvest = 0
weedlevel += 1 * SPEED_MULTIPLIER // Weeds flourish
weedlevel += 1 * HYDRO_SPEED_MULTIPLIER // Weeds flourish
pestlevel = 0 // Pests die
// If the plant is too old, lose health fast
if(age > myseed.lifespan)
health -= rand(1,5) * SPEED_MULTIPLIER
health -= rand(1,5) * HYDRO_SPEED_MULTIPLIER
// Harvest code
if(age > myseed.production && (age - lastproduce) > myseed.production && (!harvest && !dead))
@@ -131,10 +139,10 @@ obj/machinery/hydroponics/process()
else
lastproduce = age
if(prob(5)) // On each tick, there's a 5 percent chance the pest population will increase
pestlevel += 1 * SPEED_MULTIPLIER
pestlevel += 1 * HYDRO_SPEED_MULTIPLIER
else
if(waterlevel > 10 && nutrilevel > 0 && prob(10)) // If there's no plant, the percentage chance is 10%
weedlevel += 1 * SPEED_MULTIPLIER
weedlevel += 1 * HYDRO_SPEED_MULTIPLIER
if(weedlevel > 10)
weedlevel = 10
@@ -761,6 +769,17 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(src, /obj/machinery/hydroponics/soil))
user << "You clear up the [src]!"
del(src)
else if(istype(O, /obj/item/apiary))
if(planted)
user << "\red The hydroponics tray is already occupied!"
else
user.drop_item()
del(O)
var/obj/machinery/apiary/A = new(src.loc)
A.icon = src.icon
A.icon_state = src.icon_state
del(src)
return
@@ -1042,4 +1061,4 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
SetLuminosity(0)
return
#undef SPEED_MULTIPLIER
#undef HYDRO_SPEED_MULTIPLIER
@@ -29,6 +29,7 @@
/obj/machinery/iv_drip,
/obj/machinery/disease2/incubator,
/obj/machinery/disposal,
/obj/machinery/apiary,
/mob/living/simple_animal/cow,
/mob/living/simple_animal/hostile/retaliate/goat )