Skip to content

Commit

Permalink
Merge pull request #1468 from Yawn-Wider/voreupdate
Browse files Browse the repository at this point in the history
Voreupdate [MDB IGNORE] [IDB IGNORE]
  • Loading branch information
izac112 authored Aug 28, 2024
2 parents 1c19027 + dd5a202 commit ff76263
Show file tree
Hide file tree
Showing 747 changed files with 25,674 additions and 16,838 deletions.
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@
],
"group": "build",
"label": "tgui: prettybuild"
},
{
"type": "shell",
"command": "bin/tgui --dev",
"windows": {
"command": ".\\bin\\tgui.bat --dev"
},
"problemMatcher": [
"$tsc",
"$eslint-stylish"
],
"options": {
"cwd": ".\\tgui\\",
},
"group": "build",
"label": "tgui: dev server"
}
]
}
13 changes: 13 additions & 0 deletions code/__defines/assert.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#undef ASSERT

/// Override BYOND's native ASSERT to optionally specify a message
#define ASSERT(condition, message...) \
if (!(condition)) { \
CRASH(assertion_message(__FILE__, __LINE__, #condition, ##message)) \
}

/proc/assertion_message(file, line, condition, message)
if (!isnull(message))
message = " - [message]"

return "[file]:[line]:Assertion failed: [condition][message]"
1 change: 1 addition & 0 deletions code/__defines/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define CE_SLOWDOWN "goslow" // Slowdown
#define CE_ANTACID "nopuke" // Don't puke.
#define CE_ALLERGEN "allergyreaction" // Self explanatory
#define CE_DARKSIGHT "darksight" // Gives perfect vision in dark

#define REAGENTS_PER_SHEET 20

Expand Down
4 changes: 4 additions & 0 deletions code/__defines/color.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
#define COLOR_LIGHT_VIOLET "#e7bfff"
#define COLOR_SAN_MARINO_BLUE "#4b75ab"
#define COLOR_HALF_TRANSPARENT_BLACK "#0000007A"
#define COLOR_NUKIES_GREEN "#43fe00"
#define COLOR_NUKIES_YELLOW "#ffe900"
#define COLOR_DESATTI_PRPLOW "#3300cc"
#define COLOR_DESATTI_PRPHI "#6600cc"

#define PIPE_COLOR_GREY "#808080"
#define PIPE_COLOR_RED "#ff0000"
Expand Down
1 change: 1 addition & 0 deletions code/__defines/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define BLOCK_GAS_SMOKE_EFFECT (1<<3) // Blocks the effect that chemical clouds would have on a mob -- glasses, mask and helmets ONLY! (NOTE: flag shared with ONESIZEFITSALL)
#define FLEXIBLEMATERIAL (1<<4) // At the moment, masks with this flag will not prevent eating even if they are covering your face.
#define ALLOW_SURVIVALFOOD (1<<5) // Allows special survival food items to be eaten through it
#define INFINITE_AIR (1<<6) // Provides an infinite air supply.

// Flags for pass_flags. - Used in /atom/var/pass_flags
#define PASSTABLE (1<<0)
Expand Down
2 changes: 2 additions & 0 deletions code/__defines/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
//#define isturf(D) istype(D, /turf) //Built in
#define isopenspace(A) istype(A, /turf/simulated/open)
#define isspace(A) istype(A, /turf/space)
#define isopenturf(A) istype(A, /turf/simulated/open) || istype(A, /turf/space)
#define isnonsolidturf(A) istype(A, /turf/simulated/open) || istype(A, /turf/space) || istype(A, /turf/simulated/floor/water) || istype(A, /turf/simulated/floor/lava)
#define ismineralturf(A) istype(A, /turf/simulated/mineral)

#define istaurtail(A) istype(A, /datum/sprite_accessory/tail/taur)
Expand Down
9 changes: 9 additions & 0 deletions code/__defines/speech_channels.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Used to direct channels to speak into.
#define SAY_CHANNEL "Say"
#define RADIO_CHANNEL "Radio"
#define ME_CHANNEL "Me"
#define OOC_CHANNEL "OOC"
#define ADMIN_CHANNEL "Admin"
#define LOOC_CHANNEL "LOOC"
#define WHIS_CHANNEL "Whis"
#define SUBTLE_CHANNEL "Subtle"
122 changes: 122 additions & 0 deletions code/__defines/traits/_traits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#define SIGNAL_ADDTRAIT(trait_ref) "addtrait [trait_ref]"
#define SIGNAL_REMOVETRAIT(trait_ref) "removetrait [trait_ref]"

// trait accessor defines
#define ADD_TRAIT(target, trait, source) \
do { \
var/list/_L; \
if (!target._status_traits) { \
target._status_traits = list(); \
_L = target._status_traits; \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
} else { \
_L = target._status_traits; \
if (_L[trait]) { \
_L[trait] |= list(source); \
} else { \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
} \
} \
} while (0)
#define REMOVE_TRAIT(target, trait, sources) \
do { \
var/list/_L = target._status_traits; \
var/list/_S; \
if (sources && !islist(sources)) { \
_S = list(sources); \
} else { \
_S = sources\
}; \
if (_L?[trait]) { \
for (var/_T in _L[trait]) { \
if ((!_S && (_T != ROUNDSTART_TRAIT)) || (_T in _S)) { \
_L[trait] -= _T \
} \
};\
if (!length(_L[trait])) { \
_L -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
}; \
if (!length(_L)) { \
target._status_traits = null \
}; \
} \
} while (0)
#define REMOVE_TRAIT_NOT_FROM(target, trait, sources) \
do { \
var/list/_traits_list = target._status_traits; \
var/list/_sources_list; \
if (sources && !islist(sources)) { \
_sources_list = list(sources); \
} else { \
_sources_list = sources\
}; \
if (_traits_list?[trait]) { \
for (var/_trait_source in _traits_list[trait]) { \
if (!(_trait_source in _sources_list)) { \
_traits_list[trait] -= _trait_source \
} \
};\
if (!length(_traits_list[trait])) { \
_traits_list -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
}; \
if (!length(_traits_list)) { \
target._status_traits = null \
}; \
} \
} while (0)
#define REMOVE_TRAITS_NOT_IN(target, sources) \
do { \
var/list/_L = target._status_traits; \
var/list/_S = sources; \
if (_L) { \
for (var/_T in _L) { \
_L[_T] &= _S;\
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \
}; \
};\
if (!length(_L)) { \
target._status_traits = null\
};\
}\
} while (0)

#define REMOVE_TRAITS_IN(target, sources) \
do { \
var/list/_L = target._status_traits; \
var/list/_S = sources; \
if (sources && !islist(sources)) { \
_S = list(sources); \
} else { \
_S = sources\
}; \
if (_L) { \
for (var/_T in _L) { \
_L[_T] -= _S;\
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \
}; \
};\
if (!length(_L)) { \
target._status_traits = null\
};\
}\
} while (0)

