Skip to content

Commit

Permalink
Merge branch 'cmss13-devs:master' into wire-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeKuwait authored Aug 24, 2023
2 parents 3587f49 + 43fe68a commit 960f1c2
Show file tree
Hide file tree
Showing 34 changed files with 382 additions and 231 deletions.
4 changes: 3 additions & 1 deletion code/__DEFINES/conflict.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#define GUN_ANTIQUE (1<<13)
/// Whether the gun has been fired by its current user (reset upon `dropped()`)
#define GUN_RECOIL_BUILDUP (1<<14)
/// support weapon, bipod will grant IFF
/// support weapon, bipod will grant autofire
#define GUN_SUPPORT_PLATFORM (1<<15)
/// No gun description, only base desc
#define GUN_NO_DESCRIPTION (1<<16)
Expand Down Expand Up @@ -99,6 +99,8 @@
#define AMMUNITION_HANDFUL_BOX (1<<2)
#define AMMUNITION_HIDE_AMMO (1<<3)
#define AMMUNITION_CANNOT_REMOVE_BULLETS (1<<4)
/// If this magazine can transfer to other magazines of the same type by slapping one with the other
#define AMMUNITION_SLAP_TRANSFER (1<<5)
//Slowdown from various armors.

/// How much shoes slow you down by default. Negative values speed you up
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@
#define COMSIG_GUN_AUTOFIREDELAY_MODIFIED "gun_autofiredelay_modified"
#define COMSIG_GUN_BURST_SHOTS_TO_FIRE_MODIFIED "gun_burst_shots_to_fire_modified"
#define COMSIG_GUN_BURST_SHOT_DELAY_MODIFIED "gun_burst_shot_delay_modified"

/// from /obj/item/weapon/gun/proc/recalculate_attachment_bonuses() : ()
#define COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES "gun_recalculate_attachment_bonuses"

/// from /obj/item/weapon/gun/proc/load_into_chamber() : ()
#define COMSIG_GUN_INTERRUPT_FIRE "gun_interrupt_fire"
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals/signals_global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@

/// From
#define COMSIG_GLOB_YAUTJA_ARMORY_OPENED "yautja_armory_opened"

/// From /proc/biohazard_lockdown()
#define COMSIG_GLOB_RESEARCH_LOCKDOWN "research_lockdown_closed"
#define COMSIG_GLOB_RESEARCH_LIFT "research_lockdown_opened"
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ DEFINE_BITFIELD(flags_magazine, list(
"AMMUNITION_HANDFUL_BOX" = AMMUNITION_HANDFUL_BOX,
"AMMUNITION_HIDE_AMMO" = AMMUNITION_HIDE_AMMO,
"AMMUNITION_CANNOT_REMOVE_BULLETS" = AMMUNITION_CANNOT_REMOVE_BULLETS,
"AMMUNITION_SLAP_TRANSFER" = AMMUNITION_SLAP_TRANSFER,
))

