Skip to content

Commit

Permalink
Changes to squad color code (#3908)
Browse files Browse the repository at this point in the history
# About the pull request

Changes the squad text and equipment colors from a list into a variable
that can be edited

# Explain why it's good for the game

This allows the squad information to be edited much easier mid-round,
allowing the creation of new squads with new colors, and edits to
pre-existing squads.

# Changelog
:cl:
code: Changed squad color code from a list to a variable
/:cl:
  • Loading branch information
BeagleGaming1 committed Jul 24, 2023
1 parent 00c5b1d commit f0f8e4c
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 139 deletions.
46 changes: 23 additions & 23 deletions code/datums/factions/uscm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
name = "United States Colonial Marines"
faction_tag = FACTION_MARINE

/datum/faction/uscm/modify_hud_holder(image/holder, mob/living/carbon/human/H)
var/datum/squad/squad = H.assigned_squad
/datum/faction/uscm/modify_hud_holder(image/holder, mob/living/carbon/human/current_human)
var/datum/squad/squad = current_human.assigned_squad
if(istype(squad))
var/squad_clr = squad_colors[H.assigned_squad.color]
var/squad_clr = current_human.assigned_squad.equipment_color
var/marine_rk
var/obj/item/card/id/I = H.get_idcard()
var/obj/item/card/id/I = current_human.get_idcard()
var/_role
if(H.job)
_role = H.job
if(current_human.job)
_role = current_human.job
else if(I)
_role = I.rank
switch(GET_DEFAULT_ROLE(_role))
Expand All @@ -29,42 +29,42 @@
if(JOB_MARINE_RAIDER) marine_rk = "soc"
if(JOB_MARINE_RAIDER_SL) marine_rk = "soctl"
if(JOB_MARINE_RAIDER_CMD) marine_rk = "soccmd"
if(squad.squad_leader == H)
if(squad.squad_leader == current_human)
switch(squad.squad_type)
if("Squad") marine_rk = "leader_a"
if("Team") marine_rk = "soctl_a"

H.langchat_styles = "langchat_bolded" // bold text for bold leaders
current_human.langchat_styles = "langchat_bolded" // bold text for bold leaders
else
H.langchat_styles = initial(H.langchat_styles)
current_human.langchat_styles = initial(current_human.langchat_styles)

H.langchat_color = squad_colors_chat[H.assigned_squad.color]
current_human.langchat_color = current_human.assigned_squad.chat_color

if(!marine_rk) marine_rk = H.rank_fallback
if(!marine_rk) marine_rk = current_human.rank_fallback
if(marine_rk)
var/image/IMG = image('icons/mob/hud/marine_hud.dmi', H, "hudsquad")
var/image/IMG = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad")
if(squad_clr)
IMG.color = squad_clr
else
IMG.color = "#5A934A"
holder.overlays += IMG
holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "hudsquad_[marine_rk]")
if(H.assigned_squad && H.assigned_fireteam)
var/image/IMG2 = image('icons/mob/hud/marine_hud.dmi', H, "hudsquad_[H.assigned_fireteam]")
holder.overlays += image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad_[marine_rk]")
if(current_human.assigned_squad && current_human.assigned_fireteam)
var/image/IMG2 = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad_[current_human.assigned_fireteam]")
IMG2.color = squad_clr
holder.overlays += IMG2
if(H.assigned_squad.fireteam_leaders[H.assigned_fireteam] == H)
var/image/IMG3 = image('icons/mob/hud/marine_hud.dmi', H, "hudsquad_ftl")
if(current_human.assigned_squad.fireteam_leaders[current_human.assigned_fireteam] == current_human)
var/image/IMG3 = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad_ftl")
IMG3.color = squad_clr
holder.overlays += IMG3
else
var/marine_rk
var/border_rk
var/icon_prefix = "hudsquad_"
var/obj/item/card/id/ID = H.get_idcard()
var/obj/item/card/id/ID = current_human.get_idcard()
var/_role
if(H.mind)
_role = H.job
if(current_human.mind)
_role = current_human.job
else if(ID)
_role = ID.rank
switch(_role)
Expand Down Expand Up @@ -188,9 +188,9 @@
icon_prefix = "cmb_"