#define HAS_TRAIT(target, trait) (target._status_traits?[trait] ? TRUE : FALSE)
#define HAS_TRAIT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]))
#define HAS_TRAIT_FROM_ONLY(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]) && (length(target._status_traits[trait]) == 1))
#define HAS_TRAIT_NOT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (length(target._status_traits[trait] - source) > 0))
/// Returns a list of trait sources for this trait. Only useful for wacko cases and internal futzing
/// You should not be using this
#define GET_TRAIT_SOURCES(target, trait) (target._status_traits?[trait] || list())
/// Returns the amount of sources for a trait. useful if you don't want to have a "thing counter" stuck around all the time
#define COUNT_TRAIT_SOURCES(target, trait) length(GET_TRAIT_SOURCES(target, trait))
/// A simple helper for checking traits in a mob's mind
#define HAS_MIND_TRAIT(target, trait) (HAS_TRAIT(target, trait) || (target.mind ? HAS_TRAIT(target.mind, trait) : FALSE))
11 changes: 11 additions & 0 deletions code/__defines/traits/declarations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file contains all of the "static" define strings that tie to a trait.
// WARNING: The sections here actually matter in this file as it's tested by CI. Please do not toy with the sections."

// BEGIN TRAIT DEFINES

/*
Remember to update _globalvars/traits.dm if you're adding/removing/renaming traits.
*/

