Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better OB cannon logging #4830

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
#define between(low, middle, high) (max(min(middle, high), low))

//Offuscate x for coord system
#define obfuscate_x(x) (x + obfs_x)
#define obfuscate_x(x) (x + GLOB.obfs_x)

//Offuscate y for coord system
#define obfuscate_y(y) (y + obfs_y)
#define obfuscate_y(y) (y + GLOB.obfs_y)

//Deoffuscate x for coord system
#define deobfuscate_x(x) (x - obfs_x)
#define deobfuscate_x(x) (x - GLOB.obfs_x)

//Deoffuscate y for coord system
#define deobfuscate_y(y) (y - obfs_y)
#define deobfuscate_y(y) (y - GLOB.obfs_y)

#define can_xeno_build(T) (!T.density && !(locate(/obj/structure/fence) in T) && !(locate(/obj/structure/tunnel) in T) && (locate(/obj/effect/alien/weeds) in T))

Expand Down
7 changes: 7 additions & 0 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ GLOBAL_VAR_INIT(time_offset, setup_offset())

/// The last count of possible candidates in the xeno larva queue (updated via get_alien_candidates)
GLOBAL_VAR(xeno_queue_candidate_count)

//Coordinate obsfucator
//Used by the rangefinders and linked systems to prevent coords collection/prefiring
/// A number between -500 and 500.
GLOBAL_VAR(obfs_x)
/// A number between -500 and 500.
GLOBAL_VAR(obfs_y)
4 changes: 2 additions & 2 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ var/list/reboot_sfx = file2list("config/reboot_sfx.txt")
update_status()

//Scramble the coords obsfucator
obfs_x = rand(-500, 500) //A number between -100 and 100
obfs_y = rand(-500, 500) //A number between -100 and 100
GLOB.obfs_x = rand(-500, 500) //A number between -100 and 100
GLOB.obfs_y = rand(-500, 500) //A number between -100 and 100

spawn(3000) //so we aren't adding to the round-start lag
if(CONFIG_GET(flag/ToRban))
Expand Down
8 changes: 0 additions & 8 deletions code/global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ var/list/nato_phonetic_alphabet = list("Alpha", "Bravo", "Charlie", "Delta", "Ec
var/distress_cancel = 0
var/destroy_cancel = 0

//Coordinate obsfucator
//Used by the rangefinders and linked systems to prevent coords collection/prefiring

/// A number between -500 and 500.
var/global/obfs_x = 0
/// A number between -500 and 500.
var/global/obfs_y = 0

// Which lobby art is on display
// This is updated by the lobby art turf when it initializes
var/displayed_lobby_art = -1
Expand Down
47 changes: 35 additions & 12 deletions code/modules/cm_marines/orbital_cannon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,39 @@ var/list/ob_type_fuel_requirements

flick("OBC_chambering",src)




playsound(loc, 'sound/machines/hydraulics_2.ogg', 40, 1)

ob_cannon_busy = TRUE

sleep(6)

ob_cannon_busy = FALSE

chambered_tray = TRUE
var/misfuel = get_misfuel_amount()
var/message = "[key_name(user)] chambered the Orbital Bombardment cannon."
if(misfuel)
message += " It is misfueled by [misfuel] units!"
message_admins(message, x, y, z)

update_icon()

/var/global/list/orbital_cannon_cancellation = new

/obj/structure/orbital_cannon/proc/fire_ob_cannon(turf/T, mob/user)

/obj/structure/orbital_cannon/proc/get_misfuel_amount()
switch(tray.warhead.warhead_kind)
if("explosive")
return abs(ob_type_fuel_requirements[1] - tray.fuel_amt)
if("incendiary")
return abs(ob_type_fuel_requirements[2] - tray.fuel_amt)
if("cluster")
return abs(ob_type_fuel_requirements[3] - tray.fuel_amt)
return 0

/obj/structure/orbital_cannon/proc/fire_ob_cannon(turf/T, mob/user, squad_behalf)
set waitfor = 0

if(!chambered_tray || !loaded_tray || !tray || !tray.warhead || ob_cannon_busy)
Expand All @@ -203,17 +221,22 @@ var/list/ob_type_fuel_requirements
playsound(loc, 'sound/weapons/vehicles/smokelauncher_fire.ogg', 70, 1)
playsound(loc, 'sound/weapons/pred_plasma_shot.ogg', 70, 1)

var/inaccurate_fuel = 0

switch(tray.warhead.warhead_kind)
if("explosive")
inaccurate_fuel = abs(ob_type_fuel_requirements[1] - tray.fuel_amt)
if("incendiary")
inaccurate_fuel = abs(ob_type_fuel_requirements[2] - tray.fuel_amt)
if("cluster")
inaccurate_fuel = abs(ob_type_fuel_requirements[3] - tray.fuel_amt)
var/inaccurate_fuel = get_misfuel_amount()
var/area/area = get_area(T)
var/off_x = (inaccurate_fuel + 1) * round(rand(-3,3), 1)
var/off_y = (inaccurate_fuel + 1) * round(rand(-3,3), 1)
var/target_x = Clamp(T.x + off_x, 1, world.maxx)
var/target_y = Clamp(T.y + off_y, 1, world.maxy)
var/turf/target = locate(target_x, target_y, T.z)
var/area/target_area = get_area(target)

message_admins(FONT_SIZE_HUGE("ALERT: [key_name(user)] fired an orbital bombardment in '[target_area]' for squad '[squad_behalf]' landing at ([target.x],[target.y],[target.z])"), target.x, target.y, target.z)
var/message = "Orbital bombardment original target was ([T.x],[T.y],[T.z]) - offset by [abs(off_x)+abs(off_y)]"
if(inaccurate_fuel)
message += " - It was misfueled by [inaccurate_fuel] units!"
message_admins(message, T.x, T.y, T.z)
log_attack("[key_name(user)] fired an orbital bombardment in [area.name] for squad '[squad_behalf]'")

var/turf/target = locate(T.x + inaccurate_fuel * round(rand(-3,3), 1), T.y + inaccurate_fuel * round(rand(-3,3), 1), T.z)
if(user)
tray.warhead.source_mob = user

Expand Down
17 changes: 7 additions & 10 deletions code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@
playsound(T,'sound/effects/alert.ogg', 25, 1) //Placeholder
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/structure/machinery/computer/overwatch, alert_ob), T), 2 SECONDS)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/structure/machinery/computer/overwatch, begin_fire)), 6 SECONDS)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/structure/machinery/computer/overwatch, fire_bombard), user, A, T), 6 SECONDS + 6)
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/structure/machinery/computer/overwatch, fire_bombard), user, T), 6 SECONDS + 6)

