Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Fluffy-Frontier/FluffySTG
Browse files Browse the repository at this point in the history
…into upstream-mirror-24456
  • Loading branch information
Iajret committed Oct 20, 2023
2 parents 9c1a8e8 + f64cf6c commit 9604752
Show file tree
Hide file tree
Showing 160 changed files with 1,178 additions and 644 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/ai/monsters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#define BB_CURRENT_HOME "BB_current_home"
///the hydro we will pollinate
#define BB_TARGET_HYDRO "BB_target_hydro"
///key to swarm around
#define BB_SWARM_TARGET "BB_swarm_target"

// bear keys
///the hive with honey that we will steal from
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
///from base of atom/fire_act(): (exposed_temperature, exposed_volume)
#define COMSIG_ATOM_FIRE_ACT "atom_fire_act"
///from base of atom/bullet_act(): (/obj/projectile, def_zone)
#define COMSIG_ATOM_PRE_BULLET_ACT "pre_atom_bullet_act"
/// All this does is prevent default bullet on_hit from being called, [BULLET_ACT_HIT] being return is implied
#define COMPONENT_BULLET_ACTED (1<<0)
/// Forces bullet act to return [BULLET_ACT_BLOCK], takes priority over above
#define COMPONENT_BULLET_BLOCKED (1<<1)
/// Forces bullet act to return [BULLET_ACT_FORCE_PIERCE], takes priority over above
#define COMPONENT_BULLET_PIERCED (1<<2)
///from base of atom/bullet_act(): (/obj/projectile, def_zone)
#define COMSIG_ATOM_BULLET_ACT "atom_bullet_act"
///from base of atom/CheckParts(): (list/parts_list, datum/crafting_recipe/R)
#define COMSIG_ATOM_CHECKPARTS "atom_checkparts"
Expand Down
3 changes: 3 additions & 0 deletions code/__HELPERS/dynamic_human_icon_gen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ GLOBAL_LIST_EMPTY(dynamic_human_appearances)
/proc/get_dynamic_human_appearance(outfit_path, species_path = /datum/species/human, mob_spawn_path, r_hand, l_hand, bloody_slots = NONE, animated = TRUE)
if(!species_path)
return FALSE
if(!ispath(species_path))
stack_trace("Attempted to call get_dynamic_human_appearance() with an instantiated species_path. Pass the species datum typepath instead.")
return FALSE
var/arg_string = "[outfit_path]_[species_path]_[mob_spawn_path]_[l_hand]_[r_hand]_[bloody_slots]"
if(GLOB.dynamic_human_appearances[arg_string]) //if already exists in our cache, just return that
return GLOB.dynamic_human_appearances[arg_string]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
var/list/airlocks = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)
for(var/i in 1 to run_distance)
var/turf/test_destination = get_ranged_target_turf_direct(source, target, range = i, offset = angle)
if(test_destination.is_blocked_turf(exclude_mobs = !source.density, source_atom = source, ignore_atoms = airlocks))
if(test_destination.is_blocked_turf(source_atom = source, ignore_atoms = airlocks))
break
return_turf = test_destination
return return_turf
Expand Down
36 changes: 9 additions & 27 deletions code/datums/ai/basic_mobs/targetting_datums/dont_target_friends.dm
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
/// Don't target an atom in our friends list (or turfs), anything else is fair game
/datum/targetting_datum/not_friends
/datum/targetting_datum/basic/not_friends
/// Stop regarding someone as a valid target once they pass this stat level, setting it to DEAD means you will happily attack corpses
var/attack_until_past_stat = HARD_CRIT
/// If we can try to closed turfs or not
var/attack_closed_turf = FALSE

///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if (!target)
return FALSE
if (attack_closed_turf)
if (isopenturf(target))
return FALSE
else
if (isturf(target))
return FALSE

if (ismob(target))
var/mob/mob_target = target
if (mob_target.status_flags & GODMODE)
return FALSE
if (mob_target.stat > attack_until_past_stat)
return FALSE
/datum/targetting_datum/basic/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if(attack_closed_turf && isclosedturf(target))
return TRUE

