Skip to content

Commit

Permalink
Merge branch 'cmss13-devs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cuberound authored Aug 9, 2024
2 parents b412fdb + 0ce0c73 commit d2d0c64
Show file tree
Hide file tree
Showing 447 changed files with 5,668 additions and 7,516 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/autowiki.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifdef AUTOWIKI
#define AUTOWIKI_SKIP(skip) autowiki_skip = skip
#define IS_AUTOWIKI_SKIP(datum) datum.autowiki_skip
#else
#define AUTOWIKI_SKIP(skip)
#define IS_AUTOWIKI_SKIP(datum) UNLINT(FALSE)
#endif
1 change: 1 addition & 0 deletions code/__DEFINES/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define CAMERA_NET_CONTAINMENT "Containment"
#define CAMERA_NET_CONTAINMENT_HIDDEN "Containment Hidden"
#define CAMERA_NET_RESEARCH "Research"
#define CAMERA_NET_BRIG "Brig"
#define CAMERA_NET_ALAMO "Alamo"
#define CAMERA_NET_NORMANDY "Normandy"
#define CAMERA_NET_COLONY "Colony"
Expand Down
4 changes: 3 additions & 1 deletion code/__DEFINES/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
* Chemistry defines
*/

/// Amount of bottle icon variations in total
#define BOTTLE_ICON_CHOICES 4
/// Amount of random icon variations for pills in total
#define PILL_ICON_CHOICES 21
#define PILL_ICON_CHOICES 22
/* Pill icon classes to generate mappings for */
#define PILL_ICON_CLASSES list("bica", "kelo", "dex", "para", "tram", "atox", "tox", "inap", "peri", "spac", "drug", "stim", "alky", "imi", "qc", "tric", "psych", "oxy")

Expand Down
27 changes: 14 additions & 13 deletions code/__DEFINES/conflict.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,25 @@
#define GUN_TRIGGER_SAFETY (1<<1)
#define GUN_UNUSUAL_DESIGN (1<<2)
#define GUN_SILENCED (1<<3)
#define GUN_CANT_EXECUTE (1<<4)
///If checking for ammo with current.mag you have to check it against numerical values, as booleans will not trigger.
#define GUN_INTERNAL_MAG (1<<4)
#define GUN_AUTO_EJECTOR (1<<5)
#define GUN_AMMO_COUNTER (1<<6)
#define GUN_BURST_FIRING (1<<7)
#define GUN_FLASHLIGHT_ON (1<<8)
#define GUN_WY_RESTRICTED (1<<9)
#define GUN_SPECIALIST (1<<10)
#define GUN_WIELDED_FIRING_ONLY (1<<11)
#define GUN_INTERNAL_MAG (1<<5)
#define GUN_AUTO_EJECTOR (1<<6)
#define GUN_AMMO_COUNTER (1<<7)
#define GUN_BURST_FIRING (1<<8)
#define GUN_FLASHLIGHT_ON (1<<9)
#define GUN_WY_RESTRICTED (1<<10)
#define GUN_SPECIALIST (1<<11)
#define GUN_WIELDED_FIRING_ONLY (1<<12)
/// removes unwielded accuracy and scatter penalties (not recoil)
#define GUN_ONE_HAND_WIELDED (1<<12)
#define GUN_ANTIQUE (1<<13)
#define GUN_ONE_HAND_WIELDED (1<<13)
#define GUN_ANTIQUE (1<<14)
/// Whether the gun has been fired by its current user (reset upon `dropped()`)
#define GUN_RECOIL_BUILDUP (1<<14)
#define GUN_RECOIL_BUILDUP (1<<15)
/// support weapon, bipod will grant autofire
#define GUN_SUPPORT_PLATFORM (1<<15)
#define GUN_SUPPORT_PLATFORM (1<<16)
/// No gun description, only base desc
#define GUN_NO_DESCRIPTION (1<<16)
#define GUN_NO_DESCRIPTION (1<<17)
// NOTE: Don't add flags past 1<<23, it'll break things due to BYOND limitations. You can usually use a Component instead.

#define USES_STREAKS (1<<0)
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ GLOBAL_LIST_INIT(job_command_roles, JOB_COMMAND_ROLES_LIST)
#define JOB_XENOMORPH_QUEEN "Queen"

