Skip to content

Commit

Permalink
codestyle доработочка
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoonij authored Nov 14, 2024
1 parent 4b056b9 commit 1c15eed
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 73 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define ABOVE_GAME_PLANE -2

///Slightly above the game plane but does not catch mouse clicks. Useful for certain visuals that should be clicked through, like seethrough trees
/// Slightly above the game plane but does not catch mouse clicks. Useful for certain visuals that should be clicked through, like seethrough trees
#define SEETHROUGH_PLANE -2

#define RENDER_PLANE_GAME_WORLD -1
Expand Down
54 changes: 23 additions & 31 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,60 +33,52 @@
/// Turf has lube on the floor and mobs will slip
#define TURF_WET_LUBE (1<<3)

//spisjeno with TG


#define CHANGETURF_DEFER_CHANGE (1<<0)
#define CHANGETURF_IGNORE_AIR (1<<1) // This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air
#define CHANGETURF_FORCEOP (1<<2)
#define CHANGETURF_SKIP (1<<3) // A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE
#define CHANGETURF_INHERIT_AIR (1<<4) // Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR
#define CHANGETURF_RECALC_ADJACENT (1<<5) //Immediately recalc adjacent atmos turfs instead of queuing.
#define CHANGETURF_DEFER_CHANGE (1<<0)
#define CHANGETURF_IGNORE_AIR (1<<1) // This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air
#define CHANGETURF_FORCEOP (1<<2)
#define CHANGETURF_SKIP (1<<3) // A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE
#define CHANGETURF_INHERIT_AIR (1<<4) // Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR
#define CHANGETURF_RECALC_ADJACENT (1<<5) // Immediately recalc adjacent atmos turfs instead of queuing.
#define CHANGETURF_TRAPDOOR_INDUCED (1<<6) // Caused by a trapdoor, for trapdoor to know that this changeturf was caused by itself

/// Returns all turfs in a zlevel
#define Z_TURFS(ZLEVEL) block(locate(1, 1, ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL))

///Returns all turfs in a zlevel
#define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL))

///Returns all currently loaded turfs
/// Returns all currently loaded turfs
#define ALL_TURFS(...) block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))

#define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3]))




#define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3]))

/// The pipes, disposals, and wires are hidden
#define UNDERFLOOR_HIDDEN 0
#define UNDERFLOOR_HIDDEN 0
/// The pipes, disposals, and wires are visible but cannot be interacted with
#define UNDERFLOOR_VISIBLE 1
#define UNDERFLOOR_VISIBLE 1
/// The pipes, disposals, and wires are visible and can be interacted with
#define UNDERFLOOR_INTERACTABLE 2


/// Turf has superlube on the floor and mobs will slip even if they are crawling
#define TURF_WET_SUPERLUBE (1<<4)


// Defines for turfs rust resistance
#define RUST_RESISTANCE_BASIC 1
#define RUST_RESISTANCE_REINFORCED 2
#define RUST_RESISTANCE_TITANIUM 3
#define RUST_RESISTANCE_ORGANIC 4
#define RUST_RESISTANCE_ABSOLUTE 5

#define RUST_RESISTANCE_BASIC 1
#define RUST_RESISTANCE_REINFORCED 2
#define RUST_RESISTANCE_TITANIUM 3
#define RUST_RESISTANCE_ORGANIC 4
#define RUST_RESISTANCE_ABSOLUTE 5

/// Define the alpha for holiday/colored tile decals
#define DECAL_ALPHA 60

/// Generate horizontal striped color turf decals
#define PATTERN_DEFAULT "default"
#define PATTERN_DEFAULT "default"
/// Generate vertical striped color turf decals
#define PATTERN_VERTICAL_STRIPE "vertical"
/// Generate random color turf decals
#define PATTERN_RANDOM "random"
#define PATTERN_RANDOM "random"
/// Generate rainbow color turf decals
#define PATTERN_RAINBOW "rainbow"
#define PATTERN_RAINBOW "rainbow"

