Files
Captain277andGitHub e2ba2b1adb Minor Layout Adjustment to Archaic Temple and Statue Component Bugfix (#6019)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

1. **Makes Layout Adjustments to Archaic Temple POI.**
2. **Adds New Ranged Trap Subtype.**
3. **Adds Female Statue Side and Back Sprites.**
4. **Bugfixes Unobserved Actor Component.**

## Why It's Good For The Game

1. _Minor adjustments to the POI that I don't want to describe in the PR
due to their connection to the mechanics. Repair of the door icons,
minor housekeeping._
2. _Having the traps fire non-stop is a little unfun. Even if they can
be jammed, sometimes it's neat to give them a limited chain of blasts._
3. _The male had side and back sprites but the female didn't. I just
kinda tweaked the male to fit._
4. _It was discovered that Ghosts able to see a statue were counting as
observers for the unobserved actor component, effectively crippling the
statue._

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
tweak: Layout Changes to Archaic Temple
add: Adds New Launcher Trap Type
fix: Adds Sprites to Female Statue
fix: Fixes Bug in Unobserved Actor Component
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
2023-09-25 19:46:17 -06:00

120 lines
4.0 KiB
Plaintext

/**
* ### Unobserved Actor
*
* Blocks certain actions while this mob is being observed by something.
*/
/datum/component/unobserved_actor
/// Dictates what behaviour you're blocked from while observed
var/unobserved_flags = NONE
/// Cooldown to prevent message spam when holding a move button
COOLDOWN_DECLARE(message_cooldown)
/datum/component/unobserved_actor/Initialize(unobserved_flags = NONE)
. = ..()
if (!isliving(parent))
return ELEMENT_INCOMPATIBLE
if (unobserved_flags == NONE)
CRASH("No behaviour flags provided to unobserved actor element")
src.unobserved_flags = unobserved_flags
/datum/component/unobserved_actor/RegisterWithParent()
if (unobserved_flags & NO_OBSERVED_MOVEMENT)
RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_tried_move))
RegisterSignal(parent, COMSIG_ATOM_PRE_DIR_CHANGE, PROC_REF(on_tried_turn))
// if (unobserved_flags & NO_OBSERVED_ACTIONS)
// RegisterSignal(parent, COMSIG_MOB_ABILITY_STARTED, PROC_REF(on_tried_ability))
// RegisterSignal(parent, COMSIG_MOB_BEFORE_SPELL_CAST, PROC_REF(on_tried_spell))
if (unobserved_flags & NO_OBSERVED_ATTACKS)
RegisterSignal(parent, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(on_tried_attack))
/datum/component/unobserved_actor/UnregisterFromParent()
UnregisterSignal(parent, list(
COMSIG_MOVABLE_PRE_MOVE,
COMSIG_ATOM_PRE_DIR_CHANGE,
// COMSIG_MOB_ABILITY_STARTED,
// COMSIG_MOB_BEFORE_SPELL_CAST,
COMSIG_HOSTILE_PRE_ATTACKINGTARGET,
))
return ..()
/// Called when the mob tries to move
/datum/component/unobserved_actor/proc/on_tried_move(mob/living/source)
SIGNAL_HANDLER
if (!check_if_seen(source))
return
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
/// Called when the mob tries to change direction
/datum/component/unobserved_actor/proc/on_tried_turn(mob/living/source)
SIGNAL_HANDLER
if (!check_if_seen(source))
return
return COMPONENT_ATOM_BLOCK_DIR_CHANGE
/*
/// Called when the mob tries to use an ability
/datum/component/unobserved_actor/proc/on_tried_ability(mob/living/source)
SIGNAL_HANDLER
if (!check_if_seen(source))
return
return COMPONENT_BLOCK_ABILITY_START
/// Called when the mob tries to cast a spell
/datum/component/unobserved_actor/proc/on_tried_spell(mob/living/source)
SIGNAL_HANDLER
if (!check_if_seen(source))
return
return SPELL_CANCEL_CAST
*/
/// Called when the mob tries to attack
/datum/component/unobserved_actor/proc/on_tried_attack(mob/living/source)
SIGNAL_HANDLER
if (!check_if_seen(source))
return
return COMPONENT_HOSTILE_NO_ATTACK
/// Checks if the mob is visible to something else, and provides a balloon alert of feedback if appropriate.
/datum/component/unobserved_actor/proc/check_if_seen(mob/living/source)
var/observed = can_be_seen(source)
if (observed && COOLDOWN_FINISHED(src, message_cooldown))
// source.balloon_alert(source, "something can see you!")
to_chat(source, "something can see you!")
COOLDOWN_START(src, message_cooldown, 1 SECONDS)
return observed
/**
* Returns true if you can be seen by something.
* Not a very robust algorithm but it'll work in the majority of situations.
*/
/datum/component/unobserved_actor/proc/can_be_seen(mob/living/source)
var/turf/my_turf = get_turf(source)
// Check for darkness
if(my_turf.lighting_overlay && my_turf.get_lumcount() < 0.1) // No one can see us in the darkness, right?
return FALSE
var/view_size
if(source.client)
view_size = source.client.view
else
view_size = world.view
// We aren't in darkness, loop for viewers.
for(var/mob/living/mob_target in oviewers(my_turf, view_size)) // They probably cannot see us if we cannot see them... can they?
if(mob_target.client && !mob_target.is_blind() && !mob_target.silicon_privileges && !HAS_TRAIT(mob_target, TRAIT_UNOBSERVANT))
return TRUE
for(var/obj/vehicle/vehicle_target in oview(my_turf, view_size))
for(var/mob/vehicle_mob_target in vehicle_target.occupants)
if(vehicle_mob_target.client && !vehicle_mob_target.is_blind() && !HAS_TRAIT(vehicle_mob_target, TRAIT_UNOBSERVANT))
return TRUE
return FALSE