Skip to content

Commit

Permalink
Merge branch 'SkyRatMaster' into upstreammaint
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueStationAI committed Dec 18, 2023
2 parents 05e7e6d + 12eede1 commit 528b40b
Show file tree
Hide file tree
Showing 115 changed files with 899 additions and 423 deletions.
20 changes: 8 additions & 12 deletions _maps/shuttles/emergency_cruise.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,7 @@
/turf/open/floor/iron,
/area/shuttle/escape)
"tT" = (
/obj/structure/railing{
dir = 2
},
/obj/structure/railing,
/turf/open/floor/carpet/red,
/area/shuttle/escape)
"tZ" = (
Expand Down Expand Up @@ -1224,9 +1222,7 @@
/turf/open/floor/iron,
/area/shuttle/escape)
"Av" = (
/obj/structure/railing{
dir = 2
},
/obj/structure/railing,
/obj/machinery/light/directional/north,
/turf/open/floor/iron/stairs{
dir = 8
Expand Down Expand Up @@ -1398,7 +1394,9 @@
/obj/structure/disposalpipe/segment{
dir = 4
},
/obj/effect/fun_balloon/sentience/emergency_shuttle,
/obj/effect/fun_balloon/sentience/emergency_shuttle{
group_name = "bar staff on the NTTS Independence"
},
/turf/open/floor/wood/parquet,
/area/shuttle/escape)
"DF" = (
Expand Down Expand Up @@ -1754,9 +1752,7 @@
/obj/effect/turf_decal/siding/thinplating{
dir = 6
},
/obj/structure/railing{
dir = 2
},
/obj/structure/railing,
/turf/open/floor/iron,
/area/shuttle/escape)
"LD" = (
Expand Down Expand Up @@ -2818,7 +2814,7 @@ WX
hB
AF
Mv
DA
Tz
il
YY
tG
Expand Down Expand Up @@ -2864,7 +2860,7 @@ at
AL
AF
AF
Tz
DA
il
IO
Ew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
#define COMSIG_MOVABLE_DRIFT_BLOCK_INPUT "movable_drift_block_input"
#define DRIFT_ALLOW_INPUT (1<<0)
///from base of atom/movable/throw_impact(): (/atom/hit_atom, /datum/thrownthing/throwingdatum)
#define COMSIG_MOVABLE_IMPACT "movable_impact"
#define COMSIG_MOVABLE_PRE_IMPACT "movable_pre_impact"
#define COMPONENT_MOVABLE_IMPACT_FLIP_HITPUSH (1<<0) //if true, flip if the impact will push what it hits
#define COMPONENT_MOVABLE_IMPACT_NEVERMIND (1<<1) //return true if you destroyed whatever it was you're impacting and there won't be anything for hitby() to run on
///from base of atom/movable/throw_impact() after confirming a hit: (/atom/hit_atom, /datum/thrownthing/throwingdatum)
#define COMSIG_MOVABLE_IMPACT "movable_impact"
///from base of mob/living/hitby(): (mob/living/target, hit_zone, blocked, datum/thrownthing/throwingdatum)
#define COMSIG_MOVABLE_IMPACT_ZONE "item_impact_zone"
///from /atom/movable/proc/buckle_mob(): (mob/living/M, force, check_loc, buckle_mob_flags)
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/~skyrat_defines/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_OXYIMMUNE "oxyimmune" // Immune to oxygen damage, ideally give this to all non-breathing species or bad stuff will happen
#define TRAIT_AFFECTION_AVERSION "affection_aversion" // No more dogborg licking. "Dogborg bad" is no longer a personality
#define TRAIT_PERSONALSPACE "personalspace" // Block/counter-attack ass-slaps
#define TRAIT_QUICKREFLEXES "quickreflexes" // Counters hugs and headpats
#define TRAIT_MOOD_NOEXAMINE "mood_noexamine" // Can't assess your own mood
#define TRAIT_DNR "do_not_revive" // Can't be revived without supernatural means or admin intervention
#define TRAIT_HARD_SOLES "hard_soles" // No step on glass
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_OVERSIZED" = TRAIT_OVERSIZED,
"TRAIT_OXYIMMUNE" = TRAIT_OXYIMMUNE,
"TRAIT_PERSONALSPACE" = TRAIT_PERSONALSPACE,
"TRAIT_QUICKREFLEXES" = TRAIT_QUICKREFLEXES,
"TRAIT_PET_OWNER" = TRAIT_PET_OWNER,
"TRAIT_R_UNIQUEWRECK" = TRAIT_R_UNIQUEWRECK,
"TRAIT_R_UNIQUETIP" = TRAIT_R_UNIQUETIP,
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_OVERSIZED" = TRAIT_OVERSIZED,
"TRAIT_OXYIMMUNE" = TRAIT_OXYIMMUNE,
"TRAIT_PERSONALSPACE" = TRAIT_PERSONALSPACE,
"TRAIT_QUICKREFLEXES" = TRAIT_QUICKREFLEXES,
"TRAIT_PET_OWNER" = TRAIT_PET_OWNER,
"TRAIT_R_UNIQUEWRECK" = TRAIT_R_UNIQUEWRECK,
"TRAIT_R_UNIQUETIP" = TRAIT_R_UNIQUETIP,
Expand Down
18 changes: 16 additions & 2 deletions code/datums/ai/_ai_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ multiple modular subtrees with behaviors
/datum/ai_controller/Destroy(force, ...)
set_ai_status(AI_STATUS_OFF)
UnpossessPawn(FALSE)
set_movement_target(type, null)
if(ai_movement.moving_controllers[src])
ai_movement.stop_moving_towards(src)
return ..()

///Sets the current movement target, with an optional param to override the movement behavior
Expand Down Expand Up @@ -118,6 +121,7 @@ multiple modular subtrees with behaviors
reset_ai_status()
RegisterSignal(pawn, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_changed))
RegisterSignal(pawn, COMSIG_MOB_LOGIN, PROC_REF(on_sentience_gained))
RegisterSignal(pawn, COMSIG_QDELETING, PROC_REF(on_pawn_qdeleted))

/// Sets the AI on or off based on current conditions, call to reset after you've manually disabled it somewhere
/datum/ai_controller/proc/reset_ai_status()
Expand Down Expand Up @@ -152,7 +156,7 @@ multiple modular subtrees with behaviors
if(isnull(pawn))
return // instantiated without an applicable pawn, fine

UnregisterSignal(pawn, list(COMSIG_MOB_LOGIN, COMSIG_MOB_LOGOUT, COMSIG_MOB_STATCHANGE))
UnregisterSignal(pawn, list(COMSIG_MOB_LOGIN, COMSIG_MOB_LOGOUT, COMSIG_MOB_STATCHANGE, COMSIG_QDELETING))
if(ai_movement.moving_controllers[src])
ai_movement.stop_moving_towards(src)
pawn.ai_controller = null
Expand Down Expand Up @@ -230,6 +234,8 @@ multiple modular subtrees with behaviors
///Determines whether the AI can currently make a new plan
/datum/ai_controller/proc/able_to_plan()
. = TRUE
if(QDELETED(pawn))
return FALSE
for(var/datum/ai_behavior/current_behavior as anything in current_behaviors)
if(!(current_behavior.behavior_flags & AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION)) //We have a behavior that blocks planning
. = FALSE
Expand Down Expand Up @@ -296,7 +302,7 @@ multiple modular subtrees with behaviors
if(length(arguments))
behavior_args[behavior_type] = arguments
else
behavior_args[behavior_type] = null
behavior_args -= behavior_type

/datum/ai_controller/proc/ProcessBehavior(seconds_per_tick, datum/ai_behavior/behavior)
var/list/arguments = list(seconds_per_tick, src)
Expand Down Expand Up @@ -334,6 +340,14 @@ multiple modular subtrees with behaviors
set_ai_status(AI_STATUS_ON) //Can't do anything while player is connected
RegisterSignal(pawn, COMSIG_MOB_LOGIN, PROC_REF(on_sentience_gained))

// Turn the controller off the controller if the pawn has been qdeleted
/datum/ai_controller/proc/on_pawn_qdeleted()
SIGNAL_HANDLER
set_ai_status(AI_STATUS_OFF)
set_movement_target(type, null)
if(ai_movement.moving_controllers[src])
ai_movement.stop_moving_towards(src)

/// Use this proc to define how your controller defines what access the pawn has for the sake of pathfinding. Return the access list you want to use
/datum/ai_controller/proc/get_access()
return
Expand Down
2 changes: 2 additions & 0 deletions code/datums/ai/babies/babies_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@
if(!succeeded)
return
var/mob/living/living_pawn = controller.pawn
if(QDELETED(living_pawn)) // pawn can be null at this point
return
living_pawn.set_combat_mode(initial(living_pawn.combat_mode))
2 changes: 2 additions & 0 deletions code/datums/ai/bane/bane_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
if(succeeded)
var/list/bane_quotes = strings("bane.json", "bane")
var/mob/living/bane = controller.pawn
if(QDELETED(bane)) // pawn can be null at this point
return ..()
bane.say(pick(bane_quotes))
return ..()
2 changes: 2 additions & 0 deletions code/datums/ai/basic_mobs/basic_ai_behaviors/climb_tree.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
. = ..()
var/obj/structure/flora/target_tree = controller.blackboard[target_key]
var/mob/living/basic/living_pawn = controller.pawn
if(QDELETED(living_pawn)) // pawn can be null at this point
return
SEND_SIGNAL(living_pawn, COMSIG_LIVING_CLIMB_TREE, target_tree)
finish_action(controller, TRUE, target_key)

Expand Down
6 changes: 3 additions & 3 deletions code/datums/ai/basic_mobs/basic_ai_behaviors/unbuckle_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
. = ..()

var/mob/living/living_pawn = controller.pawn
var/atom/movable/buckled_too = living_pawn.buckled
var/atom/movable/buckled_to = living_pawn.buckled

if(isnull(buckled_too))
if(isnull(buckled_to))
finish_action(controller, FALSE)
return

buckled_too.unbuckle_mob(living_pawn)
buckled_to.unbuckle_mob(living_pawn)
finish_action(controller, TRUE)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/datum/ai_planning_subtree/opportunistic_ventcrawler

/datum/ai_planning_subtree/opportunistic_ventcrawler/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
if(QDELETED(controller.pawn) || HAS_TRAIT(controller.pawn, TRAIT_MOVE_VENTCRAWLING))
if(HAS_TRAIT(controller.pawn, TRAIT_MOVE_VENTCRAWLING))
return SUBTREE_RETURN_FINISH_PLANNING // hold on let me cook

var/obj/machinery/atmospherics/components/unary/vent_pump/target = controller.blackboard[BB_ENTRY_VENT_TARGET]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
finish_action(controller, FALSE, ability_key, target_key)
return
var/mob/pawn = controller.pawn
if (ability.InterceptClickOn(pawn, null, target))
if(QDELETED(pawn) || ability.InterceptClickOn(pawn, null, target))
finish_action(controller, TRUE, ability_key, target_key)

/datum/ai_behavior/pet_use_ability/finish_action(datum/ai_controller/controller, succeeded, ability_key, target_key)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/basic_mobs/pet_commands/play_dead.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/datum/ai_behavior/play_dead/finish_action(datum/ai_controller/controller, succeeded)
. = ..()
var/mob/living/basic/basic_pawn = controller.pawn
if(!istype(basic_pawn) || basic_pawn.stat) // imagine actually dying while playing dead. hell, imagine being the kid waiting for your pup to get back up :(
if(QDELETED(basic_pawn) || basic_pawn.stat) // imagine actually dying while playing dead. hell, imagine being the kid waiting for your pup to get back up :(
return
basic_pawn.visible_message(span_notice("[basic_pawn] miraculously springs back to life!"))
REMOVE_TRAIT(basic_pawn, TRAIT_FAKEDEATH, BASIC_MOB_DEATH_TRAIT)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ai/generic/generic_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
/datum/ai_behavior/break_spine/finish_action(datum/ai_controller/controller, succeeded, target_key)
if(succeeded)
var/mob/living/bane = controller.pawn
if(QDELETED(bane)) // pawn can be null at this point
return ..()
bane.stop_pulling()
controller.clear_blackboard_key(target_key)
return ..()
Expand Down Expand Up @@ -283,8 +285,6 @@
. = ..()
controller.clear_blackboard_key(BB_FOLLOW_TARGET)



/datum/ai_behavior/perform_emote

/datum/ai_behavior/perform_emote/perform(seconds_per_tick, datum/ai_controller/controller, emote, speech_sound)
Expand Down
2 changes: 0 additions & 2 deletions code/datums/ai/generic/generic_subtrees.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
*/
/datum/ai_planning_subtree/generic_resist/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
var/mob/living/living_pawn = controller.pawn
if(QDELETED(living_pawn))
return

if(SHOULD_RESIST(living_pawn) && SPT_PROB(RESIST_SUBTREE_PROB, seconds_per_tick))
controller.queue_behavior(/datum/ai_behavior/resist) //BRO IM ON FUCKING FIRE BRO
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/hunting_behavior/hunting_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return
var/mob/living/living_pawn = controller.pawn
// We can't hunt if we're indisposed
if(QDELETED(living_pawn) || HAS_TRAIT(controller.pawn, TRAIT_HANDS_BLOCKED) || living_pawn.stat != CONSCIOUS)
if(HAS_TRAIT(controller.pawn, TRAIT_HANDS_BLOCKED) || living_pawn.stat != CONSCIOUS)
return

var/atom/hunted = controller.blackboard[target_key]
Expand Down
4 changes: 3 additions & 1 deletion code/datums/ai/monkey/monkey_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@
/datum/ai_behavior/monkey_attack_mob/finish_action(datum/ai_controller/controller, succeeded, target_key)
. = ..()
var/mob/living/living_pawn = controller.pawn
SSmove_manager.stop_looping(living_pawn)
controller.clear_blackboard_key(target_key)
if(QDELETED(living_pawn)) // pawn can be null at this point
return
SSmove_manager.stop_looping(living_pawn)

/// attack using a held weapon otherwise bite the enemy, then if we are angry there is a chance we might calm down a little
/datum/ai_behavior/monkey_attack_mob/proc/monkey_attack(datum/ai_controller/controller, mob/living/target, seconds_per_tick, disarm)
Expand Down
2 changes: 0 additions & 2 deletions code/datums/ai/monkey/monkey_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ have ways of interacting with a specific mob and control it.

/datum/ai_controller/monkey/proc/set_trip_mode(mode = TRUE)
var/mob/living/carbon/regressed_monkey = pawn
if(QDELETED(regressed_monkey))
return
var/brain = regressed_monkey.get_organ_slot(ORGAN_SLOT_BRAIN)
if(istype(brain, /obj/item/organ/internal/brain/primate)) // In case we are a monkey AI in a human brain by who was previously controlled by a client but it now not by some marvel
var/obj/item/organ/internal/brain/primate/monkeybrain = brain
Expand Down
3 changes: 0 additions & 3 deletions code/datums/ai/monkey/monkey_subtrees.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
///monkey combat subtree.
/datum/ai_planning_subtree/monkey_combat/SelectBehaviors(datum/ai_controller/monkey/controller, seconds_per_tick)
var/mob/living/living_pawn = controller.pawn
if(QDELETED(living_pawn))
return

var/list/enemies = controller.blackboard[BB_MONKEY_ENEMIES]

if((HAS_TRAIT(controller.pawn, TRAIT_PACIFISM)) || (!length(enemies) && !controller.blackboard[BB_MONKEY_AGGRESSIVE])) //Pacifist, or we have no enemies and we're not pissed
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/robot_customer/robot_customer_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
var/mob/living/greytider = controller.blackboard[BB_CUSTOMER_CURRENT_TARGET]
//usually if we stop waiting, it's because we're done with the venue. but here we're either beating some dude up
//or are being qdeleted and don't want runtime errors, so don't switch to leaving
if(greytider || QDELETED(src))
if(greytider || QDELETED(src) || QDELETED(customer_pawn))
return
controller.set_blackboard_key(BB_CUSTOMER_LEAVING, TRUE)
customer_pawn.update_icon() //They might have a special leaving accesoiry (french flag)
Expand Down
3 changes: 2 additions & 1 deletion code/datums/brain_damage/creepy_trauma.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
var/obsession_hug_count = 0

/datum/brain_trauma/special/obsessed/on_gain()

//setup, linking, etc//
if(!obsession)//admins didn't set one
obsession = find_obsession()
Expand All @@ -34,6 +33,7 @@
//antag stuff//
antagonist.forge_objectives(obsession.mind)
antagonist.greet()
log_game("[key_name(antagonist)] has developed an obsession with [key_name(obsession)].")
RegisterSignal(owner, COMSIG_CARBON_HELPED, PROC_REF(on_hug))

/datum/brain_trauma/special/obsessed/on_life(seconds_per_tick, times_fired)
Expand Down Expand Up @@ -69,6 +69,7 @@
owner.mind.remove_antag_datum(/datum/antagonist/obsessed)
owner.clear_mood_event("creeping")
if(obsession)
log_game("[key_name(owner)] is no longer obsessed with [key_name(obsession)].")
UnregisterSignal(obsession, COMSIG_MOB_EYECONTACT)

/datum/brain_trauma/special/obsessed/handle_speech(datum/source, list/speech_args)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/crafting/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
result = /mob/living/simple_animal/bot/secbot/ed209
reqs = list(
/obj/item/robot_suit = 1,
/obj/item/clothing/head/helmet = 1,
/obj/item/clothing/head/helmet/sec = 1,
/obj/item/clothing/suit/armor/vest = 1,
/obj/item/bodypart/leg/left/robot = 1,
/obj/item/bodypart/leg/right/robot = 1,
Expand Down
15 changes: 14 additions & 1 deletion code/datums/components/on_hit_effect.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
var/datum/callback/on_hit_callback
///callback optionally used for more checks
var/datum/callback/extra_check_callback
///optionally should we also apply the effect if thrown at something?
var/thrown_effect

/datum/component/on_hit_effect/Initialize(on_hit_callback, extra_check_callback)
/datum/component/on_hit_effect/Initialize(on_hit_callback, extra_check_callback, thrown_effect = FALSE)
src.on_hit_callback = on_hit_callback
src.extra_check_callback = extra_check_callback
if(!(ismachinery(parent) || isstructure(parent) || isgun(parent) || isprojectilespell(parent) || isitem(parent) || isanimal_or_basicmob(parent) || isprojectile(parent)))
return ELEMENT_INCOMPATIBLE
src.thrown_effect = thrown_effect

/datum/component/on_hit_effect/Destroy(force, silent)
on_hit_callback = null
Expand All @@ -33,12 +36,16 @@
else if(isprojectile(parent))
RegisterSignal(parent, COMSIG_PROJECTILE_SELF_ON_HIT, PROC_REF(on_projectile_self_hit))

if(thrown_effect)
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, PROC_REF(on_thrown_hit))

/datum/component/on_hit_effect/UnregisterFromParent()
UnregisterSignal(parent, list(
COMSIG_PROJECTILE_ON_HIT,
COMSIG_ITEM_AFTERATTACK,
COMSIG_HOSTILE_POST_ATTACKINGTARGET,
COMSIG_PROJECTILE_SELF_ON_HIT,
COMSIG_MOVABLE_IMPACT,
))

/datum/component/on_hit_effect/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
Expand Down Expand Up @@ -79,3 +86,9 @@
if(!extra_check_callback.Invoke(firer, target))
return
on_hit_callback.Invoke(source, firer, target, body_zone)

/datum/component/on_hit_effect/proc/on_thrown_hit(datum/source, atom/hit_atom, datum/thrownthing/throwingdatum)
SIGNAL_HANDLER
if(extra_check_callback && !extra_check_callback.Invoke(source, hit_atom))
return
on_hit_callback.Invoke(source, source, hit_atom, null)
4 changes: 2 additions & 2 deletions code/datums/components/tackle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@

/datum/component/tackler/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_CLICKON, PROC_REF(checkTackle))
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, PROC_REF(sack))
RegisterSignal(parent, COMSIG_MOVABLE_PRE_IMPACT, PROC_REF(sack))
RegisterSignal(parent, COMSIG_MOVABLE_POST_THROW, PROC_REF(registerTackle))

/datum/component/tackler/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOB_CLICKON, COMSIG_MOVABLE_IMPACT, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_POST_THROW))
UnregisterSignal(parent, list(COMSIG_MOB_CLICKON, COMSIG_MOVABLE_PRE_IMPACT, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_POST_THROW))

///Store the thrownthing datum for later use
/datum/component/tackler/proc/registerTackle(mob/living/carbon/user, datum/thrownthing/tackle)
Expand Down
Loading

0 comments on commit 528b40b

Please sign in to comment.