/// Trait given to a mob that is currently thinking (giving off the "thinking" icon), used in an IC context
#define TRAIT_THINKING_IN_CHARACTER "currently_thinking_IC"
7 changes: 7 additions & 0 deletions code/__defines/traits/sources.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file contains all of the trait sources, or all of the things that grant traits.
// Several things such as `type` or `REF(src)` may be used in the ADD_TRAIT() macro as the "source", but this file contains all of the defines for immutable static strings.

/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"
/// This trait comes from when a mob is currently typing.
#define CURRENTLY_TYPING_TRAIT "currently_typing"
12 changes: 12 additions & 0 deletions code/_global_vars/traits/_traits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This file should contain every single global trait in the game in a type-based list, as well as any additional trait-related information that's useful to have on a global basis.
// This file is used in linting, so make sure to add everything alphabetically and what-not.
// Do consider adding your trait entry to the similar list in `admin_tooling.dm` if you want it to be accessible to admins (which is probably the case for 75% of traits).

// Please do note that there is absolutely no bearing on what traits are added to what subtype of `/datum`, this is just an easily referenceable list sorted by type.
// The only thing that truly matters about traits is the code that is built to handle the traits, and where that code is located. Nothing else.

GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_THINKING_IN_CHARACTER" = TRAIT_THINKING_IN_CHARACTER,
)
))
45 changes: 45 additions & 0 deletions code/_helpers/traits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#define TRAIT_CALLBACK_ADD(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitAdd), ##target, ##trait, ##source)
#define TRAIT_CALLBACK_REMOVE(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitRemove), ##target, ##trait, ##source)

///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
/proc/___TraitAdd(target, trait, source)
if(!target || !trait || !source)
return

if(islist(target))
for(var/datum/listed_target in target)
ADD_TRAIT(listed_target, trait, source)
return

ASSERT(isdatum(target), "Invalid target used in TRAIT_CALLBACK_ADD! Expected a datum reference, got [target] instead.")

var/datum/datum_target = target
ADD_TRAIT(datum_target, trait, source)

///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
/proc/___TraitRemove(target, trait, source)
if(!target || !trait || !source)
return

if(islist(target))
for(var/datum/listed_target in target)
REMOVE_TRAIT(listed_target, trait, source)
return

ASSERT(isdatum(target), "Invalid target used in TRAIT_CALLBACK_REMOVE! Expected a datum reference, got [target] instead.")

var/datum/datum_target = target
REMOVE_TRAIT(datum_target, trait, source)


/// Proc that handles adding multiple traits to a target via a list. Must have a common source and target.
/datum/proc/add_traits(list/list_of_traits, source)
ASSERT(islist(list_of_traits), "Invalid arguments passed to add_traits! Invoked on [src] with [list_of_traits], source being [source].")
for(var/trait in list_of_traits)
ADD_TRAIT(src, trait, source)

