Range limit on bee wandering. Will eventually be upgradable.

This commit is contained in:
Rob Nelson
2015-08-27 13:50:17 -07:00
parent 94e0d114a3
commit 6ab85b5a83
3 changed files with 34 additions and 4 deletions

View File

@@ -32,6 +32,8 @@
minbodytemp = 0
maxbodytemp = 360
var/max_hive_dist=5
/mob/living/simple_animal/bee/New(loc, var/obj/machinery/apiary/new_parent)
..()
parent = new_parent
@@ -72,6 +74,26 @@
B.feral = 15
B.target = damagesource
/mob/living/simple_animal/bee/wander_move(var/turf/dest)
var/goodmove=0
if(!my_hydrotray || my_hydrotray.loc != src.loc || my_hydrotray.dead || !my_hydrotray.seed)
// Wander the wastes
goodmove=1
else
// Restrict bee to area within distance of tray
var/turf/hiveturf = get_turf(my_hydrotray)
var/current_dist = get_dist(src,hiveturf)
var/new_dist = get_dist(dest,hiveturf)
// If we're beyond hive max range and we're not feral, we can only move towards or parallel to the hive.
if(current_dist > max_hive_dist && !feral)
if(new_dist <= current_dist)
goodmove=1
else
// Otherwise, we can move anywhere we like.
goodmove=1
if(goodmove)
Move(dest)
/mob/living/simple_animal/bee/Life()
if(timestopped) return 0 //under effects of time magick
@@ -194,8 +216,10 @@
break
if(target_turf)
if (!(DirBlocked(get_step(src, get_dir(src,target_turf)),get_dir(src,target_turf)))) // Check for windows and doors!
Move(get_step(src, get_dir(src,target_turf)))
var/tdir=get_dir(src,target_turf) // This was called thrice. Optimize.
var/turf/move_to=get_step(src, tdir) // Called twice.
if (!(DirBlocked(move_to,tdir))) // Check for windows and doors!
Move(move_to)
if (prob(0.1))
src.visible_message("<span class='notice'>The bees swarm after [target]!</span>")
if(src.loc == target_turf)

View File

@@ -130,6 +130,10 @@ var/global/list/animal_count = list() //Stores types, and amount of animals of t
/mob/living/simple_animal/airflow_hit(atom/A)
return
// For changing wander behavior
/mob/living/simple_animal/proc/wander_move(var/turf/dest)
Move(dest)
/mob/living/simple_animal/Life()
if(timestopped) return 0 //under effects of time magick
..()
@@ -170,7 +174,8 @@ var/global/list/animal_count = list() //Stores types, and amount of animals of t
turns_since_move++
if(turns_since_move >= turns_per_move)
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
var/destination = get_step(src, pick(cardinal))
wander_move(destination)
turns_since_move = 0
//Speaking