Files
GhomandGitHub 54df8cab2d Moved a few monkeys features out of species code (+ updated a couple infusion organs) (#96735)
## About The Pull Request
Title. I'm moving a few monkey features away from the species and into
its bodyparts and organs. I plan on following up with another PR for the
various `ismonkey()` in the code, as these are necessary changes for a
niche thing I'm ultimately working on.

Also one carp organ and one stoat organ both had bits of code made
redundant by available traits. This takes care of them.
Also removed the passwindow_on/off and passtable_on/off procs. We can
just register the associated trait signals on init for living mobs (plus
they were being misused on non-mobs).

## Why It's Good For The Game
Less code associated directly to the species and more to its body parts
and organs, which is basically something we've been doing for a few
years ~~(also I need it for skeletonized monkeys)~~.

## Changelog
N/A
2026-07-11 21:51:39 +01:00

111 lines
4.4 KiB
Plaintext

// Action that toggles flight onto the mob.
/datum/action/item_action/toggle_flight
name = "Activate Flight Jets"
desc = "Activates the jet boot's miniturized rocket thrusters, allowing for sustained flight."
button_icon = 'icons/mob/actions/actions_items.dmi'
button_icon_state = "jet_boot_toggle"
/// Managed overlay for the fire produced from flight.
var/mutable_appearance/jet_fire
/// Audio loop for when the jet boot flight is active.
var/datum/looping_sound/burning_jet/burning_audio
/datum/action/item_action/toggle_flight/New(Target)
. = ..()
jet_fire = mutable_appearance('icons/effects/effects.dmi', "jetfire")
jet_fire.pixel_z = -4
burning_audio = new(target)
/datum/action/item_action/toggle_flight/Destroy()
. = ..()
QDEL_NULL(jet_fire)
QDEL_NULL(burning_audio)
/datum/action/item_action/toggle_flight/Grant(mob/grant_to)
. = ..()
grant_to.AddComponent( \
/datum/component/jetpack, \
FALSE, \
2 NEWTONS, \
COMSIG_JETBOOTS_ACTIVE, \
COMSIG_JETBOOTS_INACTIVE, \
null, \
CALLBACK(src, PROC_REF(can_fly)), \
CALLBACK(src, PROC_REF(can_fly)), \
/datum/effect_system/trail_follow/smoke, \
)
/datum/action/item_action/toggle_flight/Remove(mob/remove_from)
. = ..()
if(HAS_TRAIT_FROM(remove_from, TRAIT_MOVE_FLOATING, SHOES_TRAIT))
switch_flight()
/datum/action/item_action/toggle_flight/do_effect(trigger_flags)
if(!ishuman(owner))
to_chat(owner, span_warning("Your shoes aren't built with you in mind, unfortunately."))
return FALSE
if(!target)
return FALSE
switch_flight()
return TRUE
/// Proc that toggles between flight behavior on the mob being on and off, including the mob's flight, gravity, passtable, and the sounds/visuals.
/datum/action/item_action/toggle_flight/proc/switch_flight()
var/obj/item/clothing/shoes/bhop/rocket/jet/target_shoes = target
var/mob/living/carbon/human/human_owner = owner
if(!HAS_TRAIT_FROM(human_owner, TRAIT_MOVE_FLOATING, SHOES_TRAIT))
//functional
human_owner.physiology.stun_mod *= 2
human_owner.add_traits(list(TRAIT_MOVE_FLOATING, TRAIT_IGNORING_GRAVITY, TRAIT_NOGRAV_ALWAYS_DRIFT), SHOES_TRAIT)
human_owner.add_movespeed_modifier(/datum/movespeed_modifier/jetpack/shoes)
human_owner.AddElement(/datum/element/forced_gravity, 0)
SEND_SIGNAL(human_owner, COMSIG_JETBOOTS_ACTIVE, human_owner)
ADD_TRAIT(human_owner, TRAIT_PASSTABLE, SHOES_TRAIT)
to_chat(human_owner, span_notice("You click your jet boots together and begin to hover gently above the ground..."))
human_owner.set_resting(FALSE, TRUE)
human_owner.refresh_gravity()
RegisterSignals(human_owner, list(COMSIG_LIVING_STATUS_STUN, COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_LIVING_STATUS_PARALYZE), PROC_REF(switch_flight))
//visuals
burning_audio.start()
human_owner.add_overlay(jet_fire)
target_shoes.flight_active = TRUE
target_shoes.update_appearance(UPDATE_ICON_STATE)
human_owner.update_appearance(UPDATE_OVERLAYS)
return
//functional
human_owner.physiology.stun_mod *= 0.5
human_owner.remove_traits(list(TRAIT_MOVE_FLOATING, TRAIT_IGNORING_GRAVITY, TRAIT_NOGRAV_ALWAYS_DRIFT), SHOES_TRAIT)
human_owner.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/shoes)
human_owner.RemoveElement(/datum/element/forced_gravity, 0)
SEND_SIGNAL(human_owner, COMSIG_JETBOOTS_INACTIVE, human_owner)
REMOVE_TRAIT(human_owner, TRAIT_PASSTABLE, SHOES_TRAIT)
to_chat(human_owner, span_notice("You're lowered back onto the ground..."))
human_owner.refresh_gravity()
UnregisterSignal(human_owner, list(COMSIG_LIVING_STATUS_STUN, COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_LIVING_STATUS_PARALYZE))
//visuals
burning_audio.stop()
human_owner.cut_overlay(jet_fire)
target_shoes.flight_active = FALSE
target_shoes.update_appearance(UPDATE_ICON_STATE)
human_owner.update_appearance(UPDATE_OVERLAYS)
/// Largely lifted off of wing's can_fly proc, tailored to the jet boots functionality.
/datum/action/item_action/toggle_flight/proc/can_fly()
var/mob/living/carbon/human/human = owner
if(human.stat || human.body_position == LYING_DOWN || isnull(human.client))
return FALSE
var/turf/location = get_turf(human)
if(!location)
return FALSE
if(human.get_item_by_slot(ITEM_SLOT_LEGCUFFED))
to_chat(human, span_warning("Your legs are bound! Free yourself first!"))
return FALSE
var/datum/gas_mixture/environment = location.return_air()
if(environment?.return_pressure() < HAZARD_LOW_PRESSURE + 10)
to_chat(human, span_warning("The atmosphere is too thin for you to fly!"))
return FALSE
return TRUE