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

Fire Support Menu for GM's #321

Merged
merged 26 commits into from
Aug 9, 2024
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1eb7e3b
draft 1 lesgo bros
sunofang Jul 3, 2024
0bf2101
Merge branch 'firesupport' of https://github.com/sunofang/PvE-CMSS13 …
sunofang Jul 3, 2024
297e6c4
Categorized menu wow
sunofang Jul 5, 2024
be1af0b
feck I forgot to include it
sunofang Jul 5, 2024
e80422e
oopsie I forgot to clean it up.
sunofang Jul 5, 2024
4dc51d4
Styling upgrades
sunofang Jul 5, 2024
bde9b95
Devlog was funny, but it doesnt add anything
sunofang Jul 5, 2024
a3a838c
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 18, 2024
c60c8de
there's a snake in my code!
sunofang Jul 18, 2024
b7add33
The documentation demon strikes again
sunofang Jul 22, 2024
ca0e51e
Merge branch 'firesupport' of https://github.com/sunofang/PvE-CMSS13 …
sunofang Jul 22, 2024
a941e39
linters give me lint
sunofang Jul 22, 2024
04f3175
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 23, 2024
166e5ac
does the things
sunofang Jul 24, 2024
15bb5ed
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 25, 2024
0209b8f
Merge branch 'master' into firesupport
sunofang Jul 26, 2024
5db56f8
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
69f2d6c
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
5c7c12f
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
1400934
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
8941735
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
5a22285
Update code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
sunofang Jul 30, 2024
1249718
It now also removes fire support menu
sunofang Aug 3, 2024
bfb701c
Merge branch 'firesupport' of https://github.com/sunofang/PvE-CMSS13 …
sunofang Aug 3, 2024
8ffa9a7
Merge branch 'cmss13-devs:master' into firesupport
sunofang Aug 7, 2024
bfe87d0
JSXifies fire support menu. Yippie!
sunofang Aug 7, 2024
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
56 changes: 33 additions & 23 deletions code/modules/admin/game_master/extra_buttons/fire_support_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
return
GLOB.fire_support_menu.tgui_interact(mob)
sunofang marked this conversation as resolved.
Show resolved Hide resolved

///The actual menu datum
/datum/fire_support_menu
var/fire_support_click_intercept = FALSE
var/selected_ordnance = "Banshee Missile"
var/soundCooldown = FALSE
var/sound_cooldown = FALSE
///Mortar to fire the abstract shells.
var/obj/structure/mortar/abstract_mortar = new()
sunofang marked this conversation as resolved.
Show resolved Hide resolved
sunofang marked this conversation as resolved.
Show resolved Hide resolved

/datum/fire_support_menu/tgui_interact(mob/user, datum/tgui/ui)
Expand Down Expand Up @@ -64,6 +66,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)

fire_support_click_intercept = FALSE
sunofang marked this conversation as resolved.
Show resolved Hide resolved

///Handles firing logic whenever the mouse is clicked, and the fire_support_click_intercept var is TRUE
/datum/fire_support_menu/proc/InterceptClickOn(mob/user, params, atom/object)
sunofang marked this conversation as resolved.
Show resolved Hide resolved

var/turf/target_turf = get_turf(object)
Expand All @@ -76,7 +79,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/banshee/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -85,7 +88,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/harpoon/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -94,7 +97,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/keeper/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -103,7 +106,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/napalm/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -112,7 +115,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/thermobaric/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -121,7 +124,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/rocket/widowmaker/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -131,7 +134,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/laser_battery/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -140,7 +143,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/minirocket/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -149,7 +152,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/minirocket/incendiary/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -162,7 +165,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/sentry/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -171,7 +174,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/heavygun/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -180,7 +183,7 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
var/obj/effect/overlay/temp/blinking_laser/target_lase = new(target_turf)
var/obj/structure/ship_ammo/heavygun/antitank/ammo = new()

