Skip to content

Commit

Permalink
Squads 3! (#1924)
Browse files Browse the repository at this point in the history
* Separates all the stuff

* It does compile but I doubt it works

* It does compile and assign me a squad

* Fixes some retasking stuff

* Access and jobs depend on role

* Even more retasking

* Renamed a variable

* Apparently that didn't delete the old name

* Renamed a different variable

* Missed the assignments

* Got the management console working

* Made pagers mostly receive-only

* Fixed TGUI

* Working on the squad manager

* Okay, that's the actual computer taken care of

* Fixed tablet squad manager

* Makes pager replay last message when used in-hand

* Not everyone is a midshipman, okay?

* Tried to balance squad size a bit more

* Tweaked descriptions

* Duplicate messages are gone

* Added control for message length

* Lets squads get relevant emergency alerts

* Lets squads get relevant emergency alerts

* missed a couple

* Moved files and deleted old ones

* one more rename

* More file cleanup

* Made leader buttons just not show up if there's no leader

* Actually, fallback engineers do need access to the engine

* Added ability to message relevant squads to request consoles

* Hopefully fixed the linter

* Maybe this is what it wants

* Oh hey that time it only said one line was wrong

* I guess it lied to me and I don't need these curly braces

* This is supposed to be deleted

* Re-fixed glock ammo paths

* Adds middies to disallowed jobs

* Updates savefile

* Revert "Updates savefile"

This reverts commit 3097c30.

* Updates savefile correctly

* Stopped preferred squad from overriding job restrictions

* Restricts squad management to captain and XO

* Made pagers buzz if inside stuff

* fixes some runtimes

* Fixes a runtime and adds some logs

* Hopefully fixes keybindings

* input length check

* fix

* Shortened some messages

* more length checking

* Shortened role descriptions and bypassed radiochat for objectives

* aaaaaaa

* sanity checks

* silences pager static

* do not write keybindings what the fuck

* makes the bug stop happening

* Revert "do not write keybindings what the fuck"

This reverts commit eb0c973.

* Adds logging and a possible workaround for savefile issues

* Makes backup actually work

* simplifies remove_ship a bit

* Revert "simplifies remove_ship a bit"

This reverts commit b990089.

* Tweaks to the security squad

* Updates squad vendors to work better

* Adds lost item fee

* Put squad kit pox into fancy boxes
  • Loading branch information
covertcorvid authored Aug 22, 2022
1 parent 87bf93f commit 8c990f3
Show file tree
Hide file tree
Showing 26 changed files with 964 additions and 1,087 deletions.
11 changes: 10 additions & 1 deletion code/__DEFINES/nsv13.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,13 @@ GLOBAL_DATUM_INIT(conquest_role_handler, /datum/conquest_role_handler, new)
#define NEVER_DELETE_OCCUPIED (1<<2) // Even if the overmap takes enough damage to be destroyed, never delete it if it's occupied. I don't know when we'd use this it just seems useful
#define DELETE_UNOCCUPIED_ON_DEPARTURE (1<<3) // When a fighter/dropship leaves the map level for the overmap level, look for remaining occupants. If none exist, delete
#define FIGHTERS_ARE_OCCUPANTS (1<<4) // Docked overmaps count as occupants when deciding whether to delete something
//NSV13 change end

// Squads
//These names ought to be self explanatory for any XO when he assigns them.
#define DC_SQUAD "Damage Control Team"
#define MEDICAL_SQUAD "Medical Team"
#define SECURITY_SQUAD "Security Support"
#define COMBAT_AIR_PATROL "Combat Air Patrol"
#define MUNITIONS_SUPPORT "Munitions Support"
#define CIC_OPS "CIC Ops"
#define SQUAD_TYPES list(DC_SQUAD, MEDICAL_SQUAD, SECURITY_SQUAD, COMBAT_AIR_PATROL, MUNITIONS_SUPPORT, CIC_OPS)
56 changes: 56 additions & 0 deletions code/game/machinery/requests_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
#define REQ_SCREEN_VIEW_MSGS 8
#define REQ_SCREEN_AUTHENTICATE 9
#define REQ_SCREEN_ANNOUNCE 10
#define REQ_SCREEN_WRITE_SQUAD 11 //NSV13

#define REQ_EMERGENCY_SECURITY 1
#define REQ_EMERGENCY_ENGINEERING 2
Expand Down Expand Up @@ -68,6 +69,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
var/emergency //If an emergency has been called by this device. Acts as both a cooldown and lets the responder know where it the emergency was triggered from
var/receive_ore_updates = FALSE //If ore redemption machines will send an update when it receives new ores.
var/auth_id = "Unknown" //Will contain the name and and job of the person who verified it
var/static/list/departments_with_squads = list("bridge", "cic", "medbay", "medical", "engineering", "security", "munitions", "hangar")
max_integrity = 300
armor = list("melee" = 70, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90, "stamina" = 0)

Expand Down Expand Up @@ -147,6 +149,8 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)

