Skip to content

Commit

Permalink
Reagent Bees! Bees come from a beebox and pollinate nearby hydroponic…
Browse files Browse the repository at this point in the history
…s plants, improving the health/yield/removing pests from the plants. While pollinating they build up resources to build honeycomb, honeycomb contains honey (a mild healing reagent that is very nutritious) any spare resources (50 bee_resources) are converted into new bees. honeycombs can be ground up to get the honey and other reagent inside them in an All In One Grinder.

Beeboxes have honey_frames which determine the amount of honeycomb+bees they can maintain.
Bees now have a beegent (Bee reagent, geddit?) that they use during their attacks AND that their produced honeycomb contains, this allows you to farm chemicals using bees.
  • Loading branch information
RemieRichards committed Mar 21, 2016
1 parent d7f81ba commit be0b16a
Show file tree
Hide file tree
Showing 19 changed files with 567 additions and 22 deletions.
21 changes: 21 additions & 0 deletions code/modules/cargo/packs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,27 @@
/obj/item/seeds/eggplant/eggy)
crate_name = "exotic seeds crate"

/datum/supply_pack/organic/hydroponics/beekeeping_fullkit
name = "Beekeeping Starter Kit"
cost = 40
contains = list(/obj/structure/beebox,
/obj/item/honey_frame,
/obj/item/honey_frame,
/obj/item/honey_frame,
/obj/item/queen_bee/bought,
/obj/item/clothing/head/beekeeper_head,
/obj/item/clothing/suit/beekeeper_suit)
crate_name = "beekeeping starter kit"

/datum/supply_pack/organic/hydroponics/beekeeping_suits
name = "2 Beekeeper suits"
cost = 10
contains = list(/obj/item/clothing/head/beekeeper_head,
/obj/item/clothing/suit/beekeeper_suit,
/obj/item/clothing/head/beekeeper_head,
/obj/item/clothing/suit/beekeeper_suit)
crate_name = "beekeper suits"

/datum/supply_pack/organic/vending
name = "Bartending Supply Crate"
cost = 20
Expand Down
Binary file added code/modules/hydroponics/beekeeping/BEES.dmi
Binary file not shown.
235 changes: 235 additions & 0 deletions code/modules/hydroponics/beekeeping/beebox.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@

#define BEEBOX_MAX_FRAMES 3 //Max frames per box
#define BEES_RATIO 0.5 //Multiplied by the max number of honeycombs to find the max number of bees
#define BEE_PROB_NEW_BEE 20 //The chance for spare bee_resources to be turned into new bees
#define BEE_RESOURCE_HONEYCOMB_COST 100 //The amount of bee_resources for a new honeycomb to be produced, percentage cost 1-100
#define BEE_RESOURCE_NEW_BEE_COST 50 //The amount of bee_resources for a new bee to be produced, percentage cost 1-100



/mob/proc/bee_friendly()
return 0


/mob/living/simple_animal/hostile/poison/bees/bee_friendly()
return 1


/mob/living/carbon/human/bee_friendly()
if((wear_suit && (wear_suit.flags & THICKMATERIAL)) && (head && (head.flags & THICKMATERIAL)))
return 1
return 0


/obj/structure/beebox
name = "apiary"
desc = "Dr Miles Manners is just your average Wasp themed super hero by day, but by night he becomes DR BEES!"
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "beebox"
anchored = 1
density = 1
var/mob/living/simple_animal/hostile/poison/bees/queen/queen_bee = null
var/list/bees = list() //bees owned by the box, not those inside it
var/list/honeycombs = list()
var/list/honey_frames = list()
var/bee_resources = 0


/obj/structure/beebox/New()
..()
SSobj.processing += src


/obj/structure/beebox/Destroy()
SSobj.processing -= src
bees.Cut()
bees = null
honeycombs.Cut()
honeycombs = null
queen_bee = null
return ..()


//Premade apiaries can spawn with a random reagent
/obj/structure/beebox/premade
var/random_reagent = FALSE


/obj/structure/beebox/premade/New()
..()

var/datum/reagent/R = null
if(random_reagent)
R = pick(subtypesof(/datum/reagent))
R = chemical_reagents_list[initial(R.id)]

queen_bee = new(src)
queen_bee.beehome = src
bees += queen_bee
queen_bee.assign_reagent(R)