DEFINE_BITFIELD(flags_atom, list(
Expand Down
9 changes: 7 additions & 2 deletions code/datums/components/autofire/autofire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
var/have_to_reset_at_burst_end = FALSE
///If we are in a burst
var/bursting = FALSE
/// The multiplier for how much slower the parent should fire in automatic mode. 1 is normal, 1.2 is 20% slower, 2 is 100% slower, etc.
var/automatic_delay_mult = 1
///Callback to set bursting mode on the parent
var/datum/callback/callback_bursting
///Callback to ask the parent to reset its firing vars
Expand All @@ -26,7 +28,7 @@
///Callback to set parent's fa_firing
var/datum/callback/callback_set_firing

/datum/component/automatedfire/autofire/Initialize(auto_fire_shot_delay = 0.3 SECONDS, burstfire_shot_delay, burst_shots_to_fire = 3, fire_mode = GUN_FIREMODE_SEMIAUTO, datum/callback/callback_bursting, datum/callback/callback_reset_fire, datum/callback/callback_fire, datum/callback/callback_display_ammo, datum/callback/callback_set_firing)
/datum/component/automatedfire/autofire/Initialize(auto_fire_shot_delay = 0.3 SECONDS, burstfire_shot_delay, burst_shots_to_fire = 3, fire_mode = GUN_FIREMODE_SEMIAUTO, automatic_delay_mult = 1, datum/callback/callback_bursting, datum/callback/callback_reset_fire, datum/callback/callback_fire, datum/callback/callback_display_ammo, datum/callback/callback_set_firing)
. = ..()

RegisterSignal(parent, COMSIG_GUN_FIRE_MODE_TOGGLE, PROC_REF(modify_fire_mode))
Expand All @@ -35,11 +37,13 @@
RegisterSignal(parent, COMSIG_GUN_BURST_SHOT_DELAY_MODIFIED, PROC_REF(modify_burstfire_shot_delay))
RegisterSignal(parent, COMSIG_GUN_FIRE, PROC_REF(initiate_shot))
RegisterSignal(parent, COMSIG_GUN_STOP_FIRE, PROC_REF(stop_firing))
RegisterSignal(parent, COMSIG_GUN_INTERRUPT_FIRE, PROC_REF(hard_reset))

src.auto_fire_shot_delay = auto_fire_shot_delay
src.burstfire_shot_delay = burstfire_shot_delay
src.burst_shots_to_fire = burst_shots_to_fire
src.fire_mode = fire_mode
src.automatic_delay_mult = automatic_delay_mult
src.callback_bursting = callback_bursting
src.callback_reset_fire = callback_reset_fire
src.callback_fire = callback_fire
Expand Down Expand Up @@ -96,6 +100,7 @@

///Hard reset the autofire, happens when the shooter fall/is thrown, at the end of a burst or when it runs out of ammunition
/datum/component/automatedfire/autofire/proc/hard_reset()
SIGNAL_HANDLER
callback_reset_fire.Invoke() //resets the gun
shots_fired = 0
have_to_reset_at_burst_end = FALSE
Expand Down Expand Up @@ -131,7 +136,7 @@
next_fire = world.time + burstfire_shot_delay
if(GUN_FIREMODE_AUTOMATIC)
callback_set_firing.Invoke(TRUE)
next_fire = world.time + auto_fire_shot_delay
next_fire = world.time + (auto_fire_shot_delay * automatic_delay_mult)
if(GUN_FIREMODE_SEMIAUTO)
return
schedule_shot()
10 changes: 0 additions & 10 deletions code/datums/supply_packs/ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@
containername = "\improper M39 AP magazines crate"
group = "Ammo"

/datum/supply_packs/ammo_smg_mag_box_ext
name = "Magazine box (M39, 10x extended mags)"
contains = list(
/obj/item/ammo_box/magazine/m39/ext,
)
cost = 30
containertype = /obj/structure/closet/crate/ammo
containername = "\improper M39 extended magazines crate"
group = "Ammo"

//------------------------For M4RA----------------

/datum/supply_packs/ammo_m4ra_mag_box
Expand Down
7 changes: 3 additions & 4 deletions code/datums/supply_packs/black_market.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,9 @@ Non-USCM items, from CLF, UPP, colonies, etc. Mostly combat-related.
new /obj/item/ammo_magazine/rifle/mar40/extended(src)
new /obj/item/ammo_magazine/rifle/mar40(src)
else
new /obj/item/weapon/gun/rifle/m41aMK1/tactical(src)
new /obj/item/ammo_magazine/rifle/m41aMK1/ap(src)
new /obj/item/ammo_magazine/rifle/m41aMK1(src)
new /obj/item/ammo_magazine/rifle/m41aMK1(src)
new /obj/item/weapon/gun/rifle/mar40/lmg(src)
new /obj/item/ammo_magazine/rifle/mar40/lmg(src)
new /obj/item/ammo_magazine/rifle/mar40/lmg(src)

/* Misc. Individual Guns */

Expand Down
109 changes: 109 additions & 0 deletions code/game/machinery/biohazard_lockdown.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#define LOCKDOWN_READY 0
#define LOCKDOWN_ACTIVE 1
GLOBAL_VAR_INIT(lockdown_state, LOCKDOWN_READY)

/obj/structure/machinery/biohazard_lockdown
name = "Emergency Containment Breach"
icon_state = "big_red_button_tablev"
unslashable = TRUE
unacidable = TRUE
COOLDOWN_DECLARE(containment_lockdown)

/obj/structure/machinery/biohazard_lockdown/ex_act(severity)
return FALSE

/obj/structure/machinery/biohazard_lockdown/attack_remote(mob/user as mob)
return FALSE

/obj/structure/machinery/biohazard_lockdown/attack_alien(mob/user as mob)
return FALSE

/obj/structure/machinery/biohazard_lockdown/attackby(obj/item/attacking_item, mob/user)
return attack_hand(user)

/obj/structure/machinery/biohazard_lockdown/attack_hand(mob/living/user)
if(isxeno(user))
return FALSE
if(!allowed(user))
to_chat(user, SPAN_DANGER("Access Denied"))
flick(initial(icon_state) + "-denied", src)
return FALSE

if(!COOLDOWN_FINISHED(src, containment_lockdown))
to_chat(user, SPAN_BOLDWARNING("Biohazard Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(src, containment_lockdown)] seconds!"))
return FALSE

add_fingerprint(user)
biohazard_lockdown(user)
COOLDOWN_START(src, containment_lockdown, 5 MINUTES)

/obj/structure/machinery/door/poddoor/almayer/biohazard
name = "Biohazard Containment Airlock"
density = FALSE

/obj/structure/machinery/door/poddoor/almayer/biohazard/Initialize()
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_RESEARCH_LOCKDOWN, PROC_REF(close))
RegisterSignal(SSdcs, COMSIG_GLOB_RESEARCH_LIFT, PROC_REF(open))

/obj/structure/machinery/door/poddoor/almayer/biohazard/white
icon_state = "w_almayer_pdoor1"
base_icon_state = "w_almayer_pdoor"

/client/proc/admin_biohazard_alert()
set name = "Containment Breach Alert"
set category = "Admin.Ship"

if(!admin_holder ||!check_rights(R_EVENT))
return FALSE

var/prompt = tgui_alert(src, "Are you sure you want to trigger a containment breach alert? This will force red alert, and lockdown research.", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt != "Yes")
return FALSE

prompt = tgui_alert(src, "Do you want to use a custom announcement?", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "Yes")
var/whattoannounce = tgui_input_text(src, "Please enter announcement text.", "what?")
biohazard_lockdown(usr, whattoannounce, TRUE)
else
biohazard_lockdown(usr, admin = TRUE)
return TRUE

/proc/biohazard_lockdown(mob/user, message, admin = FALSE)
if(IsAdminAdvancedProcCall())
return PROC_BLOCKED

var/log = "[key_name(user)] triggered research bio lockdown!"
var/ares_log = "[user.name] triggered Medical Research Biohazard Containment Lockdown."
if(!message)
message = "ATTENTION! \n\nBIOHAZARD CONTAINMENT BREACH. \n\nRESEARCH DEPARTMENT UNDER LOCKDOWN."
else
log = "[key_name(user)] triggered research bio lockdown! (Using a custom announcement)."
if(admin)
log += " (Admin Triggered)."
ares_log = "[MAIN_AI_SYSTEM] triggered Medical Research Biohazard Containment Lockdown."

switch(GLOB.lockdown_state)
if(LOCKDOWN_READY)
GLOB.lockdown_state = LOCKDOWN_ACTIVE
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_RESEARCH_LOCKDOWN)
if(LOCKDOWN_ACTIVE)
GLOB.lockdown_state = LOCKDOWN_READY
message = "ATTENTION! \n\nBIOHAZARD CONTAINMENT LOCKDOWN LIFTED."
log = "[key_name(user)] lifted research bio lockdown!"
ares_log = "[user.name] lifted Medical Research Biohazard Containment Lockdown."
if(admin)
log += " (Admin Triggered)."
ares_log = "[MAIN_AI_SYSTEM] lifted Medical Research Biohazard Containment Lockdown."