dat += "<A href='?src=[REF(src)];setScreen=[REQ_SCREEN_REQ_ASSISTANCE]'>Request Assistance</A><BR>"
dat += "<A href='?src=[REF(src)];setScreen=[REQ_SCREEN_REQ_SUPPLIES]'>Request Supplies</A><BR>"
if(lowertext(department) in departments_with_squads) //NSV13 - squad messaging
dat += "<A href='?src=[REF(src)];writeSquad=1'>Page Squad Members</A><BR>"
dat += "<A href='?src=[REF(src)];setScreen=[REQ_SCREEN_RELAY]'>Relay Anonymous Information</A><BR><BR>"

if(!emergency)
Expand Down Expand Up @@ -219,6 +223,16 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
dat += "<span class='linkOff'>Announce Message</span><BR>"
dat += "<BR><A href='?src=[REF(src)];setScreen=[REQ_SCREEN_MAIN]'><< Back</A><BR>"

//NSV13 - squad messaging
if(REQ_SCREEN_WRITE_SQUAD)
dat += "<B>Message Squads</B><BR><BR>"
dat += "<b>Message: </b>[message]<BR><BR>"
dat += "<div class='notice'>You may authenticate your message now by scanning your ID or your stamp</div><BR>"
dat += "<b>Validated by:</b> [msgVerified ? msgVerified : "<i>Not Validated</i>"]<br>"
dat += "<b>Stamped by:</b> [msgStamped ? msgStamped : "<i>Not Stamped</i>"]<br><br>"
dat += "<A href='?src=[REF(src)];sendSquadMessage=[TRUE]'>Send Message</A><BR>"
dat += "<BR><A href='?src=[REF(src)];setScreen=[REQ_SCREEN_MAIN]'><< Discard Message</A><BR>"

if(!dat)
CRASH("No UI for src. Screen var is: [screen]")
var/datum/browser/popup = new(user, "req_console", "[department] Requests Console", 450, 440)
Expand Down Expand Up @@ -285,21 +299,29 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
if(href_list["emergency"])
if(!emergency)
var/radio_freq
var/squad_type //NSV13 - squad alerts
switch(text2num(href_list["emergency"]))
if(REQ_EMERGENCY_SECURITY) //Security
radio_freq = FREQ_SECURITY
emergency = "Security"
squad_type = SECURITY_SQUAD //NSV13 - squad alerts
if(REQ_EMERGENCY_ENGINEERING) //Engineering
radio_freq = FREQ_ENGINEERING
emergency = "Engineering"
squad_type = DC_SQUAD //NSV13 - squad alerts
if(REQ_EMERGENCY_MEDICAL) //Medical
radio_freq = FREQ_MEDICAL
emergency = "Medical"
squad_type = MEDICAL_SQUAD //NSV13 - squad alerts
if(radio_freq)
Radio.set_frequency(radio_freq)
Radio.talk_into(src,"[emergency] emergency in [department]!!",radio_freq)
update_icon()
addtimer(CALLBACK(src, .proc/clear_emergency), 5 MINUTES)
if(squad_type) //NSV13 - squad alerts
var/list/squads = GLOB.squad_manager.role_squad_map[squad_type]
for(var/datum/squad/S as() in squads)
S.broadcast(null, "[emergency] emergency in [department]!!")

if(href_list["send"] && message && to_department && priority)

Expand All @@ -317,6 +339,8 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
radio_freq = FREQ_SECURITY
if("cargobay" || "mining")
radio_freq = FREQ_SUPPLY
if("munitions") //NSV13 - added munitions
radio_freq = FREQ_MUNITIONS