for(var/i in 1 to BEEBOX_MAX_FRAMES)
var/obj/item/honey_frame/HF = new(src)
honey_frames += HF

for(var/i in 1 to get_max_bees())
var/mob/living/simple_animal/hostile/poison/bees/B = new(src)
bees += B
B.beehome = src
B.assign_reagent(R)


/obj/structure/beebox/premade/random
random_reagent = TRUE


/obj/structure/beebox/process()
if(queen_bee)
if(bee_resources >= BEE_RESOURCE_HONEYCOMB_COST)
if(honeycombs.len < get_max_honeycomb())
bee_resources = max(bee_resources-BEE_RESOURCE_HONEYCOMB_COST, 0)
var/obj/item/weapon/reagent_containers/honeycomb/HC = new(src)
if(queen_bee.beegent)
HC.set_reagent(queen_bee.beegent.id)
honeycombs += HC

if(bees.len < get_max_bees())
var/freebee = FALSE //a freebee, geddit?, hahaha HAHAHAHA
if(!bees.len) //there's always one set of worker bees, this isn't colony collapse disorder its 2d spessmen
freebee = TRUE
if((bee_resources >= BEE_RESOURCE_NEW_BEE_COST && prob(BEE_PROB_NEW_BEE)) || freebee)
if(!freebee)
bee_resources = max(bee_resources - BEE_RESOURCE_NEW_BEE_COST, 0)
var/mob/living/simple_animal/hostile/poison/bees/B = new(src)
B.beehome = src
B.assign_reagent(queen_bee.beegent)
bees += B


/obj/structure/beebox/proc/get_max_honeycomb()
. = 0
for(var/hf in honey_frames)
var/obj/item/honey_frame/HF = hf
. += HF.honeycomb_capacity


/obj/structure/beebox/proc/get_max_bees()
. = get_max_honeycomb() * BEES_RATIO


/obj/structure/beebox/examine(mob/user)
..()

if(!queen_bee)
user << "<span class='warning'>There is no queen bee!</span>"

if(bees.len >= get_max_bees()*0.5)
user << "This place is a BUZZ with activity..."

if(bee_resources)
user << "[bee_resources]/100 honey supply."
user << "[bee_resources]% towards a new honeycomb."
user << "[bee_resources*2]% towards a new bee."

if(honeycombs.len >= get_max_honeycomb())
user << "there's no room for more honeycomb!"


/obj/structure/beebox/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/honey_frame))
var/obj/item/honey_frame/HF = I
if(honey_frames.len < BEEBOX_MAX_FRAMES)
visible_message("<span class='notice'>[user] adds a frame to the apiary.</span>")
user.unEquip(HF)
HF.loc = src
honey_frames += HF
else
user << "<span class='warning'>There's no room for anymore frames in the apiary!</span>"

if(istype(I, /obj/item/weapon/wrench))
if(default_unfasten_wrench(user, I, time = 20))
return

if(istype(I, /obj/item/queen_bee))
var/obj/item/queen_bee/qb = I
user.unEquip(qb)

qb.queen.loc = src
bees += qb.queen
queen_bee = qb.queen
qb.queen = null

if(qb.queen)
visible_message("<span class='notice'>[user] sets [qb] down inside the apiary, making it their new home.</span>")
var/relocated = 0
for(var/b in bees)
var/mob/living/simple_animal/hostile/poison/bees/B = b
if(B.reagent_incompatible(queen_bee))
bees -= B
B.beehome = null
if(B.loc == src)
B.loc = get_turf(src)
relocated++
if(relocated)
user << "<span class='warning'>This queen has a different reagent to some of the bees who live here, those bees will not return to this apiary!</span>"

else
user << "<span class='warning'>The queen bee disappeared! bees disappearing has been in the news lately...</span>"

qdel(qb)


/obj/structure/beebox/attack_hand(mob/user)
if(istype(user, /mob/living/carbon/human))
if(!user.bee_friendly())
//Time to get stung!
var/bees = FALSE
for(var/b in bees) //everyone who's ever lived here now instantly hates you, suck it assistant!
var/mob/living/simple_animal/hostile/poison/bees/B = b
if(B.isqueen)
continue
if(B.loc == src)
B.loc = get_turf(src)
B.target = user
bees = TRUE
if(bees)
visible_message("<span class='danger'>[user] disturbs the bees!</span>")
else
var/option = alert(user, "What Action do you wish to perform?","Apiary","Remove a Honey Frame","Remove the Queen Bee")
switch(option)
if("Remove a Honey Frame")
if(!honey_frames.len)
user << "<span class='warning'>There are no honey frames to remove!</span>"
return

