Skip to content

Commit

Permalink
TGS Test Merge (#6755)
Browse files Browse the repository at this point in the history
  • Loading branch information
lordme authored and lordme committed Sep 19, 2024
2 parents d6907a8 + 64773b7 commit 12321ce
Show file tree
Hide file tree
Showing 29 changed files with 2,458 additions and 21 deletions.
10 changes: 10 additions & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
#include "code\__HELPERS\files\walk.dm"
#include "code\__HELPERS\game\depth.dm"
#include "code\__HELPERS\game\combat\arc.dm"
#include "code\__HELPERS\game\turfs\blocks.dm"
#include "code\__HELPERS\game\turfs\line.dm"
#include "code\__HELPERS\game\turfs\offsets.dm"
#include "code\__HELPERS\graphs\astar.dm"
Expand Down Expand Up @@ -4709,6 +4710,13 @@
#include "code\modules\shuttles\shuttles_vr.dm"
#include "code\modules\shuttles\shuttles_web.dm"
#include "code\modules\shuttles\web_datums.dm"
#include "code\modules\shuttles\effects\shuttle_landing.dm"
#include "code\modules\shuttles\shuttle\shuttle.dm"
#include "code\modules\shuttles\shuttle\shuttle_anchor.dm"
#include "code\modules\shuttles\shuttle\shuttle_area.dm"
#include "code\modules\shuttles\shuttle\shuttle_descriptor.dm"
#include "code\modules\shuttles\shuttle\shuttle_port.dm"
#include "code\modules\shuttles\shuttle\shuttle_template.dm"
#include "code\modules\species\abilites.dm"
#include "code\modules\species\character_species.dm"
#include "code\modules\species\physiology.dm"
Expand Down Expand Up @@ -5293,6 +5301,8 @@
#include "maps\sectors\virgo4_140\virgo4_140.dm"
#include "maps\sectors\wasteland_140\wasteland_140.dm"
#include "maps\sectors\wasteland_192\wasteland_192.dm"
#include "maps\shuttles\factions\corporations\nanotrasen\drone_prototype.dm"
#include "maps\shuttles\factions\corporations\nanotrasen\sci_vector.dm"
#include "maps\submaps\_helpers.dm"
#include "maps\submaps\_readme.dm"
#include "maps\submaps\level_specific\debrisfield_vr\debrisfield_things.dm"
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/_flags/turf_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// This is used in literally one place, turf.dm, to block ethwereal jaunt.
#define NO_JAUNT (1<<0)
/// Unused reservation turf
#define UNUSED_RESERVATION_TURF (1<<2)
#define TURF_FLAG_UNUSED_RESERVATION (1<<2)
/// queued for planet turf addition
#define TURF_PLANET_QUEUED (1<<3)
/// registered to a planet
Expand All @@ -28,7 +28,7 @@

DEFINE_BITFIELD(turf_flags, list(
BITFIELD(NO_JAUNT),
BITFIELD(UNUSED_RESERVATION_TURF),
BITFIELD(TURF_FLAG_UNUSED_RESERVATION),
BITFIELD(TURF_PLANET_QUEUED),
BITFIELD(TURF_PLANET_REGISTERED),
BITFIELD(TURF_ZONE_REBUILD_QUEUED),
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/_planes+layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
*/
#define DEBUG_PLANE 23
#define DEBUG_LAYER_AREA_OVERLAYS 100
#define DEBUG_LAYER_SHUTTLE_MARKERS 500

/**
*! -- Ghost Plane
Expand Down
83 changes: 83 additions & 0 deletions code/__HELPERS/game/turfs/blocks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* get turfs bordering a block of turfs
*
* * returned list will be empty if distance = 0
* * returned list will have all nulls incurred by turfs being outside world border
* * returned list **has no particular order.**
*
* @params
* * ll_x - lowerleft x
* * ll_y - lowerleft y
* * ur_x - upperright x
* * ur_y - upperright y
* * z - z level
* * distance - border distance
*
* @return list() if distance = 0, list of turfs otherwise. turfs outside of world border will be null.
*/
/proc/border_of_turf_block(ll_x, ll_y, ur_x, ur_y, z, distance)
if(distance <= 0)
return list()
. = block(
ll_x - distance,
ll_y - distance,
z,
ll_x - 1,
ur_y + distance,
) + block(
ur_x + 1,
ll_y - distance,
z,
ur_x + distance,
ur_y + distance,
) + block(
ll_x,
ur_y + 1,
z,
ur_x,
ur_y + distance,
) + block(
ll_x,
ll_y - distance,
z,
ur_x,
ll_y - 1,
)

/**
* get turfs bordering a block of turfs
*
* * returned list will be empty if distance = 0
* * returned list will have all nulls incurred by turfs being outside world border
* * returned list is in clockwise order from the **upper left** turf, spiralling outwards from there.
*
* @params
* * ll_x - lowerleft x
* * ll_y - lowerleft y
* * ur_x - upperright x
* * ur_y - upperright y
* * z - z level
* * distance - border distance
*
* @return list() if distance = 0, list of turfs otherwise. turfs outside of world border will be null.
*/
/proc/border_of_turf_block_spiral_outwards_clockwise(ll_x, ll_y, ur_x, ur_y, z, distance)
if(distance <= 0)
return list()
. = list()
for(var/radius in distance)
// gather top left to right
for(var/x in (ll_x - radius) to (ur_x + radius))
. += locate(x, ur_y + radius, z)
// gather right top to bottom excluding top and bottom turf
for(var/y in (ur_y + radius - 1) to (ll_y - radius + 1) step -1)
. += locate(ur_x + radius, y, z)
// gather bottom right to left
for(var/x in (ur_x + radius) to (ll_x - radius) step -1)
. += locate(x, ll_y - radius, z)
// gather left bottom to top excluding top and bottom turf
for(var/y in (ll_y - radius + 1) to (ur_y + radius - 1))
. += locate(ll_x - radius, y, z)
2 changes: 1 addition & 1 deletion code/__HELPERS/game/turfs/line.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* line drawing algorithm
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/game/turfs/offsets.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* get coordinate and direction tuple when entity is moved relative with a 'block' movement,
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/mapping/reservations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
/datum/controller/subsystem/mapping/proc/reserve_turfs(list/turf/turfs)
for(var/turf/T as anything in turfs)
T.empty(RESERVED_TURF_TYPE, RESERVED_TURF_TYPE)
T.turf_flags |= UNUSED_RESERVATION_TURF
T.turf_flags |= TURF_FLAG_UNUSED_RESERVATION
CHECK_TICK
// todo: area.assimilate_turfs?
reservation_unallocated_area.contents.Add(turfs)
Expand Down
4 changes: 4 additions & 0 deletions code/game/area/area.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
/// default initial gas mix
var/initial_gas_mix = GAS_STRING_STP

//* Identity *//
/// player-facing name, overrides name when / if necessary.
var/display_name

//? nightshift
/// nightshift level
/// in general, nightshift must be at or above this level for it to proc on areas.
Expand Down
10 changes: 0 additions & 10 deletions code/game/objects/effects/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@
. = ..()
animate(src, alpha = 0, time = time_to_die - 1)

/obj/effect/temporary_effect/shuttle_landing
name = "shuttle landing"
desc = "You better move if you don't want to go splat!"
icon_state = "shuttle_warning_still"
time_to_die = 4.9 SECONDS

/obj/effect/temporary_effect/shuttle_landing/Initialize(mapload)
flick("shuttle_warning", src) // flick() forces the animation to always begin at the start.
. = ..()

// The manifestation of Zeus's might. Or just a really unlucky day.
// This is purely a visual effect, this isn't the part of the code that hurts things.
/obj/effect/temporary_effect/lightning_strike
Expand Down
19 changes: 16 additions & 3 deletions code/modules/mapping/turf_reservation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@
release()
return ..()

/datum/turf_reservation/proc/get_approximately_center_turf()
return locate(
bottom_left_coords[1] + floor(top_right_coords[1] - bottom_left_coords[1]),
bottom_left_coords[2] + floor(top_right_coords[2] - bottom_left_coords[2]),
bottom_left_coords[3],
)

/datum/turf_reservation/proc/is_atom_inside(atom/A)
A = get_turf(A)
return A.z == bottom_left_coords[3] && \
A.x >= bottom_left_coords[1] && A.x <= top_right_coords[1] && \
A.y >= bottom_left_coords[2] && A.y <= top_right_coords[2]

/datum/turf_reservation/proc/release()
if(border)
SSmapping.reserve_turfs(block(locate(
Expand Down Expand Up @@ -170,7 +183,7 @@
1 + (inner_y - 1) * TURF_CHUNK_RESOLUTION,
level_index,
)
if(!(checking.turf_flags & UNUSED_RESERVATION_TURF))
if(!(checking.turf_flags & TURF_FLAG_UNUSED_RESERVATION))
passing = FALSE
break
if(!passing)
Expand Down Expand Up @@ -245,7 +258,7 @@
SSmapping.reservation_blocking_op = FALSE
return FALSE
for(var/turf/T as anything in final)
T.turf_flags &= ~UNUSED_RESERVATION_TURF
T.turf_flags &= ~TURF_FLAG_UNUSED_RESERVATION
if(T.type != turf_type)
T.ChangeTurf(turf_type, turf_type)

Expand All @@ -262,7 +275,7 @@
// todo: take_turfs
src.border_area.contents.Add(final_border)
for(var/turf/T as anything in final_border)
T.turf_flags &= ~UNUSED_RESERVATION_TURF
T.turf_flags &= ~TURF_FLAG_UNUSED_RESERVATION
// get just the first layer, but also init them at the same time
var/list/turf/final_immediate_border
// left
Expand Down
30 changes: 30 additions & 0 deletions code/modules/shuttles/effects/shuttle_landing.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

// todo: maybe orchestrate this with lists and timers on shuttle_transit_cycle?
/obj/effect/temporary_effect/shuttle_landing
name = "shuttle landing"
desc = "A massive entity is about to land here. You should not be here."
icon = 'icons/modules/shuttles/effects/shuttle_landing.dmi'
icon_state = "still"
time_to_die = 4.9 SECONDS

/obj/effect/temporary_effect/shuttle_landing/Initialize(mapload, time_to_dock)
if(!isnull(time_to_dock))
time_to_die = time_to_dock
run_animation()
return ..()

/obj/effect/temporary_effect/shuttle_landing/proc/run_animation()
var/half_time = time_to_die / 2

var/matrix/using_matrix = matrix()
using_matrix.Scale(0.1, 0.1)

transform = using_matrix
alpha = 75

using_matrix.Scale(10, 10)
animate(src, time = half_time, transform = using_matrix, alpha = 150)

animate(src, time = half_time, alpha = 255)
3 changes: 0 additions & 3 deletions code/modules/shuttles/shuttle.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//shuttle moving state defines are in setup.dm

/datum/shuttle
var/name = ""
var/warmup_time = 0
var/moving_status = SHUTTLE_IDLE

Expand All @@ -14,8 +13,6 @@
var/category = /datum/shuttle
var/multiz = 0 // How many multiz levels, starts at 0 TODO Leshana - Are we porting this?

var/ceiling_type = /turf/simulated/shuttle_ceiling // Type path of turf to roof over the shuttle when at multi-z landmarks. Ignored if null.

var/sound_takeoff = 'sound/effects/shuttles/shuttle_takeoff.ogg'
var/sound_landing = 'sound/effects/shuttles/shuttle_landing.ogg'

Expand Down
37 changes: 37 additions & 0 deletions code/modules/shuttles/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* # Shuttles
*
* Core datum for shuttles.
*
* ## Controllers
*
* All shuttle behaviors are now in controllers whenever possible. The base datum just handles the actual shuttle itself.
* Moving to transit and staying in transit? That's a controller thing. Temporary dynamic transit? That's a controller thing, too.
*
* todo: nestable-shuttle support ? e.g. transport ship on a shuttle ; this is not optimal for performance but sure is cool
* todo: multi-z shuttles; is this even possible? very long term.
* todo: areas is a shit system. this is probably not fixable, because how else would we do bounding boxes?
* todo: it would sure be nice to be able to dynamically expand shuttles in-game though; probably a bad idea too.
* todo: serialize/deserialize, but should it be on this side or the map tempalte side? we want save/loadable.
*/
/datum/shuttle
//* Intrinsics *//
/// our unique template id; this is *not* our ID and is *not* unique!
var/template_id
/// our descriptor instance; this is what determines how we act
/// to our controller, as well as things like overmaps.
var/datum/shuttle_descriptor/descriptor

//* Identity *//
/// real / code name
var/name = "Unnamed Shuttle"
/// description for things like admin interfaces
var/desc = "Some kind of shuttle. The coder forgot to set this."

//* Structure *//
/// if set, we generate a ceiling above the shuttle of this type, on the bottom of the turf stack.
// todo: vv hook this
var/ceiling_type = /turf/simulated/shuttle_ceiling
Loading

0 comments on commit 12321ce

Please sign in to comment.