Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Whiskey-Outpost-Mod
Browse files Browse the repository at this point in the history
  • Loading branch information
FslashN committed Mar 29, 2024
2 parents 2429cea + 2a371a9 commit a55118c
Show file tree
Hide file tree
Showing 35 changed files with 328 additions and 133 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/dropships.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@
#define DROPSHIP_MIN_AUTO_DELAY 10 SECONDS
#define DROPSHIP_AUTO_RETRY_COOLDOWN 20 SECONDS
#define DROPSHIP_MEDEVAC_COOLDOWN 20 SECONDS

//Hatches states
#define SHUTTLE_DOOR_BROKEN -1
#define SHUTTLE_DOOR_UNLOCKED 0
#define SHUTTLE_DOOR_LOCKED 1
20 changes: 20 additions & 0 deletions code/datums/entities/player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
set waitfor=0
WAIT_DB_READY
load_player_data_info(get_player_from_key(ckey))
check_discord_link()

/client/proc/load_player_data_info(datum/entity/player/player)
if(ckey != player.ckey)
Expand All @@ -482,6 +483,25 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
record_login_triplet(player.ckey, address, computer_id)
player_data.sync()

/client/proc/check_discord_link()
var/datum/view_record/discord_link/current_link = locate() in DB_VIEW(/datum/view_record/discord_link, DB_COMP("player_id", DB_EQUALS, player_data.id))

if(!current_link)

if(player_data.discord_link_id != null)
player_data.discord_link_id = null
player_data.save()
player_data.sync()

return

if(player_data.discord_link_id == current_link.id)
return

player_data.discord_link_id = current_link.id
player_data.save()
player_data.sync()

/datum/entity/player/proc/check_ban(computer_id, address, is_telemetry)
. = list()

Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/command/cic/staffofficer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ AddTimelock(/datum/job/command/bridge, list(
/datum/job/command/bridge/ai
total_positions = 1
spawn_positions = 1
prime_priority = TRUE

/datum/job/command/bridge/ai/set_spawn_positions(count)
return spawn_positions
Expand Down
3 changes: 3 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
/// If TRUE, this job will spawn w/ a cryo emergency kit during evac/red alert
var/gets_emergency_kit = TRUE

/// Whether or not linking your discord account can let you get prime priority for this role
var/prime_priority = FALSE

/datum/job/New()
. = ..()

Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/marine/squad/leader.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ AddTimelock(/datum/job/marine/leader, list(
/datum/job/marine/leader/ai
total_positions = 1
spawn_positions = 1
prime_priority = TRUE

/datum/job/marine/leader/ai/upp
title = JOB_SQUAD_LEADER_UPP
Expand Down
68 changes: 40 additions & 28 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ var/global/datum/authority/branch/role/RoleAuthority
#define RETURN_TO_LOBBY 2

#define NEVER_PRIORITY 0
#define HIGH_PRIORITY 1
#define MED_PRIORITY 2
#define LOW_PRIORITY 3
#define PRIME_PRIORITY 1
#define HIGH_PRIORITY 2
#define MED_PRIORITY 3
#define LOW_PRIORITY 4

#define SHIPSIDE_ROLE_WEIGHT 0.25

Expand Down Expand Up @@ -247,37 +248,19 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
if(!length(roles_to_assign) || !length(unassigned_players))
return

log_debug("ASSIGNMENT: Starting prime priority assignments.")
for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players))
assign_role_to_player_by_priority(cycled_unassigned, roles_to_assign, unassigned_players, PRIME_PRIORITY)

log_debug("ASSIGNMENT: Starting regular priority assignments.")
for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players))
var/player_assigned_job = FALSE
log_debug("ASSIGNMENT: We have started assigning for [cycled_unassigned].")

for(var/priority in HIGH_PRIORITY to LOW_PRIORITY)
var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(priority))
log_debug("ASSIGNMENT: We have started cycled through priority [priority] for [cycled_unassigned].")

