Merge pull request #4356 from FalseIncarnate/botany

Briefcase Full of BEES!
This commit is contained in:
Fox McCloud
2016-05-06 23:28:11 -04:00
9 changed files with 235 additions and 80 deletions
+18 -8
View File
@@ -52,7 +52,7 @@ var/list/sounds_cache = list()
set desc = "Plays a sound at every intercomm on the station z level. Works best with small sounds."
if(!check_rights(R_SOUNDS)) return
var/A = alert("This will play a sound at every intercomm on the station Z, are you sure you want to continue? This works best with short sounds, beware.","Warning","Yep","Nope")
var/A = alert("This will play a sound at every intercomm, are you sure you want to continue? This works best with short sounds, beware.","Warning","Yep","Nope")
if(A != "Yep") return
var/list/sounds = file2list("sound/serversound_list.txt");
@@ -67,15 +67,25 @@ var/list/sounds_cache = list()
if(inputvol && inputvol >= 1 && inputvol <= 70)
cvol = inputvol
var/list/intercomms = list()
//Allows for override to utilize intercomms on all z-levels
var/B = alert("Do you want to play through intercomms on ALL Z-levels, or just the station?", "Override", "All", "Station")
var/ignore_z = 0
if(B == "All")
ignore_z = 1
for(var/obj/item/device/radio/intercom/I in world)
if(I.z != ZLEVEL_STATION) continue
intercomms += I
//Allows for override to utilize incomplete and unpowered intercomms
var/C = alert("Do you want to play through unpowered / incomplete intercomms, so the crew can't silence it?", "Override", "Yep", "Nope")
var/ignore_power = 0
if(C == "Yep")
ignore_power = 1
if(intercomms.len)
for(var/obj/item/device/radio/intercom/I in intercomms)
playsound(I, melody, cvol)
for(var/O in global_intercoms)
var/obj/item/device/radio/intercom/I = O
if(I.z != ZLEVEL_STATION && !ignore_z)
continue
if(!I.on && !ignore_power)
continue
playsound(I, melody, cvol)
/*
/client/proc/cuban_pete()
@@ -109,7 +109,7 @@
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)
var/mob/living/simple_animal/hostile/poison/bees/worker/B = new(src)
B.beehome = src
B.assign_reagent(queen_bee.beegent)
bees += B
@@ -180,7 +180,7 @@
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
var/mob/living/simple_animal/hostile/poison/bees/worker/B = b
if(B.reagent_incompatible(queen_bee))
bees -= B
B.beehome = null
@@ -42,33 +42,23 @@
var/datum/reagent/beegent = null //hehe, beegent
var/obj/structure/beebox/beehome = null
var/idle = 0
var/isqueen = FALSE
var/idle = 0
var/icon_base = "bee"
var/static/list/bee_icons = list()
/mob/living/simple_animal/hostile/poison/bees/Process_Spacemove(movement_dir = 0)
return 1
/mob/living/simple_animal/hostile/poison/bees/New()
..()
generate_bee_visuals()
/mob/living/simple_animal/hostile/poison/bees/Destroy()
if(beehome)
beehome.bees.Remove(src)
beehome = null
beegent = null
return ..()
/mob/living/simple_animal/hostile/poison/bees/death(gibbed)
if(beehome)
beehome.bees.Remove(src)
beehome = null
beegent = null
..()
ghostize()
@@ -77,10 +67,6 @@
/mob/living/simple_animal/hostile/poison/bees/examine(mob/user)
..()
if(!beehome)
to_chat(user, "<span class='warning'>This bee is homeless!</span>")
/mob/living/simple_animal/hostile/poison/bees/proc/generate_bee_visuals()
overlays.Cut()
@@ -107,31 +93,87 @@
wings = bee_icons["[icon_base]_wings"]
overlays += wings
//We don't attack beekeepers/people dressed as bees//Todo: bee costume
/mob/living/simple_animal/hostile/poison/bees/CanAttack(atom/the_target)
. = ..()
if(!.)
return 0
if(ishuman(the_target))
var/mob/living/carbon/human/H = the_target
return !H.bee_friendly()
return .
/mob/living/simple_animal/hostile/poison/bees/Found(atom/A)
if(isliving(A))
var/mob/living/L = A
return !L.bee_friendly()
return 0
/mob/living/simple_animal/hostile/poison/bees/AttackingTarget()
if(beegent && isliving(target))
var/mob/living/L = target
if(!isnull(target.reagents))
beegent.reaction_mob(L, INGEST)
L.reagents.add_reagent(beegent.id, rand(1,5))
target.attack_animal(src)
/mob/living/simple_animal/hostile/poison/bees/proc/assign_reagent(datum/reagent/R)
if(istype(R))
beegent = R
name = "[initial(name)] ([R.name])"
generate_bee_visuals()
/mob/living/simple_animal/hostile/poison/bees/handle_automated_action()
. = ..()
if(!.)
return
/mob/living/simple_animal/hostile/poison/bees/proc/reagent_incompatible(mob/living/simple_animal/hostile/poison/bees/B)
if(!B)
return 0
if(B.beegent && beegent && B.beegent.id != beegent.id || B.beegent && !beegent || !B.beegent && beegent)
return 1
return 0
//Botany Worker Bees
/mob/living/simple_animal/hostile/poison/bees/worker
//Blank type define in case we need to give them special stuff later, plus organization (currently they are same as base type bee)
/mob/living/simple_animal/hostile/poison/bees/worker/Destroy()
if(beehome)
beehome.bees.Remove(src)
beehome = null
..()
/mob/living/simple_animal/hostile/poison/bees/worker/death(gibbed)
if(beehome)
beehome.bees.Remove(src)
beehome = null
..()
/mob/living/simple_animal/hostile/poison/bees/worker/examine(mob/user)
..()
if(!beehome)
to_chat(user, "<span class='warning'>This bee is homeless!</span>")
/mob/living/simple_animal/hostile/poison/bees/worker/Found(atom/A)
if(istype(A, /obj/machinery/portable_atmospherics/hydroponics))
var/obj/machinery/portable_atmospherics/hydroponics/Hydro = A
if(Hydro.seed && !Hydro.dead && !Hydro.recent_bee_visit)
wanted_objects |= /obj/machinery/portable_atmospherics/hydroponics //so we only hunt them while they're alive/seeded/not visisted
return 1
if(ishuman(A))
var/mob/living/carbon/human/H = A
return !H.bee_friendly()
return 0
..()
/mob/living/simple_animal/hostile/poison/bees/worker/CanAttack(atom/the_target)
. = ..()
if(!.)
return 0
if(isliving(the_target)) //Should ignore ghosts and camera mobs already, but just in case
var/mob/living/L = the_target
return !L.bee_friendly()
/mob/living/simple_animal/hostile/poison/bees/AttackingTarget()
//Pollinate
/mob/living/simple_animal/hostile/poison/bees/worker/AttackingTarget()
//Pollinate
if(istype(target, /obj/machinery/portable_atmospherics/hydroponics))
var/obj/machinery/portable_atmospherics/hydroponics/Hydro = target
pollinate(Hydro)
@@ -141,22 +183,9 @@
target = null
wanted_objects.Remove(/obj/structure/beebox) //so we don't attack beeboxes when not going home
else
if(beegent && isliving(target))
var/mob/living/L = target
if(!isnull(target.reagents))
beegent.reaction_mob(L, INGEST)
L.reagents.add_reagent(beegent.id, rand(1,5))
target.attack_animal(src)
..()
/mob/living/simple_animal/hostile/poison/bees/proc/assign_reagent(datum/reagent/R)
if(istype(R))
beegent = R
name = "[initial(name)] ([R.name])"
generate_bee_visuals()
/mob/living/simple_animal/hostile/poison/bees/proc/pollinate(obj/machinery/portable_atmospherics/hydroponics/Hydro)
/mob/living/simple_animal/hostile/poison/bees/worker/proc/pollinate(obj/machinery/portable_atmospherics/hydroponics/Hydro)
if(!istype(Hydro) || !Hydro.seed || Hydro.dead || Hydro.recent_bee_visit)
target = null
return
@@ -187,12 +216,10 @@
if(beehome)
beehome.bee_resources = min(beehome.bee_resources + growth, 100)
/mob/living/simple_animal/hostile/poison/bees/handle_automated_action()
/mob/living/simple_animal/hostile/poison/bees/worker/handle_automated_action()
. = ..()
if(!.)
return
if(!isqueen)
if(loc == beehome)
idle = min(100, ++idle)
@@ -212,7 +239,9 @@
beehome = BB
/mob/living/simple_animal/hostile/poison/bees/queen
//Botany Queen Bee
/mob/living/simple_animal/hostile/poison/bees/queen
name = "queen bee"
desc = "she's the queen of bees, BZZ BZZ"
icon_base = "queen"
@@ -223,28 +252,13 @@
/mob/living/simple_animal/hostile/poison/bees/queen/Found(atom/A)
return 0
//leave pollination for the peasent bees
/mob/living/simple_animal/hostile/poison/bees/queen/AttackingTarget()
if(beegent && isliving(target))
var/mob/living/L = target
beegent.reaction_mob(L, TOUCH)
L.reagents.add_reagent(beegent.id, rand(1,5))
target.attack_animal(src)
//PEASENT BEES
/mob/living/simple_animal/hostile/poison/bees/queen/pollinate()
return
/mob/living/simple_animal/hostile/poison/bees/proc/reagent_incompatible(mob/living/simple_animal/hostile/poison/bees/B)
if(!B)
/mob/living/simple_animal/hostile/poison/bees/queen/CanAttack(atom/the_target)
. = ..()
if(!.)
return 0
if(B.beegent && beegent && B.beegent.id != beegent.id || B.beegent && !beegent || !B.beegent && beegent)
return 1
return 0
if(isliving(the_target)) //Should ignore ghosts and camera mobs already, but just in case
var/mob/living/L = the_target
return !L.bee_friendly()
/obj/item/queen_bee
name = "queen bee"
@@ -254,7 +268,6 @@
icon = 'icons/mob/bees.dmi'
var/mob/living/simple_animal/hostile/poison/bees/queen/queen
/obj/item/queen_bee/attackby(obj/item/I, mob/user, params)
if(istype(I,/obj/item/weapon/reagent_containers/syringe))
var/obj/item/weapon/reagent_containers/syringe/S = I
@@ -280,7 +293,6 @@
to_chat(user, "<span class='warning'>You don't have enough units of that chemical to modify the bee's DNA!</span>")
..()
/obj/item/queen_bee/bought/New()
..()
queen = new(src)
@@ -288,3 +300,43 @@
/obj/item/queen_bee/Destroy()
qdel(queen)
return ..()
//Syndicate Bees
/mob/living/simple_animal/hostile/poison/bees/syndi
name = "syndi-bee"
desc = "The result of a large influx of BEES!"
melee_damage_lower = 5
melee_damage_upper = 5
maxHealth = 25
health = 25
faction = list("hostile", "syndicate")
search_objects = 0 //these bees don't care about trivial things like plants, especially when there is havoc to sow
beegent = new /datum/reagent/facid() //prepare to die
var/list/master_and_friends = list()
/mob/living/simple_animal/hostile/poison/bees/syndi/assign_reagent(datum/reagent/R)
return
/mob/living/simple_animal/hostile/poison/bees/syndi/Found(atom/A)
return CanAttack(A)
/mob/living/simple_animal/hostile/poison/bees/syndi/CanAttack(atom/the_target)
. = ..()
if(!.)
return 0
if(isliving(the_target))
var/mob/living/L = the_target
if(ishuman(L))
var/mob/living/carbon/human/H = L
if(H in master_and_friends)
return 0
return 1
/mob/living/simple_animal/hostile/poison/bees/syndi/AttackingTarget()
..()
if(target && isliving(target))
var/mob/living/L = target
if(L.stat)
LoseTarget()