set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_RESEARCH_LIFT)

shipwide_ai_announcement(message, MAIN_AI_SYSTEM, 'sound/effects/biohazard.ogg')
message_admins(log)
var/datum/ares_link/link = GLOB.ares_link
link.log_ares_security("Containment Lockdown", ares_log)

#undef LOCKDOWN_READY
#undef LOCKDOWN_ACTIVE
2 changes: 2 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ cases. Override_icon_state should be a list.*/
UnregisterSignal(src, list(
COMSIG_ITEM_DROPPED,
COMSIG_ITEM_UNWIELD,
COMSIG_PARENT_QDELETING,
))
UnregisterSignal(user, COMSIG_MOB_MOVE_OR_LOOK)
//General reset in case anything goes wrong, the view will always reset to default unless zooming in.
Expand Down Expand Up @@ -861,6 +862,7 @@ cases. Override_icon_state should be a list.*/
RegisterSignal(src, list(
COMSIG_ITEM_DROPPED,
COMSIG_ITEM_UNWIELD,
COMSIG_PARENT_QDELETING,
), PROC_REF(unzoom_dropped_callback))
RegisterSignal(user, COMSIG_MOB_MOVE_OR_LOOK, PROC_REF(zoom_handle_mob_move_or_look))

Expand Down
3 changes: 2 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ var/list/admin_verbs_minor_event = list(
/client/proc/toggle_shipside_sd,
/client/proc/shakeshipverb,
/client/proc/adminpanelweapons,
/client/proc/adminpanelgq,
/client/proc/admin_general_quarters,
/client/proc/admin_biohazard_alert,
/client/proc/toggle_hardcore_perma
)

Expand Down
36 changes: 19 additions & 17 deletions code/modules/admin/verbs/adminpanelgq.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/client/proc/adminpanelgq()
/client/proc/admin_general_quarters()
set name = "Call General Quarters"
set category = "Admin.Ship"