if (living_mob.see_invisible < target.invisibility)
return FALSE
if (isturf(target.loc) && living_mob.z != target.z) // z check will always fail if target is in a mech
return FALSE
if (!living_mob.ai_controller) // How did you get here?
if(target in living_mob.ai_controller.blackboard[BB_FRIENDS_LIST])
return FALSE

if (!(target in living_mob.ai_controller.blackboard[BB_FRIENDS_LIST]))
// We don't have any friends, anything's fair game
// OR This is not our friend, fire at will
return TRUE
return ..()

///friends dont care about factions
/datum/targetting_datum/basic/not_friends/faction_check(mob/living/living_mob, mob/living/the_target)
return FALSE

/datum/targetting_datum/not_friends/attack_closed_turfs
/datum/targetting_datum/basic/not_friends/attack_closed_turfs
attack_closed_turf = TRUE

/// Subtype that allows us to target items while deftly avoiding attacking our allies. Be careful when it comes to targetting items as an AI could get trapped targetting something it can't destroy.
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ai/dog/dog_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/not_friends(),
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_dog
Expand All @@ -19,7 +19,7 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/not_friends(),
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
// Find nearby mobs with tongs in hand.
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/holding_object(/obj/item/kitchen/tongs),
BB_BABIES_PARTNER_TYPES = list(/mob/living/basic/pet/dog),
Expand Down
1 change: 1 addition & 0 deletions code/datums/brain_damage/split_personality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
/datum/brain_trauma/severe/split_personality/blackout/on_gain()
. = ..()
RegisterSignal(owner, COMSIG_ATOM_SPLASHED, PROC_REF(on_splashed))
notify_ghosts("[owner] is blacking out!", source = owner, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Bro I'm not even drunk right now")

/datum/brain_trauma/severe/split_personality/blackout/on_lose()
. = ..()
Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/cult_ritual_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@
for(var/shielded_turf in spiral_range_turfs(1, cultist, 1))
LAZYADD(shields, new /obj/structure/emergency_shield/cult/narsie(shielded_turf))

notify_ghosts("[cultist] has begun scribing a Nar'Sie rune!", source = cultist, action = NOTIFY_ORBIT, header = "Maranax Infirmux!")

return TRUE

/*
Expand Down
4 changes: 3 additions & 1 deletion code/datums/components/pet_commands/pet_commands_basic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
radial_icon = 'icons/testing/turf_analysis.dmi'
radial_icon_state = "red_arrow"
speech_commands = list("heel", "follow")
///the behavior we use to follow
var/follow_behavior = /datum/ai_behavior/pet_follow_friend

/datum/pet_command/follow/set_command_active(mob/living/parent, mob/living/commander)
. = ..()
set_command_target(parent, commander)

/datum/pet_command/follow/execute_action(datum/ai_controller/controller)
controller.queue_behavior(/datum/ai_behavior/pet_follow_friend, BB_CURRENT_PET_TARGET)
controller.queue_behavior(follow_behavior, BB_CURRENT_PET_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING

/**
Expand Down
5 changes: 3 additions & 2 deletions code/datums/components/singularity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
)
AddComponent(/datum/component/connect_loc_behalf, parent, loc_connections)

RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, PROC_REF(consume_bullets))
RegisterSignal(parent, COMSIG_ATOM_PRE_BULLET_ACT, PROC_REF(consume_bullets))

if (notify_admins)
admin_investigate_setup()
Expand All @@ -127,7 +127,7 @@
COMSIG_ATOM_ATTACK_PAW,
COMSIG_ATOM_BLOB_ACT,
COMSIG_ATOM_BSA_BEAM,
COMSIG_ATOM_BULLET_ACT,
COMSIG_ATOM_PRE_BULLET_ACT,
COMSIG_ATOM_BUMPED,
COMSIG_MOVABLE_PRE_MOVE,
COMSIG_ATOM_ATTACKBY,
Expand Down Expand Up @@ -180,6 +180,7 @@
SIGNAL_HANDLER

qdel(projectile)
return COMPONENT_BULLET_BLOCKED

/// Calls singularity_act on the thing passed, usually destroying the object
/datum/component/singularity/proc/default_singularity_act(atom/thing)
Expand Down
26 changes: 26 additions & 0 deletions code/datums/components/vision_hurting.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// A component that damages eyes that look at the owner
/datum/component/vision_hurting
var/damage_per_second
var/message

/datum/component/vision_hurting/Initialize(damage_per_second=1, message="Your eyes burn as you look at")
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE

src.damage_per_second = damage_per_second
src.message = message

START_PROCESSING(SSdcs, src)

/datum/component/vision_hurting/process(seconds_per_tick)
for(var/mob/living/carbon/viewer in viewers(parent))
if(viewer.is_blind() || viewer.get_eye_protection() >= damage_per_second)
continue
var/obj/item/organ/internal/eyes/burning_orbs = locate() in viewer.organs
if(!burning_orbs)
continue
burning_orbs.apply_organ_damage(damage_per_second * seconds_per_tick)
if(SPT_PROB(50, seconds_per_tick))
to_chat(viewer, span_userdanger("[message] [parent]!"))
if(SPT_PROB(20, seconds_per_tick))
viewer.emote("scream")
4 changes: 4 additions & 0 deletions code/datums/looping_sounds/item_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@
end_volume = 35
volume = 40
ignore_walls = FALSE

/datum/looping_sound/beesmoke
mid_sounds = list('sound/weapons/beesmoke.ogg' = 1)
volume = 5
4 changes: 0 additions & 4 deletions code/datums/martial/_martial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,3 @@
if(help_verb)
remove_verb(holder_living, help_verb)
return

///Gets called when a projectile hits the owner. Returning anything other than BULLET_ACT_HIT will stop the projectile from hitting the mob.
/datum/martial_art/proc/on_projectile_hit(mob/living/attacker, obj/projectile/P, def_zone)
return BULLET_ACT_HIT
27 changes: 17 additions & 10 deletions code/datums/martial/sleeping_carp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
return
target.add_traits(list(TRAIT_NOGUNS, TRAIT_HARDLY_WOUNDED, TRAIT_NODISMEMBER), SLEEPING_CARP_TRAIT)
RegisterSignal(target, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby))
RegisterSignal(target, COMSIG_ATOM_PRE_BULLET_ACT, PROC_REF(hit_by_projectile))
target.faction |= FACTION_CARP //:D

/datum/martial_art/the_sleeping_carp/on_remove(mob/living/target)
target.remove_traits(list(TRAIT_NOGUNS, TRAIT_HARDLY_WOUNDED, TRAIT_NODISMEMBER), SLEEPING_CARP_TRAIT)
UnregisterSignal(target, COMSIG_ATOM_ATTACKBY)
UnregisterSignal(target, COMSIG_ATOM_PRE_BULLET_ACT)
target.faction -= FACTION_CARP //:(
. = ..()

Expand Down Expand Up @@ -113,6 +115,8 @@
return ..()

/datum/martial_art/the_sleeping_carp/proc/can_deflect(mob/living/carp_user)
if(!can_use(carp_user) || !carp_user.throw_mode)
return FALSE
if(carp_user.incapacitated(IGNORE_GRAB)) //NO STUN
return FALSE
if(!(carp_user.mobility_flags & MOBILITY_USE)) //NO UNABLE TO USE
Expand All @@ -124,17 +128,20 @@
return FALSE
return TRUE

/datum/martial_art/the_sleeping_carp/on_projectile_hit(mob/living/carp_user, obj/projectile/P, def_zone)
. = ..()
/datum/martial_art/the_sleeping_carp/proc/hit_by_projectile(mob/living/carp_user, obj/projectile/hitting_projectile, def_zone)
SIGNAL_HANDLER

if(!can_deflect(carp_user))
return BULLET_ACT_HIT
if(carp_user.throw_mode)
carp_user.visible_message(span_danger("[carp_user] effortlessly swats the projectile aside! They can block bullets with their bare hands!"), span_userdanger("You deflect the projectile!"))
playsound(get_turf(carp_user), pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg'), 75, TRUE)
P.firer = carp_user
P.set_angle(rand(0, 360))//SHING
return BULLET_ACT_FORCE_PIERCE
return BULLET_ACT_HIT
return NONE

carp_user.visible_message(
span_danger("[carp_user] effortlessly swats [hitting_projectile] aside! [carp_user.p_They()] can block bullets with [carp_user.p_their()] bare hands!"),
span_userdanger("You deflect [hitting_projectile]!"),
)
playsound(carp_user, pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg'), 75, TRUE)
hitting_projectile.firer = carp_user
hitting_projectile.set_angle(rand(0, 360))//SHING
return COMPONENT_BULLET_PIERCED

///Signal from getting attacked with an item, for a special interaction with touch spells
/datum/martial_art/the_sleeping_carp/proc/on_attackby(mob/living/carp_user, obj/item/attack_weapon, mob/attacker, params)
Expand Down
6 changes: 2 additions & 4 deletions code/datums/status_effects/debuffs/fire_stacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@
if(!on_fire)
return TRUE

if(HAS_TRAIT(owner, TRAIT_HUSK))
adjust_stacks(-2 * seconds_between_ticks)
else
adjust_stacks(owner.fire_stack_decay_rate * seconds_between_ticks)
var/decay_multiplier = HAS_TRAIT(owner, TRAIT_HUSK) ? 2 : 1 // husks decay twice as fast
adjust_stacks(owner.fire_stack_decay_rate * decay_multiplier * seconds_between_ticks)

if(stacks <= 0)
qdel(src)
Expand Down
2 changes: 2 additions & 0 deletions code/game/atom_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@

/// A cut-out proc for [/atom/proc/bullet_act] so living mobs can have their own armor behavior checks without causing issues with needing their own on_hit call
/atom/proc/check_projectile_armor(def_zone, obj/projectile/impacting_projectile, is_silent)
if(uses_integrity)
return clamp(PENETRATE_ARMOUR(get_armor_rating(impacting_projectile.armor_flag), impacting_projectile.armour_penetration), 0, 100)
return 0
32 changes: 23 additions & 9 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -586,19 +586,33 @@
/**
* React to a hit by a projectile object
*
* Default behaviour is to send the [COMSIG_ATOM_BULLET_ACT] and then call [on_hit][/obj/projectile/proc/on_hit] on the projectile.
*
* @params
* hitting_projectile - projectile
* def_zone - zone hit
* piercing_hit - is this hit piercing or normal?
* * hitting_projectile - projectile
* * def_zone - zone hit
* * piercing_hit - is this hit piercing or normal?
*/
/atom/proc/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE)
SHOULD_CALL_PARENT(TRUE)