if(marine_rk)
var/image/I = image('icons/mob/hud/marine_hud.dmi', H, "hudsquad")
var/image/I = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad")
I.color = "#5A934A"
holder.overlays += I
holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "[icon_prefix][marine_rk]")
holder.overlays += image('icons/mob/hud/marine_hud.dmi', current_human, "[icon_prefix][marine_rk]")
if(border_rk)
holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "hudmarineborder[border_rk]")
holder.overlays += image('icons/mob/hud/marine_hud.dmi', current_human, "hudmarineborder[border_rk]")
10 changes: 5 additions & 5 deletions code/game/jobs/job/marine/marine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
spawn_positions = 8
allow_additional = 1

/datum/job/marine/generate_entry_message(mob/living/carbon/human/H)
if(H.assigned_squad)
entry_message_intro = "You are a [title]!<br>You have been assigned to: <b><font size=3 color=[squad_colors[H.assigned_squad.color]]>[lowertext(H.assigned_squad.name)] squad</font></b>.[Check_WO() ? "" : " Make your way to the cafeteria for some post-cryosleep chow, and then get equipped in your squad's prep room." ]"
/datum/job/marine/generate_entry_message(mob/living/carbon/human/current_human)
if(current_human.assigned_squad)
entry_message_intro = "You are a [title]!<br>You have been assigned to: <b><font size=3 color=[current_human.assigned_squad.equipment_color]>[lowertext(current_human.assigned_squad.name)] squad</font></b>.[Check_WO() ? "" : " Make your way to the cafeteria for some post-cryosleep chow, and then get equipped in your squad's prep room." ]"
return ..()

/datum/job/marine/generate_entry_conditions(mob/living/carbon/human/H)
/datum/job/marine/generate_entry_conditions(mob/living/carbon/human/current_human)
..()
if(!Check_WO())
H.nutrition = rand(NUTRITION_VERYLOW, NUTRITION_LOW) //Start hungry for the default marine.
current_human.nutrition = rand(NUTRITION_VERYLOW, NUTRITION_LOW) //Start hungry for the default marine.