for(var/job_name in wanted_jobs_by_name)
log_debug("ASSIGNMENT: We are cycling through wanted jobs and are at [job_name] for [cycled_unassigned].")
if(job_name in roles_to_assign)
log_debug("ASSIGNMENT: We have found [job_name] in roles to assign for [cycled_unassigned].")
var/datum/job/actual_job = roles_to_assign[job_name]

if(assign_role(cycled_unassigned, actual_job))
log_debug("ASSIGNMENT: We have assigned [job_name] to [cycled_unassigned].")
unassigned_players -= cycled_unassigned

if(actual_job.spawn_positions != -1 && actual_job.current_positions >= actual_job.spawn_positions)
roles_to_assign -= job_name
log_debug("ASSIGNMENT: We have ran out of slots for [job_name] and it has been removed from roles to assign.")

player_assigned_job = TRUE
break

player_assigned_job = assign_role_to_player_by_priority(cycled_unassigned, roles_to_assign, unassigned_players, priority)
if(player_assigned_job)
log_debug("ASSIGNMENT: [cycled_unassigned] has been assigned a job and we are breaking.")
break

log_debug("ASSIGNMENT: [cycled_unassigned] did not get a job at priority [priority], moving to next priority level.")

if(!length(roles_to_assign))
log_debug("ASSIGNMENT: No more roles to assign, breaking.")
break
Expand Down Expand Up @@ -323,10 +306,39 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
log_debug("ASSIGNMENT: [cycled_unassigned] has opted for return to lobby alternate option.")
cycled_unassigned.ready = 0

log_debug("ASSIGNMENT: Assigning complete. Players unassigned: [length(unassigned_players)] Jobs unassigned: [length(roles_to_assign)]")
log_debug("ASSIGNMENT: Assignment complete. Players unassigned: [length(unassigned_players)] Jobs unassigned: [length(roles_to_assign)]")

return roles_to_assign

/datum/authority/branch/role/proc/assign_role_to_player_by_priority(mob/new_player/cycled_unassigned, list/roles_to_assign, list/unassigned_players, priority)
log_debug("ASSIGNMENT: We have started cycled through priority [priority] for [cycled_unassigned].")
var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(priority))
var/player_assigned_job = FALSE

for(var/job_name in wanted_jobs_by_name)
log_debug("ASSIGNMENT: We are cycling through wanted jobs and are at [job_name] for [cycled_unassigned].")
if(job_name in roles_to_assign)
log_debug("ASSIGNMENT: We have found [job_name] in roles to assign for [cycled_unassigned].")
var/datum/job/actual_job = roles_to_assign[job_name]

if(assign_role(cycled_unassigned, actual_job))
log_debug("ASSIGNMENT: We have assigned [job_name] to [cycled_unassigned].")
unassigned_players -= cycled_unassigned

if(actual_job.spawn_positions != -1 && actual_job.current_positions >= actual_job.spawn_positions)
roles_to_assign -= job_name
log_debug("ASSIGNMENT: We have ran out of slots for [job_name] and it has been removed from roles to assign.")

player_assigned_job = TRUE
break

if(player_assigned_job)
log_debug("ASSIGNMENT: [cycled_unassigned] has been assigned a job.")
return player_assigned_job

log_debug("ASSIGNMENT: [cycled_unassigned] did not get a job at priority [priority].")
return player_assigned_job