/**
* Finds the midpoint of two given turfs.
Expand All @@ -99,7 +91,7 @@
#define LARGE_TURF_SMOOTHING_Y_OFFSET -9

/// Defines a consistent light power for our various basalt turfs
#define BASALT_LIGHT_POWER 0.6
#define BASALT_LIGHT_POWER 0.6
/// Defines a consistent light range for basalt turfs that have a bigger area of lava
#define BASALT_LIGHT_RANGE_BRIGHT 2
#define BASALT_LIGHT_RANGE_BRIGHT 2

35 changes: 17 additions & 18 deletions code/__HELPERS/see_through_maps.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
//For these defines, check also above for their actual shapes in-game and maybe get a better idea
// For these defines, check also above for their actual shapes in-game and maybe get a better idea

///Default shape. It's one tile above the atom
#define SEE_THROUGH_MAP_DEFAULT "default"
///A 3x3 area 2 tiles above the atom (trees love to be this shape)
#define SEE_THROUGH_MAP_THREE_X_THREE "3x3"
///2 tiles above the atom
#define SEE_THROUGH_MAP_DEFAULT_TWO_TALL "default_two_tall"
///two rows of three tiles above the atom (small but thick trees love these)
#define SEE_THROUGH_MAP_THREE_X_TWO "3x2"
///One row of three tiles above the atom, but offset one tile to the left because of how billboards work
#define SEE_THROUGH_MAP_BILLBOARD "billboard"
///Two rows of three wide, but offset one tile to the left because thats how shipping containers work
#define SEE_THROUGH_MAP_SHIPPING_CONTAINER "shipping_container"
///Seethrough component for the ratvar wreck, in shape of the ratvar wreck
#define SEE_THROUGH_MAP_RATVAR_WRECK "ratvar"
/// Default shape. It's one tile above the atom
#define SEE_THROUGH_MAP_DEFAULT "default"
/// A 3x3 area 2 tiles above the atom (trees love to be this shape)
#define SEE_THROUGH_MAP_THREE_X_THREE "3x3"
/// 2 tiles above the atom
#define SEE_THROUGH_MAP_DEFAULT_TWO_TALL "default_two_tall"
/// two rows of three tiles above the atom (small but thick trees love these)
#define SEE_THROUGH_MAP_THREE_X_TWO "3x2"
/// One row of three tiles above the atom, but offset one tile to the left because of how billboards work
#define SEE_THROUGH_MAP_BILLBOARD "billboard"
/// Two rows of three wide, but offset one tile to the left because thats how shipping containers work
#define SEE_THROUGH_MAP_SHIPPING_CONTAINER "shipping_container"
/// Seethrough component for the ratvar wreck, in shape of the ratvar wreck
#define SEE_THROUGH_MAP_RATVAR_WRECK "ratvar"


/**global statics for the see_through_component coordinate maps
/** global statics for the see_through_component coordinate maps
* For ease of use, include a comment in the shape of the coordinate map, where O is nothing, X is a hidden tile and A is the object
* List-coordinate layout is list(relative_x, relative_y, relative_z)
* Turf finding algorithm needs the z and you can totally use it, but I can't think of any reason to ever do it
Expand Down Expand Up @@ -68,7 +67,7 @@ GLOBAL_LIST_INIT(see_through_maps, list(
list(0, 1, 0), list(1, 1, 0), list(2, 1, 0),
list(0, 0, 0), list(1, 0, 0), list(2, 0, 0)
),
//No
// No
SEE_THROUGH_MAP_RATVAR_WRECK = list(
list(3, 5, 0), list(4, 5, 0), list(5, 5, 0), list(6, 5, 0),
list(3, 4, 0), list(4, 4, 0), list(5, 4, 0), list(6, 4, 0), list(7, 4, 0), list(9, 4, 0),
Expand Down
44 changes: 22 additions & 22 deletions code/datums/components/seetouch.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
///A component that lets you turn an object invisible when you're standing on certain relative turfs to it, like behind a tree
/// A component that lets you turn an object invisible when you're standing on certain relative turfs to it, like behind a tree
/datum/component/seethrough
///List of lists that represent relative coordinates to the source atom
/// List of lists that represent relative coordinates to the source atom
var/list/relative_turf_coords
///A list of turfs on which we make ourself transparent
/// A list of turfs on which we make ourself transparent
var/list/watched_turfs
///Associate list, with client = trickery_image. Track which client is being tricked with which image
/// Associate list, with client = trickery_image. Track which client is being tricked with which image
var/list/tricked_mobs = list()

///Which alpha do we animate towards?
/// Which alpha do we animate towards?
var/target_alpha
///How long our fase in/out takes
/// How long our fase in/out takes
var/animation_time
///After we somehow moved (because ss13 is godless and does not respect anything), how long do we need to stand still to feel safe to setup our "behind" area again
/// After we somehow moved (because ss13 is godless and does not respect anything), how long do we need to stand still to feel safe to setup our "behind" area again
var/perimeter_reset_timer
///Does this object let clicks from players its transparent to pass through it
/// Does this object let clicks from players its transparent to pass through it
var/clickthrough

///see_through_map is a define pointing to a specific map. It's basically defining the area which is considered behind. See see_through_maps.dm for a list of maps
/// see_through_map is a define pointing to a specific map. It's basically defining the area which is considered behind. See see_through_maps.dm for a list of maps
/datum/component/seethrough/Initialize(see_through_map = SEE_THROUGH_MAP_DEFAULT, target_alpha = 100, animation_time = 0.5 SECONDS, perimeter_reset_timer = 2 SECONDS, clickthrough = TRUE)
. = ..()

Expand All @@ -36,7 +36,7 @@

setup_perimeter(parent)

///Loop through a list with relative coordinate lists to mark those tiles and hide our parent when someone enters those tiles
/// Loop through a list with relative coordinate lists to mark those tiles and hide our parent when someone enters those tiles
/datum/component/seethrough/proc/setup_perimeter(atom/parent)
watched_turfs = list()

Expand All @@ -51,7 +51,7 @@

watched_turfs.Add(target)

///Someone entered one of our tiles, so sent an override overlay and a cute animation to make us fade out a bit
/// Someone entered one of our tiles, so sent an override overlay and a cute animation to make us fade out a bit
/datum/component/seethrough/proc/on_entered(atom/source, atom/movable/entered)
SIGNAL_HANDLER

Expand All @@ -69,7 +69,7 @@

trick_mob(mob)

///Remove the screen object and make us appear solid to the client again
/// Remove the screen object and make us appear solid to the client again
/datum/component/seethrough/proc/on_exited(atom/source, atom/movable/exited, direction)
SIGNAL_HANDLER

Expand All @@ -86,17 +86,17 @@
if(moving_to in watched_turfs)
return

//Check if we're being 'tricked'
// Check if we're being 'tricked'
if(mob in tricked_mobs)
var/image/trickery_image = tricked_mobs[mob]
animate(trickery_image, alpha = 255, time = animation_time)
tricked_mobs.Remove(mob)
UnregisterSignal(mob, COMSIG_MOB_LOGOUT)

//after playing the fade-in animation, remove the screen obj
// after playing the fade-in animation, remove the screen obj
addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/component/seethrough,clear_image), trickery_image, mob.client), animation_time)

///Apply the trickery image and animation
/// Apply the trickery image and animation
/datum/component/seethrough/proc/trick_mob(mob/fool)
var/datum/hud/our_hud = fool.hud_used
for(var/atom/movable/screen/plane_master/seethrough in our_hud.get_true_plane_masters(SEETHROUGH_PLANE))
Expand All @@ -108,10 +108,10 @@
user_overlay.override = TRUE

if(clickthrough)
//Special plane so we can click through the overlay
// Special plane so we can click through the overlay
SET_PLANE_EXPLICIT(user_overlay, SEETHROUGH_PLANE, atom_parent)

//These are inherited, but we already use the atom's loc so we end up at double the pixel offset
// These are inherited, but we already use the atom's loc so we end up at double the pixel offset
user_overlay.pixel_x = 0
user_overlay.pixel_y = 0

Expand All @@ -123,7 +123,7 @@
RegisterSignal(fool, COMSIG_MOB_LOGOUT, PROC_REF(on_client_disconnect))


///Unrout ourselves after we somehow moved, and start a timer so we can re-restablish our behind area after standing still for a bit
/// Unrout ourselves after we somehow moved, and start a timer so we can re-restablish our behind area after standing still for a bit
/datum/component/seethrough/proc/dismantle_perimeter()
SIGNAL_HANDLER

Expand All @@ -133,12 +133,12 @@
watched_turfs = null
clear_all_images()

//Timer override, so if our atom keeps moving the timer is reset until they stop for X time
// Timer override, so if our atom keeps moving the timer is reset until they stop for X time
addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/component/seethrough,setup_perimeter), parent), perimeter_reset_timer, TIMER_OVERRIDE | TIMER_UNIQUE)

///Remove a screen image from a client
/// Remove a screen image from a client
/datum/component/seethrough/proc/clear_image(image/removee, client/remove_from)
remove_from?.images -= removee //player could've logged out during the animation, so check just in case
remove_from?.images -= removee // player could've logged out during the animation, so check just in case

/datum/component/seethrough/proc/clear_all_images()
for(var/mob/fool in tricked_mobs)
Expand All @@ -152,7 +152,7 @@

tricked_mobs.Cut()

///Image is removed when they log out because client gets deleted, so drop the mob reference
/// Image is removed when they log out because client gets deleted, so drop the mob reference
/datum/component/seethrough/proc/on_client_disconnect(mob/fool)
SIGNAL_HANDLER

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/flora.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. = ..()
AddComponent(/datum/component/seethrough, get_seethrough_map())

///Return a see_through_map, examples in seethrough.dm
/// Return a see_through_map, examples in seethrough.dm
/obj/structure/flora/tree/proc/get_seethrough_map()
return SEE_THROUGH_MAP_DEFAULT

Expand Down

0 comments on commit 1c15eed

Please sign in to comment.