Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BeagleGaming1/cmss13
Browse files Browse the repository at this point in the history
  • Loading branch information
BeagleGaming1 committed Jun 29, 2023
2 parents 19060a1 + ae54d1f commit 8d5e539
Show file tree
Hide file tree
Showing 151 changed files with 8,846 additions and 2,572 deletions.
4 changes: 3 additions & 1 deletion .github/guides/STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ While we normally encourage (and in some cases, even require) bringing out of da
This is a simple one - as we will eventually move to 515, we will need to ditch this kind of callback. So please don't add any new ones. Make our lives easier.

### PROC_REF Macros
When referencing procs in RegisterSignal, Callback and other procs you should use PROC_REF,TYPE_PROC_REF and GLOBAL_PROC_REF macros.
When referencing procs in RegisterSignal, Callback and other procs you should use PROC_REF, TYPE_PROC_REF and GLOBAL_PROC_REF macros.
They ensure compilation fails if the reffered to procs change names or get removed.
The macro to be used depends on how the proc you're in relates to the proc you want to use:

Expand Down Expand Up @@ -168,6 +168,8 @@ This is a simple one - as we will eventually move to 515, we will need to ditch
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(funny)), 100))
```

Note that the same rules go for verbs too! We have VERB_REF() and TYPE_VERB_REF() as you need it in these same cases. GLOBAL_VERB_REF() isn't a thing however, as verbs are not global.

### Signal Handlers

All procs that are registered to listen for signals using `RegisterSignal()` must contain at the start of the proc `SIGNAL_HANDLER` eg;
Expand Down
54 changes: 54 additions & 0 deletions code/__DEFINES/ARES.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/// Generic access for 1:1 conversations with ARES and unrestricted commands.
#define ARES_ACCESS_BASIC 0
/// Secure Access, can read ARES Announcements and Bioscans.
#define ARES_ACCESS_COMMAND 1
#define ARES_ACCESS_JOE 2
/// CL, can read Apollo Log and also Delete Announcements.
#define ARES_ACCESS_CORPORATE 3
/// Senior Command, can Delete Bioscans.
#define ARES_ACCESS_SENIOR 4
/// Synth, CE & Commanding Officer, can read the access log.
#define ARES_ACCESS_CE 5
#define ARES_ACCESS_SYNTH 6
#define ARES_ACCESS_CO 7
/// High Command, can read the deletion log.
#define ARES_ACCESS_HIGH 8
#define ARES_ACCESS_WY_COMMAND 9
/// Debugging. Allows me to view everything without using a high command rank. Unlikely to stay in a full merge.
#define ARES_ACCESS_DEBUG 10

#define ARES_RECORD_ANNOUNCE "Announcement Record"
#define ARES_RECORD_ANTIAIR "AntiAir Control Log"
#define ARES_RECORD_ASRS "Requisition Record"
#define ARES_RECORD_BIOSCAN "Bioscan Record"
#define ARES_RECORD_BOMB "Orbital Bombardment Record"
#define ARES_RECORD_DELETED "Deleted Record"
#define ARES_RECORD_SECURITY "Security Update"
#define ARES_RECORD_MAINTENANCE "Maintenance Ticket"
#define ARES_RECORD_ACCESS "Access Ticket"

/// Not by ARES logged through marine_announcement()
#define ARES_LOG_NONE 0
/// Logged with all announcements
#define ARES_LOG_MAIN 1
/// Logged in the security updates
#define ARES_LOG_SECURITY 2

/// Access levels specifically for Working Joe management console
#define APOLLO_ACCESS_REQUEST 0
#define APOLLO_ACCESS_REPORTER 1
#define APOLLO_ACCESS_TEMP 2
#define APOLLO_ACCESS_AUTHED 3
#define APOLLO_ACCESS_JOE 4
#define APOLLO_ACCESS_DEBUG 5

/// Ticket statuses, both for Access and Maintenance
#define TICKET_PENDING "pending"
#define TICKET_ASSIGNED "assigned"
#define TICKET_REJECTED "rejected"
#define TICKET_CANCELLED "cancelled"
#define TICKET_COMPLETED "complete"

/// Cooldowns
#define COOLDOWN_ARES_SENSOR 60 SECONDS
#define COOLDOWN_ARES_ACCESS_CONTROL 20 SECONDS
1 change: 1 addition & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ block( \
#define SOUND_REBOOT (1<<5)
#define SOUND_ADMIN_MEME (1<<6)
#define SOUND_ADMIN_ATMOSPHERIC (1<<7)
#define SOUND_ARES_MESSAGE (1<<8)

//toggles_chat
#define CHAT_OOC (1<<0)
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ most of them are tied into map-placed objects. This should be reworked in the fu

#define ACCESS_MARINE_SYNTH 36

// AI Core Accesses
/// Used in temporary passes
#define ACCESS_MARINE_AI_TEMP 90
/// Used as dedicated access to ARES Core.
#define ACCESS_MARINE_AI 91
/// Used to access Maintenance Protocols on ARES Interface.
#define ACCESS_ARES_DEBUG 92

//Surface access levels
#define ACCESS_CIVILIAN_PUBLIC 100
#define ACCESS_CIVILIAN_LOGISTICS 101
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ var/global/list/note_categories = list("Admin", "Merit", "Commanding Officer", "
#define CC_MARK(user) "(<a href='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];ccmark=[REF(user)]'>MARK</a>)"
#define CC_REPLY(user) "(<a href='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];CentcommReply=[REF(user)]'>RPLY</a>)"
#define OBSERVER_JMP(observer, atom) atom ? "(<a href='?src=[REF(observer)];jumptocoord=1;X=[atom.x];Y=[atom.y];Z=[atom.z]'>JMP</a>)" : ""
#define ARES_MARK(user) "(<a href='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];AresMark=[REF(user)]'>MARK</a>)"
#define ARES_REPLY(user, ref) "(<a href='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];AresReply=[REF(user)];AresRef=[ref]'>RPLY</a>)"

/atom/proc/Admin_Coordinates_Readable(area_name, admin_jump_ref)
var/turf/T = get_turf(src)
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define CAMERA_NET_ALAMO "Alamo"
#define CAMERA_NET_NORMANDY "Normandy"
#define CAMERA_NET_COLONY "Colony"
#define CAMERA_NET_ARES "ARES"

#define CAMERA_NET_MILITARY "Military"
#define CAMERA_NET_OVERWATCH "Overwatch"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/defenses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Defines for barricade upgrades
#define BARRICADE_UPGRADE_BURN "Biohazard Upgrade (+Burn)"
#define BARRICADE_UPGRADE_BRUTE "Reinforced Upgrade (+Brute)"
#define BARRICADE_UPGRADE_EXPLOSIVE "Explosive Upgrade (+Explosive)"
#define BARRICADE_UPGRADE_ANTIFF "Composite Upgrade (++Explosive, ++Projectile, ++Fire)"

// Defines for defense stats
#define DEFENSE_FUNCTIONAL 0
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/language.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define LANGUAGE_XENOMORPH "Xenomorph"
#define LANGUAGE_HIVEMIND "Hivemind"

#define LANGUAGE_APOLLO "Apollo Link"
#define LANGUAGE_APOLLO "APOLLO Link"

#define LANGUAGE_TELEPATH "Telepath Implant"

Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#define AREA_ALLOW_XENO_JOIN (1<<2)
/// Flags the area as a containment area
#define AREA_CONTAINMENT (1<<3)
/// Flags the area as permanently unweedable. Still requires is_resin_allowed = FALSE
#define AREA_UNWEEDABLE (1<<4)
/// Default number of ticks for do_after
#define DA_DEFAULT_NUM_TICKS 5

Expand Down
2 changes: 0 additions & 2 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#define OVEREAT_TIME 200

//=================================================
#define ALIEN_SELECT_AFK_BUFFER 1 // How many minutes that a person can be AFK before not being allowed to be an alien.

#define HEAT_DAMAGE_LEVEL_1 2 //Amount of damage applied when your body temperature just passes the 360.15k safety point
#define HEAT_DAMAGE_LEVEL_2 4 //Amount of damage applied when your body temperature passes the 400K point
#define HEAT_DAMAGE_LEVEL_3 8 //Amount of damage applied when your body temperature passes the 1000K point
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define EVACUATION_STATUS_IN_PROGRESS 2
#define EVACUATION_STATUS_COMPLETE 3

#define NUCLEAR_TIME_LOCK 90 MINUTES
#define NUKE_EXPLOSION_INACTIVE 0
#define NUKE_EXPLOSION_ACTIVE 1
#define NUKE_EXPLOSION_IN_PROGRESS 2
Expand Down
16 changes: 16 additions & 0 deletions code/__DEFINES/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@
#define WEED_BASE_GROW_SPEED (5 SECONDS)
#define WEED_BASE_DECAY_SPEED (10 SECONDS)

/// The time you must be dead to join as a xeno larva
#define XENO_JOIN_DEAD_LARVA_TIME (2.5 MINUTES)
/// The time you must be dead to join as xeno (not larva)
#define XENO_JOIN_DEAD_TIME (5 MINUTES)
/// The time of inactivity you cannot exceed to join as a xeno
#define XENO_JOIN_AFK_TIME_LIMIT (5 MINUTES)
/// The amount of time after round start before buried larva spawns are disallowed
#define XENO_BURIED_LARVA_TIME_LIMIT (30 MINUTES)

/// The time against away_timer when an AFK xeno larva can be replaced
#define XENO_LEAVE_TIMER_LARVA 80 //80 seconds
/// The time against away_timer when an AFK xeno (not larva) can be replaced
#define XENO_LEAVE_TIMER 300 //300 seconds
/// The time against away_timer when an AFK xeno gets listed in the available list so ghosts can get ready
#define XENO_AVAILABLE_TIMER 60 //60 seconds

/// Between 2% to 10% of explosion severity
#define WEED_EXPLOSION_DAMAGEMULT rand(2, 10)*0.01

Expand Down
4 changes: 0 additions & 4 deletions code/__HELPERS/_time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

#define DECISECONDS_TO_HOURS /36000

#define XENO_LEAVE_TIMER_LARVA 80 //80 seconds
#define XENO_LEAVE_TIMER 300 //300 seconds
#define XENO_AVAILABLE_TIMER 60 //60 seconds, when to add a xeno to the avaliable list so ghosts can get ready

var/midnight_rollovers = 0
var/rollovercheck_last_timeofday = 0

Expand Down
9 changes: 9 additions & 0 deletions code/__HELPERS/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ var/atom/cmp_dist_origin=null

/proc/cmp_typepaths_asc(A, B)
return sorttext("[B]","[A]")

/// Compares mobs based on their timeofdeath value in ascending order
/proc/cmp_mob_deathtime_asc(mob/A, mob/B)
return A.timeofdeath - B.timeofdeath

/// Compares observers based on their larva_queue_time value in ascending order
/// Assumes the client on the observer is not null
/proc/cmp_obs_larvaqueuetime_asc(mob/dead/observer/A, mob/dead/observer/B)
return A.client.larva_queue_time - B.client.larva_queue_time
5 changes: 0 additions & 5 deletions code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

return text

//Sends resource files to client cache
/client/proc/getFiles()
for(var/file in args)
src << browse_rsc(file)

/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list(".txt",".log",".htm"))
var/path = root

Expand Down
61 changes: 48 additions & 13 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,35 +241,70 @@
else
return get_step(start, EAST)

// Same as above but for alien candidates.
/proc/get_alien_candidates()
/// Get a list of observers that can be alien candidates, optionally sorted by larva_queue_time
/proc/get_alien_candidates(sorted = TRUE)
var/list/candidates = list()

for(var/i in GLOB.observer_list)
var/mob/dead/observer/O = i
for(var/mob/dead/observer/cur_obs as anything in GLOB.observer_list)
// Preference check
if(!cur_obs.client || !cur_obs.client.prefs || !(cur_obs.client.prefs.be_special & BE_ALIEN_AFTER_DEATH))
continue

// Jobban check
if(!O.client || !O.client.prefs || !(O.client.prefs.be_special & BE_ALIEN_AFTER_DEATH) || jobban_isbanned(O, JOB_XENOMORPH))
if(jobban_isbanned(cur_obs, JOB_XENOMORPH))
continue

//players that can still be revived are skipped
if(O.mind && O.mind.original && ishuman(O.mind.original))
var/mob/living/carbon/human/H = O.mind.original
if (H.check_tod() && H.is_revivable())
if(cur_obs.mind && cur_obs.mind.original && ishuman(cur_obs.mind.original))
var/mob/living/carbon/human/cur_human = cur_obs.mind.original
if(cur_human.check_tod() && cur_human.is_revivable())
continue

// copied from join as xeno
var/deathtime = world.time - O.timeofdeath
if(deathtime < 3000 && ( !O.client.admin_holder || !(O.client.admin_holder.rights & R_ADMIN)) )
var/deathtime = world.time - cur_obs.timeofdeath
if(deathtime < XENO_JOIN_DEAD_TIME && ( !cur_obs.client.admin_holder || !(cur_obs.client.admin_holder.rights & R_ADMIN)) )
continue

// Admins and AFK players cannot be drafted
if(O.client.inactivity / 600 > ALIEN_SELECT_AFK_BUFFER + 5 || (O.client.admin_holder && (O.client.admin_holder.rights & R_MOD)) && O.adminlarva == 0)
// AFK players cannot be drafted
if(cur_obs.client.inactivity > XENO_JOIN_AFK_TIME_LIMIT)
continue

candidates += O
// Mods with larva protection cannot be drafted
if((cur_obs.client.admin_holder && (cur_obs.client.admin_holder.rights & R_MOD)) && !cur_obs.adminlarva)
continue

candidates += cur_obs

// Optionally sort by larva_queue_time
if(sorted && length(candidates))
candidates = sort_list(candidates, GLOBAL_PROC_REF(cmp_obs_larvaqueuetime_asc))

return candidates

/**
* Messages observers that are currently candidates an update on the queue.
*
* Arguments:
* * candidates - The list of observers from get_alien_candidates()
* * dequeued - How many candidates to skip messaging because they were dequeued
* * cache_only - Whether to not actually send a to_chat message and instead only update larva_queue_cached_message
*/
/proc/message_alien_candidates(list/candidates, dequeued, cache_only = FALSE)
var/new_players = 0
for(var/i in (1 + dequeued) to candidates.len)
var/mob/dead/observer/cur_obs = candidates[i]

// Generate the messages
var/cached_message = SPAN_XENONOTICE("You are currently [i-dequeued]\th in the larva queue. There are [new_players] ahead of you that have yet to play this round.")
cur_obs.larva_queue_cached_message = cached_message
if(!cache_only)
var/chat_message = dequeued ? replacetext(cached_message, "currently", "now") : cached_message
to_chat(candidates[i], chat_message)

// Count how many are prioritized
if(cur_obs.client.larva_queue_time < 2) // 0 and 1 because facehuggers/t-domers are slightly deprioritized
new_players++

/proc/convert_k2c(temp)
return ((temp - T0C))

Expand Down
44 changes: 37 additions & 7 deletions code/_byond_version_compat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,49 @@
#define LIBCALL call_ext
#endif

// So we want to have compile time guarantees these procs exist on local type, unfortunately 515 killed the .proc/procname syntax so we have to use nameof()
// So we want to have compile time guarantees these methods exist on local type, unfortunately 515 killed the .proc/procname and .verb/verbname syntax so we have to use nameof()
// For the record: GLOBAL_VERB_REF would be useless as verbs can't be global.

#if DM_VERSION < 515
/// Call by name proc reference, checks if the proc exists on this type or as a global proc

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (.proc/##X)
/// Call by name proc reference, checks if the proc exists on given type or as a global proc
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (.verb/##X)

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X)
/// Call by name proc reference, checks if the proc is existing global proc
/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (##TYPE.verb/##X)

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#else
/// Call by name proc reference, checks if the proc exists on this type or as a global proc

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (nameof(.proc/##X))
/// Call by name proc reference, checks if the proc exists on given type or as a global proc
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (nameof(.verb/##X))

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X))
/// Call by name proc reference, checks if the proc is existing global proc
/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (nameof(##TYPE.verb/##X))

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#endif

#if (DM_VERSION == 515)
/// fcopy will crash on 515 linux if given a non-existant file, instead of returning 0 like on 514 linux or 515 windows
/// var case matches documentation for fcopy.
/world/proc/__fcopy(Src, Dst)
if (istext(Src) && !fexists(Src))
return 0
return fcopy(Src, Dst)

#define fcopy(Src, Dst) world.__fcopy(Src, Dst)

#endif
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ DEFINE_BITFIELD(flags_area, list(
"AREA_NOTUNNEL" = AREA_NOTUNNEL,
"AREA_ALLOW_XENO_JOIN" = AREA_ALLOW_XENO_JOIN,
"AREA_CONTAINMENT" = AREA_CONTAINMENT,
"ARES_UNWEEDABLE" = AREA_UNWEEDABLE,
))

DEFINE_BITFIELD(disabilities, list(
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GLOBAL_LIST_EMPTY_TYPED(alive_human_list, /mob/living/carbon/human) // list of a
GLOBAL_LIST_EMPTY_TYPED(xeno_mob_list, /mob/living/carbon/xenomorph)
GLOBAL_LIST_EMPTY_TYPED(living_xeno_list, /mob/living/carbon/xenomorph)
GLOBAL_LIST_EMPTY_TYPED(xeno_cultists, /mob/living/carbon/human)
GLOBAL_LIST_EMPTY_TYPED(player_embryo_list, /obj/item/alien_embryo)

GLOBAL_LIST_EMPTY_TYPED(hellhound_list, /mob/living/carbon/xenomorph/hellhound)
GLOBAL_LIST_EMPTY_TYPED(zombie_list, /mob/living/carbon/human)
Expand Down
Loading

0 comments on commit 8d5e539

Please sign in to comment.