Skip to content

Commit

Permalink
Merge branch 'master' into Adds-Pilot,-Crew-Chief,-Synth-to-Low-Pop
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfOrion authored Nov 5, 2023
2 parents 1cac5c8 + a248407 commit 7dcadcd
Show file tree
Hide file tree
Showing 43 changed files with 537 additions and 302 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@

// from /proc/update_living_queens() : /mob/living/carbon/xenomorph/queen
#define COMSIG_HIVE_NEW_QUEEN "hive_new_queen"

/// From /datum/game_master_submenu/vents/proc/setup_ambush()
#define COMSIG_GAME_MASTER_AMBUSH_SET "game_master_ambush_set"
1 change: 0 additions & 1 deletion code/__DEFINES/pain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// How slow we go from losing a limb
#define MOVE_REDUCTION_LIMB_DESTROYED 4
#define MOVE_REDUCTION_LIMB_BROKEN 1.5
#define MOVE_REDUCTION_DIRECTION_LOCKED 1
#define MOVE_REDUCTION_LIMB_SPLINTED 0.5

// Traumatic shock reduction for different reagents
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define DOOR_PENALTY 3
#define OBJECT_PENALTY 20
#define HUMAN_PENALTY 4
#define XENO_PENALTY 20
#define VEHICLE_PENALTY 25
#define SENTRY_PENALTY 25
#define WINDOW_FRAME_PENALTY 25
Expand Down
60 changes: 60 additions & 0 deletions code/datums/components/atom_narrate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#define NARRATION_METHOD_SAY "Say"
#define NARRATION_METHOD_ME "Me"
#define NARRATION_METHOD_DIRECT "Direct"

/datum/component/atom_narrate
var/message
var/narration_type
var/narrator

/datum/component/atom_narrate/Initialize(message, narration_type, delayed, narrator)
. = ..()

src.message = message
src.narration_type = narration_type
src.narrator = narrator

if(!delayed)
send_narration()
return

var/turf/parent_turf = get_turf(parent)

if(!parent_turf)
return COMPONENT_INCOMPATIBLE

var/list/message_turfs = block(locate(max(parent_turf.x - 4, 1), max(parent_turf.y - 4, 1), parent_turf.z), locate(parent_turf.x + 4, parent_turf.y + 4, parent_turf.z))

for(var/turf/cycled_turf as anything in message_turfs)
RegisterSignal(cycled_turf, COMSIG_TURF_ENTERED, PROC_REF(send_message_on_movement))

/datum/component/atom_narrate/proc/send_message_on_movement(turf/source, atom/movable/entered)
SIGNAL_HANDLER

if(!istype(entered, /mob/living/carbon/human))
return

send_narration()
qdel(src)

/datum/component/atom_narrate/proc/send_narration()
var/atom/atom_parent = parent

if(!atom_parent)
qdel(src)
return

var/list/heard = get_mobs_in_view(world_view_size, atom_parent)

switch(narration_type)
if(NARRATION_METHOD_SAY)
atom_parent.langchat_speech(message, heard, GLOB.all_languages, skip_language_check = TRUE)
atom_parent.visible_message("<b>[atom_parent]</b> says, \"[message]\"")
if(NARRATION_METHOD_ME)
atom_parent.langchat_speech(message, heard, GLOB.all_languages, skip_language_check = TRUE, animation_style = 2, additional_styles = list("langchat_small", "emote"))
atom_parent.visible_message("<b>[atom_parent]</b> [message]")
if(NARRATION_METHOD_DIRECT)
atom_parent.visible_message("[message]")

log_admin("[narrator] sent an Atom Narrate with message \"[message]\" from [atom_parent].")
message_admins("[narrator] sent an Atom Narrate with message \"[message]\" from [atom_parent].")
2 changes: 1 addition & 1 deletion code/datums/langchat/langchat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
if(langchat_client_enabled(M) && !M.ear_deaf && (skip_language_check || M.say_understands(src, language)))
M.client.images += langchat_image

