diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 9a6ee4362088..38c02e776735 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -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)) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 646b8ec2c854..44f4b2c4010f 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -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) diff --git a/code/game/world.dm b/code/game/world.dm index fce40ca468ae..450f72427903 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -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)) diff --git a/code/global.dm b/code/global.dm index bdde529a9af8..e329cbdd00d5 100644 --- a/code/global.dm +++ b/code/global.dm @@ -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 diff --git a/code/modules/cm_marines/orbital_cannon.dm b/code/modules/cm_marines/orbital_cannon.dm index 1d49c42f5e0d..edcb5a836b5d 100644 --- a/code/modules/cm_marines/orbital_cannon.dm +++ b/code/modules/cm_marines/orbital_cannon.dm @@ -171,6 +171,9 @@ var/list/ob_type_fuel_requirements flick("OBC_chambering",src) + + + playsound(loc, 'sound/machines/hydraulics_2.ogg', 40, 1) ob_cannon_busy = TRUE @@ -178,14 +181,29 @@ var/list/ob_type_fuel_requirements 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) @@ -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 diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 66d83f9e73b8..5d651e0aa220 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -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) @@ -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() diff --git a/code/modules/shuttle/computers/dropship_computer.dm b/code/modules/shuttle/computers/dropship_computer.dm index 4540588ca628..4fe102270537 100644 --- a/code/modules/shuttle/computers/dropship_computer.dm +++ b/code/modules/shuttle/computers/dropship_computer.dm @@ -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)