/datum/timelock/squad
name = "Squad Roles"
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/marine/squad_info.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
update_squad_leader()
var/list/data = squad_info_data.Copy()
data["squad"] = name
data["squad_color"] = squad_colors[color]
data["squad_color"] = equipment_color
data["is_lead"] = get_leadership(user)
data["objective"] = list(
"primary" = primary_objective,
Expand Down
100 changes: 68 additions & 32 deletions code/game/jobs/job/marine/squads.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,51 @@
sub_leader = "Strike Leader"

/datum/squad
var/name //Name of the squad
/// Name of the squad
var/name
/// Squads ID that is set on New()
var/tracking_id = null //Used for the tracking subsystem
var/max_positions = -1 //Maximum number allowed in a squad. Defaults to infinite
var/color = 0 //Color for helmets, etc.
var/list/access = list() //Which special access do we grant them
var/omni_squad_vendor = FALSE /// Can use any squad vendor regardless of squad connection
var/max_engineers = 3 //maximum # of engineers allowed in squad
var/max_medics = 4 //Ditto, squad medics
/// Maximum number allowed in a squad. Defaults to infinite
var/max_positions = -1
/// Color for the squad marines gear overlays
var/equipment_color = "#FFFFFF"
/// The alpha for the armor overlay used by equipment color
var/armor_alpha = 125
/// Color for the squad marines langchat
var/chat_color = "#FFFFFF"
/// Which special access do we grant them
var/list/access = list()
/// Can use any squad vendor regardless of squad connection
var/omni_squad_vendor = FALSE
/// maximum # of engineers allowed in the squad
var/max_engineers = 3
/// maximum # of squad medics allowed in the squad
var/max_medics = 4
/// maximum # of specs allowed in the squad
var/max_specialists = 1
/// maximum # of fireteam leaders allowed in the suqad
var/max_tl = 2
/// maximum # of smartgunners allowed in the squad
var/max_smartgun = 1
/// maximum # of squad leaders allowed in the squad
var/max_leaders = 1
var/radio_freq = 1461 //Squad radio headset frequency.

///Variables for showing up in various places
var/usable = FALSE //Is it used in-game?
var/roundstart = TRUE /// Whether this squad can be picked at roundstart
var/locked = FALSE //Is it available for squad management?
var/active = FALSE //Is it visible in overwatch?
var/faction = FACTION_MARINE //What faction runs the squad?

///Squad Type Specifics
/// Squad headsets default radio frequency
var/radio_freq = 1461

/// Whether this squad can be used by marines
var/usable = FALSE
/// Whether this squad can be picked at roundstart
var/roundstart = TRUE
// Whether the squad is available for squad management
var/locked = FALSE
/// Whether it is visible in overwatch
var/active = FALSE
/// Which faction the squad is in
var/faction = FACTION_MARINE

/// What will the assistant squad leader be called
var/squad_type = "Squad" //Referenced for aSL details. Squad/Team/Cell etc.
/// Squad leaders icon
var/lead_icon //Referenced for SL's 'L' icon. If nulled, won't override icon for aSLs.

//vvv Do not set these in squad defines
Expand Down Expand Up @@ -96,35 +118,40 @@

/datum/squad/marine/alpha
name = SQUAD_MARINE_1
color = 1
equipment_color = "#e61919"
chat_color = "#e67d7d"
access = list(ACCESS_MARINE_ALPHA)
radio_freq = ALPHA_FREQ
minimap_color = MINIMAP_SQUAD_ALPHA

/datum/squad/marine/bravo
name = SQUAD_MARINE_2
color = 2
equipment_color = "#ffc32d"
chat_color = "#ffe650"
access = list(ACCESS_MARINE_BRAVO)
radio_freq = BRAVO_FREQ
minimap_color = MINIMAP_SQUAD_BRAVO

/datum/squad/marine/charlie
name = SQUAD_MARINE_3
color = 3
equipment_color = "#c864c8"
chat_color = "#ff96ff"
access = list(ACCESS_MARINE_CHARLIE)
radio_freq = CHARLIE_FREQ
minimap_color = MINIMAP_SQUAD_CHARLIE

/datum/squad/marine/delta
name = SQUAD_MARINE_4
color = 4
equipment_color = "#4148c8"
chat_color = "#828cff"
access = list(ACCESS_MARINE_DELTA)
radio_freq = DELTA_FREQ
minimap_color = MINIMAP_SQUAD_DELTA

/datum/squad/marine/echo
name = SQUAD_MARINE_5
color = 5
equipment_color = "#67d692"
chat_color = "#67d692"
access = list(ACCESS_MARINE_ALPHA, ACCESS_MARINE_BRAVO, ACCESS_MARINE_CHARLIE, ACCESS_MARINE_DELTA)
radio_freq = ECHO_FREQ
omni_squad_vendor = TRUE
Expand All @@ -136,7 +163,8 @@

/datum/squad/marine/cryo
name = SQUAD_MARINE_CRYO
color = 6
equipment_color = "#c47a50"
chat_color = "#c47a50"
access = list(ACCESS_MARINE_ALPHA, ACCESS_MARINE_BRAVO, ACCESS_MARINE_CHARLIE, ACCESS_MARINE_DELTA)
minimap_color = MINIMAP_SQUAD_FOXTROT

Expand All @@ -149,7 +177,8 @@

/datum/squad/marine/sof
name = SQUAD_SOF
color = 7
equipment_color = "#400000"
chat_color = "#400000"
radio_freq = SOF_FREQ
squad_type = "Team"
lead_icon = "soctl"
Expand All @@ -168,23 +197,28 @@

/datum/squad/upp/one
name = "UPPS1"
color = 1
equipment_color = "#e61919"
chat_color = "#e67d7d"

/datum/squad/upp/twp
name = "UPPS2"
color = 2
equipment_color = "#ffc32d"
chat_color = "#ffe650"

/datum/squad/upp/three
name = "UPPS3"
color = 3
equipment_color = "#c864c8"
chat_color = "#ff96ff"

/datum/squad/upp/four
name = "UPPS4"
color = 4
equipment_color = "#4148c8"
chat_color = "#828cff"

/datum/squad/upp/kdo
name = "UPPKdo"
color = 6
equipment_color = "#c47a50"
chat_color = "#c47a50"
squad_type = "Team"
locked = TRUE
//###############################
Expand All @@ -197,11 +231,13 @@

/datum/squad/pmc/one
name = "Team Upsilon"
color = 3
equipment_color = "#c864c8"
chat_color = "#ff96ff"

/datum/squad/pmc/two
name = "Team Gamma"
color = 6
equipment_color = "#c47a50"
chat_color = "#c47a50"

/datum/squad/pmc/wo
name = "Taskforce White"
Expand Down Expand Up @@ -331,7 +367,7 @@

/// Displays a message to squad members directly on the game map
/datum/squad/proc/send_maptext(text = "", title_text = "", only_leader = 0)
var/message_colour = squad_colors_chat[color]
var/message_colour = chat_color
if(only_leader)
if(squad_leader)
var/mob/living/carbon/human/SL = squad_leader
Expand Down
8 changes: 4 additions & 4 deletions code/game/supplyshuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ var/datum/controller/supply/supply_controller = new()
var/list/data = list()

var/list/squad_list = list()
for(var/datum/squad/S in RoleAuthority.squads)
if(S.active && S.faction == faction && S.color)
for(var/datum/squad/current_squad in RoleAuthority.squads)
if(current_squad.active && current_squad.faction == faction && current_squad.equipment_color)
squad_list += list(list(
"squad_name" = S.name,
"squad_color" = squad_colors[S.color]
"squad_name" = current_squad.name,
"squad_color" = current_squad.equipment_color
))

data["can_pick_squad"] = can_pick_squad
Expand Down
1 change: 0 additions & 1 deletion code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var/list/reboot_sfx = file2list("config/reboot_sfx.txt")
GLOB.changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : 0 //for telling if the changelog has changed recently

initialize_tgs()
initialize_marine_armor()

#ifdef UNIT_TESTS
GLOB.test_log = "data/logs/tests.log"
Expand Down
7 changes: 2 additions & 5 deletions code/modules/asset_cache/asset_list_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@

/datum/asset/spritesheet/ranks/register()
var/icon_file = 'icons/mob/hud/marine_hud.dmi'
var/list/squads = list("Alpha", "Bravo", "Charlie", "Delta", "Foxtrot", "Cryo")

var/list/icon_data = list(
list("Mar", null),
Expand All @@ -284,10 +283,8 @@
list("SL", "hudsquad_leader"),
)

var/i
for(i = 1; i < length(squads); i++)
var/squad = squads[i]
var/color = squad_colors[i]
for(var/datum/squad/marine/squad in RoleAuthority.squads)
var/color = squad.equipment_color
for(var/iref in icon_data)
var/list/iconref = iref
var/icon/background = icon('icons/mob/hud/marine_hud.dmi', "hudsquad", SOUTH)
Expand Down
12 changes: 9 additions & 3 deletions code/modules/clothing/gloves/marine_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
armor_rad = CLOTHING_ARMOR_NONE
armor_internaldamage = CLOTHING_ARMOR_LOW
var/adopts_squad_color = TRUE
/// The dmi where the grayscale squad overlays are contained
var/squad_overlay_icon = 'icons/mob/humans/onmob/hands_garb.dmi'

/obj/item/clothing/gloves/marine/get_mob_overlay(mob/living/carbon/human/H, slot)
/obj/item/clothing/gloves/marine/get_mob_overlay(mob/living/carbon/human/current_human, slot)
var/image/ret = ..()
if(adopts_squad_color && slot == WEAR_HANDS && istype(H) && H.assigned_squad)
ret.overlays += glovemarkings[H.assigned_squad.color]
if(!adopts_squad_color || !(current_human.assigned_squad && current_human.assigned_squad.equipment_color))
return ret
var/image/glove_overlay = image(squad_overlay_icon, icon_state = "std-gloves")
glove_overlay.alpha = current_human.assigned_squad.armor_alpha
glove_overlay.color = current_human.assigned_squad.equipment_color
ret.overlays += glove_overlay
return ret

/obj/item/clothing/gloves/marine/insulated
Expand Down
Loading

0 comments on commit f0f8e4c

Please sign in to comment.