if(isturf(loc))
if(isturf(src) || isturf(loc))
langchat_image.loc = src
else
langchat_image.loc = recursive_holder_check(src)
Expand Down
7 changes: 3 additions & 4 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,9 @@ Parameters are passed from New.
/atom/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION("", "-----ATOM-----")
if(!ismovable(src))
var/turf/curturf = get_turf(src)
if(curturf)
. += "<option value='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];adminplayerobservecoodjump=1;X=[curturf.x];Y=[curturf.y];Z=[curturf.z]'>Jump To</option>"
var/turf/curturf = get_turf(src)
if(curturf)
. += "<option value='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];adminplayerobservecoodjump=1;X=[curturf.x];Y=[curturf.y];Z=[curturf.z]'>Jump To</option>"
VV_DROPDOWN_OPTION(VV_HK_MODIFY_TRANSFORM, "Modify Transform")
VV_DROPDOWN_OPTION(VV_HK_ADD_REAGENT, "Add Reagent")
VV_DROPDOWN_OPTION(VV_HK_TRIGGER_EMP, "EMP Pulse")
Expand Down
141 changes: 43 additions & 98 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,55 +234,16 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
if(length(overwritten_roles_for_mode))
temp_roles_for_mode = overwritten_roles_for_mode

// Get balancing weight for the readied players.
// Squad marine roles have a weight of 1, and shipside roles have a lower weight of SHIPSIDE_ROLE_WEIGHT.
players_preassigned = assign_roles(temp_roles_for_mode.Copy(), unassigned_players.Copy(), TRUE)

// Even though we pass a copy of temp_roles_for_mode, job counters still change, so we reset them here.
for(var/title in temp_roles_for_mode)
var/datum/job/J = temp_roles_for_mode[title]
J.current_positions = 0

// Set up limits for other roles based on our balancing weight number.
// Set the xeno starting amount based on marines assigned
var/datum/job/antag/xenos/XJ = temp_roles_for_mode[JOB_XENOMORPH]
if(istype(XJ))
XJ.set_spawn_positions(players_preassigned)

// Limit the number of SQUAD MARINE roles players can roll initially
var/datum/job/SMJ = GET_MAPPED_ROLE(JOB_SQUAD_MARINE)
if(istype(SMJ))
SMJ.set_spawn_positions(players_preassigned)

// Set survivor starting amount based on marines assigned
var/datum/job/SJ = temp_roles_for_mode[JOB_SURVIVOR]
if(istype(SJ))
SJ.set_spawn_positions(players_preassigned)

var/datum/job/CO_surv_job = temp_roles_for_mode[JOB_CO_SURVIVOR]
if(istype(CO_surv_job))
CO_surv_job.set_spawn_positions(players_preassigned)

if(SSnightmare.get_scenario_value("predator_round"))
SSticker.mode.flags_round_type |= MODE_PREDATOR
// Set predators starting amount based on marines assigned
var/datum/job/PJ = temp_roles_for_mode[JOB_PREDATOR]
if(istype(PJ))
PJ.set_spawn_positions(players_preassigned)

// Assign the roles, this time for real, respecting limits we have established.
var/list/roles_left = assign_roles(temp_roles_for_mode, unassigned_players)

var/alternate_option_assigned = 0;
for(var/mob/new_player/M in unassigned_players)
switch(M.client.prefs.alternate_option)
if(GET_RANDOM_JOB)
roles_left = assign_random_role(M, roles_left) //We want to keep the list between assignments.
alternate_option_assigned++
if(BE_MARINE)
var/datum/job/marine_job = GET_MAPPED_ROLE(JOB_SQUAD_MARINE)
assign_role(M, marine_job) //Should always be available, in all game modes, as a candidate. Even if it may not be a marine.
alternate_option_assigned++
if(BE_XENOMORPH)
assign_role(M, temp_roles_for_mode[JOB_XENOMORPH])
if(RETURN_TO_LOBBY)
Expand All @@ -295,70 +256,54 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou

unassigned_players = null

// Now we take spare unfilled xeno slots and make them larva NEW
var/datum/hive_status/hive = GLOB.hive_datum[XENO_HIVE_NORMAL]
if(istype(hive) && istype(XJ))
hive.stored_larva += max(0, (XJ.total_positions - XJ.current_positions) \
+ (XJ.calculate_extra_spawn_positions(alternate_option_assigned)))

