mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-03-28 15:04:38 +00:00
About The Pull Request I've reworked multiz. This was done because our current implementation of multiz flattens planes down into just the openspace plane. This breaks any effects we attach to plane masters (including lighting), but it also totally kills the SIDE_MAP map format, which we NEED for wallening (A major 3/4ths resprite of all wall and wall adjacent things, making them more then one tile high. Without sidemap we would be unable to display things both in from of and behind objects on map. Stupid.) This required MASSIVE changes. Both to all uses of the plane var for reasons I'll discuss later, and to a ton of different systems that interact with rendering. I'll do my best to keep this compact, but there's only so much I can do. Sorry brother. Core idea OK: first thing. vis_contents as it works now squishes the planes of everything inside it down into the plane of the vis_loc. This is bad. But how to do better? It's trivially easy to make copies of our existing plane masters but offset, and relay them to the bottom of the plane above. Not a problem. The issue is how to get the actual atoms on the map to "land" on them properly. We could use FLOAT_PLANE to offset planes based off how they're being seen, in theory this would allow us to create lens for how objects are viewed. But that's not a stable thing to do, because properly "landing" a plane on a desired plane master would require taking into account every bit of how it's being seen, would inherently break this effect. Ok so we need to manually edit planes based off "z layer" (IE: what layer of a z stack are you on). That's the key conceit of this pr. Implementing the plane cube, and ensuring planes are always offset properly. Everything else is just gravy. About the Plane Cube Each plane master (except ones that opt out) is copied down by some constant value equal to the max absolute change between the first and the last plane. We do this based off the max z stack size detected by SSmapping. This is also where updates come from, and where all our updating logic will live. As mentioned, plane masters can choose to opt out of being mirrored down. In this case, anything that interacts with them assuming that they'll be offset will instead just get back the valid plane value. This works for render targets too, since I had to work them into the system as well. Plane masters can also be temporarily hidden from the client's screen. This is done as an attempt at optimization, and applies to anything used in niche cases, or planes only used if there's a z layer below you. About Plane Master Groups BYOND supports having different "maps" on screen at once (IE: groups of items/turfs/etc) Plane masters cannot cover 2 maps at once, since their location is determined by their screen_loc. So we need to maintain a mirror of each plane for every map we have open. This was quite messy, so I've refactored it (and maps too) to be a bit more modular. Rather then storing a list of plane masters, we store a list of plane master group datums. Each datum is in charge of the plane masters for its particular map, both creating them, and managing them. Like I mentioned, I also refactored map views. Adding a new mapview is now as simple as newing a /atom/movable/screen/map_view, calling generate_view with the appropriate map id, setting things you want to display in its vis_contents, and then calling display_to on it, passing in the mob to show ourselves to. Much better then the hardcoded pattern we used to use. So much duplicated code man. Oh and plane master controllers, that system we have that allows for applying filters to sets of plane masters? I've made it use lookups on plane master groups now, rather then hanging references to all impacted planes. This makes logic easier, and prevents the need to manage references and update the controllers. image In addition, I've added a debug ui for plane masters. It allows you to view all of your own plane masters and short descriptions of what they do, alongside tools for editing them and their relays. It ALSO supports editing someone elses plane masters, AND it supports (in a very fragile and incomplete manner) viewing literally through someone else's eyes, including their plane masters. This is very useful, because it means you can debug "hey my X is yorked" issues yourself, on live. In order to accomplish this I have needed to add setters for an ungodly amount of visual impacting vars. Sight flags, eye, see_invis, see_in_dark, etc. It also comes with an info dump about the ui, and plane masters/relays in general. Sort of on that note. I've documented everything I know that's niche/useful about our visual effects and rendering system. My hope is this will serve to bring people up to speed on what can be done more quickly, alongside making my sin here less horrible. See https://github.com/LemonInTheDark/tgstation/blob/multiz-hell/.github/guides/VISUALS.md. "Landing" planes Ok so I've explained the backend, but how do we actually land planes properly? Most of the time this is really simple. When a plane var is set, we need to provide some spokesperson for the appearance's z level. We can use this to derive their z layer, and thus what offset to use. This is just a lot of gruntwork, but it's occasionally more complex. Sometimes we need to cache a list of z layer -> effect, and then use that. Also a LOT of updating on z move. So much z move shit. Oh. and in order to make byond darkness work properly, I needed to add SEE_BLACKNESS to all sight flags. This draws darkness to plane 0, which means I'm able to relay it around and draw it on different z layers as is possible. fun darkness ripple effects incoming someday I also need to update mob overlays on move. I do this by realiizing their appearances, mutating their plane, and then readding the overlay in the correct order. The cost of this is currently 3N. I'm convinced this could be improved, but I've not got to it yet. It can also occasionally cause overlays to corrupt. This is fixed by laying a protective ward of overlays.Copy in the sand, but that spell makes the compiler confused, so I'll have to bully lummy about fixing it at some point. Behavior changes We've had to give up on the already broken gateway "see through" effect. Won't work without managing gateway plane masters or something stupid. Not worth it. So instead we display the other side as a ui element. It's worse, but not that bad. Because vis_contents no longer flattens planes (most of the time), some uses of it now have interesting behavior. The main thing that comes to mind is alert popups that display mobs. They can impact the lighting plane. I don't really care, but it should be fixable, I think, given elbow grease. Ah and I've cleaned up layers and plane defines to make them a bit easier to read/reason about, at least I think. Why It's Good For The Game <visual candy> Fixes #65800 Fixes #68461 Changelog cl refactor: Refactored... well a lot really. Map views, anything to do with planes, multiz, a shit ton of rendering stuff. Basically if you see anything off visually report it admin: VV a mob, and hit View/Edit Planes in the dropdown to steal their view, and modify it as you like. You can do the same to yourself using the Edit/Debug Planes verb /cl
228 lines
8.3 KiB
Plaintext
228 lines
8.3 KiB
Plaintext
/**
|
|
* The mob, usually meant to be a creature of some type
|
|
*
|
|
* Has a client attached that is a living person (most of the time), although I have to admit
|
|
* sometimes it's hard to tell they're sentient
|
|
*
|
|
* Has a lot of the creature game world logic, such as health etc
|
|
*/
|
|
/mob
|
|
density = TRUE
|
|
layer = MOB_LAYER
|
|
plane = GAME_PLANE_FOV_HIDDEN
|
|
animate_movement = SLIDE_STEPS
|
|
hud_possible = list(ANTAG_HUD)
|
|
pressure_resistance = 8
|
|
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
|
throwforce = 10
|
|
blocks_emissive = EMISSIVE_BLOCK_GENERIC
|
|
pass_flags_self = PASSMOB
|
|
/// The current client inhabiting this mob. Managed by login/logout
|
|
/// This exists so we can do cleanup in logout for occasions where a client was transfere rather then destroyed
|
|
/// We need to do this because the mob on logout never actually has a reference to client
|
|
/// We also need to clear this var/do other cleanup in client/Destroy, since that happens before logout
|
|
/// HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
|
|
var/client/canon_client
|
|
|
|
var/shift_to_open_context_menu = TRUE
|
|
|
|
var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
|
|
var/datum/mind/mind
|
|
var/static/next_mob_id = 0
|
|
|
|
/// List of movement speed modifiers applying to this mob
|
|
var/list/movespeed_modification //Lazy list, see mob_movespeed.dm
|
|
/// List of movement speed modifiers ignored by this mob. List -> List (id) -> List (sources)
|
|
var/list/movespeed_mod_immunities //Lazy list, see mob_movespeed.dm
|
|
/// The calculated mob speed slowdown based on the modifiers list
|
|
var/cached_multiplicative_slowdown
|
|
/// List of action speed modifiers applying to this mob
|
|
var/list/actionspeed_modification //Lazy list, see mob_movespeed.dm
|
|
/// List of action speed modifiers ignored by this mob. List -> List (id) -> List (sources)
|
|
var/list/actionspeed_mod_immunities //Lazy list, see mob_movespeed.dm
|
|
/// The calculated mob action speed slowdown based on the modifiers list
|
|
var/cached_multiplicative_actions_slowdown
|
|
/// List of action hud items the user has
|
|
var/list/datum/action/actions
|
|
/// A list of chameleon actions we have specifically
|
|
/// This can be unified with the actions list
|
|
var/list/datum/action/item_action/chameleon/chameleon_item_actions
|
|
///Cursor icon used when holding shift over things
|
|
var/examine_cursor_icon = 'icons/effects/mouse_pointers/examine_pointer.dmi'
|
|
|
|
///Whether this mob has or is in the middle of committing suicide.
|
|
var/suiciding = FALSE
|
|
|
|
/// Whether a mob is alive or dead. TODO: Move this to living - Nodrak (2019, still here)
|
|
var/stat = CONSCIOUS
|
|
|
|
/* A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob.
|
|
A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such.
|
|
The current method unnecessarily clusters up the variable list, especially for humans (although rearranging won't really clean it up a lot but the difference will be noticable for other mobs).
|
|
I'll make some notes on where certain variable defines should probably go.
|
|
Changing this around would probably require a good look-over the pre-existing code.
|
|
*/
|
|
|
|
/// The zone this mob is currently targeting
|
|
var/zone_selected = BODY_ZONE_CHEST
|
|
|
|
var/computer_id = null
|
|
var/list/logging = list()
|
|
|
|
/// The machine the mob is interacting with (this is very bad old code btw)
|
|
var/obj/machinery/machine = null
|
|
|
|
/// Tick time the mob can next move
|
|
var/next_move = null
|
|
|
|
/**
|
|
* Magic var that stops you moving and interacting with anything
|
|
*
|
|
* Set when you're being turned into something else and also used in a bunch of places
|
|
* it probably shouldn't really be
|
|
*/
|
|
var/notransform = null //Carbon
|
|
|
|
/// Is the mob blind
|
|
var/eye_blind = 0 //Carbon
|
|
/// Does the mob have blurry sight
|
|
var/eye_blurry = 0 //Carbon
|
|
/// What is the mobs real name (name is overridden for disguises etc)
|
|
var/real_name = null
|
|
|
|
/**
|
|
* back up of the real name during admin possession
|
|
*
|
|
* If an admin possesses an object it's real name is set to the admin name and this
|
|
* stores whatever the real name was previously. When possession ends, the real name
|
|
* is reset to this value
|
|
*/
|
|
var/name_archive //For admin things like possession
|
|
|
|
/// Default body temperature
|
|
var/bodytemperature = BODYTEMP_NORMAL //310.15K / 98.6F
|
|
/// Our body temperatue as of the last process, prevents pointless work when handling alerts
|
|
var/old_bodytemperature = 0
|
|
/// Drowsyness level of the mob
|
|
var/drowsyness = 0//Carbon
|
|
/// Hunger level of the mob
|
|
var/nutrition = NUTRITION_LEVEL_START_MIN // randomised in Initialize
|
|
/// Satiation level of the mob
|
|
var/satiety = 0//Carbon
|
|
|
|
/// How many ticks this mob has been over reating
|
|
var/overeatduration = 0 // How long this guy is overeating //Carbon
|
|
|
|
/// The movement intent of the mob (run/wal)
|
|
var/m_intent = MOVE_INTENT_RUN//Living
|
|
|
|
/// The last known IP of the client who was in this mob
|
|
var/lastKnownIP = null
|
|
|
|
/// movable atom we are buckled to
|
|
var/atom/movable/buckled = null//Living
|
|
|
|
//Hands
|
|
///What hand is the active hand
|
|
var/active_hand_index = 1
|
|
/**
|
|
* list of items held in hands
|
|
*
|
|
* len = number of hands, eg: 2 nulls is 2 empty hands, 1 item and 1 null is 1 full hand
|
|
* and 1 empty hand.
|
|
*
|
|
* NB: contains nulls!
|
|
*
|
|
* `held_items[active_hand_index]` is the actively held item, but please use
|
|
* [get_active_held_item()][/mob/proc/get_active_held_item] instead, because OOP
|
|
*/
|
|
var/list/held_items = list()
|
|
|
|
//HUD things
|
|
|
|
/// Storage component (for mob inventory)
|
|
var/datum/storage/active_storage
|
|
/// Active hud
|
|
var/datum/hud/hud_used = null
|
|
|
|
/// Is the mob throw intent on
|
|
var/throw_mode = THROW_MODE_DISABLED
|
|
|
|
/// What job does this mob have
|
|
var/job = null//Living
|
|
|
|
/// A list of factions that this mob is currently in, for hostile mob targetting, amongst other things
|
|
var/list/faction = list("neutral")
|
|
|
|
/// Can this mob enter shuttles
|
|
var/move_on_shuttle = 1
|
|
|
|
///A weakref to the last mob/living/carbon to push/drag/grab this mob (exclusively used by slimes friend recognition)
|
|
var/datum/weakref/LAssailant = null
|
|
|
|
/// bitflags defining which status effects can be inflicted (replaces canknockdown, canstun, etc)
|
|
var/status_flags = CANSTUN|CANKNOCKDOWN|CANUNCONSCIOUS|CANPUSH
|
|
|
|
/// Can they interact with station electronics
|
|
var/has_unlimited_silicon_privilege = FALSE
|
|
|
|
///Used by admins to possess objects. All mobs should have this var
|
|
var/obj/control_object
|
|
|
|
///Calls relay_move() to whatever this is set to when the mob tries to move
|
|
var/atom/movable/remote_control
|
|
|
|
///the current turf being examined in the stat panel
|
|
var/turf/listed_turf = null
|
|
|
|
///The list of people observing this mob.
|
|
var/list/observers = null
|
|
|
|
///List of progress bars this mob is currently seeing for actions
|
|
var/list/progressbars = null //for stacking do_after bars
|
|
|
|
///For storing what do_after's someone has, key = string, value = amount of interactions of that type happening.
|
|
var/list/do_afters
|
|
|
|
///Allows a datum to intercept all click calls this mob is the source of
|
|
var/datum/click_intercept
|
|
|
|
///THe z level this mob is currently registered in
|
|
var/registered_z = null
|
|
|
|
var/memory_throttle_time = 0
|
|
|
|
/// Contains [/atom/movable/screen/alert] only.
|
|
///
|
|
/// On [/mob] so clientless mobs will throw alerts properly.
|
|
var/list/alerts = list()
|
|
var/list/screens = list()
|
|
var/list/client_colours = list()
|
|
var/hud_type = /datum/hud
|
|
|
|
var/datum/focus //What receives our keyboard inputs. src by default
|
|
|
|
/// Used for tracking last uses of emotes for cooldown purposes
|
|
var/list/emotes_used
|
|
|
|
///Whether the mob is updating glide size when movespeed updates or not
|
|
var/updating_glide_size = TRUE
|
|
|
|
///Override for sound_environments. If this is set the user will always hear a specific type of reverb (Instead of the area defined reverb)
|
|
var/sound_environment_override = SOUND_ENVIRONMENT_NONE
|
|
|
|
/// A mock client, provided by tests and friends
|
|
var/datum/client_interface/mock_client
|
|
|
|
var/interaction_range = 0 //how far a mob has to be to interact with something without caring about obsctruction, defaulted to 0 tiles
|
|
|
|
///the icon currently used for the typing indicator's bubble
|
|
var/active_typing_indicator
|
|
///the icon currently used for the thinking indicator's bubble
|
|
var/active_thinking_indicator
|
|
/// User is thinking in character. Used to revert to thinking state after stop_typing
|
|
var/thinking_IC = FALSE
|
|
|
|
///how much gravity is slowing us down
|
|
var/gravity_slowdown = 0
|