var/datum/signal/subspace/messaging/rc/signal = new(src, list(
"sender" = department,
Expand Down Expand Up @@ -351,6 +375,38 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments)
if(href_list["setSilent"])
silent = text2num(href_list["setSilent"]) ? TRUE : FALSE

//NSV13 - squad messaging
if(href_list["writeSquad"])
var/new_message = stripped_input(usr, "Write your message:", "Awaiting Input", "", MAX_MESSAGE_LEN)
if(new_message)
message = new_message
screen = REQ_SCREEN_WRITE_SQUAD

if(href_list["sendSquadMessage"] && message)
var/squad_type
switch(lowertext(department))
if("bridge", "cic")
squad_type = CIC_OPS
if("munitions")
squad_type = MUNITIONS_SUPPORT
if("security")
squad_type = SECURITY_SQUAD
if("medical", "medbay")
squad_type = MEDICAL_SQUAD
if("engineering")
squad_type = DC_SQUAD
if("hangar")
squad_type = COMBAT_AIR_PATROL

if(!squad_type)
screen = REQ_SCREEN_ERR
else
var/list/squads = GLOB.squad_manager.role_squad_map[squad_type]
for(var/datum/squad/S as() in squads)
S.broadcast(department, message)
screen = REQ_SCREEN_SENT
//NSV13 end

updateUsrDialog()

/obj/machinery/requests_console/say_mod(input, list/message_mods = list())
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@ GLOBAL_LIST_INIT(cardboard_recipes, list ( \
new /datum/stack_recipe("light bulbs box", /obj/item/storage/box/lights/bulbs), \
new /datum/stack_recipe("mixed lights box", /obj/item/storage/box/lights/mixed), \
new /datum/stack_recipe("mouse traps box", /obj/item/storage/box/mousetraps), \
new /datum/stack_recipe("candle box", /obj/item/storage/fancy/candle_box)
new /datum/stack_recipe("candle box", /obj/item/storage/fancy/candle_box), \
null, // NSV13 - added squad kit box
new /datum/stack_recipe("squad kit box", /obj/item/storage/box/squad_kit)
)),

null, \
Expand Down
2 changes: 0 additions & 2 deletions code/game/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ INITIALIZE_IMMEDIATE(/atom/movable/virtualspeaker)
if(ishuman(M))
// Humans use their job as seen on the crew manifest. This is so the AI
// can know their job even if they don't carry an ID.
var/mob/living/carbon/human/H = M
squad_rank = H.squad_rank
var/datum/data/record/findjob = find_record("name", name, GLOB.data_core.general)
if(findjob)
job = findjob.fields["rank"]
Expand Down
10 changes: 6 additions & 4 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
var/max_save_slots = 3

var/bad_savefile = FALSE //NSV13 - fixing some savefile stupidity

//non-preference stuff
var/muted = 0
var/last_ip
Expand Down Expand Up @@ -133,7 +135,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)

var/action_buttons_screen_locs = list()
//Nsv13 squads - we CM now
var/squad_specialisation = "Midshipman"
var/preferred_squad = "Able"
//Nsv13 - Syndicate role select
var/preferred_syndie_role = CONQUEST_ROLE_GRUNT

Expand Down Expand Up @@ -251,7 +253,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<a href='?_src_=prefs;preference=syndiecrew;task=input'><b>Preferred Syndicate Role:</b> [preferred_syndie_role]</a><br>" //Nsv13

dat += "<b>Squad Preferences:</b><BR>"
dat += "<a href='?_src_=prefs;preference=squad;task=input'><b>Squad Specialisation:</b> [squad_specialisation]</a><br>" //Nsv13 squads - we CM now.
dat += "<a href='?_src_=prefs;preference=squad;task=input'><b>Preferred GQ Squad:</b> [preferred_squad]</a><br>" //Nsv13 squads - we CM now.
dat += "</tr></table>"

dat += "<h2>Body</h2>"
Expand Down Expand Up @@ -1665,9 +1667,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)

//Nsv13 squads - we CM now
if("squad")
var/new_spec = input(user, "Choose your preferred squad specialisation:", "Squad Setup") as null|anything in GLOB.squad_manager.specialisations
var/datum/squad/new_spec = input(user, "Choose your preferred squad:", "Squad Setup") as null|anything in GLOB.squad_manager.squads
if(new_spec)
squad_specialisation = new_spec
preferred_squad = new_spec.name
if("syndiecrew")
var/client/C = (istype(user, /client)) ? user : user.client
C.select_syndie_role()
Expand Down
27 changes: 19 additions & 8 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 36
#define SAVEFILE_VERSION_MAX 38

/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
Expand Down Expand Up @@ -64,7 +64,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(n_gear)
purchased_gear += n_gear
if(current_version < 34)
squad_specialisation = "Midshipman"
preferred_squad = "Able"
preferred_pilot_role = PILOT_COMBAT
if(current_version < 35)
chat_on_map = TRUE
Expand All @@ -73,6 +73,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
see_rc_emotes = TRUE
S.dir.Remove("overhead_chat")
see_balloon_alerts = BALLOON_ALERT_ALWAYS
if(current_version < 37)
preferred_squad = "Able"
if(current_version < 38) //NSV13 - added some keybinds
key_bindings = deepCopyList(GLOB.keybinding_list_by_key)
WRITE_FILE(S["key_bindings"], key_bindings)
return

/datum/preferences/proc/update_character(current_version, savefile/S)
Expand Down Expand Up @@ -145,9 +150,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(current_version < 27)
if (!(underwear in GLOB.underwear_list))
underwear = "Nude"
if(current_version < 36) //NSV13 - added some keybinds
key_bindings = deepCopyList(GLOB.keybinding_list_by_key)
WRITE_FILE(S["key_bindings"], key_bindings)

