Skip to content

Commit

Permalink
Merge remote-tracking branch 'cmss13-devs/master' into forest/pred/we…
Browse files Browse the repository at this point in the history
…apons_overhaul
  • Loading branch information
realforest2001 committed Jan 22, 2024
2 parents 2db3859 + 9c97136 commit bcd8b2b
Show file tree
Hide file tree
Showing 445 changed files with 7,950 additions and 13,705 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/_math.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@

/// Gets the sign of x, returns -1 if negative, 0 if 0, 1 if positive
#define SIGN(x) ( ((x) > 0) - ((x) < 0) )

/// Performs a linear interpolation between a and b. Note that amount=0 returns a, amount=1 returns b, and amount=0.5 returns the mean of a and b.
#define LERP(a, b, amount) ( amount ? ((a) + ((b) - (a)) * (amount)) : a )
32 changes: 19 additions & 13 deletions code/__DEFINES/colours.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,65 @@

// BLACK AND WHITE COLOR DEFINE.

/// Full white. rgb(255, 255, 255)
/// White rgb(255, 255, 255)
#define COLOR_WHITE "#FFFFFF"
/// Full black. rgb(0, 0, 0)
/// Black rgb(0, 0, 0)
#define COLOR_BLACK "#000000"

// THE THREE PRIMARIES COLORS DEFINES.

/// Full red. rgb(255, 0, 0)
/// Red rgb(255, 0, 0)
#define COLOR_RED "#FF0000"
/// Full green. rgb(0, 255, 0)
/// Green rgb(0, 255, 0)
#define COLOR_GREEN "#00FF00"
/// Full blue. rgb(0, 0, 255)
/// Blue rgb(0, 0, 255)
#define COLOR_BLUE "#0000FF"

//mix of two full primary colors

/// full cyan rgb(0, 255, 255) B + G
/// Cyan rgb(0, 255, 255) B + G
#define COLOR_CYAN "#00FFFF"
/// full magenta(not pink) rgb(255, 0, 255) R+B
#define COLOR_PINK "#FF00FF"
/// full yellow rgb(255, 255, 0) R+G
/// Magenta rgb(255, 0, 255) R+B
#define COLOR_MAGENTA "#FF00FF"
/// Yellow rgb(255, 255, 0) R+G
#define COLOR_YELLOW "#FFFF00"

// colors define in use bellow

/// Olive rgb(128, 128, 0)
#define COLOR_OLIVE "#808000"
/// Silver rgb(192, 192, 192) shade of grey
#define COLOR_SILVER "#C0C0C0"
/// Gray rgb(128, 128, 128)
#define COLOR_GRAY "#808080"

#define COLOR_FLOORTILE_GRAY "#8D8B8B"

#define COLOR_HALF_TRANSPARENT_BLACK "#0000007A"

#define COLOR_DARK_RED "#A50824"

/// Maroon rgb(128, 0, 0) shade of red
#define COLOR_MAROON "#800000"

#define COLOR_VIVID_RED "#FF3232"
#define COLOR_LIGHT_GRAYISH_RED "#E4C7C5"
#define COLOR_SOFT_RED "#FA8282"

#define COLOR_VERY_SOFT_YELLOW "#FAE48E"

#define COLOR_OLIVE "#808000"

///light green rgb( 0, 128, 0)
#define COLOR_LIGHT_GREEN "#008000"
#define COLOR_DARK_MODERATE_LIME_GREEN "#44964A"

#define COLOR_TEAL "#008080"

#define COLOR_MODERATE_BLUE "#555CC2"

/// Purple rgb( 128, 0, 128)
#define COLOR_PURPLE "#800080"
#define COLOR_STRONG_VIOLET "#6927c5"

#define COLOR_BEIGE "#CEB689"
#define LIGHT_BEIGE "#CEB689"
#define COLOR_DARK_MODERATE_ORANGE "#8B633B"

#define COLOR_BROWN "#BA9F6D"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
///from mind/transfer_to. Sent after the mind has been transferred to a different body: (mob/previous_body)
#define COMSIG_MIND_TRANSFERRED "mind_transferred"
2 changes: 2 additions & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@
#define FLOOR_PLANE -7
/// Game Plane, where most of the game objects reside
#define GAME_PLANE -6
/// Above Game Plane. For things which are above game objects, but below screen effects.
#define ABOVE_GAME_PLANE -5
/// Roof plane, disappearing when entering buildings
#define ROOF_PLANE -4