/**
* Calculate role balance weight for one person joining as that role. This weight is used
* when calculating the number of xenos both roundstart and burrowed larva they get for
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/door_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
if(is_mainship_level(z)) // on the almayer
return

shuttle.control_doors("lock", "all", force=FALSE)
shuttle.control_doors("force-lock", "all", force=FALSE)

/obj/structure/machinery/door_control/proc/handle_door()
for(var/obj/structure/machinery/door/airlock/D in range(range))
Expand Down
12 changes: 6 additions & 6 deletions code/game/machinery/doors/airlock_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@
radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK)


/obj/structure/machinery/door/airlock/open(surpress_send)
/obj/structure/machinery/door/airlock/open(forced)
. = ..()
if(!surpress_send) send_status()
if(!forced)
send_status()


/obj/structure/machinery/door/airlock/close(surpress_send)
/obj/structure/machinery/door/airlock/close(forced)
. = ..()
if(!surpress_send) send_status()

if(!forced)
send_status()

/obj/structure/machinery/door/airlock/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
flick("door_deny", src)
return

/obj/structure/machinery/door/proc/open(forced=0)
/obj/structure/machinery/door/proc/open(forced)
if(!density)
return TRUE
if(operating || !loc)
Expand Down
78 changes: 73 additions & 5 deletions code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,42 @@
no_panel = 1
not_weldable = 1
var/queen_pryable = TRUE
var/obj/docking_port/mobile/marine_dropship/linked_dropship

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/ex_act(severity)
return

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/attackby(obj/item/item, mob/user)
if(HAS_TRAIT(item, TRAIT_TOOL_MULTITOOL))
var/direction
switch(id)
if("starboard_door")
direction = "starboard"
if("port_door")
direction = "port"
if("aft_door")
direction = "aft"
if(!linked_dropship || !linked_dropship.door_control.door_controllers[direction])
return ..()
var/datum/door_controller/single/control = linked_dropship.door_control.door_controllers[direction]
if (control.status != SHUTTLE_DOOR_BROKEN)
return ..()
if(!skillcheck(user, SKILL_ENGINEER, SKILL_ENGINEER_ENGI))
to_chat(user, SPAN_WARNING("You don't seem to understand how to restore a remote connection to [src]."))
return
if(user.action_busy)
return

to_chat(user, SPAN_WARNING("You begin to restore the remote connection to [src]."))
if(!do_after(user, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_BUILD))
to_chat(user, SPAN_WARNING("You fail to restore a remote connection to [src]."))
return
unlock(TRUE)
close(FALSE)
control.status = SHUTTLE_DOOR_UNLOCKED
to_chat(user, SPAN_WARNING("You successfully restored the remote connection to [src]."))
return
..()

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/unlock()
if(is_reserved_level(z))
Expand All @@ -181,13 +213,32 @@
if(!queen_pryable)
return ..()

if(!locked)
return ..()

to_chat(xeno, SPAN_NOTICE("You try and force the doors open"))
if(xeno.action_busy)
return

var/direction
switch(id)
if("starboard_door")
direction = "starboard"
if("port_door")
direction = "port"
if("aft_door")
direction = "aft"
var/datum/door_controller/single/control
if(linked_dropship && linked_dropship.door_control.door_controllers[direction])
control = linked_dropship.door_control.door_controllers[direction]

if(control && control.status == SHUTTLE_DOOR_BROKEN)
to_chat(xeno, SPAN_NOTICE("The door is already disabled."))
return

to_chat(xeno, SPAN_WARNING("You try and force the doors open!"))
if(do_after(xeno, 3 SECONDS, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
if(control)
control.status = SHUTTLE_DOOR_BROKEN
unlock(TRUE)
open(1)
open(TRUE)
lock(TRUE)

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/ds1
Expand All @@ -198,6 +249,23 @@
name = "\improper Normandy cargo door"
icon = 'icons/obj/structures/doors/dropship2_cargo.dmi'

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/dropshipside
width = 2

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/dropshipside/ds1
name = "\improper Alamo crew hatch"
icon = 'icons/obj/structures/doors/dropship1_side2.dmi'

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/dropshipside/ds1/midway
name = "\improper Midway crew hatch"

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/dropshipside/ds2
name = "\improper Normandy crew hatch"
icon = 'icons/obj/structures/doors/dropship2_side2.dmi'

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/dropshipside/ds2/cyclone
name = "\improper Cyclone crew hatch"

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/upp
name = "\improper Akademia Nauk cargo door"
icon = 'icons/obj/structures/doors/dropshipupp_cargo.dmi'
Expand Down Expand Up @@ -252,7 +320,7 @@
continue
INVOKE_ASYNC(atom_movable, TYPE_PROC_REF(/atom/movable, throw_atom), projected, 1, SPEED_FAST, null, FALSE)

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/lifeboat/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock, idnum, override)
/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/lifeboat/connect_to_shuttle(mapload, obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
. = ..()
if(istype(port, /obj/docking_port/mobile/crashable/lifeboat))
var/obj/docking_port/mobile/crashable/lifeboat/lifeboat = port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@

list("BACKPACK", -1, null, null, null),
list("Lightweight IMP Backpack", round(scale * 15), /obj/item/storage/backpack/marine, VENDOR_ITEM_REGULAR),
list("USCM Technician Backpack", round(scale * 15), /obj/item/storage/backpack/marine/tech, VENDOR_ITEM_REGULAR),
list("USCM Satchel", round(scale * 15), /obj/item/storage/backpack/marine/satchel, VENDOR_ITEM_REGULAR),
list("Technician Chestrig", round(scale * 15), /obj/item/storage/backpack/marine/satchel/tech, VENDOR_ITEM_REGULAR),
list("Shotgun Scabbard", round(scale * 5), /obj/item/storage/large_holster/m37, VENDOR_ITEM_REGULAR),

list("RESTRICTED BACKPACKS", -1, null, null),
Expand Down
20 changes: 17 additions & 3 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,14 @@ var/const/MAX_SAVE_SLOTS = 10
//splitJobs - Allows you split the table by job. You can make different tables for each department by including their heads. Defaults to CE to make it look nice.
//width - Screen' width.
//height - Screen's height.
/datum/preferences/proc/SetChoices(mob/user, limit = 19, list/splitJobs = list(JOB_CHIEF_REQUISITION), width = 450, height = 450)
/datum/preferences/proc/SetChoices(mob/user, limit = 19, list/splitJobs = list(JOB_CHIEF_REQUISITION), width = 480, height = 450)
if(!RoleAuthority)
return

var/host_bypass = FALSE
if(user.client?.admin_holder?.check_for_rights(R_HOST))
host_bypass = TRUE

var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Choose occupation chances</b><br>Unavailable occupations are crossed out.<br><br>"
Expand All @@ -676,7 +680,7 @@ var/const/MAX_SAVE_SLOTS = 10
HTML += "</table></td><td valign='top' width='20%'><table width='100%' cellpadding='1' cellspacing='0'>"
index = 0

HTML += "<tr class='[job.selection_class]'><td width='40%' align='right'>"
HTML += "<tr class='[job.selection_class]'><td width='30%' align='center'>"

if(jobban_isbanned(user, job.title))
HTML += "<b><del>[job.disp_title]</del></b></td><td width='10%' align='center'></td><td><b>BANNED</b></td></tr>"
Expand Down Expand Up @@ -714,6 +718,9 @@ var/const/MAX_SAVE_SLOTS = 10
if(NEVER_PRIORITY)
b_color = "red"
priority_text = "NEVER"
if(PRIME_PRIORITY)
b_color = "purple"
priority_text = "PRIME"
if(HIGH_PRIORITY)
b_color = "blue"
priority_text = "HIGH"
Expand All @@ -724,6 +731,9 @@ var/const/MAX_SAVE_SLOTS = 10
b_color = "orange"
priority_text = "LOW"

if(j == PRIME_PRIORITY && !host_bypass && (!job.prime_priority || !user.client?.player_data?.discord_link_id || user.client?.get_total_human_playtime() < JOB_PLAYTIME_TIER_1))
continue

HTML += "<a class='[j == cur_priority ? b_color : "inactive"]' href='?_src_=prefs;preference=job;task=input;text=[job.title];target_priority=[j];'>[priority_text]</a>"
if (j < 4)
HTML += "&nbsp"
Expand Down Expand Up @@ -922,11 +932,15 @@ var/const/MAX_SAVE_SLOTS = 10
if(!J || priority < 0 || priority > 4)
return FALSE


if(!length(job_preference_list))
ResetJobs()

// Need to set old HIGH priority to 2
if(priority == PRIME_PRIORITY)
for(var/job in job_preference_list)
if(job_preference_list[job] == PRIME_PRIORITY)
job_preference_list[job] = MED_PRIORITY

if(priority == HIGH_PRIORITY)
for(var/job in job_preference_list)
if(job_preference_list[job] == HIGH_PRIORITY)
Expand Down
Loading

0 comments on commit a55118c

Please sign in to comment.