mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
[MIRROR] mothroaches in the wardrobe (#28266)
* mothroaches in the wardrobe (#83695) ## About The Pull Request there is a very small chance vendrobes will have mothroaches inside. this will become apparent as the clothes you buy will come out slightly damaged and eaten. hitting the vendrobe with a weapon (or throwing the weapon at it) will cause the mothroaches to come out and scatter everywhere. mothroaches will now also seek out clothes to eat them ## Why It's Good For The Game gives more character and depth to mothroach AI ## Changelog 🆑 add: vendrobes may have mothroaches inside them add: mothroaches will now seek out clothes to eat them /🆑 * mothroaches in the wardrobe --------- Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
This commit is contained in:
co-authored by
Ben10Omintrix
parent
668f7d0d5f
commit
d7de7b74b6
@@ -7,3 +7,6 @@
|
||||
#define BB_PET_TARGETING_STRATEGY "BB_pet_targeting"
|
||||
/// Typecache of weakrefs to mobs this mob is friends with, will follow their instructions and won't attack them
|
||||
#define BB_FRIENDS_LIST "BB_friends_list"
|
||||
|
||||
///mothroach next meal key!
|
||||
#define BB_MOTHROACH_NEXT_EAT "mothroach_next_eat"
|
||||
|
||||
@@ -93,4 +93,5 @@
|
||||
if(isstack(target)) //if stack, only consume 1
|
||||
var/obj/item/stack/food_stack = target
|
||||
final_target = food_stack.split_stack(eater, 1)
|
||||
eater.log_message("has eaten [target]!", LOG_ATTACK)
|
||||
qdel(final_target)
|
||||
|
||||
+4
-10
@@ -36,6 +36,10 @@
|
||||
|
||||
/mob/living/basic/mothroach/Initialize(mapload)
|
||||
. = ..()
|
||||
var/static/list/food_types = list(/obj/item/clothing)
|
||||
AddElement(/datum/element/basic_eating, food_types = food_types)
|
||||
ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(food_types))
|
||||
AddElement(/datum/element/ai_retaliate)
|
||||
AddElement(/datum/element/pet_bonus, "squeaks happily!")
|
||||
add_verb(src, /mob/living/proc/toggle_resting)
|
||||
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
|
||||
@@ -64,16 +68,6 @@
|
||||
else
|
||||
playsound(loc, 'sound/voice/moth/scream_moth.ogg', 50, TRUE)
|
||||
|
||||
/datum/ai_controller/basic_controller/mothroach
|
||||
blackboard = list()
|
||||
|
||||
ai_traits = STOP_MOVING_WHEN_PULLED
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
planning_subtrees = list(
|
||||
/datum/ai_planning_subtree/random_speech/mothroach,
|
||||
)
|
||||
|
||||
/mob/living/basic/mothroach/bar
|
||||
name = "mothroach bartender"
|
||||
desc = "A mothroach serving drinks. Look at him go."
|
||||
@@ -0,0 +1,35 @@
|
||||
#define MOTHROACH_EAT_TIMER 1 MINUTES
|
||||
|
||||
/datum/ai_controller/basic_controller/mothroach
|
||||
blackboard = list(
|
||||
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
|
||||
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/allow_items,
|
||||
)
|
||||
|
||||
ai_traits = STOP_MOVING_WHEN_PULLED
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
planning_subtrees = list(
|
||||
/datum/ai_planning_subtree/find_food/mothroach,
|
||||
/datum/ai_planning_subtree/target_retaliate/to_flee,
|
||||
/datum/ai_planning_subtree/flee_target/from_flee_key,
|
||||
/datum/ai_planning_subtree/basic_melee_attack_subtree,
|
||||
/datum/ai_planning_subtree/random_speech/mothroach,
|
||||
)
|
||||
|
||||
/datum/ai_controller/basic_controller/mothroach/TryPossessPawn(atom/new_pawn)
|
||||
. = ..()
|
||||
if(. & AI_CONTROLLER_INCOMPATIBLE)
|
||||
return
|
||||
RegisterSignal(new_pawn, COMSIG_MOB_ATE, PROC_REF(on_eaten))
|
||||
|
||||
/datum/ai_controller/basic_controller/mothroach/proc/on_eaten(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
set_blackboard_key(BB_MOTHROACH_NEXT_EAT, world.time + MOTHROACH_EAT_TIMER)
|
||||
|
||||
/datum/ai_planning_subtree/find_food/mothroach/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
if(world.time < controller.blackboard[BB_MOTHROACH_NEXT_EAT])
|
||||
return
|
||||
return ..()
|
||||
|
||||
#undef MOTHROACH_EAT_TIMER
|
||||
@@ -1,3 +1,7 @@
|
||||
GLOBAL_VAR_INIT(roaches_deployed, FALSE)
|
||||
#define MOTHROACH_START_CHANCE 5
|
||||
#define MAX_MOTHROACH_AMOUNT 3
|
||||
|
||||
/obj/item/vending_refill/wardrobe
|
||||
icon_state = "refill_clothes"
|
||||
|
||||
@@ -8,6 +12,29 @@
|
||||
panel_type = "panel19"
|
||||
light_mask = "wardrobe-light-mask"
|
||||
|
||||
/obj/machinery/vending/wardrobe/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!mapload)
|
||||
return
|
||||
if(GLOB.roaches_deployed || !is_station_level(z) || !prob(MOTHROACH_START_CHANCE))
|
||||
return
|
||||
for(var/count in 1 to rand(1, MAX_MOTHROACH_AMOUNT))
|
||||
new /mob/living/basic/mothroach(src)
|
||||
GLOB.roaches_deployed = TRUE
|
||||
|
||||
|
||||
/obj/machinery/vending/wardrobe/on_dispense(obj/item/clothing/food)
|
||||
if(!istype(food))
|
||||
return
|
||||
for(var/mob/living/basic/mothroach/roach in contents)
|
||||
food.take_damage(food.get_integrity() * 0.5)
|
||||
|
||||
/obj/machinery/vending/wardrobe/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
|
||||
. = ..()
|
||||
for(var/mob/living/basic/mothroach/roach in contents)
|
||||
roach.ai_controller.set_blackboard_key(BB_BASIC_MOB_FLEE_TARGET, src) //scatter away!
|
||||
roach.forceMove(drop_location())
|
||||
|
||||
/obj/machinery/vending/wardrobe/sec_wardrobe
|
||||
name = "\improper SecDrobe"
|
||||
desc = "A vending machine for security and security-related clothing!"
|
||||
@@ -706,3 +733,6 @@
|
||||
/obj/item/vending_refill/wardrobe/cent_wardrobe
|
||||
machine_name = "CentDrobe"
|
||||
light_color = LIGHT_COLOR_ELECTRIC_GREEN
|
||||
|
||||
#undef MOTHROACH_START_CHANCE
|
||||
#undef MAX_MOTHROACH_AMOUNT
|
||||
|
||||
+2
-1
@@ -5046,9 +5046,10 @@
|
||||
#include "code\modules\mob\living\basic\vermin\crab.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\frog.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\lizard.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\mothroach.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\mouse.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\space_bat.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\mothroach\mothroach.dm"
|
||||
#include "code\modules\mob\living\basic\vermin\mothroach\mothroach_ai.dm"
|
||||
#include "code\modules\mob\living\brain\brain.dm"
|
||||
#include "code\modules\mob\living\brain\brain_cybernetic.dm"
|
||||
#include "code\modules\mob\living\brain\brain_item.dm"
|
||||
|
||||
Reference in New Issue
Block a user