var/sigreturn = SEND_SIGNAL(src, COMSIG_ATOM_PRE_BULLET_ACT, hitting_projectile, def_zone)
if(sigreturn & COMPONENT_BULLET_PIERCED)
return BULLET_ACT_FORCE_PIERCE
if(sigreturn & COMPONENT_BULLET_BLOCKED)
return BULLET_ACT_BLOCK
if(sigreturn & COMPONENT_BULLET_ACTED)
return BULLET_ACT_HIT

SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, hitting_projectile, def_zone)
// This armor check only matters for the visuals and messages in on_hit(), it's not actually used to reduce damage since
// only living mobs use armor to reduce damage, but on_hit() is going to need the value no matter what is shot.
var/visual_armor_check = check_projectile_armor(def_zone, hitting_projectile)
. = hitting_projectile.on_hit(src, visual_armor_check, def_zone, piercing_hit)
if(QDELETED(hitting_projectile)) // Signal deleted it?
return BULLET_ACT_BLOCK

return hitting_projectile.on_hit(
target = src,
// This armor check only matters for the visuals and messages in on_hit(), it's not actually used to reduce damage since
// only living mobs use armor to reduce damage, but on_hit() is going to need the value no matter what is shot.
blocked = check_projectile_armor(def_zone, hitting_projectile),
pierce_hit = piercing_hit,
)

///Return true if we're inside the passed in atom
/atom/proc/in_contents_of(container)//can take class or object instance as argument
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/effects/phased_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
/obj/effect/dummy/phased_mob/ex_act()
return FALSE

/obj/effect/dummy/phased_mob/bullet_act(blah)
/obj/effect/dummy/phased_mob/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE)
SHOULD_CALL_PARENT(FALSE)
return BULLET_ACT_FORCE_PIERCE

/obj/effect/dummy/phased_mob/relaymove(mob/living/user, direction)
Expand Down
Loading

0 comments on commit 9604752

Please sign in to comment.