// For coloring the ranks in the statistics menu
#define JOB_PLAYTIME_TIER_0 (0 HOURS)
#define JOB_PLAYTIME_TIER_1 (10 HOURS)
#define JOB_PLAYTIME_TIER_2 (25 HOURS)
#define JOB_PLAYTIME_TIER_3 (70 HOURS)
Expand Down
7 changes: 4 additions & 3 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#define CANROOT (1<<6)
#define GODMODE (1<<12)
#define FAKEDEATH (1<<13) //Replaces stuff like changeling.changeling_fakedeath
#define DISFIGURED (1<<14) //I'll probably move this elsewhere if I ever get wround to writing a bitflag mob-damage system
//#define DISFIGURED (1<<14) //unused
#define XENO_HOST (1<<15) //Tracks whether we're gonna be a baby alien's mummy.
#define IMMOBILE_ACTION (1<<16) // If you are performing an action that prevents you from being pushed by your own people.
#define PERMANENTLY_DEAD (1<<17)
Expand Down Expand Up @@ -166,8 +166,9 @@
#define ORGAN_ROBOT 2

#define ORGAN_HEALTHY 0
#define ORGAN_BRUISED 1
#define ORGAN_BROKEN 2
#define ORGAN_LITTLE_BRUISED 1 //used by stethoscopes and penlights
#define ORGAN_BRUISED 2
#define ORGAN_BROKEN 3

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

Expand Down
9 changes: 5 additions & 4 deletions code/__DEFINES/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@

// engineer skill
#define SKILL_ENGINEER_DEFAULT 0
#define SKILL_ENGINEER_TRAINED 1 //barricade repair && c4 use (mini-engis, specs)
#define SKILL_ENGINEER_ENGI 2 //plasteel barricade deconstruction, hacking&&planet engine fixing&&apc building, Telecomms fixing (Combat Engi, OT, etc.)
#define SKILL_ENGINEER_MASTER 3 //Synths
#define SKILL_ENGINEER_MAX 3
#define SKILL_ENGINEER_NOVICE 1 //barricade repair && c4 use (mini-engis, specs)
#define SKILL_ENGINEER_TRAINED 2 //plasteel barricade deconstruction, hacking&&planet engine fixing&&apc building, Telecomms fixing (OT, etc.)
#define SKILL_ENGINEER_ENGI 3 // Slightly faster at everything (Combat Technicians)
#define SKILL_ENGINEER_MASTER 4 //Synths
#define SKILL_ENGINEER_MAX 4

//medical skill
#define SKILL_MEDICAL_DEFAULT 0
Expand Down
22 changes: 22 additions & 0 deletions code/__DEFINES/sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@
#define SOUND_CHANNEL_LOBBY 1023
#define SOUND_CHANNEL_Z 1024


//default byond sound echo list index positions.
//ECHO_DIRECT and ECHO_ROOM are the only two that actually appear to do anything, and represent the dry and wet channels of the environment effects, respectively.
#define ECHO_DIRECT 1
#define ECHO_DIRECTHF 2
#define ECHO_ROOM 3
#define ECHO_ROOMHF 4
#define ECHO_OBSTRUCTION 5
#define ECHO_OBSTRUCTIONLFRATIO 6
#define ECHO_OCCLUSION 7
#define ECHO_OCCLUSIONLFRATIO 8
#define ECHO_OCCLUSIONROOMRATIO 9
#define ECHO_OCCLUSIONDIRECTRATIO 10
#define ECHO_EXCLUSION 11
#define ECHO_EXCLUSIONLFRATIO 12
#define ECHO_OUTSIDEVOLUMEHF 13
#define ECHO_DOPPLERFACTOR 14
#define ECHO_ROLLOFFFACTOR 15
#define ECHO_ROOMROLLOFFFACTOR 16
#define ECHO_AIRABSORPTIONFACTOR 17
#define ECHO_FLAGS 18

//default byond sound environments
#define SOUND_ENVIRONMENT_NONE -1
#define SOUND_ENVIRONMENT_GENERIC 0
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
#define SS_INIT_NIGHTMARE 21.5
#define SS_INIT_TIMETRACK 21.1
#define SS_INIT_HUMANS 21
#define SS_INIT_WHO 20
#define SS_INIT_POWER 19
#define SS_INIT_INFLUXMCSTATS 12
#define SS_INIT_INFLUXSTATS 11
Expand Down
2 changes: 1 addition & 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.1.2"
#define TGS_DMAPI_VERSION "7.1.3"

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

Expand Down
13 changes: 7 additions & 6 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#define RANGE_TURFS(RADIUS, CENTER) \
block( \
(CENTER).x-(RADIUS), (CENTER).y-(RADIUS), (CENTER).z, \
(CENTER).x+(RADIUS), (CENTER).y+(RADIUS), (CENTER).z \
)

/// Returns a list of turfs within H_RADIUS tiles horizontally and V_RADIUS tiles vertically of CENTER.
#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \
block( \
(CENTER).x-(H_RADIUS), (CENTER).y-(V_RADIUS), (CENTER).z, \
(CENTER).x+(H_RADIUS), (CENTER).y+(V_RADIUS), (CENTER).z \
)

/// Returns a list of turfs within Dist tiles of Center. When Dist >= 5 faster than a `range()` filtered to `/turf`s.
#define RANGE_TURFS(Dist, Center) RECT_TURFS(Dist, Dist, Center)