/*===============================================================*/

/**
* Assign roles to the players. Return roles that are still avialable.
* If count is true, return role balancing weight instead.
*/
/datum/authority/branch/role/proc/assign_roles(list/roles_for_mode, list/unassigned_players, count = FALSE)
var/list/roles_left = list()
var/assigned = 0
for(var/priority in HIGH_PRIORITY to LOW_PRIORITY)
// Assigning xenos first.
assigned += assign_initial_roles(priority, roles_for_mode & ROLES_XENO, unassigned_players)
// Assigning special roles second. (survivor, predator)
assigned += assign_initial_roles(priority, roles_for_mode & (ROLES_WHITELISTED|ROLES_SPECIAL), unassigned_players)
// Assigning command third.
assigned += assign_initial_roles(priority, roles_for_mode & ROLES_COMMAND, unassigned_players)
// Assigning the rest
var/rest_roles_for_mode = roles_for_mode - (roles_for_mode & ROLES_XENO) - (roles_for_mode & ROLES_COMMAND) - (roles_for_mode & (ROLES_WHITELISTED|ROLES_SPECIAL))
if(count)
assigned += assign_initial_roles(priority, rest_roles_for_mode, unassigned_players)
else
roles_left= assign_initial_roles(priority, rest_roles_for_mode, unassigned_players, FALSE)
if(count)
return assigned
return roles_left

/datum/authority/branch/role/proc/assign_initial_roles(priority, list/roles_to_iterate, list/unassigned_players, count = TRUE)
var/assigned = 0
if(!length(roles_to_iterate) || !length(unassigned_players))
/// Assign roles to the players. Return roles that are still available.
/datum/authority/branch/role/proc/assign_roles(list/roles_to_assign, list/unassigned_players)
if(!length(roles_to_assign) || !length(unassigned_players))
return