/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey)
Expand Down Expand Up @@ -189,10 +191,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car

READ_FILE(S["crew_objectives"], crew_objectives)

//Nsv13 squads - we CM now
READ_FILE(S["squad_specialisation"], squad_specialisation)
READ_FILE(S["preferred_syndie_role"], preferred_syndie_role)
READ_FILE(S["preferred_pilot_role"], preferred_pilot_role)
//NSV13 end

READ_FILE(S["default_slot"], default_slot)
READ_FILE(S["chat_toggles"], chat_toggles)
Expand Down Expand Up @@ -268,12 +269,22 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(!equipped_gear)
equipped_gear = list()

//Nsv13 squads - we CM now
try
READ_FILE(S["preferred_squad"], preferred_squad)
catch
bad_savefile = TRUE
return TRUE

/datum/preferences/proc/save_preferences()
if(!path)
return FALSE
var/savefile/S = new /savefile(path)
if(bad_savefile) // NSV13 - back it up so we can restore it later, and give them a clean one in the meantime
fcopy(S, path + ".bad")
S = null
fdel(path)
S = new /savefile(path)
if(!S)
return FALSE
S.cd = "/"
Expand Down Expand Up @@ -326,7 +337,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["purchased_gear"], purchased_gear)
WRITE_FILE(S["equipped_gear"], equipped_gear)
//Nsv13 squads - we CM now
WRITE_FILE(S["squad_specialisation"], squad_specialisation)
WRITE_FILE(S["preferred_squad"], preferred_squad)
WRITE_FILE(S["preferred_syndie_role"], preferred_syndie_role)
WRITE_FILE(S["preferred_pilot_role"], preferred_pilot_role)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
builtInCamera.network = list("ss13")
//Nsv13
for(var/stype in subtypesof(/datum/component/simple_teamchat/radio_dependent/squad))
AddComponent(stype)
AddComponent(stype, override = TRUE)

//Nsv13 end

Expand Down
14 changes: 10 additions & 4 deletions nsv13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3546,10 +3546,6 @@
#include "nsv13\code\game\general_quarters\damage.dm"
#include "nsv13\code\game\general_quarters\dropship.dm"
#include "nsv13\code\game\general_quarters\dropship_types.dm"
#include "nsv13\code\game\general_quarters\squad2.dm"
#include "nsv13\code\game\general_quarters\squad_items.dm"
#include "nsv13\code\game\general_quarters\squad_management.dm"
#include "nsv13\code\game\general_quarters\squad_vendor.dm"
#include "nsv13\code\game\machinery\boarding_harpoon.dm"
#include "nsv13\code\game\machinery\custom_airlocks.dm"
#include "nsv13\code\game\machinery\custom_machines.dm"
Expand Down Expand Up @@ -3768,6 +3764,16 @@
#include "nsv13\code\modules\security_levels\security_levels.dm"
#include "nsv13\code\modules\ship_missions\hail_computer.dm"
#include "nsv13\code\modules\shuttle\computer.dm"
#include "nsv13\code\modules\squads\squad_computers.dm"
#include "nsv13\code\modules\squads\squad_datum.dm"
#include "nsv13\code\modules\squads\squad_helmets.dm"
#include "nsv13\code\modules\squads\squad_hud.dm"
#include "nsv13\code\modules\squads\squad_human.dm"
#include "nsv13\code\modules\squads\squad_items.dm"
#include "nsv13\code\modules\squads\squad_jobs.dm"
#include "nsv13\code\modules\squads\squad_lead_finder.dm"
#include "nsv13\code\modules\squads\squad_manager.dm"
#include "nsv13\code\modules\squads\squad_vendor.dm"
#include "nsv13\code\modules\turbolift\lazylift.dm"
#include "nsv13\code\modules\turbolift\turbolift.dm"
#include "nsv13\code\modules\uplink\uplink_items.dm"
Expand Down
5 changes: 1 addition & 4 deletions nsv13/code/controllers/subsystem/ranks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ Checks two text ranks, see which one outranks the other. Used for squad rank ass
if (istype(speaker, /mob/living/carbon/human))
var/mob/living/carbon/human/speakerMob = speaker
//Squads can override our ranks to be beyond our station.
if(speakerMob.squad_rank)
rank = "[speakerMob.squad_rank] "
else
job = speakerMob.get_assignment("", "")
job = speakerMob.get_assignment("", "")
//Or it's radiocode jank shitcode.
else if (istype(speaker, /atom/movable/virtualspeaker))
var/atom/movable/virtualspeaker/VS = speaker
Expand Down
Loading

0 comments on commit 8c990f3

Please sign in to comment.