/// Returns a list of turfs within Dist tiles of Center, excluding Center. When Dist >= 5 faster than an `orange()` filtered to `/turf`s.
#define ORANGE_TURFS(Dist, Center) (RANGE_TURFS(Dist, Center) - Center)

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

Expand Down
18 changes: 12 additions & 6 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,23 @@
* You should only pass integers in.
*/
/proc/pick_weight(list/list_to_pick)
if(length(list_to_pick) == 0)
return null

var/total = 0
var/item
for(item in list_to_pick)
for(var/item in list_to_pick)
if(!list_to_pick[item])
list_to_pick[item] = 0
total += list_to_pick[item]

total = rand(0, total)
for(item in list_to_pick)
total -= list_to_pick[item]
if(total <= 0 && list_to_pick[item])
total = rand(1, total)
for(var/item in list_to_pick)
var/item_weight = list_to_pick[item]
if(item_weight == 0)
continue

total -= item_weight
if(total <= 0)
return item

return null
Expand Down
3 changes: 3 additions & 0 deletions code/__HELPERS/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ GLOBAL_LIST_INIT(cmp_field, "name")
/proc/cmp_typepaths_asc(A, B)
return sorttext("[B]","[A]")

/proc/cmp_typepaths_name_asc(atom/A, atom/B)
return sorttext(initial(A.name), initial(B.name))

/// Compares mobs based on their timeofdeath value in ascending order
/proc/cmp_mob_deathtime_asc(mob/A, mob/B)
return A.timeofdeath - B.timeofdeath
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
var/list/turfs = new/list()
var/rsq = radius * (radius+0.5)

for(var/turf/T in range(radius, centerturf))
for(var/turf/T as anything in RANGE_TURFS(radius, centerturf))
var/dx = T.x - centerturf.x
var/dy = T.y - centerturf.y
if(dx*dx + dy*dy <= rsq)
Expand Down
16 changes: 0 additions & 16 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@
result = first ^ second
return result

//Pretends to pick an element based on its weight but really just seems to pick a random element.
/proc/pickweight(list/L)
var/total = 0
var/item
for (item in L)
if (!L[item])
L[item] = 1
total += L[item]

total = rand(1, total)
for (item in L)
total -=L [item]
if (total <= 0)
return item
return null

/// Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/L)
RETURN_TYPE(L[_].type)
Expand Down
54 changes: 35 additions & 19 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,17 @@ GLOBAL_DATUM(action_purple_power_up, /image)
else
air_master.tiles_to_update += T2*/

/proc/get_cardinal_dir(atom/A, atom/B)
var/dx = abs(B.x - A.x)
var/dy = abs(B.y - A.y)
return get_dir(A, B) & (rand() * (dx+dy) < dy ? 3 : 12)

/// Returns the nearest cardinal dir between two atoms. Favors NORTH/SOUTH on perfect diagonals. Consistent and reversible.
/proc/get_cardinal_dir(atom/start, atom/end) as num
var/dx = end.x - start.x
var/dy = end.y - start.y
if(!(dx || dy))
return 0 //returns 0 when on same x/y, consistent with get_dir()

if(abs(dx) > abs(dy))
return dx < 0 ? WEST : EAST
else
return dy < 0 ? SOUTH : NORTH