/// Proc that handles removing multiple traits from a target via a list. Must have a common source and target.
/datum/proc/remove_traits(list/list_of_traits, source)
ASSERT(islist(list_of_traits), "Invalid arguments passed to remove_traits! Invoked on [src] with [list_of_traits], source being [source].")
for(var/trait in list_of_traits)
REMOVE_TRAIT(src, trait, source)
50 changes: 28 additions & 22 deletions code/controllers/subsystems/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SUBSYSTEM_DEF(supply)
var/points_per_slip = 2
var/points_per_money = 0.02 // 1 point for $50
//control
var/ordernum
var/ordernum = 0 // Start at zero, it's per-shift tracking
var/list/shoppinglist = list() // Approved orders
var/list/supply_pack = list() // All supply packs
var/list/exported_crates = list() // Crates sent from the station
Expand All @@ -25,8 +25,6 @@ SUBSYSTEM_DEF(supply)
var/datum/shuttle/autodock/ferry/supply/shuttle

/datum/controller/subsystem/supply/Initialize()
ordernum = rand(1,9000)

// build master supply list
for(var/typepath in subtypesof(/datum/supply_pack))
var/datum/supply_pack/P = new typepath()
Expand Down Expand Up @@ -186,35 +184,38 @@ SUBSYSTEM_DEF(supply)
var/datum/supply_pack/SP = SO.object
shopping_log += "[SP.name];"

var/obj/A = new SP.containertype(pickedloc)
A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]"
var/obj/A
if(SP.containertype)
A = new SP.containertype(pickedloc)
A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]"
if(SP.access)
if(isnum(SP.access))
A.req_access = list(SP.access)
else if(islist(SP.access) && SP.one_access)
var/list/L = SP.access // access var is a plain var, we need a list
A.req_one_access = L.Copy()
LAZYCLEARLIST(A.req_access)
else if(islist(SP.access) && !SP.one_access)
var/list/L = SP.access
A.req_access = L.Copy()
LAZYCLEARLIST(A.req_one_access)
else
log_debug("<span class='danger'>Supply pack with invalid access restriction [SP.access] encountered!</span>")

//supply manifest generation begin
var/obj/item/weapon/paper/manifest/slip
if(!SP.contraband)
slip = new /obj/item/weapon/paper/manifest(A)
if(A)
slip = new /obj/item/weapon/paper/manifest(A)
else
slip = new /obj/item/weapon/paper/manifest(pickedloc)
slip.is_copy = 0
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
slip.info +="Order #[SO.ordernum]<br>"
slip.info +="Destination: [station_name()]<br>"
slip.info +="[orderedamount] PACKAGES IN THIS SHIPMENT<br>"
slip.info +="CONTENTS:<br><ul>"

//spawn the stuff, finish generating the manifest while you're at it
if(SP.access)
if(isnum(SP.access))
A.req_access = list(SP.access)
else if(islist(SP.access) && SP.one_access)
var/list/L = SP.access // access var is a plain var, we need a list
A.req_one_access = L.Copy()
LAZYCLEARLIST(A.req_access)
else if(islist(SP.access) && !SP.one_access)
var/list/L = SP.access
A.req_access = L.Copy()
LAZYCLEARLIST(A.req_one_access)
else
log_debug("<span class='danger'>Supply pack with invalid access restriction [SP.access] encountered!</span>")

var/list/contains
if(istype(SP,/datum/supply_pack/randomised))
var/datum/supply_pack/randomised/SPR = SP
Expand All @@ -231,7 +232,12 @@ SUBSYSTEM_DEF(supply)

var/number_of_items = max(1, contains[typepath])
for(var/j = 1 to number_of_items)
var/atom/B2 = new typepath(A)
var/atom/B2
if(A)
B2 = new typepath(A)
else
B2 = new typepath(pickedloc)

if(slip)
slip.info += "<li>[B2.name]</li>" //add the item to the manifest

Expand Down
2 changes: 2 additions & 0 deletions code/datums/datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

/// Active timers with this datum as the target
var/list/active_timers
/// Status traits attached to this datum. associative list of the form: list(trait name (string) = list(source1, source2, source3,...))
var/list/_status_traits

/**
* Components attached to this datum
Expand Down
Loading

0 comments on commit ff76263

Please sign in to comment.