for(var/job in roles_to_iterate)
var/datum/job/J = roles_to_iterate[job]
if(!istype(J)) //Shouldn't happen, but who knows.
to_world(SPAN_DEBUG("Error setting up jobs, no job datum set for: [job]."))
log_debug("Error setting up jobs, no job datum set for: [job].")
continue
for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players))
var/player_assigned_job = FALSE
log_debug("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("We have started cycled through priority [priority] for [cycled_unassigned]")

for(var/job_name in wanted_jobs_by_name)
log_debug("We are cycling through wanted jobs and are at [job_name] for [cycled_unassigned]")
if(job_name in roles_to_assign)
log_debug("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("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("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("[cycled_unassigned] has been assigned a job and we are breaking")
break

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

if(!length(roles_to_assign))
log_debug("No more roles to assign, breaking")
break

if(!player_assigned_job)
log_debug("[cycled_unassigned] was unable to be assigned a job based on preferences and roles to assign. We still have roles to assign, continuing to next player")

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

var/role_weight = calculate_role_weight(J)
for(var/M in unassigned_players)
var/mob/new_player/NP = M
if(!(NP.client.prefs.get_job_priority(J.title) == priority))
continue //If they don't want the job. //TODO Change the name of the prefs proc?

if(assign_role(NP, J))
assigned += role_weight
unassigned_players -= NP
// -1 check is not strictly needed here, since standard marines are
// supposed to have an actual spawn_positions number at this point
if(J.spawn_positions != -1 && J.current_positions >= J.spawn_positions)
roles_to_iterate -= job //Remove the position, since we no longer need it.
break //Maximum position is reached?

if(!length(unassigned_players))
break //No players left to assign? Break.
if(count)
return assigned
return roles_to_iterate
return roles_to_assign

/**
* Calculate role balance weight for one person joining as that role. This weight is used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ GLOBAL_LIST_INIT(cm_vending_clothing_xo, list(
list("Aviator Shades", 0, /obj/item/clothing/glasses/sunglasses/aviator, MARINE_CAN_BUY_GLASSES, VENDOR_ITEM_REGULAR),

list("PATCHES", 0, null, null, null),
list("Falling Falcons Shoulder Patch", 0, /obj/item/clothing/accessory/patch/falcon, MARINE_CAN_BUY_ATTACHMENT, VENDOR_ITEM_MANDATORY),
list("Solar Devils Shoulder Patch", 0, /obj/item/clothing/accessory/patch/devils, MARINE_CAN_BUY_ATTACHMENT, VENDOR_ITEM_MANDATORY),
list("USCM Shoulder Patch", 0, /obj/item/clothing/accessory/patch, MARINE_CAN_BUY_MRE, VENDOR_ITEM_MANDATORY),

list("POUCHES (CHOOSE 2)", 0, null, null, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
list("M10 Helmet Rain Cover", round(scale * 10), /obj/item/prop/helmetgarb/raincover, VENDOR_ITEM_REGULAR),
list("Firearm Lubricant", round(scale * 15), /obj/item/prop/helmetgarb/gunoil, VENDOR_ITEM_REGULAR),
list("USCM Flair", round(scale * 15), /obj/item/prop/helmetgarb/flair_uscm, VENDOR_ITEM_REGULAR),
list("Falling Falcons Shoulder Patch", round(scale * 15), /obj/item/clothing/accessory/patch/falcon, VENDOR_ITEM_REGULAR),
list("Solar Devils Shoulder Patch", round(scale * 15), /obj/item/clothing/accessory/patch/devils, VENDOR_ITEM_REGULAR),
list("USCM Shoulder Patch", round(scale * 15), /obj/item/clothing/accessory/patch, VENDOR_ITEM_REGULAR),
)

Expand Down
74 changes: 74 additions & 0 deletions code/game/objects/items/beacons/deployable_beacons.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/// Generic deployable beacon for objectives
/obj/item/deployable_beacon
name = "deployable beacon"
desc = "A standard deployable beacon. Generally used by teams who may be out of regular communications range but must signal for various reasons. This one is branded with a Weyland Yutani symbol and sold en masse."
icon = 'icons/obj/items/deployable_beacon.dmi'
icon_state = "beacon_inactive"
w_class = SIZE_SMALL

/// The type of beacon it turns into
var/beacon_type = /obj/structure/deployable_beacon

/// Color of the beacon's light
var/beacon_light_color = COLOR_WHITE

/obj/item/deployable_beacon/Initialize(mapload, ...)
. = ..()

var/image/overlay_image = new('icons/obj/items/deployable_beacon.dmi', icon_state = "beacon_inactive_overlay")
overlay_image.color = beacon_light_color

overlays += overlay_image

/obj/item/deployable_beacon/attack_self(mob/user)
. = ..()

var/turf/deploying_turf = get_turf(user)

var/blocked = FALSE
for(var/obj/potential_blocking_object in deploying_turf)
if(potential_blocking_object.density || potential_blocking_object.can_block_movement)
blocked = potential_blocking_object
break

if(!istype(deploying_turf, /turf/open))
blocked = deploying_turf

var/turf/open/floor = deploying_turf
if(!floor.allow_construction)
to_chat(user, SPAN_WARNING("You cannot deploy \a [src] here, find a more secure surface!"))
return FALSE

if(blocked)
to_chat(usr, SPAN_WARNING("You need a clear, open area to deploy [src], [blocked] is blocking the way!"))
return

if(user.action_busy)
return

if(!do_after(user, (1 SECONDS), INTERRUPT_ALL, BUSY_ICON_BUILD, src))
return

playsound(deploying_turf, 'sound/mecha/mechmove01.ogg', 30, 1)

var/obj/structure/deployable_beacon/deployed_beacon = new beacon_type(get_turf(src), user)
transfer_label_component(deployed_beacon)

qdel(src)

/obj/item/deployable_beacon/red
beacon_type = /obj/structure/deployable_beacon/red
beacon_light_color = COLOR_RED

/obj/item/deployable_beacon/green
beacon_type = /obj/structure/deployable_beacon/green
beacon_light_color = COLOR_GREEN

/obj/item/deployable_beacon/blue
beacon_type = /obj/structure/deployable_beacon/blue
beacon_light_color = COLOR_BLUE

/obj/item/deployable_beacon/purple
beacon_type = /obj/structure/deployable_beacon/purple
beacon_light_color = COLOR_PURPLE

Loading

0 comments on commit 7dcadcd

Please sign in to comment.