Expand Down
1 change: 0 additions & 1 deletion code/__DEFINES/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ GLOBAL_LIST_INIT(all_minimap_flags, bitfield2list(MINIMAP_FLAG_ALL))

#define MINIMAP_ICON_COLOR_COMMANDER "#c6fcfc"
#define MINIMAP_ICON_COLOR_HEAD "#F0C542"
#define MINIMAP_ICON_COLOR_SILVER "#c0c0c0"
#define MINIMAP_ICON_COLOR_BRONZE "#eb9545"

#define MINIMAP_ICON_COLOR_DOCTOR "#b83737"
Expand Down
3 changes: 1 addition & 2 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@
#define INTERRUPT_MIDDLECLICK (1<<15)
#define INTERRUPT_DAZED (1<<16)
#define INTERRUPT_EMOTE (1<<17)
// By default not in INTERRUPT_ALL (too niche)
#define INTERRUPT_CHANGED_LYING (1<<18)

#define INTERRUPT_ALL (INTERRUPT_DIFF_LOC|INTERRUPT_DIFF_TURF|INTERRUPT_UNCONSCIOUS|INTERRUPT_KNOCKED_DOWN|INTERRUPT_STUNNED|INTERRUPT_NEEDHAND|INTERRUPT_RESIST)
#define INTERRUPT_ALL (INTERRUPT_DIFF_LOC|INTERRUPT_DIFF_TURF|INTERRUPT_UNCONSCIOUS|INTERRUPT_KNOCKED_DOWN|INTERRUPT_STUNNED|INTERRUPT_NEEDHAND|INTERRUPT_RESIST|INTERRUPT_CHANGED_LYING)
#define INTERRUPT_ALL_OUT_OF_RANGE (INTERRUPT_ALL & (~INTERRUPT_DIFF_TURF)|INTERRUPT_OUT_OF_RANGE)
#define INTERRUPT_MOVED (INTERRUPT_DIFF_LOC|INTERRUPT_DIFF_TURF|INTERRUPT_RESIST)
#define INTERRUPT_NO_NEEDHAND (INTERRUPT_ALL & (~INTERRUPT_NEEDHAND))
Expand Down
42 changes: 35 additions & 7 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ GLOBAL_LIST_INIT(ROLES_UNASSIGNED, list(JOB_SQUAD_MARINE))
GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL, WHITELIST_LEADER))

//=================================================