if(security_level == SEC_LEVEL_RED || security_level == SEC_LEVEL_DELTA)
tgui_alert(src, "Security is already red or above, General Quarters cannot be called.", "Acknowledge!", list("ok."), 10 SECONDS)
else
var/whattoannounce = "ATTENTION! GENERAL QUARTERS. ALL HANDS, MAN YOUR BATTLESTATIONS."
var/prompt = tgui_alert(src, "Do you want to leave the announcement as the default one?", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "No")
whattoannounce = tgui_input_text(src, "Please enter announcement text.", "what?")
prompt = tgui_alert(src, "Are you sure you want to send General Quarters? This will force red alert.", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "Yes")
set_security_level(2, no_sound=1, announce=0)
shipwide_ai_announcement(whattoannounce, MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg')
message_admins("[key_name_admin(src)] Sent General Quarters with a custom announcement!")
else
prompt = tgui_alert(src, "Are you sure you want to send General Quarters? This will force red alert.", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "Yes")
set_security_level(2, no_sound=1, announce=0)
shipwide_ai_announcement(whattoannounce, MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg')
message_admins("[key_name_admin(src)] Sent General Quarters!")
return FALSE

var/prompt = tgui_alert(src, "Are you sure you want to send General Quarters? This will force red alert.", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt != "Yes")
return FALSE

var/whattoannounce = "ATTENTION! GENERAL QUARTERS. ALL HANDS, MAN YOUR BATTLESTATIONS."
var/log = "[key_name_admin(src)] Sent General Quarters!"

prompt = tgui_alert(src, "Do you want to use a custom announcement?", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "Yes")
whattoannounce = tgui_input_text(src, "Please enter announcement text.", "what?")
log = "[key_name_admin(src)] Sent General Quarters! (Using a custom announcement)"

set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
shipwide_ai_announcement(whattoannounce, MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg')
message_admins(log)
return TRUE
4 changes: 2 additions & 2 deletions code/modules/clothing/shoes/miscellaneous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@
max_heat_protection_temperature = SHOE_MAX_HEAT_PROT

/obj/item/clothing/shoes/souto
name = "\improper Souto Man's boots. Harder than the kick of Souto Red."
desc = "Souto Man boots"
name = "Souto Man boots"
desc = "\improper Souto Man's boots. Harder than the kick of Souto Red"
icon_state = "souto_man"
item_state = "souto_man"
flags_inventory = CANTSTRIP|NOSLIPPING
Expand Down
2 changes: 1 addition & 1 deletion code/modules/gear_presets/uscm_ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@
ACCESS_MARINE_CARGO,
ACCESS_MARINE_RO,
ACCESS_MARINE_COMMAND,
ACCESS_MARINE_DATABASE,
ACCESS_MARINE_ALPHA,
ACCESS_MARINE_BRAVO,
ACCESS_MARINE_CHARLIE,
Expand Down Expand Up @@ -637,6 +636,7 @@
. = ..()
access = list(
ACCESS_MARINE_SENIOR,
ACCESS_MARINE_DATABASE,
ACCESS_MARINE_ASO,
ACCESS_MARINE_COMMAND,
ACCESS_MARINE_BRIG,
Expand Down
11 changes: 7 additions & 4 deletions code/modules/projectiles/ammunition.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ They're all essentially identical when it comes to getting the job done.
/obj/item/ammo_magazine/attackby(obj/item/I, mob/living/user, bypass_hold_check = 0)
if(istype(I, /obj/item/ammo_magazine))
var/obj/item/ammo_magazine/MG = I
if(MG.flags_magazine & AMMUNITION_HANDFUL) //got a handful of bullets
if((MG.flags_magazine & AMMUNITION_HANDFUL) || (MG.flags_magazine & AMMUNITION_SLAP_TRANSFER)) //got a handful of bullets
if(flags_magazine & AMMUNITION_REFILLABLE) //and a refillable magazine
var/obj/item/ammo_magazine/handful/transfer_from = I
if(src == user.get_inactive_hand() || bypass_hold_check) //It has to be held.
if(default_ammo == transfer_from.default_ammo)
transfer_ammo(transfer_from,user,transfer_from.current_rounds) // This takes care of the rest.
else to_chat(user, "Those aren't the same rounds. Better not mix them up.")
else to_chat(user, "Try holding [src] before you attempt to restock it.")
if(transfer_ammo(transfer_from,user,transfer_from.current_rounds)) // This takes care of the rest.
to_chat(user, SPAN_NOTICE("You transfer rounds to [src] from [transfer_from]."))
else
to_chat(user, SPAN_NOTICE("Those aren't the same rounds. Better not mix them up."))
else
to_chat(user, SPAN_NOTICE("Try holding [src] before you attempt to restock it."))

//Generic proc to transfer ammo between ammo mags. Can work for anything, mags, handfuls, etc.
/obj/item/ammo_magazine/proc/transfer_ammo(obj/item/ammo_magazine/source, mob/user, transfer_amount = 1)
Expand Down
Loading

0 comments on commit 960f1c2

Please sign in to comment.