Skip to content

Commit

Permalink
Tweaking exoplanet mobs to implement basic hunger.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 authored and comma committed Aug 12, 2023
1 parent 62763b4 commit f367178
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/living/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
set_stat(UNCONSCIOUS)
else
set_stat(CONSCIOUS)
return 1
return TRUE

/mob/living/proc/handle_disabilities()
handle_impaired_vision()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ default behaviour is:
return nutrition

/mob/living/proc/adjust_nutrition(var/amt)
set_nutrition(nutrition + amt)
set_nutrition(get_nutrition() + amt)

/mob/living/proc/get_max_hydration()
return 500
Expand All @@ -867,7 +867,7 @@ default behaviour is:
hydration = clamp(amt, 0, get_max_hydration())

/mob/living/proc/adjust_hydration(var/amt)
set_hydration(hydration + amt)
set_hydration(get_hydration() + amt)

/mob/living/proc/has_chemical_effect(var/chem, var/threshold_over, var/threshold_under)
var/val = GET_CHEMICAL_EFFECT(src, chem)
Expand Down
13 changes: 7 additions & 6 deletions code/modules/mob/living/simple_animal/friendly/farm_animals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@
goat.visible_message(SPAN_NOTICE("\The [goat] calms down."))

var/obj/effect/vine/SV = locate() in goat.loc
if(SV && prob(60))
goat.visible_message(SPAN_NOTICE("\The [goat] eats the plants."))
SV.die_off(1)
var/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/SP = locate() in goat.loc
if(SP)
qdel(SP)
if(SV)
if(prob(60))
goat.visible_message(SPAN_NOTICE("\The [goat] eats the plants."))
SV.die_off(1)
var/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/SP = locate() in goat.loc
if(SP)
qdel(SP)
else if(prob(20))
goat.visible_message(SPAN_NOTICE("\The [goat] chews on the plants."))
return
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/living/simple_animal/friendly/possum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
ai = /datum/ai/opossum
var/is_angry = FALSE

var/is_angry = FALSE

/datum/ai/opossum
expected_type = /mob/living/simple_animal/opossum
/datum/ai/opossum/do_process(time_elapsed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/datum/ai/commanded/do_process(time_elapsed)
..()
var/mob/living/simple_animal/hostile/commanded/com = body
while(com.command_buffer.len > 0)
while(com.command_buffer.len > 1)
var/mob/speaker = com.command_buffer[1]
var/text = com.command_buffer[2]
var/filtered_name = lowertext(html_decode(com.name))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

/mob/living/simple_animal/hostile/retaliate/beast
ai = /datum/ai/beast
var/list/prey = list()
nutrition = 300
var/list/prey

/mob/living/simple_animal/hostile/retaliate/beast/get_max_nutrition()
return 300

/mob/living/simple_animal/hostile/retaliate/beast/ListTargets(var/dist = 7)
. = ..()
if(!length(.))
if(length(prey))
if(LAZYLEN(prey))
. = list()
for(var/weakref/W in prey)
var/mob/M = W.resolve()
Expand All @@ -15,7 +19,7 @@
else if(get_nutrition() < get_max_nutrition() * 0.75) //time to look for some food
for(var/mob/living/L in view(src, dist))
if(!attack_same && L.faction != faction)
prey |= weakref(L)
LAZYDISTINCTADD(prey, weakref(L))

/datum/ai/beast
expected_type = /mob/living/simple_animal/hostile/retaliate/beast
Expand All @@ -25,7 +29,7 @@
var/nut = beast.get_nutrition()
var/max_nut = beast.get_max_nutrition()
if(nut > max_nut * 0.75 || beast.incapacitated())
beast.prey.Cut()
LAZYCLEARLIST(beast.prey)
return
for(var/mob/living/simple_animal/S in range(beast,1))
if(S == beast)
Expand Down

0 comments on commit f367178

Please sign in to comment.