Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] basic gutlunchers and ashwalker ranching #601

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _maps/RandomRuins/LavaRuins/lavaland_surface_ash_walker1.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
dir = 1
},
/obj/structure/stone_tile,
/mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck,
/mob/living/basic/mining/gutlunch/milk,
/turf/open/indestructible/boss,
/area/ruin/unpowered/ash_walkers)
"aR" = (
Expand Down Expand Up @@ -287,7 +287,7 @@
/obj/structure/stone_tile{
dir = 4
},
/mob/living/simple_animal/hostile/asteroid/gutlunch/guthen,
/mob/living/basic/mining/gutlunch/warrior,
/turf/open/indestructible/boss,
/area/ruin/unpowered/ash_walkers)
"bd" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/lavaland/surface/outdoors)
"p" = (
/obj/structure/material_stand,
/obj/structure/ore_container/material_stand,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/lavaland/surface/outdoors)
"q" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
/turf/open/indestructible/boss,
/area/ruin/unpowered/ash_walkers)
"ky" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck,
/mob/living/basic/mining/gutlunch/milk,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"lB" = (
Expand All @@ -261,7 +261,7 @@
/turf/open/lava/smooth/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"lH" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/grublunch,
/mob/living/basic/mining/gutlunch/grub,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"mc" = (
Expand Down Expand Up @@ -495,7 +495,7 @@
/obj/structure/stone_tile/block{
dir = 4
},
/mob/living/simple_animal/hostile/asteroid/gutlunch/guthen,
/mob/living/basic/mining/gutlunch/warrior,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"rQ" = (
Expand Down
6 changes: 1 addition & 5 deletions _maps/RandomRuins/SpaceRuins/russian_derelict.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -4876,10 +4876,6 @@
/obj/structure/cable,
/turf/open/floor/plating/airless,
/area/ruin/space/ks13/engineering/singulo)
"IZ" = (
/obj/effect/mapping_helpers/burnt_floor,
/turf/open/floor/iron/airless,
/area/ruin/space/ks13/engineering/singulo)
"Jc" = (
/obj/effect/mapping_helpers/broken_floor,
/obj/effect/mapping_helpers/broken_floor,
Expand Down Expand Up @@ -11718,7 +11714,7 @@ PI
Ex
pi
FI
IZ
FI
FI
FI
zv
Expand Down
4 changes: 2 additions & 2 deletions _maps/map_files/Basketball/ash_gladiators.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
/turf/open/floor/fakebasalt,
/area/centcom/basketball)
"ie" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/guthen,
/mob/living/basic/mining/gutlunch/warrior,
/turf/open/floor/fakebasalt,
/area/centcom/basketball)
"ix" = (
Expand Down Expand Up @@ -609,7 +609,7 @@
/turf/open/lava/smooth/basketball,
/area/centcom/basketball)
"Fy" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck,
/mob/living/basic/mining/gutlunch/milk,
/turf/open/floor/fakebasalt,
/area/centcom/basketball)
"FS" = (
Expand Down
2 changes: 1 addition & 1 deletion _maps/map_files/IceBoxStation/IceBoxStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -33897,7 +33897,7 @@
/turf/open/floor/plating/snowed/smoothed/icemoon,
/area/icemoon/underground/explored)
"ksu" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch,
/mob/living/basic/mining/gutlunch/warrior,
/turf/open/misc/asteroid/snow/icemoon,
/area/icemoon/underground/explored)
"ksC" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"xo" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/grublunch,
/mob/living/basic/mining/gutlunch/grub,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"xY" = (
Expand Down Expand Up @@ -943,7 +943,7 @@
/obj/structure/stone_tile/block{
dir = 4
},
/mob/living/simple_animal/hostile/asteroid/gutlunch/guthen,
/mob/living/basic/mining/gutlunch/warrior,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"Hf" = (
Expand Down Expand Up @@ -1185,7 +1185,7 @@
/turf/closed/indestructible/riveted/boss,
/area/ruin/unpowered/ash_walkers)
"QU" = (
/mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck,
/mob/living/basic/mining/gutlunch/milk,
/turf/open/misc/asteroid/basalt/lava_land_surface,
/area/ruin/unpowered/ash_walkers)
"Re" = (
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/ai/ai_blackboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#define BB_PATH_TO_USE "BB_path_to_use"
///How close a mob must be for us to select it as a target, if that is less than how far we can maintain it as a target
#define BB_AGGRO_RANGE "BB_aggro_range"
///are we hungry? determined by the udder compnent
#define BB_CHECK_HUNGRY "BB_check_hungry"
///are we ready to breed?
#define BB_BREED_READY "BB_breed_ready"
///maximum kids we can have
#define BB_MAX_CHILDREN "BB_max_children"

/// Store a single or list of emotes at this key
#define BB_EMOTE_KEY "BB_emotes"
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/ai/monsters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@
/// the bonfire we will light up
#define BB_MOOK_BONFIRE_TARGET "bonfire_target"

//gutlunch keys
///the trough we will eat from
#define BB_TROUGH_TARGET "trough_target"
//leaper keys
///key holds our volley ability
#define BB_LEAPER_VOLLEY "leaper_volley"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1349,5 +1349,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Trait given to a dragon who fails to defend their rifts
#define TRAIT_RIFT_FAILURE "fail_dragon_loser"

///trait determines if this mob can breed given by /datum/component/breeding
#define TRAIT_MOB_BREEDER "mob_breeder"
/// Trait given to mobs that we do not want to mindswap
#define TRAIT_NO_MINDSWAP "no_mindswap"
63 changes: 33 additions & 30 deletions code/datums/ai/babies/babies_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,77 @@
* Find a compatible, living partner, if we're also alone.
*/
/datum/ai_behavior/find_partner
action_cooldown = 40 SECONDS

/// Range to look.
var/range = 7

/// Maximum number of children
var/max_children = 3

/datum/ai_behavior/find_partner/perform(seconds_per_tick, datum/ai_controller/controller, target_key, partner_types_key, child_types_key)
. = ..()

max_children = controller.blackboard[BB_MAX_CHILDREN] || max_children
var/mob/pawn_mob = controller.pawn
var/list/partner_types = controller.blackboard[partner_types_key]
var/list/child_types = controller.blackboard[child_types_key]
var/mob/living/living_pawn = controller.pawn

var/mob/living/partner
var/children = 0
for(var/mob/other in oview(range, pawn_mob))
for(var/mob/living/other in oview(range, pawn_mob))
if(!pawn_mob.faction_check_atom(other))
finish_action(controller, FALSE)
return

if(children >= max_children)
finish_action(controller, FALSE)
return

if(other.stat != CONSCIOUS) //Check if it's conscious FIRST.
continue
var/is_child = is_type_in_list(other, child_types)
if(is_child) //Check for children SECOND.

if(is_type_in_list(other, child_types)) //Check for children SECOND.
children++
else if(is_type_in_list(other, partner_types))
if(other.ckey)
continue
else if(!is_child && other.gender == MALE && !(other.flags_1 & HOLOGRAM_1)) //Better safe than sorry ;_;
partner = other
continue

//shyness check. we're not shy in front of things that share a faction with us.
else if(isliving(other) && !pawn_mob.faction_check_atom(other))
finish_action(controller, FALSE)
return
if(!is_type_in_list(other, partner_types) || !HAS_TRAIT(other, TRAIT_MOB_BREEDER))
continue

if(other.ckey)
continue

if(other.gender != living_pawn.gender && !(other.flags_1 & HOLOGRAM_1)) //Better safe than sorry ;_;
controller.set_blackboard_key(target_key, other)
finish_action(controller, TRUE)

if(partner && children < max_children)
controller.set_blackboard_key(target_key, partner)
finish_action(controller, FALSE)

finish_action(controller, TRUE)

/**
* Reproduce.
*/
/datum/ai_behavior/make_babies
action_cooldown = 40 SECONDS
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_REQUIRE_REACH

/datum/ai_behavior/make_babies/setup(datum/ai_controller/controller, target_key, child_types_key)
. = ..()
var/atom/target = controller.blackboard[target_key]
if(!target)
return FALSE
set_movement_target(controller, target)
return TRUE

/datum/ai_behavior/make_babies/perform(seconds_per_tick, datum/ai_controller/controller, target_key, child_types_key)
. = ..()
var/mob/target = controller.blackboard[target_key]
if(!target || target.stat != CONSCIOUS)
if(QDELETED(target) || target.stat != CONSCIOUS)
finish_action(controller, FALSE, target_key)
return

var/child_type = pick_weight(controller.blackboard[child_types_key])
var/turf/turf_loc = get_turf(controller.pawn.loc)
if(turf_loc)
new child_type(turf_loc)

var/mob/living/basic/living_pawn = controller.pawn
living_pawn.set_combat_mode(FALSE)
living_pawn.melee_attack(target)
finish_action(controller, TRUE, target_key)

/datum/ai_behavior/make_babies/finish_action(datum/ai_controller/controller, succeeded, target_key)
. = ..()

controller.clear_blackboard_key(target_key)
if(!succeeded)
return
var/mob/living/living_pawn = controller.pawn
living_pawn.set_combat_mode(initial(living_pawn.combat_mode))
13 changes: 9 additions & 4 deletions code/datums/ai/babies/babies_subtrees.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
*/
/datum/ai_planning_subtree/make_babies
var/chance = 5
operational_datums = list(/datum/component/breed)

/datum/ai_planning_subtree/make_babies/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
. = ..()

if(controller.pawn.gender != FEMALE || !SPT_PROB(chance, seconds_per_tick))
if(!SPT_PROB(chance, seconds_per_tick))
return

if(controller.blackboard_key_exists(BB_BABIES_TARGET))
controller.queue_behavior(/datum/ai_behavior/make_babies, BB_BABIES_TARGET, BB_BABIES_CHILD_TYPES)
return SUBTREE_RETURN_FINISH_PLANNING

if(controller.pawn.gender == FEMALE || !controller.blackboard[BB_BREED_READY])
return

var/partner_types = controller.blackboard[BB_BABIES_PARTNER_TYPES]
Expand All @@ -21,7 +29,4 @@
return

// Find target
if(controller.blackboard_key_exists(BB_BABIES_TARGET))
controller.queue_behavior(/datum/ai_behavior/make_babies, BB_BABIES_TARGET, BB_BABIES_CHILD_TYPES)
return SUBTREE_RETURN_FINISH_PLANNING
controller.queue_behavior(/datum/ai_behavior/find_partner, BB_BABIES_TARGET, BB_BABIES_PARTNER_TYPES, BB_BABIES_CHILD_TYPES)
17 changes: 17 additions & 0 deletions code/datums/ai/dog/dog_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,20 @@
return

return corgi_pawn.access_card.GetAccess()

/datum/ai_controller/basic_controller/dog/puppy
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETING_STRATEGY = /datum/targeting_strategy/basic/not_friends,
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/holding_object,
// With tongs in hand!
BB_TARGET_HELD_ITEM = /obj/item/kitchen/tongs,
)
planning_subtrees = list(
/datum/ai_planning_subtree/random_speech/dog,
/datum/ai_planning_subtree/pet_planning,
/datum/ai_planning_subtree/dog_harassment,
/datum/ai_planning_subtree/simple_find_target,
/datum/ai_planning_subtree/flee_target,
)
18 changes: 18 additions & 0 deletions code/datums/ai/hunting_behavior/hunting_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
/// Do we reset the target after attacking something, so we can check for status changes.
var/always_reset_target = FALSE


/datum/ai_behavior/hunt_target/setup(datum/ai_controller/controller, hunting_target_key, hunting_cooldown_key)
. = ..()
var/atom/hunt_target = controller.blackboard[hunting_target_key]
Expand Down Expand Up @@ -123,10 +124,27 @@
controller.clear_blackboard_key(hunting_target_key)

/datum/ai_behavior/hunt_target/unarmed_attack_target
///do we toggle combat mode before interacting with the object?
var/switch_combat_mode = FALSE

/datum/ai_behavior/hunt_target/unarmed_attack_target/target_caught(mob/living/hunter, obj/structure/cable/hunted)
if(switch_combat_mode)
hunter.combat_mode = !(hunter.combat_mode)
hunter.UnarmedAttack(hunted, TRUE)

/datum/ai_behavior/hunt_target/unarmed_attack_target/finish_action(datum/ai_controller/controller, succeeded, hunting_target_key, hunting_cooldown_key)
. = ..()
if(!switch_combat_mode)
return
var/mob/living/living_pawn = controller.pawn
living_pawn.combat_mode = initial(living_pawn.combat_mode)

/datum/ai_behavior/hunt_target/unarmed_attack_target/switch_combat_mode
switch_combat_mode = TRUE

/datum/ai_behavior/hunt_target/unarmed_attack_target/reset_target
always_reset_target = TRUE

/datum/ai_behavior/hunt_target/use_ability_on_target
always_reset_target = TRUE
///the ability we will use
Expand Down
Loading
Loading