-
Notifications
You must be signed in to change notification settings - Fork 566
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
Ship vs ship revival #4326
Ship vs ship revival #4326
Changes from all commits
ccdf574
c71e4de
a55f0eb
fa30bec
d8030ba
3a9774c
be40c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
set name = "Weapons" | ||
set category = "Admin.Ship" | ||
|
||
var/weapontype = tgui_alert(src, "What weapon?", "Choose wisely!", list("Missile", "Railgun"), 20 SECONDS) | ||
var/weapontype = tgui_input_list(src, "What weapon?", "Choose wisely!", list("Missile", "Railgun", "Orb. Def. Cannon", "AA Boiler Shot"), 20 SECONDS) | ||
if(!weapontype) | ||
return | ||
var/hiteta = tgui_input_number(src, "Give an ETA for the weapon to hit.", "Don't make them wait too long!", 10, 120, 10, 20 SECONDS) | ||
|
@@ -97,6 +97,66 @@ | |
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 2, picked_atom, point_defense), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a single Railgun Slug at the Almayer at a random location, [picked_atom], with the possibility of missing as [point_defense]") | ||
|
||
if("Orb. Def. Cannon") | ||
if(exactplace == TRUE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can just do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :true: |
||
shipwide_ai_announcement("DANGER: ORBITAL DEFENSES ENGAGING, INCOMING SHOT. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 3, mob.loc, point_defense), hiteta SECONDS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you know that the mob's loc will always be a turf? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be misuse if it wasn't, it's for an admin to aim it at somewhere in a ship (Which kinda most certainly gonna be a turf) and then firin' it |
||
message_admins("[key_name_admin(src)] Fired a single ODC Shot at the Almayer at their location, [mob.loc], with the possibility of missing as [point_defense]") | ||
|
||
|
||
if(exactplace == FALSE) | ||
if(salvo == TRUE) | ||
shipwide_ai_announcement("DANGER: ORBITAL DEFENSES ENGAGING, SALVO INCOMING. BRACE, BRACE, BRACE. SALVO SIZE: [quantity], ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
targets = shipside_random_turf_picker(quantity) | ||
if(targets == null) | ||
tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) | ||
return | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 3, targets, point_defense, salvo), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a salvo of ODC Shots at the Almayer at random places, with the possibility of missing [point_defense]") | ||
picked_atom = null | ||
targets = null | ||
|
||
if(salvo == FALSE) | ||
prompt = tgui_alert(src, "Are you sure you want to shoot an Orbital Defense Cannon shot at the USS Almayer at a random place?", "Choose wisely!", list("Yes", "No"), 20 SECONDS) | ||
if(prompt == "Yes") | ||
shipwide_ai_announcement("DANGER: ORBITAL DEFENSES ENGAGING, INCOMING SHOT. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
picked_atom = shipside_random_turf_picker(1) | ||
if(picked_atom == null) | ||
tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) | ||
return | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 3, picked_atom, point_defense), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a single ODC Shot at the Almayer at their location, [picked_atom], with the possibility of missing as [point_defense]") | ||
|
||
if("AA Boiler Shot") | ||
if(exactplace == TRUE) | ||
shipwide_ai_announcement("DANGER: LARGE VOLATILE BIOMASS INCOMING. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 4, mob.loc, point_defense), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a single AA Boiler Shot at the Almayer at their location, [mob.loc], with the possibility of missing as [point_defense]") | ||
|
||
|
||
if(exactplace == FALSE) | ||
if(salvo == TRUE) | ||
shipwide_ai_announcement("DANGER: MULTIPLE LARGE VOLATILE BIOMASS INCOMING. BRACE, BRACE, BRACE. QUANTITY: [quantity], ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
targets = shipside_random_turf_picker(quantity) | ||
if(targets == null) | ||
tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) | ||
return | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 4, targets, point_defense, salvo), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a salvo of AA Boiler Shots at the Almayer at random places, with the possibility of missing [point_defense]") | ||
picked_atom = null | ||
targets = null | ||
|
||
if(salvo == FALSE) | ||
prompt = tgui_alert(src, "Are you sure you want to attack the USS Almayer with an AA Boiler Shot at a random place?", "Choose wisely!", list("Yes", "No"), 20 SECONDS) | ||
if(prompt == "Yes") | ||
shipwide_ai_announcement("DANGER: LARGE VOLATILE BIOMASS INCOMING. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') | ||
picked_atom = shipside_random_turf_picker(1) | ||
if(picked_atom == null) | ||
tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) | ||
return | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 4, picked_atom, point_defense), hiteta SECONDS) | ||
message_admins("[key_name_admin(src)] Fired a single AA Boiler Shot at the Almayer at their location, [picked_atom], with the possibility of missing as [point_defense]") | ||
|
||
/proc/shipside_random_turf_picker(turfquantity) | ||
|
||
var/picked_atom | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/proc/generalquarters(customannouncement, customannouncementtext) | ||
var/GQannouncement = "ATTENTION! GENERAL QUARTERS. ALL HANDS, MAN YOUR BATTLESTATIONS." | ||
if(security_level < SEC_LEVEL_RED) | ||
set_security_level(SEC_LEVEL_RED, TRUE, FALSE) | ||
if(customannouncement) | ||
shipwide_ai_announcement(customannouncementtext, MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg') | ||
else | ||
shipwide_ai_announcement(GQannouncement, MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
#define WEAPON_MISSILE 1 | ||
#define WEAPON_RAILGUN 2 | ||
#define WEAPON_ODC 3 | ||
#define WEAPON_AABOILER 4 | ||
#define WEAPON_MISSILE_DAMAGE 20 | ||
#define WEAPON_RAILGUN_DAMAGE 2 | ||
#define WEAPON_ODC_DAMAGE 10 | ||
#define WEAPON_AABOILER_DAMAGE 20 | ||
#define HIT_CHANCE_CHEAT 100 | ||
#define HIT_CHANCE_STANDARD 70 | ||
/** | ||
|
@@ -16,6 +22,7 @@ | |
* * salvo - identifies it as a salvo or not. | ||
*/ | ||
/proc/weaponhits(weaponused, location, point_defense = FALSE, salvo = FALSE) | ||
var/logtotalhits | ||
|
||
|
||
switch(weaponused) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. everything in this file (weapons, what they do for damage, etc.) should 100% be datums |
||
|
@@ -26,36 +33,48 @@ | |
if(salvo == TRUE) | ||
var/shotspacing | ||
for(var/turf/picked_atom in location) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 700, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_MISSILE_DAMAGE | ||
shotspacing += 1 | ||
shakeship(10, 10, TRUE, FALSE) | ||
GLOB.ship_hits_tally["times_hit_missile"] += 1 | ||
logtotalhits += 1 | ||
weaponhits_effects(WEAPON_MISSILE) | ||
else | ||
cell_explosion(location, 350, 1, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) | ||
cell_explosion(location, 700, 9, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_MISSILE_DAMAGE | ||
shakeship(10, 10, TRUE, FALSE) | ||
weaponhits_effects(WEAPON_MISSILE) | ||
GLOB.ship_hits_tally["times_hit_missile"] += 1 | ||
logtotalhits +=1 | ||
if(point_defense == TRUE) | ||
var/hitchance = HIT_CHANCE_STANDARD | ||
if(salvo == TRUE) | ||
var/confirmedhit | ||
var/shotspacing | ||
for(var/turf/picked_atom in location) | ||
if(prob(hitchance)) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 700, 9, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_MISSILE_DAMAGE | ||
shakeship(10, 10, TRUE, FALSE) | ||
confirmedhit += 1 | ||
logtotalhits += 1 | ||
else | ||
weaponhits_effects(WEAPON_MISSILE, TRUE, shotspacing) | ||
|
||
shotspacing += 1 | ||
if(confirmedhit > 0) | ||
weaponhits_effects(WEAPON_MISSILE, FALSE) | ||
GLOB.ship_hits_tally["times_hit_missile"] += confirmedhit | ||
confirmedhit = 0 | ||
else | ||
if(prob(hitchance)) | ||
cell_explosion(location, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) | ||
cell_explosion(location, 700, 9, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - 10 | ||
shakeship(10, 10, TRUE, FALSE) | ||
weaponhits_effects(WEAPON_MISSILE, FALSE) | ||
GLOB.ship_hits_tally["times_hit_missile"] += 1 | ||
logtotalhits += 1 | ||
else | ||
weaponhits_effects(WEAPON_MISSILE, TRUE) | ||
|
||
|
@@ -69,21 +88,91 @@ | |
for(var/turf/picked_atom in location) | ||
if(prob(hitchance)) | ||
cell_explosion(picked_atom, 600, 600, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, antishiprailgun_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_RAILGUN_DAMAGE | ||
shakeship(5, 5, FALSE, FALSE) | ||
confirmedhit += 1 | ||
logtotalhits += 1 | ||
if(confirmedhit > 0) | ||
weaponhits_effects(WEAPON_RAILGUN) | ||
if(confirmedhit < 1) | ||
weaponhits_effects(WEAPON_RAILGUN, TRUE) | ||
GLOB.ship_hits_tally["times_hit_railgun"] += confirmedhit | ||
|
||
else if(salvo == FALSE) | ||
if(prob(hitchance)) | ||
cell_explosion(location, 600, 600, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, antishiprailgun_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_RAILGUN_DAMAGE | ||
shakeship(5, 5, FALSE, FALSE) | ||
weaponhits_effects(WEAPON_RAILGUN) | ||
GLOB.ship_hits_tally["times_hit_railgun"] += 1 | ||
logtotalhits += 1 | ||
else | ||
weaponhits_effects(WEAPON_RAILGUN, TRUE) | ||
|
||
if(WEAPON_ODC) | ||
var/datum/cause_data/orbitaldefensecannon_cause_data = create_cause_data("Orbital Defense Shell") | ||
var/hitchance = HIT_CHANCE_CHEAT | ||
if(point_defense == TRUE) | ||
hitchance = HIT_CHANCE_STANDARD | ||
if(salvo == TRUE) | ||
var/confirmedhit | ||
for(var/turf/picked_atom in location) | ||
if(prob(hitchance)) | ||
cell_explosion(picked_atom, 850, 6, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, orbitaldefensecannon_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_ODC_DAMAGE | ||
shakeship(10, 10, TRUE, FALSE) | ||
confirmedhit += 1 | ||
logtotalhits += 1 | ||
if(confirmedhit > 0) | ||
weaponhits_effects(WEAPON_ODC) | ||
if(confirmedhit < 1) | ||
weaponhits_effects(WEAPON_ODC, TRUE) | ||
GLOB.ship_hits_tally["times_hit_odc"] += confirmedhit | ||
|
||
else if(salvo == FALSE) | ||
if(prob(hitchance)) | ||
cell_explosion(location, 850, 6, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, orbitaldefensecannon_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_ODC_DAMAGE | ||
shakeship(10, 10, TRUE, FALSE) | ||
weaponhits_effects(WEAPON_ODC) | ||
GLOB.ship_hits_tally["times_hit_odc"] += 1 | ||
logtotalhits += 1 | ||
else | ||
weaponhits_effects(WEAPON_ODC, TRUE) | ||
|
||
if(WEAPON_AABOILER) | ||
var/datum/cause_data/aaboiler_cause_data = create_cause_data("AA Boiler Shot") | ||
var/hitchance = HIT_CHANCE_CHEAT | ||
if(point_defense == TRUE) | ||
hitchance = HIT_CHANCE_STANDARD | ||
if(salvo == TRUE) | ||
var/confirmedhit | ||
for(var/turf/picked_atom in location) | ||
if(prob(hitchance)) | ||
cell_explosion(picked_atom, 700, 9, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, aaboiler_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_AABOILER_DAMAGE | ||
shakeship(10, 10, FALSE, FALSE) | ||
confirmedhit += 1 | ||
logtotalhits += 1 | ||
if(confirmedhit > 0) | ||
weaponhits_effects(WEAPON_AABOILER) | ||
if(confirmedhit < 1) | ||
weaponhits_effects(WEAPON_AABOILER, TRUE) | ||
GLOB.ship_hits_tally["times_hit_aaboiler"] += confirmedhit | ||
|
||
else if(salvo == FALSE) | ||
if(prob(hitchance)) | ||
cell_explosion(location, 700, 9, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, aaboiler_cause_data) | ||
GLOB.ship_health_vars["ship_hull_health"] = GLOB.ship_health_vars["ship_hull_health"] - WEAPON_AABOILER_DAMAGE | ||
shakeship(10, 10, FALSE, FALSE) | ||
weaponhits_effects(WEAPON_AABOILER) | ||
GLOB.ship_hits_tally["times_hit_aaboiler"] += 1 | ||
logtotalhits += 1 | ||
else | ||
weaponhits_effects(WEAPON_AABOILER, TRUE) | ||
var/integerhitstally = GLOB.ship_hits_tally["times_hit_missile"] + GLOB.ship_hits_tally["times_hit_railgun"] + GLOB.ship_hits_tally["times_hit_odc"] + GLOB.ship_hits_tally["times_hit_aaboiler"] | ||
message_admins("weaponhits concluded! Type '[weaponused]' weapon was used, and hit [logtotalhits] times. The Almayer has now suffered a total of [integerhitstally] hits from all the weapons!") | ||
|
||
/proc/weaponhits_effects(weaponused, weaponmiss = FALSE, shotspacing = 0) | ||
switch(weaponused) | ||
if(WEAPON_MISSILE) | ||
|
@@ -116,8 +205,47 @@ | |
continue | ||
playsound_client (current_mob.client, 'sound/effects/railgun_miss.ogg', 60) | ||
to_chat(current_mob.client, SPAN_DANGER("You hear railgun shots barely missing the hull!")) | ||
|
||
if(WEAPON_ODC) | ||
if(!weaponmiss) | ||
for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) | ||
if(!is_mainship_level(current_mob.z)) | ||
continue | ||
playsound_client(current_mob.client, 'sound/effects/metal_crash.ogg', 100 ) | ||
playsound_client(current_mob.client, 'sound/effects/bigboom3.ogg', 100) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/pry2.ogg', 20), 1 SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/double_klaxon.ogg'), 2 SECONDS) | ||
else | ||
for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) | ||
if(!is_mainship_level(current_mob.z)) | ||
continue | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/railgun_miss.ogg', 60), shotspacing SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), current_mob.client, SPAN_DANGER("You hear Shells barely missing the hull!")), shotspacing SECONDS) | ||
|
||
if(WEAPON_AABOILER) | ||
if(!weaponmiss) | ||
for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) | ||
if(!is_mainship_level(current_mob.z)) | ||
continue | ||
playsound_client(current_mob.client, 'sound/effects/metal_crash.ogg', 100 ) | ||
playsound_client(current_mob.client, 'sound/effects/bigboom3.ogg', 100) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/pry2.ogg', 20), 1 SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/double_klaxon.ogg'), 2 SECONDS) | ||
else | ||
for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) | ||
if(!is_mainship_level(current_mob.z)) | ||
continue | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/railgun_miss.ogg', 60), shotspacing SECONDS) | ||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), current_mob.client, SPAN_DANGER("You hear a vile mass barely missing the hull!")), shotspacing SECONDS) | ||
|
||
#undef WEAPON_MISSILE_DAMAGE | ||
#undef WEAPON_RAILGUN_DAMAGE | ||
#undef WEAPON_ODC_DAMAGE | ||
#undef WEAPON_AABOILER_DAMAGE | ||
//REMOVE THIS WHEN WE USE THESE DEFS SOMEWHERE ELSE OR ELSE IT STRAIGHT UP WON'T WORK. | ||
#undef WEAPON_MISSILE | ||
#undef WEAPON_RAILGUN | ||
#undef WEAPON_ODC | ||
#undef WEAPON_AABOILER | ||
#undef HIT_CHANCE_CHEAT | ||
#undef HIT_CHANCE_STANDARD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like the ship being a datum is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of this specific code being datumized was here (but unfinished) #3355 / #3647