//Returns the 2 dirs perpendicular to the arg
/proc/get_perpen_dir(dir)
Expand Down Expand Up @@ -1283,10 +1289,7 @@ GLOBAL_LIST_INIT(WALLITEMS, list(
origin = get_turf(origin)
if(!origin)
return
var/list/turfs = list()
for(var/turf/T in orange(origin, outer_range))
if(!inner_range || get_dist(origin, T) >= inner_range)
turfs += T
var/list/turfs = (RANGE_TURFS(outer_range, origin) - RANGE_TURFS(inner_range - 1, origin))
if(length(turfs))
return pick(turfs)

Expand Down Expand Up @@ -1337,29 +1340,35 @@ GLOBAL_LIST_INIT(WALLITEMS, list(
GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)

/// Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant).
/proc/dview(range = world.view, center, invis_flags = 0)
/proc/dview(range = world.view, atom/center, invis_flags = 0)
if(!center)
return

GLOB.dview_mob.loc = center

GLOB.dview_mob.loc = isturf(center) ? center : center.loc
GLOB.dview_mob.see_invisible = invis_flags

. = view(range, GLOB.dview_mob)
. = oview(range, GLOB.dview_mob)
GLOB.dview_mob.loc = null

/// Version of oview() which ignores darkness
/proc/doview(range, atom/center, invis_flags)
if(!center)
return

return dview(range, center, invis_flags) - center

/mob/dview
name = "INTERNAL DVIEW MOB"
invisibility = 101
invisibility = INVISIBILITY_ABSTRACT
density = FALSE
see_in_dark = 1e6
see_in_dark = INFINITY
var/ready_to_die = FALSE

/mob/dview/Initialize() //Properly prevents this mob from gaining huds or joining any global lists
SHOULD_CALL_PARENT(FALSE)
if(flags_atom & INITIALIZED)
if(CHECK_BITFIELD(flags_atom, INITIALIZED))
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags_atom |= INITIALIZED
ENABLE_BITFIELD(flags_atom, INITIALIZED)
return INITIALIZE_HINT_NORMAL

/mob/dview/Destroy(force = FALSE)
Expand All @@ -1375,12 +1384,19 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)


#define FOR_DVIEW(type, range, center, invis_flags) \
GLOB.dview_mob.loc = center; \
GLOB.dview_mob.loc = isturf(center) ? (center) : (center).loc; \
GLOB.dview_mob.see_invisible = invis_flags; \
for(type in view(range, GLOB.dview_mob))
for(type in oview(range, GLOB.dview_mob))

#define FOR_DVIEW_END GLOB.dview_mob.loc = null

#define FOR_DOVIEW(type, range, center, invis_flags) \
GLOB.dview_mob.loc = isturf(center) ? (center) : (center).loc; \
GLOB.dview_mob.see_invisible = invis_flags; \
for(type in oview(range, GLOB.dview_mob) - (center))

#define FOR_DOVIEW_END FOR_DVIEW_END

/proc/get_turf_pixel(atom/AM)
if(!istype(AM))
return
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ DEFINE_BITFIELD(flags_gun_features, list(
"GUN_TRIGGER_SAFETY" = GUN_TRIGGER_SAFETY,
"GUN_UNUSUAL_DESIGN" = GUN_UNUSUAL_DESIGN,
"GUN_SILENCED" = GUN_SILENCED,
"GUN_CANT_EXECUTE" = GUN_CANT_EXECUTE,
"GUN_INTERNAL_MAG" = GUN_INTERNAL_MAG,
"GUN_AUTO_EJECTOR" = GUN_AUTO_EJECTOR,
"GUN_AMMO_COUNTER" = GUN_AMMO_COUNTER,
Expand Down Expand Up @@ -356,7 +357,6 @@ DEFINE_BITFIELD(status_flags, list(
"PASSEMOTES" = PASSEMOTES,
"GODMODE" = GODMODE,
"FAKEDEATH" = FAKEDEATH,
"DISFIGURED" = DISFIGURED,
"XENO_HOST" = XENO_HOST,
"IMMOBILE_ACTION" = IMMOBILE_ACTION,
"PERMANENTLY_DEAD" = PERMANENTLY_DEAD,
Expand Down
17 changes: 17 additions & 0 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ GLOBAL_LIST_INIT_TYPED(chemical_gen_classes_list, /list, list("C" = list(),"C1"
//properties generated in chemicals, helps to make sure the same property doesn't show up 10 times
GLOBAL_LIST_INIT_TYPED(generated_properties, /list, list("positive" = list(), "negative" = list(), "neutral" = list()))

GLOBAL_LIST_INIT_TYPED(space_weapons, /datum/space_weapon, setup_ship_weapon())
GLOBAL_LIST_INIT_TYPED(space_weapons_ammo, /datum/space_weapon_ammo, setup_ship_ammo())

GLOBAL_LIST_INIT_TYPED(ammo_list, /datum/ammo, setup_ammo()) //List of all ammo types. Used by guns to tell the projectile how to act.
GLOBAL_REFERENCE_LIST_INDEXED(joblist, /datum/job, title) //List of all jobstypes, minus borg and AI

Expand Down Expand Up @@ -348,6 +351,20 @@ GLOBAL_LIST_INIT(hj_emotes, setup_hazard_joe_emotes())
all_species[S.name] = S
return all_species

/proc/setup_ship_weapon()
var/list/ammo_list = list()
for(var/weapon_type in subtypesof(/datum/space_weapon))
var/datum/space_weapon/new_weapon = new weapon_type
ammo_list[new_weapon.type] = new_weapon
return ammo_list

/proc/setup_ship_ammo()
var/list/ammo_list = list()
for(var/ammo_type in subtypesof(/datum/space_weapon_ammo))
var/datum/space_weapon_ammo/new_ammo = new ammo_type
ammo_list[new_ammo.type] = new_ammo
return ammo_list

/proc/setup_ammo()
var/list/blacklist = list(/datum/ammo/energy, /datum/ammo/energy/yautja, /datum/ammo/energy/yautja/rifle, /datum/ammo/bullet/shotgun, /datum/ammo/xeno)
var/list/ammo_list = list()
Expand Down
Loading

0 comments on commit d2d0c64

Please sign in to comment.