Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TGUI react migration and fixes, Part 1 #342

Merged
merged 61 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
efea5b0
migrated js components to jsx (#5307)
mullenpaul Dec 29, 2023
199faa5
TGUI upgrades to support react migration (#5435)
mullenpaul Jan 18, 2024
0b11c94
React Migration - part 2 (#5493)
mullenpaul Jan 23, 2024
441c21c
Fixes edited `.jsx` files not triggering a TGUI recompile (#5562)
SabreML Jan 28, 2024
05f9737
Resolve sticky messages in STUI (#5581)
mullenpaul Jan 29, 2024
4c90c4b
[s] Another number input guard (#5649)
Drulikar Feb 4, 2024
a3e1865
Fix bug with RestrictedInput TGUI component (#5651)
mullenpaul Feb 16, 2024
5a1c4e9
Fix broken admin medals panel (#5764)
Drulikar Feb 21, 2024
fcdb8d9
TGUI input list search fix (#5775)
SabreML Feb 22, 2024
44f48af
TGUI: Replaces babel & terser (#6196)
jlsnow301 May 1, 2024
dd97261
re-fix conflicts
Doubleumc Jul 24, 2024
c02fd48
Update tgui-panel.bundle.css
Doubleumc Jul 24, 2024
7d25fcf
Jumping out of a dropship heading towards an LZ now throws your body …
Contrabang Feb 20, 2024
58e842c
clean lints
Doubleumc Jul 25, 2024
31e8967
fixes is_interior(), fixing xeno construction on dropships during tra…
harryob Dec 9, 2023
bdfabe6
Ports Mapping Backend updates (#5165)
fira Feb 22, 2024
7b75c93
Allows for trailing or leading whitespace in VV edits (#5417)
Birdtalon Jan 13, 2024
6b85a68
TGUI Parity with Upstream and Remaining React Porting & Polish (#6244)
Drulikar May 19, 2024
83bde0c
Create ping.js
Doubleumc Jul 25, 2024
697b073
Delete Dpad.tsx
Doubleumc Jul 25, 2024
56756c9
.js to .jsx
Doubleumc Jul 25, 2024
c84841a
Update trijent_elevator.dm
Doubleumc Jul 25, 2024
79bfc68
Update SoundPanel.tsx
Doubleumc Jul 25, 2024
02af80f
Update ResinPanel.tsx
Doubleumc Jul 25, 2024
ea807ed
prettier styles
Doubleumc Jul 25, 2024
9907822
Dropship weapons console TGUI (#4812)
mullenpaul Dec 25, 2023
ccf102b
Fixes users getting locked in simulation view / simulation refactor (…
Dec 31, 2023
169e26e
Polish Dropship Weapons UI (#5298)
Drulikar Jan 6, 2024
effc9ad
Fix dropship equipment infinite loop (#5823)
mullenpaul Feb 28, 2024
78860b5
Fixes spotlight breaking every time (#6184)
ihatethisengine Apr 24, 2024
214dce9
camera console now uses camera manager (#5310)
mullenpaul Feb 1, 2024
63dae5f
adds warning messages when CAS sonic boom happens and makes the boom …
cuberound Jan 25, 2024
89fefc7
Fm timeing changes (#6097)
cuberound May 1, 2024
caab834
Falling Falcons: Paratroopers Edition (#6150)
ihatethisengine May 10, 2024
7a2a952
sentry compat
Doubleumc Jul 25, 2024
99b5451
downdate GLOB usage
Doubleumc Jul 25, 2024
3dfcad4
Return to client macros for tgsay (#6320)
Drulikar May 22, 2024
37ff57c
Port style changes for vendors fixes since the frontend changes are a…
Drulikar Jul 26, 2024
e3434ba
Finalize port of 5873 since most of front end changes are already pre…
Drulikar Jul 26, 2024
830685e
Add missing readme mention for onConfirmChange
Drulikar Jul 26, 2024
bc3152b
Fixes TGUI overwatch console & custom font entry ui runtimes (#6370)
vero5123 Jun 4, 2024
4946ad3
Partial port of 5318 fixing cas/demo simulators + outstanding changes…
Drulikar Jul 26, 2024
7310767
update to "TGUI Parity"
Doubleumc Jul 26, 2024
8ec7746
smartgunner merge
Doubleumc Jul 26, 2024
ea4377e
rappel to paradrop conversion
Doubleumc Jul 26, 2024
b25cb04
rappel_harness to parachute
Doubleumc Jul 26, 2024
9ee1236
cas panel prettier
Doubleumc Jul 26, 2024
a7f6a6d
no more extraction rappels
Doubleumc Jul 26, 2024
88d52bb
Merge branch 'port-tgui-part1' of https://github.com/Doubleumc/PvE-CM…
Drulikar Jul 26, 2024
380ff53
Port of 5968 holocards since frontend was already expecting holocards
Vicacrov Mar 26, 2024
e538c7a
Move holocards to the squad hud (#6029)
Drulikar Mar 31, 2024
f8e0dbe
Fix simulator and overwatch
Drulikar Jul 26, 2024
6078bf6
Fix depreciations and run prettier/eslint fixes
Drulikar Jul 26, 2024
09647f5
Update dropship_midway.dmm
Doubleumc Jul 27, 2024
166f703
adjust dropdown widths
Doubleumc Jul 27, 2024
e7a45f2
Update trijent_elevator.dm
Doubleumc Jul 27, 2024
6c375ce
Update trijent_elevator.dm
Doubleumc Jul 27, 2024
b677889
rappels reintroduced
Doubleumc Jul 27, 2024
62c9ff4
PvE shuttle mapping fix
Doubleumc Aug 1, 2024
7edba34
virtual phone compat
Doubleumc Aug 2, 2024
edde0fb
Jumping out of a dropship heading towards an LZ now throws your body …
Contrabang Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# We don't want prettier to run on anything outside of the TGUI folder, so we have to do this.
/*

# We want it to run into the TGUI folder, however.
!/tgui
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"eslint.nodePath": "./tgui/.yarn/sdks",
"eslint.workingDirectories": ["./tgui"],
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js",
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.cjs",
"typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
Expand All @@ -14,6 +14,7 @@
"files.eol": "\n",
"files.insertFinalNewline": true,
"gitlens.advanced.blame.customArguments": ["-w"],
"tgstationTestExplorer.project.resultsType": "json",
"[javascript]": {
"editor.rulers": [80],
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
7 changes: 1 addition & 6 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#define RANGE_TURFS(RADIUS, CENTER) \
block( \
locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \
locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \
)

//Admin perms are in global.dm.

/// To make it even more clear that something is a bitfield.
Expand Down Expand Up @@ -396,6 +390,7 @@ block( \
#define FIRE_MISSION_WEAPON_REMOVED 8
#define FIRE_MISSION_WEAPON_UNUSABLE 16
#define FIRE_MISSION_WEAPON_OUT_OF_AMMO 32
#define FIRE_MISSION_BAD_DIRECTION 64
#define FIRE_MISSION_NOT_EXECUTABLE -1

//Defines for firemission state
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/_math.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#define CEILING(x, y) ( -round(-(x) / (y)) * (y) )

#define ROUND_UP(x) ( -round(-(x)))

// round() acts like floor(x, 1) by default but can't handle other values
#define FLOOR(x, y) ( round((x) / (y)) * (y) )

Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/dcs/signals/atom/signals_atom.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// From /atom/proc/Decorate
#define COMSIG_ATOM_DECORATED "atom_decorated"

//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization and has a loc
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON "atom_init_success_on"
///from base of atom/setDir(): (old_dir, new_dir). Called before the direction changes.
#define COMSIG_ATOM_DIR_CHANGE "atom_dir_change"

Expand Down
10 changes: 10 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@

//Additional procs on items that will be triggered right after the human finishes spawns in
#define COMSIG_POST_SPAWN_UPDATE "post_spawn_update"

#define COMSIG_CAMERA_MAPNAME_ASSIGNED "camera_manager_mapname_assigned"
#define COMSIG_CAMERA_REGISTER_UI "camera_manager_register_ui"
#define COMSIG_CAMERA_UNREGISTER_UI "camera_manager_unregister_ui"
#define COMSIG_CAMERA_SET_NVG "camera_manager_set_nvg"
#define COMSIG_CAMERA_CLEAR_NVG "camera_manager_clear_nvg"
#define COMSIG_CAMERA_SET_TARGET "camera_manager_set_target"
#define COMSIG_CAMERA_SET_AREA "camera_manager_set_area"
#define COMSIG_CAMERA_CLEAR "camera_manager_clear_target"
#define COMSIG_CAMERA_REFRESH "camera_manager_refresh"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
/// from /obj/proc/afterbuckle()
#define COSMIG_OBJ_AFTER_BUCKLE "signal_obj_after_buckle"

#define COMSIG_DROPSHIP_ADD_EQUIPMENT "dropship_add_equipment"
#define COMSIG_DROPSHIP_REMOVE_EQUIPMENT "dropship_remove_equipment"
#define COMSIG_STRUCTURE_CRATE_SQUAD_LAUNCHED "structure_crate_squad_launched"
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@

///from /turf/closed/wall/proc/place_poster
#define COMSIG_POSTER_PLACED "poster_placed"

///from base of /datum/turf_reservation/proc/Release: (datum/turf_reservation/reservation)
#define COMSIG_TURF_RESERVATION_RELEASED "turf_reservation_released"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

///from base of datum/controller/subsystem/mapping/proc/add_new_zlevel(): (list/args)
#define COMSIG_GLOB_NEW_Z "!new_z"
/// sent after world.maxx and/or world.maxy are expanded: (has_exapnded_world_maxx, has_expanded_world_maxy)
#define COMSIG_GLOB_EXPANDED_WORLD_BOUNDS "!expanded_world_bounds"
///from base of datum/controller/subsystem/mapping/proc/add_new_zlevel(): (list/args)
#define COMSIG_GLOB_VEHICLE_ORDERED "!vehicle_ordered"
/// from /datum/controller/subsystem/ticker/fire
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
#define ANIMATED_SURGICAL_TOOL (1<<12)
/// Has heat source but isn't 'on fire' and thus can be stored
#define IGNITING_ITEM (1<<13)
/// Overrides NODROP in some cases (stripping)
#define FORCEDROP_CONDITIONAL (1<<14)
/// Overrides smartgunner not being able to wear backpacks
#define SMARTGUNNER_BACKPACK_OVERRIDE (1<<15)
//==========================================================================================


Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
///--------------- FULLSCREEN RUNECHAT BUBBLES ------------
#define LIGHTING_PLANE 100
#define EXTERIOR_LIGHTING_PLANE 101
#define NVG_PLANE 110

///Popup Chat Messages
#define RUNECHAT_PLANE 501
Expand Down
7 changes: 2 additions & 5 deletions code/__DEFINES/maps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,5 @@ require only minor tweaks.
#define MAP_ARMOR_STYLE_JUNGLE "jungle"
#define MAP_ARMOR_STYLE_PRISON "prison"

//turf-only flags
#define NOJAUNT_1 (1<<0)
#define UNUSED_RESERVATION_TURF (1<<1)
/// If a turf can be made dirty at roundstart. This is also used in areas.
#define CAN_BE_DIRTY_1 (1<<2)
/// A map key that corresponds to being one exclusively for Space.
#define SPACE_KEY "space"
1 change: 1 addition & 0 deletions code/__DEFINES/mob_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define STATUS_HUD_XENO_CULTIST "24" // Whether they are a xeno cultist or not
#define HUNTER_CLAN "25" //Displays a colored icon to represent ingame Hunter Clans
#define HUNTER_HUD "26" //Displays various statuses on mobs for Hunters to identify targets
#define HOLOCARD_HUD "27" //Displays the holocards set by medical personnel

//data HUD (medhud, sechud) defines
#define MOB_HUD_SECURITY_BASIC 1
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,8 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
#define CHECKS_PASSED 1
#define STILL_ON_COOLDOWN 2
#define NO_LIGHT_STATE_CHANGE 3

//tool capabilities or something i don't know
#define REMOVE_CROWBAR (1<<0)
#define BREAK_CROWBAR (1<<1)
#define REMOVE_SCREWDRIVER (1<<2)
2 changes: 1 addition & 1 deletion code/__DEFINES/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define TRANSIT_REQUEST 1
#define TRANSIT_READY 2

#define SHUTTLE_TRANSIT_BORDER 8
#define SHUTTLE_TRANSIT_BORDER 16

#define PARALLAX_LOOP_TIME 25
#define HYPERSPACE_END_TIME 5
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"%7b%22type%22%3a%22[type]%22%2c%22payload%22%3a[url_encode(json_encode(payload))]%7d" \
)

/// Creates a message packet for sending via output() specifically for opening tgsay using an embedded winget
// This is {"type":"open","payload":{"channel":channel,"mapfocus":[[map.focus]]}}, but pre-encoded.
#define TGUI_CREATE_OPEN_MESSAGE(channel) ( \
"%7b%22type%22%3a%22open%22%2c%22payload%22%3a%7B%22channel%22%3a%22[channel]%22%2c%22mapfocus%22%3a\[\[map.focus\]\]%7d%7d" \
)

/*
*Defines for the TGUI health analyser interface
*The higher the level, the more information you can see
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ GLOBAL_LIST(trait_name_map)
#define XENO_WEED_TRAIT "xeno_weed"
/// traits associated with actively interacted machinery
#define INTERACTION_TRAIT "interaction"
/// traits associated with interacting with a dropship
#define TRAIT_SOURCE_DROPSHIP_INTERACTION "dropship_interaction"
/// traits bound by stunned status effects
#define STUNNED_TRAIT "stunned"
/// traits bound by knocked_down status effect
Expand Down
18 changes: 9 additions & 9 deletions code/__DEFINES/turf_flags.dm
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//turf_flags values
/// Marks a turf as organic. Used for alien wall and membranes.
#define TURF_ORGANIC (1<<0)
/// If a turf is an usused reservation turf awaiting assignment
#define UNUSED_RESERVATION_TURF (1<<1)
/// If a turf is a reserved turf
#define RESERVATION_TURF (1<<2)

//ChangeTurf options to change its behavior
#define CHANGETURF_DEFER_CHANGE (1<<0)
/// This flag prevents changeturf from gathering air from nearby turfs to fill the new turf with an approximation of local air
#define CHANGETURF_IGNORE_AIR (1<<1)
#define CHANGETURF_FORCEOP (1<<2)
/// A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE
#define CHANGETURF_SKIP (1<<3)

#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS)

/// Marks a turf as organic. Used for alien wall and membranes.
#define TURF_ORGANIC (1<<0)


#define REMOVE_CROWBAR (1<<0)
#define BREAK_CROWBAR (1<<1)
#define REMOVE_SCREWDRIVER (1<<2)
29 changes: 29 additions & 0 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#define RANGE_TURFS(RADIUS, CENTER) \
block( \
locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \
locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \
)

#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \
block( \
locate(max((CENTER).x-(H_RADIUS),1), max((CENTER).y-(V_RADIUS),1), (CENTER).z), \
locate(min((CENTER).x+(H_RADIUS),world.maxx), min((CENTER).y+(V_RADIUS),world.maxy), (CENTER).z) \
)

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

/// Returns a list of turfs in the rectangle specified by BOTTOM LEFT corner and height/width, checks for being outside the world border for you
#define CORNER_BLOCK(corner, width, height) CORNER_BLOCK_OFFSET(corner, width, height, 0, 0)

/// Returns a list of turfs similar to CORNER_BLOCK but with offsets
#define CORNER_BLOCK_OFFSET(corner, width, height, offset_x, offset_y) ((block(locate(corner.x + offset_x, corner.y + offset_y, corner.z), locate(min(corner.x + (width - 1) + offset_x, world.maxx), min(corner.y + (height - 1) + offset_y, world.maxy), corner.z))))

/// Returns an outline (neighboring turfs) of the given block
#define CORNER_OUTLINE(corner, width, height) ( \
CORNER_BLOCK_OFFSET(corner, width + 2, 1, -1, -1) + \
CORNER_BLOCK_OFFSET(corner, width + 2, 1, -1, height) + \
CORNER_BLOCK_OFFSET(corner, 1, height, -1, 0) + \
CORNER_BLOCK_OFFSET(corner, 1, height, width, 0))

#define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3]))
1 change: 1 addition & 0 deletions code/__DEFINES/typecheck/generic_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define ismovableatom(A) (ismovable(A))
#define isatom(A) (isloc(A))
#define isfloorturf(A) (istype(A, /turf/open/floor))
#define isclosedturf(A) (istype(A, /turf/closed))
#define isweakref(D) (istype(D, /datum/weakref))
#define isgenerator(A) (istype(A, /generator))

Expand Down
2 changes: 2 additions & 0 deletions code/__HELPERS/lighting.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS)

/// Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the [EMISSIVE_COLOR].
/proc/emissive_appearance(icon, icon_state = "", layer = FLOAT_LAYER, alpha = 255, appearance_flags = NONE)
var/mutable_appearance/appearance = mutable_appearance(icon, icon_state, layer, EMISSIVE_PLANE, alpha, appearance_flags | EMISSIVE_APPEARANCE_FLAGS)
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@

//Copies a list, and all lists inside it recusively
//Does not copy any other reference type
/proc/deepCopyList(list/L)
/proc/deep_copy_list(list/L)
if(!islist(L))
return L
. = L.Copy()
Expand All @@ -532,10 +532,10 @@
continue
var/value = .[key]
if(islist(value))
value = deepCopyList(value)
value = deep_copy_list(value)
.[key] = value
if(islist(key))
key = deepCopyList(key)
key = deep_copy_list(key)
.[i] = key
.[key] = value

Expand Down
10 changes: 10 additions & 0 deletions code/__HELPERS/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,16 @@ GLOBAL_PROTECT(config_error_log)
WRITE_LOG(GLOB.config_error_log, text)
SEND_TEXT(world.log, text)

/// Logging for mapping errors
/proc/log_mapping(text, skip_world_log)
#ifdef UNIT_TESTS
GLOB.unit_test_mapping_logs += text
#endif
if(skip_world_log)
return
WRITE_LOG(GLOB.mapping_log, text)
SEND_TEXT(world.log, text)

/proc/log_admin_private(text)
log_admin(text)

Expand Down
23 changes: 23 additions & 0 deletions code/__HELPERS/string_lists.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
GLOBAL_LIST_EMPTY(string_lists)

/**
* Caches lists with non-numeric stringify-able values (text or typepath).
*/
/proc/string_list(list/values)
var/string_id = values.Join("-")

. = GLOB.string_lists[string_id]

if(.)
return .

return GLOB.string_lists[string_id] = values

///A wrapper for baseturf string lists, to offer support of non list values, and a stack_trace if we have major issues
/proc/baseturfs_string_list(list/values, turf/baseturf_holder)
if(!islist(values))
return values //baseturf things
// return values
if(length(values) > 10)
return string_list(list(/turf/closed/cordon/debug))
return string_list(values)
18 changes: 18 additions & 0 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,24 @@

return ""

//Returns a string with reserved characters and spaces after the first and last letters removed
//Like trim(), but very slightly faster. worth it for niche usecases
/proc/trim_reduced(text)
var/starting_coord = 1
var/text_len = length(text)
for (var/i in 1 to text_len)
if (text2ascii(text, i) > 32)
starting_coord = i
break

for (var/i = text_len, i >= starting_coord, i--)
if (text2ascii(text, i) > 32)
return copytext(text, starting_coord, i + 1)

if(starting_coord > 1)
return copytext(text, starting_coord)
return ""

//Returns a string with reserved characters and spaces before the first word and after the last word removed.
/proc/trim(text)
return trim_left(trim_right(text))
Expand Down
14 changes: 11 additions & 3 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,24 @@
animation.master = target
flick(flick_anim, animation)

//Will return the contents of an atom recursivly to a depth of 'searchDepth'
///Will return the contents of an atom recursivly to a depth of 'searchDepth', not including starting atom
/atom/proc/GetAllContents(searchDepth = 5, list/toReturn = list())
for(var/atom/part as anything in contents)
toReturn += part
if(part.contents.len && searchDepth)
part.GetAllContents(searchDepth - 1, toReturn)
return toReturn

///Returns the src and all recursive contents as a list. Includes the starting atom.
/atom/proc/get_all_contents(ignore_flag_1)
. = list(src)
var/i = 0
while(i < length(.))
var/atom/checked_atom = .[++i]
if(checked_atom.flags_atom & ignore_flag_1)
continue
. += checked_atom.contents

/// Returns list of contents of a turf recursively, much like GetAllContents
/// We only get containing atoms in the turf, excluding multitiles bordering on it
/turf/proc/GetAllTurfStrictContents(searchDepth = 5, list/toReturn = list())
Expand Down Expand Up @@ -2022,8 +2032,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)

return list(region_x1 & region_x2, region_y1 & region_y2)

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

//Vars that will not be copied when using /DuplicateObject
GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
"tag", "datum_components", "area", "type", "loc", "locs", "vars", "parent", "parent_type", "verbs", "ckey", "key",
Expand Down
6 changes: 6 additions & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ DEFINE_BITFIELD(flags_atom, list(
"USES_HEARING" = USES_HEARING,
))

DEFINE_BITFIELD(turf_flags, list(
"TURF_ORGANIC" = TURF_ORGANIC,
"UNUSED_RESERVATION_TURF" = UNUSED_RESERVATION_TURF,
"RESERVATION_TURF" = RESERVATION_TURF,
))

DEFINE_BITFIELD(flags_item, list(
"NODROP" = NODROP,
"NOBLUDGEON" = NOBLUDGEON,
Expand Down
3 changes: 3 additions & 0 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ GLOBAL_LIST_EMPTY(minimap_icons)

GLOBAL_LIST_EMPTY(mainship_pipes)

/// List of all the maps that have been cached for /proc/load_map
GLOBAL_LIST_EMPTY(cached_maps)

/proc/initiate_minimap_icons()
var/list/icons = list()
for(var/iconstate in icon_states('icons/UI_icons/map_blips.dmi'))
Expand Down
Loading
Loading