var/obj/item/honey_frame/HF = pick_n_take(honey_frames)
if(HF)
if(!user.put_in_active_hand(HF))
HF.loc = get_turf(src)
visible_message("<span class='notice'>[user] removes a frame from the apiary.</span>")

var/amtH = honeycombs.len
var/maxH = get_max_honeycomb()
var/fallen = 0
while(amtH > maxH) //let's pretend you always grab the frame with the most honeycomb on it
var/obj/item/weapon/reagent_containers/honeycomb/HC = pick_n_take(honeycombs)
if(HC)
honeycombs -= HC
HC.loc = get_turf(user)
amtH--
fallen++
if(fallen)
var/multiple = fallen > 1
visible_message("<span class='notice'>[user] scapes [multiple ? "[fallen]" : "a"] honeycomb[multiple ? "s" : ""] off of the frame.</span>")

if("Remove the Queen Bee")
if(!queen_bee)
user << "<span class='warning'>There is no queen bee to remove!</span>"
return
var/obj/item/queen_bee/QB = new()
queen_bee.loc = QB
QB.queen = queen_bee
QB.name = queen_bee.name
if(!user.put_in_active_hand(QB))
QB.loc = get_turf(src)
visible_message("<span class='notice'>[user] removes the queen from the apiary.</span>")
16 changes: 16 additions & 0 deletions code/modules/hydroponics/beekeeping/beekeeper_suit.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

/obj/item/clothing/head/beekeeper_head
name = "beekeeper hat"
desc = "keeps the lil buzzing buggers out of your eyes"
icon_state = "beekeeper"
item_state = "beekeeper"
flags = THICKMATERIAL


/obj/item/clothing/suit/beekeeper_suit
name = "beekeeper suit"
desc = "keeps the lil buzzing buggers away from your squishy bits"
icon_state = "beekeeper"
item_state = "beekeeper"
flags = THICKMATERIAL

12 changes: 12 additions & 0 deletions code/modules/hydroponics/beekeeping/honey_frame.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

/obj/item/honey_frame
name = "honey frame"
desc = "a scaffold for bees to build honeycomb on"
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "honey_frame"
var/honeycomb_capacity = 10 //10 Honeycomb per frame by default, researchable frames perhaps?


/obj/item/honey_frame/New()
pixel_x = rand(8,-8)
pixel_y = rand(8,-8)
41 changes: 41 additions & 0 deletions code/modules/hydroponics/beekeeping/honeycomb.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

/obj/item/weapon/reagent_containers/honeycomb
name = "honeycomb"
desc = "a hexagonal mesh of honeycomb"
icon = 'icons/obj/hydroponics/harvest.dmi'
icon_state = "honeycomb"
possible_transfer_amounts = null
spillable = 0
disease_amount = 0
volume = 10
amount_per_transfer_from_this = 0
list_reagents = list("honey" = 5)
var/honey_color = ""

/obj/item/weapon/reagent_containers/honeycomb/New()
..()
pixel_x = rand(8,-8)
pixel_y = rand(8,-8)
update_icon()


/obj/item/weapon/reagent_containers/honeycomb/update_icon()
overlays.Cut()
var/image/honey
if(honey_color)
honey = image(icon = 'icons/obj/hydroponics/harvest.dmi', icon_state = "greyscale_honey")
honey.color = honey_color
else
honey = image(icon = 'icons/obj/hydroponics/harvest.dmi', icon_state = "honey")
overlays += honey


/obj/item/weapon/reagent_containers/honeycomb/proc/set_reagent(reagent)
var/datum/reagent/R = chemical_reagents_list[reagent]
if(istype(R))
name = "honeycomb ([R.name])"
honey_color = R.color
reagents.add_reagent(R.id,5)
else
honey_color = ""
update_icon()
1 change: 1 addition & 0 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var/obj/item/seeds/myseed = null //The currently planted seed
var/rating = 1
var/unwrenchable = 1
var/recent_bee_visit = FALSE //Have we been visited by a bee recently, so bees dont overpolinate one plant

pixel_y=8

Expand Down
Loading

0 comments on commit be0b16a

Please sign in to comment.