[MISSED MIRROR] make the mushroom a basic monster (#76570) (#22760)

make the mushroom a basic monster (#76570)

## About The Pull Request
i maked the mushrom from the simple monster to a basic monster so he is
dont a simple anymore but now he is a basic.i followe the instrucions in
the guide learn-ai.md to maked this pr. i also give the mushrom a extra
feture he will go and hunt food mushroms on the floor to ate them and
when he ate them he will heal small his hp

## Why It's Good For The Game
he is now a basic monster so he is not simple anymore. it is good
because he is a more advance ai and he will stil go and do the same stuf
he did when he is simple but he is now a basic

## Changelog
🆑
refactor: Mushrooms have been refactors, please report any
bugs/unintended behavior
add: the mushroom basic mob can eat the mushroom plant to heal itself
/🆑

---------

Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
Bloop
2023-07-30 20:43:28 -04:00
committed by nevimer
co-authored by Ben10Omintrix san7890
parent f1e167e87a
commit bed3c770ce
10 changed files with 201 additions and 214 deletions
+1 -1
View File
@@ -261,6 +261,7 @@
/mob/living/basic/killer_tomato,
/mob/living/basic/lizard,
/mob/living/basic/mouse,
/mob/living/basic/mushroom,
/mob/living/basic/pet/dog/breaddog,
/mob/living/basic/pet/dog/corgi,
/mob/living/basic/pet/dog/pug,
@@ -274,7 +275,6 @@
/mob/living/simple_animal/hostile/gorilla,
/mob/living/simple_animal/hostile/megafauna/dragon/lesser,
/mob/living/simple_animal/hostile/morph,
/mob/living/simple_animal/hostile/mushroom,
/mob/living/simple_animal/hostile/retaliate/goat,
/mob/living/simple_animal/parrot,
/mob/living/simple_animal/pet/cat,
+2 -2
View File
@@ -287,12 +287,12 @@
/datum/round_event/vent_clog/strange/get_mob()
var/static/list/mob_list = list(
/mob/living/basic/cockroach/glockroach/mobroach,
/mob/living/basic/lightgeist,
/mob/living/basic/mothroach,
/mob/living/basic/cockroach/glockroach/mobroach,
/mob/living/basic/mushroom,
/mob/living/basic/viscerator,
/mob/living/simple_animal/hostile/bear,
/mob/living/simple_animal/hostile/mushroom,
/mob/living/simple_animal/hostile/retaliate/goose, //Janitors HATE geese.
/mob/living/simple_animal/pet/gondola,
)
@@ -465,7 +465,7 @@
/// Walking Mushroom's transformation gene
/datum/plant_gene/trait/mob_transformation/shroom
killer_plant = /mob/living/simple_animal/hostile/mushroom
killer_plant = /mob/living/basic/mushroom
mob_health_multiplier = 0.25
mob_melee_multiplier = 0.05
mob_speed_multiplier = 0.02
@@ -0,0 +1,193 @@
/mob/living/basic/mushroom
name = "walking mushroom"
desc = "It's a massive mushroom... with legs?"
icon_state = "mushroom_color"
icon_living = "mushroom_color"
icon_dead = "mushroom_dead"
mob_biotypes = MOB_ORGANIC | MOB_PLANT
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
response_harm_continuous = "whacks"
response_harm_simple = "whack"
speed = 1
melee_damage_lower = 4
melee_damage_upper = 4
maxHealth = 60
attack_verb_continuous = "chomps"
attack_verb_simple = "chomp"
attack_sound = 'sound/weapons/bite.ogg'
attack_vis_effect = ATTACK_EFFECT_BITE
faction = list(FACTION_MUSHROOM)
speak_emote = list("squeaks")
death_message = "fainted!"
ai_controller = /datum/ai_controller/basic_controller/mushroom
var/cap_color = "#ffffff"
///Tracks our general strength level gained from eating other shrooms
var/powerlevel = 0
///If someone tries to cheat the system by attacking a shroom to lower its health, punish them so that it won't award levels to shrooms that eat it
var/bruised = FALSE
///If we hit three, another mushroom's gonna eat us
var/faint_ticker = 0
///Where we store our cap icons so we dont generate them constantly to update our icon
var/static/mutable_appearance/cap_living
///Where we store our cap icons so we dont generate them constantly to update our icon
var/static/mutable_appearance/cap_dead
///Cooldown that tracks how long its been since revival
COOLDOWN_DECLARE(recovery_cooldown)
/mob/living/basic/mushroom/Initialize(mapload)
. = ..()
melee_damage_lower = rand(3, 5)
melee_damage_upper = rand(10,20)
maxHealth = rand(50,70)
cap_living = cap_living || mutable_appearance(icon, "mushroom_cap")
cap_dead = cap_dead || mutable_appearance(icon, "mushroom_cap_dead")
cap_color = rgb(rand(0, 255), rand(0, 255), rand(0, 255))
update_mushroomcap()
health = maxHealth
AddElement(/datum/element/swabable, CELL_LINE_TABLE_WALKING_MUSHROOM, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
RegisterSignal(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(on_attacked_target))
/datum/ai_controller/basic_controller/mushroom
blackboard = list(
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/mushroom,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/basic_melee_attack_subtree/mushroom,
/datum/ai_planning_subtree/find_and_hunt_target/mushroom_food,
)
/datum/targetting_datum/basic/mushroom
stat_attack = DEAD
///we only attacked another mushrooms
/datum/targetting_datum/basic/mushroom/faction_check(mob/living/living_mob, mob/living/the_target)
return !living_mob.faction_check_mob(the_target, exact_match = check_factions_exactly)
/datum/ai_planning_subtree/basic_melee_attack_subtree/mushroom
melee_attack_behavior = /datum/ai_behavior/basic_melee_attack/mushroom
/datum/ai_behavior/basic_melee_attack/mushroom
action_cooldown = 2 SECONDS
/datum/ai_planning_subtree/find_and_hunt_target/mushroom_food
target_key = BB_LOW_PRIORITY_HUNTING_TARGET
hunting_behavior = /datum/ai_behavior/hunt_target/unarmed_attack_target/mushroom_food
hunt_targets = list(/obj/item/food/grown/mushroom)
hunt_range = 6
/datum/ai_behavior/hunt_target/unarmed_attack_target/mushroom_food
hunt_cooldown = 15 SECONDS
always_reset_target = TRUE
/mob/living/basic/mushroom/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
. = ..()
if(!.)
return
if(!proximity_flag)
return
if(istype(attack_target, /obj/item/food/grown/mushroom))
recover(attack_target)
return TRUE
/mob/living/basic/mushroom/proc/on_attacked_target(mob/living/basic/attacker, atom/target)
SIGNAL_HANDLER
if(!istype(target, /mob/living/basic/mushroom))
return
var/mob/living/basic/mushroom/victim = target
if(victim.stat != DEAD)
return
if(victim.faint_ticker >= 3)
consume_mushroom(victim)
return
victim.faint_ticker++
visible_message(span_notice("[src] chews a bit on [victim]."))
/mob/living/basic/mushroom/proc/consume_mushroom(mob/living/basic/mushroom/consumed)
visible_message(span_warning("[src] devours [consumed]!"))
var/level_gain = (consumed.powerlevel - powerlevel)
if(level_gain >= 0 && !ckey && !consumed.bruised)//Player shrooms can't level up to become robust gods.
consumed.level_up(level_gain)
adjustBruteLoss(-consumed.maxHealth)
qdel(consumed)
/mob/living/basic/mushroom/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
. = ..()
if(!.)
return
icon_state = "mushroom_color"
update_mushroomcap()
/mob/living/basic/mushroom/death(gibbed)
. = ..()
update_mushroomcap()
/mob/living/basic/mushroom/proc/update_mushroomcap()
cut_overlays()
cap_living.color = cap_color
cap_dead.color = cap_color
if(stat == DEAD)
add_overlay(cap_dead)
else
add_overlay(cap_living)
/mob/living/basic/mushroom/proc/recover(obj/item/mush_meal)
visible_message(span_notice("[src] eats [mush_meal]!"))
update_mushroomcap()
qdel(mush_meal)
if(!COOLDOWN_FINISHED(src, recovery_cooldown))
return
faint_ticker = 0
if(stat == DEAD)
revive(HEAL_ALL)
else
adjustBruteLoss(-5)
COOLDOWN_START(src, recovery_cooldown, 5 MINUTES)
/mob/living/basic/mushroom/proc/level_up(level_gain)
adjustBruteLoss(-maxHealth) //They'll always heal, even if they don't gain a level
if(powerlevel > 9)
return
if(level_gain == 0)
level_gain = 1
powerlevel += level_gain
if(prob(25))
melee_damage_lower += (level_gain * rand(1,5))
else
melee_damage_upper += (level_gain * rand(1,5))
maxHealth += (level_gain * rand(1,5))
/mob/living/basic/mushroom/attackby(obj/item/mush, mob/living/carbon/human/user, list/modifiers)
if(istype(mush, /obj/item/food/grown/mushroom))
recover(mush)
return
if(mush.force || user.combat_mode)
bruised = TRUE
return ..()
/mob/living/basic/mushroom/harvest(mob/living/user)
var/counter
for(counter=0, counter <= powerlevel, counter++)
var/obj/item/food/hugemushroomslice/shroomslice = new /obj/item/food/hugemushroomslice(src.loc)
shroomslice.reagents.add_reagent(/datum/reagent/drug/mushroomhallucinogen, powerlevel)
shroomslice.reagents.add_reagent(/datum/reagent/medicine/omnizine, powerlevel)
shroomslice.reagents.add_reagent(/datum/reagent/medicine/synaptizine, powerlevel)
+1 -1
View File
@@ -1500,6 +1500,7 @@
/mob/living/basic/killer_tomato,
/mob/living/basic/lizard,
/mob/living/basic/mouse,
/mob/living/basic/mushroom,
/mob/living/basic/pet/dog/breaddog,
/mob/living/basic/pet/dog/corgi,
/mob/living/basic/pet/dog/pug,
@@ -1513,7 +1514,6 @@
/mob/living/simple_animal/hostile/gorilla,
/mob/living/simple_animal/hostile/megafauna/dragon/lesser,
/mob/living/simple_animal/hostile/morph,
/mob/living/simple_animal/hostile/mushroom,
/mob/living/simple_animal/hostile/retaliate/goat,
/mob/living/simple_animal/parrot,
/mob/living/simple_animal/pet/cat,
@@ -1,205 +0,0 @@
/mob/living/simple_animal/hostile/mushroom
name = "walking mushroom"
desc = "It's a massive mushroom... with legs?"
icon_state = "mushroom_color"
icon_living = "mushroom_color"
icon_dead = "mushroom_dead"
mob_biotypes = MOB_ORGANIC | MOB_PLANT
speak_chance = 0
turns_per_move = 1
maxHealth = 10
health = 10
butcher_results = list(/obj/item/food/hugemushroomslice = 1)
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
response_harm_continuous = "whacks"
response_harm_simple = "whack"
harm_intent_damage = 5
obj_damage = 0
melee_damage_lower = 1
melee_damage_upper = 1
attack_same = 2
attack_verb_continuous = "chomps"
attack_verb_simple = "chomp"
attack_sound = 'sound/weapons/bite.ogg'
attack_vis_effect = ATTACK_EFFECT_BITE
faction = list(FACTION_MUSHROOM)
environment_smash = ENVIRONMENT_SMASH_NONE
stat_attack = DEAD
mouse_opacity = MOUSE_OPACITY_ICON
speed = 1
robust_searching = 1
unique_name = 1
speak_emote = list("squeaks")
death_message = "fainted."
var/cap_color = "#ffffff"
var/powerlevel = 0 //Tracks our general strength level gained from eating other shrooms
var/bruised = 0 //If someone tries to cheat the system by attacking a shroom to lower its health, punish them so that it won't award levels to shrooms that eat it
var/recovery_cooldown = 0 //So you can't repeatedly revive it during a fight
var/faint_ticker = 0 //If we hit three, another mushroom's gonna eat us
var/static/mutable_appearance/cap_living //Where we store our cap icons so we dont generate them constantly to update our icon
var/static/mutable_appearance/cap_dead
/mob/living/simple_animal/hostile/mushroom/examine(mob/user)
. = ..()
if(health >= maxHealth)
. += span_info("It looks healthy.")
else
. += span_info("It looks like it's been roughed up.")
/mob/living/simple_animal/hostile/mushroom/Life(seconds_per_tick = SSMOBS_DT, times_fired)
..()
if(!stat)//Mushrooms slowly regenerate if conscious, for people who want to save them from being eaten
adjustBruteLoss(-1 * seconds_per_tick)
/mob/living/simple_animal/hostile/mushroom/Initialize(mapload)//Makes every shroom a little unique
melee_damage_lower += rand(3, 5)
melee_damage_upper += rand(10,20)
maxHealth += rand(40,60)
move_to_delay = rand(3,11)
cap_living = cap_living || mutable_appearance(icon, "mushroom_cap")
cap_dead = cap_dead || mutable_appearance(icon, "mushroom_cap_dead")
cap_color = rgb(rand(0, 255), rand(0, 255), rand(0, 255))
UpdateMushroomCap()
health = maxHealth
add_cell_sample()
. = ..()
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
/mob/living/simple_animal/hostile/mushroom/CanAttack(atom/the_target) // Mushroom-specific version of CanAttack to handle stupid attack_same = 2 crap so we don't have to do it for literally every single simple_animal/hostile because this shit never gets spawned
if(!the_target || isturf(the_target))
return FALSE
if(see_invisible < the_target.invisibility)//Target's invisible to us, forget it
return FALSE
if(isliving(the_target))
var/mob/living/L = the_target
if (!faction_check_mob(L) && attack_same == 2)
return FALSE
if(L.stat > stat_attack)
return FALSE
return TRUE
return FALSE
/mob/living/simple_animal/hostile/mushroom/adjustHealth(amount, updating_health = TRUE, forced = FALSE) //Possibility to flee from a fight just to make it more visually interesting
if(!retreat_distance && prob(33))
retreat_distance = 5
addtimer(CALLBACK(src, PROC_REF(stop_retreat)), 30)
. = ..()
/mob/living/simple_animal/hostile/mushroom/proc/stop_retreat()
retreat_distance = null
/mob/living/simple_animal/hostile/mushroom/attack_animal(mob/living/user, list/modifiers)
if(istype(user, /mob/living/simple_animal/hostile/mushroom) && stat == DEAD)
var/mob/living/simple_animal/hostile/mushroom/shroom = user
if(faint_ticker < 2)
shroom.visible_message(span_notice("[shroom] chews a bit on [src]."))
faint_ticker++
return TRUE
shroom.visible_message(span_warning("[shroom] devours [src]!"))
var/level_gain = (powerlevel - shroom.powerlevel)
if(level_gain >= -1 && !bruised && !shroom.ckey)//Player shrooms can't level up to become robust gods.
if(level_gain < 1)//So we still gain a level if two mushrooms were the same level
level_gain = 1
shroom.LevelUp(level_gain)
shroom.adjustBruteLoss(-shroom.maxHealth)
qdel(src)
return TRUE
return ..()
/mob/living/simple_animal/hostile/mushroom/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
. = ..()
if(!.)
return
icon_state = "mushroom_color"
UpdateMushroomCap()
/mob/living/simple_animal/hostile/mushroom/death(gibbed)
. = ..()
UpdateMushroomCap()
/mob/living/simple_animal/hostile/mushroom/proc/UpdateMushroomCap()
cut_overlays()
cap_living.color = cap_color
cap_dead.color = cap_color
if(health == 0)
add_overlay(cap_dead)
else
add_overlay(cap_living)
/mob/living/simple_animal/hostile/mushroom/proc/Recover()
visible_message(span_notice("[src] slowly begins to recover."))
faint_ticker = 0
revive(HEAL_ALL)
UpdateMushroomCap()
recovery_cooldown = 1
addtimer(CALLBACK(src, PROC_REF(recovery_recharge)), 300)
/mob/living/simple_animal/hostile/mushroom/proc/recovery_recharge()
recovery_cooldown = 0
/mob/living/simple_animal/hostile/mushroom/proc/LevelUp(level_gain)
if(powerlevel <= 9)
powerlevel += level_gain
if(prob(25))
melee_damage_lower += (level_gain * rand(1,5))
else
melee_damage_upper += (level_gain * rand(1,5))
maxHealth += (level_gain * rand(1,5))
adjustBruteLoss(-maxHealth) //They'll always heal, even if they don't gain a level, in case you want to keep this shroom around instead of harvesting it
/mob/living/simple_animal/hostile/mushroom/proc/Bruise()
if(!bruised && !stat)
src.visible_message(span_notice("The [src.name] is bruised!"))
bruised = 1
/mob/living/simple_animal/hostile/mushroom/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/food/grown/mushroom))
if(stat == DEAD && !recovery_cooldown)
Recover()
qdel(I)
else
to_chat(user, span_warning("[src] won't eat it!"))
return
if(I.force)
Bruise()
..()
/mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/user, list/modifiers)
..()
if(user.combat_mode)
Bruise()
/mob/living/simple_animal/hostile/mushroom/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
..()
if(isitem(AM))
var/obj/item/T = AM
if(T.throwforce)
Bruise()
/mob/living/simple_animal/hostile/mushroom/bullet_act(obj/projectile/P)
. = ..()
if(P.damage > 0 && P.damage_type == BRUTE)
Bruise()
/mob/living/simple_animal/hostile/mushroom/harvest()
var/counter
for(counter=0, counter <= powerlevel, counter++)
var/obj/item/food/hugemushroomslice/S = new /obj/item/food/hugemushroomslice(src.loc)
S.reagents.add_reagent(/datum/reagent/drug/mushroomhallucinogen, powerlevel)
S.reagents.add_reagent(/datum/reagent/medicine/omnizine, powerlevel)
S.reagents.add_reagent(/datum/reagent/medicine/synaptizine, powerlevel)
/mob/living/simple_animal/hostile/mushroom/add_cell_sample()
. = ..()
AddElement(/datum/element/swabable, CELL_LINE_TABLE_WALKING_MUSHROOM, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5)
+1 -1
View File
@@ -382,7 +382,7 @@
return TRUE
if(ispath(MP, /mob/living/basic/carp))
return TRUE
if(ispath(MP, /mob/living/simple_animal/hostile/mushroom))
if(ispath(MP, /mob/living/basic/mushroom))
return TRUE
if(ispath(MP, /mob/living/simple_animal/shade))
return TRUE
@@ -629,7 +629,7 @@
/datum/reagent/copper = -1)
virus_suspectibility = 0
resulting_atoms = list(/mob/living/simple_animal/hostile/mushroom = 1)
resulting_atoms = list(/mob/living/basic/mushroom = 1)
/datum/micro_organism/cell_line/queen_bee
desc = "aphid cells"
@@ -192,7 +192,6 @@
/mob/living/simple_animal/hostile/mimic/xenobio,
/mob/living/simple_animal/hostile/mining_drone,
/mob/living/simple_animal/hostile/morph,
/mob/living/simple_animal/hostile/mushroom,
/mob/living/simple_animal/hostile/nanotrasen,
/mob/living/simple_animal/hostile/nanotrasen/elite,
/mob/living/simple_animal/hostile/nanotrasen/ranged,
+1 -1
View File
@@ -4186,6 +4186,7 @@
#include "code\modules\mob\living\basic\space_fauna\headslug.dm"
#include "code\modules\mob\living\basic\space_fauna\killer_tomato.dm"
#include "code\modules\mob\living\basic\space_fauna\lightgeist.dm"
#include "code\modules\mob\living\basic\space_fauna\mushroom.dm"
#include "code\modules\mob\living\basic\space_fauna\spaceman.dm"
#include "code\modules\mob\living\basic\space_fauna\carp\carp.dm"
#include "code\modules\mob\living\basic\space_fauna\carp\carp_abilities.dm"
@@ -4436,7 +4437,6 @@
#include "code\modules\mob\living\simple_animal\hostile\illusion.dm"
#include "code\modules\mob\living\simple_animal\hostile\mimic.dm"
#include "code\modules\mob\living\simple_animal\hostile\morph.dm"
#include "code\modules\mob\living\simple_animal\hostile\mushroom.dm"
#include "code\modules\mob\living\simple_animal\hostile\nanotrasen.dm"
#include "code\modules\mob\living\simple_animal\hostile\ooze.dm"
#include "code\modules\mob\living\simple_animal\hostile\pirate.dm"