HandleDropshipOrdnance(target_turf, ammo)
handle_dropship_ordnance(target_turf, ammo)

QDEL_IN(target_lase, 5 SECONDS) //to stop "unused var" warnings
return TRUE
Expand All @@ -189,19 +192,19 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
if("High Explosive OB")
var/obj/structure/ob_ammo/warhead/explosive/ammo = new()

HandleOrbitalOrdnance(target_turf, ammo)
handle_orbital_ordnance(target_turf, ammo)
return TRUE

if("Incendiary OB")
var/obj/structure/ob_ammo/warhead/incendiary/ammo = new()

HandleOrbitalOrdnance(target_turf, ammo)
handle_orbital_ordnance(target_turf, ammo)
return TRUE

if("Cluster OB")
var/obj/structure/ob_ammo/warhead/cluster/ammo = new()

HandleOrbitalOrdnance(target_turf, ammo)
handle_orbital_ordnance(target_turf, ammo)
return TRUE

//Mortar Shelling
Expand Down Expand Up @@ -239,22 +242,29 @@ GLOBAL_DATUM_INIT(fire_support_menu, /datum/fire_support_menu, new)
to_chat(user, SPAN_ANNOUNCEMENT_HEADER_ADMIN("Invalid ordnance selection! If this appears, yell at a coder!"))
return TRUE

/datum/fire_support_menu/proc/HandleDropshipSound(target_turf)
if(!soundCooldown)
///Handles the dropship swooping sound effect, and makes sure it doesnt play 20 times a second.
/datum/fire_support_menu/proc/handle_dropship_sound(target_turf)
if(!sound_cooldown)
playsound(target_turf, 'sound/weapons/dropship_sonic_boom.ogg', 100, 1, 60)
soundCooldown = TRUE
addtimer(VARSET_CALLBACK(src, soundCooldown, FALSE), 10 SECONDS)
sound_cooldown = TRUE
addtimer(VARSET_CALLBACK(src, sound_cooldown, FALSE), 10 SECONDS)

/datum/fire_support_menu/proc/HandleDropshipOrdnance(turf/target_turf, obj/structure/ship_ammo/ammo)
addtimer(CALLBACK(src, PROC_REF(HandleDropshipSound), target_turf), 0.5 SECONDS)
///Handles the noises and actual detonation of dropship ammo. Mainly it doesnt play the warning sound for ammo of the ship_ammo/heavygun/ type.
/datum/fire_support_menu/proc/handle_dropship_ordnance(turf/target_turf, obj/structure/ship_ammo/ammo)
addtimer(CALLBACK(src, PROC_REF(handle_dropship_sound), target_turf), 0.5 SECONDS)
if(!istype(ammo, /obj/structure/ship_ammo/heavygun/))
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), target_turf, ammo.warning_sound, ammo.warning_sound_volume, 1, 15), 1.5 SECONDS)
addtimer(CALLBACK(ammo, TYPE_PROC_REF(/obj/structure/ship_ammo, detonate_on), target_turf), 2.5 SECONDS)
QDEL_IN(ammo, 5 SECONDS)

/datum/fire_support_menu/proc/HandleOrbitalOrdnance(turf/target_turf, obj/structure/ob_ammo/warhead/ammo)
/datum/fire_support_menu/proc/handle_orbital_ordnance(turf/target_turf, obj/structure/ob_ammo/warhead/ammo)
ammo.warhead_impact(target_turf)

///Deletes the mortar when the menu is closed so we dont make a thousand of them.
/datum/fire_support_menu/Destroy(force, ...)
sunofang marked this conversation as resolved.
Show resolved Hide resolved
QDEL_NULL(abstract_mortar)
. = ..()
sunofang marked this conversation as resolved.
Show resolved Hide resolved

#undef ORDNANCE_OPTIONS
#undef ORBITAL_ORDNANCE
#undef MORTAR_ORDNANCE
Expand Down
Loading