/obj/structure/machinery/computer/overwatch/proc/begin_fire()
for(var/mob/living/carbon/H in GLOB.alive_mob_list)
Expand All @@ -787,23 +787,20 @@
visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("Orbital bombardment for squad '[current_squad]' has fired! Impact imminent!")]")
current_squad.send_message("WARNING! Ballistic trans-atmospheric launch detected! Get outside of Danger Close!")

/obj/structure/machinery/computer/overwatch/proc/fire_bombard(mob/user, area/A, turf/T)
if(!A || !T)
/obj/structure/machinery/computer/overwatch/proc/fire_bombard(mob/user,turf/T)
if(!T)
return

var/ob_name = lowertext(almayer_orbital_cannon.tray.warhead.name)
var/mutable_appearance/warhead_appearance = mutable_appearance(almayer_orbital_cannon.tray.warhead.icon, almayer_orbital_cannon.tray.warhead.icon_state)
notify_ghosts(header = "Bombardment Inbound", message = "\A [ob_name] targeting [A.name] has been fired!", source = T, alert_overlay = warhead_appearance, extra_large = TRUE)
message_admins(FONT_SIZE_HUGE("ALERT: [key_name(user)] fired an orbital bombardment in [A.name] for squad '[current_squad]' [ADMIN_JMP(T)]"))
log_attack("[key_name(user)] fired an orbital bombardment in [A.name] for squad '[current_squad]'")
notify_ghosts(header = "Bombardment Inbound", message = "\A [ob_name] targeting [get_area(T)] has been fired!", source = T, alert_overlay = warhead_appearance, extra_large = TRUE)

/// Project ARES interface log.
log_ares_bombardment(user.name, ob_name, "X[x_bomb], Y[y_bomb] in [A.name]")
log_ares_bombardment(user.name, ob_name, "X[x_bomb], Y[y_bomb] in [get_area(T)]")

busy = FALSE
var/turf/target = locate(T.x + rand(-3, 3), T.y + rand(-3, 3), T.z)
if(target && istype(target))
almayer_orbital_cannon.fire_ob_cannon(target, user)
if(istype(T))
almayer_orbital_cannon.fire_ob_cannon(T, user, current_squad)
user.count_niche_stat(STATISTICS_NICHE_OB)

/obj/structure/machinery/computer/overwatch/proc/handle_supplydrop()
Expand Down
10 changes: 5 additions & 5 deletions code/modules/shuttle/computers/dropship_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,19 @@

// door controls being overriden
if(!dropship_control_lost)
to_chat(xeno, SPAN_XENONOTICE("You override the doors."))
xeno_message(SPAN_XENOANNOUNCE("The doors of the metal bird have been overridden! Rejoice!"), 3, xeno.hivenumber)
dropship.control_doors("unlock", "all", TRUE)
dropship_control_lost = TRUE
door_control_cooldown = addtimer(CALLBACK(src, PROC_REF(remove_door_lock)), SHUTTLE_LOCK_COOLDOWN, TIMER_STOPPABLE)
notify_ghosts(header = "Dropship Locked", message = "[xeno] has locked [dropship]!", source = xeno, action = NOTIFY_ORBIT)

if(almayer_orbital_cannon)
almayer_orbital_cannon.is_disabled = TRUE
addtimer(CALLBACK(almayer_orbital_cannon, TYPE_PROC_REF(/obj/structure/orbital_cannon, enable)), 10 MINUTES, TIMER_UNIQUE)

if(!GLOB.resin_lz_allowed)
set_lz_resin_allowed(TRUE)

to_chat(xeno, SPAN_XENONOTICE("You override the doors."))
xeno_message(SPAN_XENOANNOUNCE("The doors of the metal bird have been overridden! Rejoice!"), 3, xeno.hivenumber)
message_admins("[key_name(xeno)] has locked the dropship '[dropship]'", xeno.x, xeno.y, xeno.z)
notify_ghosts(header = "Dropship Locked", message = "[xeno] has locked [dropship]!", source = xeno, action = NOTIFY_ORBIT)
return

if(dropship_control_lost)
Expand Down
Loading