#define WHITELIST_YAUTJA (1<<0)
///Old holders of YAUTJA_ELDER
#define WHITELIST_YAUTJA_LEGACY (1<<1)
Expand All @@ -170,23 +171,50 @@ GLOBAL_LIST_INIT(whitelist_hierarchy, list(WHITELIST_NORMAL, WHITELIST_COUNCIL,
///Old holders of COMMANDER_COUNCIL for 3 months
#define WHITELIST_COMMANDER_COUNCIL_LEGACY (1<<7)
#define WHITELIST_COMMANDER_LEADER (1<<8)
///Former CO senator/whitelist overseer award
#define WHITELIST_COMMANDER_COLONEL (1<<9)

#define WHITELIST_JOE (1<<9)
#define WHITELIST_SYNTHETIC (1<<10)
#define WHITELIST_SYNTHETIC_COUNCIL (1<<11)
#define WHITELIST_JOE (1<<10)
#define WHITELIST_SYNTHETIC (1<<11)
#define WHITELIST_SYNTHETIC_COUNCIL (1<<12)
///Old holders of SYNTHETIC_COUNCIL for 3 months
#define WHITELIST_SYNTHETIC_COUNCIL_LEGACY (1<<12)
#define WHITELIST_SYNTHETIC_LEADER (1<<13)
#define WHITELIST_SYNTHETIC_COUNCIL_LEGACY (1<<13)
#define WHITELIST_SYNTHETIC_LEADER (1<<14)

///Senior Enlisted Advisor, auto granted by R_MENTOR
#define WHITELIST_MENTOR (1<<15)


#define WHITELIST_MENTOR (1<<14)
#define WHITELISTS_GENERAL (WHITELIST_YAUTJA|WHITELIST_COMMANDER|WHITELIST_SYNTHETIC|WHITELIST_MENTOR|WHITELIST_JOE)
#define WHITELISTS_COUNCIL (WHITELIST_YAUTJA_COUNCIL|WHITELIST_COMMANDER_COUNCIL|WHITELIST_SYNTHETIC_COUNCIL)
#define WHITELISTS_LEGACY_COUNCIL (WHITELIST_YAUTJA_COUNCIL_LEGACY|WHITELIST_COMMANDER_COUNCIL_LEGACY|WHITELIST_SYNTHETIC_COUNCIL_LEGACY)
#define WHITELISTS_LEADER (WHITELIST_YAUTJA_LEADER|WHITELIST_COMMANDER_LEADER|WHITELIST_SYNTHETIC_LEADER)

#define WHITELIST_EVERYTHING (WHITELISTS_GENERAL|WHITELISTS_COUNCIL|WHITELISTS_LEADER)

#define isCouncil(A) (GLOB.RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_YAUTJA_COUNCIL) || (GLOB.RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_SYNTHETIC_COUNCIL) || (GLOB.RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_COMMANDER_COUNCIL)
#define COUNCIL_LIST list(WHITELIST_COMMANDER_COUNCIL, WHITELIST_SYNTHETIC_COUNCIL, WHITELIST_YAUTJA_COUNCIL)
#define SENATOR_LIST list(WHITELIST_COMMANDER_LEADER, WHITELIST_SYNTHETIC_LEADER, WHITELIST_YAUTJA_LEADER)
#define isCouncil(A) (A.check_whitelist_status_list(COUNCIL_LIST))
#define isSenator(A) (A.check_whitelist_status_list(SENATOR_LIST))

DEFINE_BITFIELD(whitelist_status, list(
"WHITELIST_YAUTJA" = WHITELIST_YAUTJA,
"WHITELIST_YAUTJA_LEGACY" = WHITELIST_YAUTJA_LEGACY,
"WHITELIST_YAUTJA_COUNCIL" = WHITELIST_YAUTJA_COUNCIL,
"WHITELIST_YAUTJA_COUNCIL_LEGACY" = WHITELIST_YAUTJA_COUNCIL_LEGACY,
"WHITELIST_YAUTJA_LEADER" = WHITELIST_YAUTJA_LEADER,
"WHITELIST_COMMANDER" = WHITELIST_COMMANDER,
"WHITELIST_COMMANDER_COUNCIL" = WHITELIST_COMMANDER_COUNCIL,
"WHITELIST_COMMANDER_COUNCIL_LEGACY" = WHITELIST_COMMANDER_COUNCIL_LEGACY,
"WHITELIST_COMMANDER_COLONEL" = WHITELIST_COMMANDER_COLONEL,
"WHITELIST_COMMANDER_LEADER" = WHITELIST_COMMANDER_LEADER,
"WHITELIST_JOE" = WHITELIST_JOE,
"WHITELIST_SYNTHETIC" = WHITELIST_SYNTHETIC,
"WHITELIST_SYNTHETIC_COUNCIL" = WHITELIST_SYNTHETIC_COUNCIL,
"WHITELIST_SYNTHETIC_COUNCIL_LEGACY" = WHITELIST_SYNTHETIC_COUNCIL_LEGACY,
"WHITELIST_SYNTHETIC_LEADER" = WHITELIST_SYNTHETIC_LEADER,
"WHITELIST_MENTOR" = WHITELIST_MENTOR,
))

//=================================================

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
#define MAX_EMOTE_LEN 256
#define MAX_PAPER_MESSAGE_LEN 3072
#define MAX_BOOK_MESSAGE_LEN 9216
#define MAX_NAME_LEN 26
#define MAX_NAME_LEN 28
5 changes: 4 additions & 1 deletion code/__DEFINES/tgs.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tgstation-server DMAPI

#define TGS_DMAPI_VERSION "7.0.1"
#define TGS_DMAPI_VERSION "7.0.2"

// All functions and datums outside this document are subject to change with any version and should not be relied on.

Expand Down Expand Up @@ -426,6 +426,7 @@

/**
* Send a message to connected chats. This function may sleep!
* If TGS is offline when called, the message may be placed in a queue to be sent and this function will return immediately. Your message will be sent when TGS reconnects to the game.
*
* message - The [/datum/tgs_message_content] to send.
* admin_only: If [TRUE], message will be sent to admin connected chats. Vice-versa applies.
Expand All @@ -435,6 +436,7 @@

/**
* Send a private message to a specific user. This function may sleep!
* If TGS is offline when called, the message may be placed in a queue to be sent and this function will return immediately. Your message will be sent when TGS reconnects to the game.
*
* message - The [/datum/tgs_message_content] to send.
* user: The [/datum/tgs_chat_user] to PM.
Expand All @@ -444,6 +446,7 @@

/**
* Send a message to connected chats that are flagged as game-related in TGS. This function may sleep!
* If TGS is offline when called, the message may be placed in a queue to be sent and this function will return immediately. Your message will be sent when TGS reconnects to the game.
*
* message - The [/datum/tgs_message_content] to send.
* channels - Optional list of [/datum/tgs_chat_channel]s to restrict the message to.
Expand Down
6 changes: 0 additions & 6 deletions code/__DEFINES/typecheck/mobs_generic.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#define isAI(A) (istype(A, /mob/living/silicon/ai))
#define isARES(A) (istype(A, /mob/living/silicon/decoy/ship_ai))
#define isSilicon(A) (istype(A, /mob/living/silicon))
#define isRemoteControlling(M) (M && M.client && M.client.remote_control)
#define isRemoteControllingOrAI(M) ((M && M.client && M.client.remote_control) || (istype(M, /mob/living/silicon/ai)))

#define isbrain(A) (istype(A, /mob/living/brain))
#define isrobot(A) (istype(A, /mob/living/silicon/robot))
#define isanimal(A) (istype(A, /mob/living/simple_animal))
#define isanimalhostile(A) (istype(A, /mob/living/simple_animal/hostile))
#define isanimalretaliate(A) (istype(A, /mob/living/simple_animal/hostile/retaliate))
Expand All @@ -17,12 +14,9 @@
#define iscarp(A) (istype(A, /mob/living/simple_animal/hostile/carp))
#define isclown(A) (istype(A, /mob/living/simple_animal/hostile/retaliate/clown))
#define iscarbon(A) (istype(A, /mob/living/carbon))
#define isborg(A) (isrobot(A) && !ismaintdrone(A))
#define ishighersilicon(A) (isborg(A) || isRemoteControllingOrAI(A))
#define isliving(A) (istype(A, /mob/living))
#define isobserver(A) (istype(A, /mob/dead/observer))
#define isorgan(A) (istype(A, /obj/limb))
#define isnewplayer(A) (istype(A, /mob/new_player))
#define ismaintdrone(A) (istype(A,/mob/living/silicon/robot/drone))
#define isHellhound(A) (istype(A, /mob/living/carbon/xenomorph/hellhound))
#define isaghost(A) (copytext(A.key, 1, 2) == "@")
18 changes: 1 addition & 17 deletions code/__HELPERS/#maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,23 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
// MATH DEFINES

#define Ceiling(x) (-round(-x))
#define Clamp(val, min_val, max_val) (max(min_val, min(val, max_val)))
#define CLAMP01(x) (clamp(x, 0, 1))

// cotangent
#define Cot(x) (1 / Tan(x))
#define Cot(x) (1 / tan(x))

// cosecant
#define Csc(x) (1 / sin(x))

#define Default(a, b) (a ? a : b)
#define Floor(x) (round(x))

//Finds nearest integer to x, above or below
//something.5 or higher, round up, else round down
#define roundNearest(x) (((Ceiling(x) - x) <= (x - Floor(x))) ? Ceiling(x) : Floor(x))

// Greatest Common Divisor - Euclid's algorithm
#define Gcd(a, b) (b ? Gcd(b, a % b) : a)

#define Inverse(x) (1 / x)
#define IsEven(x) (x % 2 == 0)

// Returns true if val is from min to max, inclusive.
#define IsInRange(val, min, max) (min <= val && val <= max)

#define IsInteger(x) (Floor(x) == x)
#define IsOdd(x) (!IsEven(x))
#define IsMultiple(x, y) (x % y == 0)
Expand All @@ -47,9 +39,6 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
// secant
#define Sec(x) (1 / cos(x))

// tangent
#define Tan(x) (sin(x) / cos(x))

// 57.2957795 = 180 / Pi
#define ToDegrees(radians) (radians * 57.2957795)

Expand Down Expand Up @@ -85,11 +74,6 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,

return rotated_point

// Round up
/proc/n_ceil(num)
if(isnum(num))
return round(num)+1

///Format a power value in W, kW, MW, or GW.
/proc/display_power(powerused)
if(powerused < 1000) //Less than a kW
Expand Down
8 changes: 4 additions & 4 deletions code/__HELPERS/_time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
return gameTimestamp("mm:ss", time)

/proc/time_left_until(target_time, current_time, time_unit)
return CEILING(target_time - current_time, 1) / time_unit
return Ceiling(target_time - current_time) / time_unit

/proc/text2duration(text = "00:00") // Attempts to convert time text back to time value
var/split_text = splittext(text, ":")
Expand Down Expand Up @@ -91,21 +91,21 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
return "right now"
if(second < 60)
return "[second] second[(second != 1)? "s":""]"
var/minute = FLOOR(second / 60, 1)
var/minute = Floor(second / 60)
second = FLOOR(MODULUS(second, 60), round_seconds_to)
var/secondT
if(second)
secondT = " and [second] second[(second != 1)? "s":""]"
if(minute < 60)
return "[minute] minute[(minute != 1)? "s":""][secondT]"
var/hour = FLOOR(minute / 60, 1)
var/hour = Floor(minute / 60)
minute = MODULUS(minute, 60)
var/minuteT
if(minute)
minuteT = " and [minute] minute[(minute != 1)? "s":""]"
if(hour < 24)
return "[hour] hour[(hour != 1)? "s":""][minuteT][secondT]"
var/day = FLOOR(hour / 24, 1)
var/day = Floor(hour / 24)
hour = MODULUS(hour, 24)
var/hourT
if(hour)
Expand Down
10 changes: 0 additions & 10 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@
var/list/speaker_coverage = list()
for(var/obj/item/device/radio/R in radios)
if(R)
//Cyborg checks. Receiving message uses a bit of cyborg's charge.
var/obj/item/device/radio/borg/BR = R
if(istype(BR) && BR.myborg)
var/mob/living/silicon/robot/borg = BR.myborg
var/datum/robot_component/CO = borg.get_component("radio")
if(!CO)
continue //No radio component (Shouldn't happen)
if(!borg.is_component_functioning("radio") || !borg.cell_use_power(CO.active_usage))
continue //No power.

var/turf/speaker = get_turf(R)
if(speaker)
for(var/turf/T in hear(R.canhear_range,speaker))
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ world
if (!value) return color

var/list/RGB = ReadRGB(color)
RGB[1] = Clamp(RGB[1]+value,0,255)
RGB[2] = Clamp(RGB[2]+value,0,255)
RGB[3] = Clamp(RGB[3]+value,0,255)
RGB[1] = clamp(RGB[1]+value,0,255)
RGB[2] = clamp(RGB[2]+value,0,255)
RGB[3] = clamp(RGB[3]+value,0,255)
return rgb(RGB[1],RGB[2],RGB[3])

/proc/sort_atoms_by_layer(list/atoms)
Expand Down
13 changes: 13 additions & 0 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,19 @@
original += result
return original

/// Returns a list of atoms sorted by each entry's distance to `target`.
/proc/sort_list_dist(list/atom/list_to_sort, atom/target)
var/list/distances = list()
for(var/atom/A as anything in list_to_sort)
// Just in case this happens anyway.
if(!istype(A))
stack_trace("sort_list_dist() was called with a list containing a non-atom object. ([A.type])")
return list_to_sort

distances[A] = get_dist_sqrd(A, target)

return sortTim(distances, GLOBAL_PROC_REF(cmp_numeric_asc), TRUE)

//Converts a bitfield to a list of numbers (or words if a wordlist is provided)
/proc/bitfield2list(bitfield = 0, list/wordlist)
var/list/r = list()
Expand Down
Loading

0 comments on commit bcd8b2b

Please sign in to comment.