mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
Introducing more weather types! And yes, you can now have rain be reagent based! <details> <summary>Regular Rain</summary>  </details> <details> <summary>Blood Rain</summary>  </details> <details> <summary>Acid Rain</summary>  </details> You can even make it rain ants, plasma, or drugs. All of their effects get applied to turfs, objects, and mobs depending on the weather options you select. Did I mention... there is thunder? <details> <summary>Thunder Strikes</summary>  </details> <details> <summary>Sand Storms</summary>  </details> Despite all this new stuff, none of it has been directly added to the game but the code can be used in the future for: - Wizard event - Similar to lava on floor, but this time make the reagent random or picked from a list and give wizard immunity - Chaplain ability - Maybe make this a benefit or ability once enough favor has been obtained - Admin events - I have added a BUNCH of admin tooling to run customized weather events that let you control a lot of options - New station maps/biomes for downstreams (Jungle Station, etc.) - Change Ion storms to use the new weather system that triggers EMP/thunder effects across the station - IceBox could get plasma rain - Lavaland could get thunder effects applied to ash storms Relevant PRs that removed/added some of the weather stuff I used: - #60303 - #25222 --- - Rain sprites were added via [novaepee](https://github.com/novaepee) in https://github.com/tgstation/TerraGov-Marine-Corps/pull/9675 - Sand sprites were added via [TiviPlus](https://github.com/TiviPlus) (who commissioned them from bimmer) in https://github.com/tgstation/TerraGov-Marine-Corps/pull/4645 - Rain sounds [already existed on tg](https://github.com/tgstation/tgstation/pull/25222#discussion_r106794579) and were provided by provided by Cuboos, using Royalty Free sounds, presumed under default tg sound license - Creative Commons 3.0 BY-SA - Siren sound is from siren.wav by IFartInUrGeneralDirection -- [Freesound](https://freesound.org/s/46092/) -- License: Attribution 4.0 The original `siren.ogg` sound used on a lot of SS13 servers doesn't seem to have any attribution that I could locate. The sound was added about 15 years ago. So I just looked for a somewhat similar sounding siren noise on Freesound. More weather customization! 🆑 add: Added new weather types for rain and sandstorms. Rain now uses a reagent that gets exposed to the turfs, mobs, and objects. There is also a thunder strike setting you can apply to any weather. add: Hydro trays and soil will now add reagents to their trays when exposed to a chemical reaction. (weather, shower, chem spills, foam grenades, etc.) add: Weather temperature now affects weather reagents and mobs body temperature. bal: Snowstorm temperature calculations were tweaked to allow universal weather temperature effects. sound: Added weather sounds from TGMC for rain and sirens (attributed to Cuboos and IFartInUrGeneralDirection ) image: Added weather images from TGMC for rain and sand storms (attributed to Novaepee and Bimmer) refactor: Refactored a lot of the weather code to be more robust admin: Admins can now control more weather related options when running weather events. The weather admin verbs have been moved to their own "Weather" category under the Admin tab. /🆑 --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
134 lines
5.0 KiB
Plaintext
134 lines
5.0 KiB
Plaintext
/// Component that allows a user to control any object as if it were a mob. Does give the user incorporeal movement.
|
|
/datum/component/object_possession
|
|
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
|
/// Stores a reference to the obj that we are currently possessing.
|
|
var/obj/possessed = null
|
|
/// Ref to the screen object that is currently being displayed.
|
|
var/datum/weakref/screen_alert_ref = null
|
|
/**
|
|
* back up of the real name during user possession
|
|
*
|
|
* When a user possesses an object its real name is set to the user name and this
|
|
* stores whatever the real name was previously. When possession ends, the real name
|
|
* is reset to this value
|
|
*/
|
|
var/stashed_name = null
|
|
|
|
/datum/component/object_possession/Initialize(obj/target)
|
|
. = ..()
|
|
if(!isobj(target) || !ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
if(!bind_to_new_object(target))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
var/mob/user = parent
|
|
screen_alert_ref = WEAKREF(user.throw_alert(ALERT_UNPOSSESS_OBJECT, /atom/movable/screen/alert/unpossess_object))
|
|
|
|
// we can expect to be possessed by either a nonliving or a living mob
|
|
RegisterSignals(parent, list(COMSIG_MOB_CLIENT_PRE_LIVING_MOVE, COMSIG_MOB_CLIENT_PRE_NON_LIVING_MOVE), PROC_REF(on_move))
|
|
RegisterSignals(parent, list(COMSIG_MOB_GHOSTIZED, COMSIG_KB_ADMIN_AGHOST_DOWN), PROC_REF(end_possession))
|
|
|
|
/datum/component/object_possession/Destroy()
|
|
cleanup_object_binding()
|
|
UnregisterSignal(parent, list(
|
|
COMSIG_KB_ADMIN_AGHOST_DOWN,
|
|
COMSIG_MOB_CLIENT_PRE_LIVING_MOVE,
|
|
COMSIG_MOB_CLIENT_PRE_NON_LIVING_MOVE,
|
|
COMSIG_MOB_GHOSTIZED,
|
|
))
|
|
|
|
var/mob/user = parent
|
|
var/atom/movable/screen/alert/alert_to_clear = screen_alert_ref?.resolve()
|
|
if(!QDELETED(alert_to_clear))
|
|
user.clear_alert(ALERT_UNPOSSESS_OBJECT)
|
|
|
|
return ..()
|
|
|
|
/datum/component/object_possession/InheritComponent(datum/component/object_possession/old_component, i_am_original, obj/target)
|
|
cleanup_object_binding()
|
|
if(!bind_to_new_object(target))
|
|
qdel(src)
|
|
|
|
stashed_name = old_component.stashed_name
|
|
|
|
/// Binds the mob to the object and sets up the naming and everything.
|
|
/// Returns FALSE if we don't bind, TRUE if we succeed.
|
|
/datum/component/object_possession/proc/bind_to_new_object(obj/target)
|
|
if((target.obj_flags & DANGEROUS_POSSESSION) && CONFIG_GET(flag/forbid_singulo_possession))
|
|
to_chat(parent, "[target] is too powerful for you to possess.", confidential = TRUE)
|
|
return FALSE
|
|
|
|
var/mob/user = parent
|
|
|
|
stashed_name = user.real_name
|
|
possessed = target
|
|
|
|
user.forceMove(target)
|
|
user.real_name = target.name
|
|
user.name = target.name
|
|
user.reset_perspective(target)
|
|
|
|
target.AddElement(/datum/element/weather_listener, /datum/weather/ash_storm, ZTRAIT_ASHSTORM, GLOB.ash_storm_sounds)
|
|
target.AddElement(/datum/element/weather_listener, /datum/weather/snow_storm, ZTRAIT_SNOWSTORM, GLOB.snowstorm_sounds)
|
|
target.AddElement(/datum/element/weather_listener, /datum/weather/rain_storm, ZTRAIT_RAINSTORM, GLOB.rain_storm_sounds)
|
|
target.AddElement(/datum/element/weather_listener, /datum/weather/sand_storm, ZTRAIT_SANDSTORM, GLOB.sand_storm_sounds)
|
|
|
|
RegisterSignal(target, COMSIG_QDELETING, PROC_REF(end_possession))
|
|
return TRUE
|
|
|
|
/// Cleans up everything pertinent to the current possessed object.
|
|
/datum/component/object_possession/proc/cleanup_object_binding()
|
|
if(QDELETED(possessed))
|
|
return
|
|
|
|
var/mob/poltergeist = parent
|
|
|
|
possessed.RemoveElement(/datum/element/weather_listener, /datum/weather/ash_storm, ZTRAIT_ASHSTORM, GLOB.ash_storm_sounds)
|
|
possessed.RemoveElement(/datum/element/weather_listener, /datum/weather/rain_storm, ZTRAIT_RAINSTORM, GLOB.rain_storm_sounds)
|
|
possessed.RemoveElement(/datum/element/weather_listener, /datum/weather/sand_storm, ZTRAIT_SANDSTORM, GLOB.sand_storm_sounds)
|
|
possessed.RemoveElement(/datum/element/weather_listener, /datum/weather/snow_storm, ZTRAIT_SNOWSTORM, GLOB.snowstorm_sounds)
|
|
UnregisterSignal(possessed, COMSIG_QDELETING)
|
|
|
|
if(!isnull(stashed_name))
|
|
poltergeist.real_name = stashed_name
|
|
poltergeist.name = stashed_name
|
|
if(ishuman(poltergeist))
|
|
var/mob/living/carbon/human/human_user = poltergeist
|
|
human_user.name = human_user.get_visible_name()
|
|
|
|
poltergeist.forceMove(get_turf(possessed))
|
|
poltergeist.reset_perspective()
|
|
|
|
possessed = null
|
|
|
|
/**
|
|
* force move the parent object instead of the source mob.
|
|
*
|
|
* Has no sanity other than checking the possed obj's density. this means it effectively has incorporeal movement, making it only good for badminnery.
|
|
*
|
|
* We always want to return `COMPONENT_MOVABLE_BLOCK_PRE_MOVE` here regardless
|
|
*/
|
|
/datum/component/object_possession/proc/on_move(datum/source, new_loc, direct)
|
|
SIGNAL_HANDLER
|
|
. = COMPONENT_MOVABLE_BLOCK_PRE_MOVE // both signals that invoke this are explicitly tied to listen for this define as the return value
|
|
|
|
if(QDELETED(possessed))
|
|
return .
|
|
|
|
if(!possessed.density)
|
|
possessed.forceMove(get_step(possessed, direct))
|
|
else
|
|
step(possessed, direct)
|
|
|
|
if(QDELETED(possessed))
|
|
return .
|
|
|
|
possessed.setDir(direct)
|
|
return .
|
|
|
|
/// Just the overall "get me outta here" proc.
|
|
/datum/component/object_possession/proc/end_possession(datum/source)
|
|
SIGNAL_HANDLER
|
|
qdel(src)
|