Skip to content

Commit

Permalink
Merge pull request Civ13#2633 from Bierkraan/working-branch
Browse files Browse the repository at this point in the history
Add animations to airstrikes
  • Loading branch information
Bierkraan authored Mar 18, 2024
2 parents f1b4f9d + 0251b66 commit ad9d9ca
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 24 deletions.
2 changes: 2 additions & 0 deletions code/_helpers/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ var/global/faction2_aircraft_cooldown = 0
var/global/faction1_aircraft_rearming = 0
var/global/faction2_aircraft_rearming = 0

var/global/faction1_airstrikes_max = 10
var/global/faction2_airstrikes_max = 10
var/global/faction1_airstrikes_remaining = 10
var/global/faction2_airstrikes_remaining = 10

Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/effects/gibs.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// gibs that don't use DNA - Kachnov

/proc/gibs(atom/location, gibber_type = /obj/effect/gibspawner/generic, var/fleshcolor, var/bloodcolor)
new gibber_type(location,fleshcolor,bloodcolor)

Expand Down
112 changes: 109 additions & 3 deletions code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@
name = "anti-tank grenade"
desc = "A powerful grenade, useful against armored vehicles."
icon_state = "rpg40"
explosion_sound = 'sound/weapons/Explosives/HEGrenade.ogg'
det_time = 50
throw_range = 5
heavy_armor_penetration = 22
Expand Down Expand Up @@ -1056,14 +1057,119 @@
/obj/structure/bomb
name = "50 kg bomb"
desc = "Uhm..."
icon = 'icons/obj/cannon_ball.dmi'
icon_state = "bomb"
icon = 'icons/obj/grenade.dmi'
icon_state = "aircraft_bomb"
anchored = TRUE
density = TRUE
opacity = FALSE
var/timer = 1 SECOND

var/fragment_type = /obj/item/projectile/bullet/pellet/fragment
var/num_fragments = 30
var/fragment_damage = 15
var/damage_step = 2
var/spread_range = 7

/obj/structure/bomb/proc/drop()
density = FALSE
spawn(15)
var/turf/T = get_turf(src)
playsound(T, 'sound/effects/bang.ogg', 80)
density = TRUE
for (var/mob/living/L in T)
L.gib()
explode()
return

/obj/structure/bomb/proc/explode()
spawn(timer)
explosion(get_turf(src), 2, 3, 4, 4, sound='sound/weapons/Explosives/FragGrenade.ogg')
if (prob(99))
var/turf/T = get_turf(src)
explosion(T, 2, 3, 5, 4)
if (!ismob(loc))
var/list/target_turfs = getcircle(T, spread_range)
var/fragments_per_projectile = round(num_fragments/target_turfs.len)

for (var/turf/TT in target_turfs)
var/obj/item/projectile/bullet/pellet/fragment/P = new fragment_type(T)
P.damage = fragment_damage
P.pellets = fragments_per_projectile
P.range_step = damage_step
P.shot_from = name
P.launch_fragment(TT)
P.firer_loc = get_turf(src)
qdel(src)
return

/obj/structure/bomb/attackby(obj/item/W as obj, mob/user as mob)
explode()
return

/obj/structure/bomb/kg150
name = "150 kg bomb"

num_fragments = 50
fragment_damage = 30

/obj/structure/bomb/kg150/explode()
spawn(timer)
if (prob(99))
var/turf/T = get_turf(src)
explosion(T, 3, 5, 8, 5)
if (!ismob(loc))
var/list/target_turfs = getcircle(T, spread_range)
var/fragments_per_projectile = round(num_fragments/target_turfs.len)

for (var/turf/TT in target_turfs)
var/obj/item/projectile/bullet/pellet/fragment/P = new fragment_type(T)
P.damage = fragment_damage
P.pellets = fragments_per_projectile
P.range_step = damage_step
P.shot_from = name
P.launch_fragment(TT)
P.firer_loc = get_turf(src)
qdel(src)
return

/obj/structure/missile
name = "missile"
desc = "Uhm..."
icon = 'icons/obj/grenade.dmi'
icon_state = "aircraft_missile"
anchored = TRUE
density = TRUE
opacity = FALSE

var/fragment_type = /obj/item/projectile/bullet/pellet/fragment
var/num_fragments = 30
var/fragment_damage = 15
var/damage_step = 2
var/spread_range = 7

/obj/structure/missile/proc/drop()
density = FALSE
spawn(15)
explode()
return

/obj/structure/missile/proc/explode()
var/turf/T = get_turf(src)
explosion(T, 0, 1, 5, 3, sound='sound/weapons/Explosives/FragGrenade.ogg')
if (!ismob(loc))
var/list/target_turfs = getcircle(T, spread_range)
var/fragments_per_projectile = round(num_fragments/target_turfs.len)

for (var/turf/TT in target_turfs)
var/obj/item/projectile/bullet/pellet/fragment/P = new fragment_type(T)
P.damage = fragment_damage
P.pellets = fragments_per_projectile
P.range_step = damage_step
P.shot_from = name
P.launch_fragment(TT)
P.firer_loc = get_turf(src)

// any mob on the source turf, lying or not, absorbs 100% of shrapnel
for (var/mob/living/L in T)
P.attack_mob(L, 0, 0)
qdel(src)
return
6 changes: 3 additions & 3 deletions code/game/objects/map_metadata/stalingrad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ID = MAP_STALINGRAD
title = "Stalingrad"
lobby_icon = 'icons/lobby/stalingrad.png'
no_winner ="The battle for the city is still going on."
no_winner = "The battle for the city is still going on."
caribbean_blocking_area_types = list(/area/caribbean/no_mans_land/invisible_wall/taiga,/area/caribbean/no_mans_land/invisible_wall/taiga/one,/area/caribbean/no_mans_land/invisible_wall/taiga/two)
respawn_delay = 600 // 1 minute

Expand All @@ -19,7 +19,7 @@
ordinal_age = 6
faction_distribution_coeffs = list(GERMAN = 0.5, RUSSIAN = 0.5)
battle_name = "battle of Stalingrad"
mission_start_message = "<font size=4>All factions have <b>5 minutes</b> to prepare before the ceasefire ends!</font><br><big>Points are added to each team for each minute they control the <b>Train Station, Telephone Central and City Hall</b>.<br>First team to reach <b>40</b> points wins!</font>"
mission_start_message = "<font size=4>All factions have <b>5 minutes</b> to prepare before the ceasefire ends!</font><br><big>Points are added to each team for each minute they control the <b>Train Station, Telephone Central and City Hall</b>.<br>First team to reach <b>40</b> points wins!</big>"
faction1 = GERMAN
faction2 = RUSSIAN
valid_weather_types = list(WEATHER_NONE, WEATHER_WET, WEATHER_EXTREME)
Expand Down Expand Up @@ -248,7 +248,7 @@

faction_distribution_coeffs = list(GERMAN = 0.5, RUSSIAN = 0.5)
battle_name = "battle of Stalingrad"
mission_start_message = "<font size=4>All factions have <b>3 minutes</b> to prepare before the ceasefire ends!</font><br><big>Points are added to each team for each minute they control the <b>Train Station, Telephone Central, Hospital, and City Hall</b>.<br>First team to reach <b>40</b> points wins!</font>"
mission_start_message = "<font size=4>All factions have <b>3 minutes</b> to prepare before the ceasefire ends!</font><br><big>Points are added to each team for each minute they control the <b>Train Station, Telephone Central, Hospital, and City Hall</b>.<br>First team to reach <b>40</b> points wins!</big>"

/obj/map_metadata/stalingrad/minigrad/job_enabled_specialcheck(var/datum/job/J)
..()
Expand Down
63 changes: 51 additions & 12 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -483,37 +483,40 @@ var/const/enterloopsanity = 100
log_game("[ckey] ([faction_text]) called in an airstrike with \the [src] at ([T.x],[T.y],[T.z])(<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>JMP</a>)")

var/aircraft_name
var/drop_delay = 3 SECONDS // Drop delay determines how long it takes for the payload to arive after the airstrike has been called .
var/dive_text = "cuts through"
var/drop_delay = 1 SECONDS // Drop delay determines how long it takes for the payload to arive after the airstrike has been called .
switch(faction_text) // Check what faction has called in the airstrike and select an aircraft.
if (DUTCH)
new /obj/effect/plane_flyby/f16_no_message(T)
aircraft_name = "F-16"
drop_delay = 3 SECONDS
drop_delay = 1 SECONDS
if (GERMAN)
if (map.ordinal_age == 6)
new /obj/effect/plane_flyby/ju87_no_message(T)
aircraft_name = "Ju 87 Stuka"
dive_text = "dives down"
drop_delay = 18 SECONDS
else
new /obj/effect/plane_flyby/ju87_no_message(T)
aircraft_name = "Ju 87 Stuka"
drop_delay = 3 SECONDS
dive_text = "dives down"
drop_delay = 18 SECONDS
if (AMERICAN)
new /obj/effect/plane_flyby/f16_no_message(T)
aircraft_name = "F-16"
drop_delay = 3 SECONDS
drop_delay = 1 SECONDS
if (RUSSIAN)
if (map.ordinal_age == 6)
return // No aircraft for the Russians in WW2 yet
else
new /obj/effect/plane_flyby/su25_no_message(T)
aircraft_name = "Su-25"
drop_delay = 3 SECONDS
drop_delay = 1 SECONDS

var/faction_num
if (map.faction1 == faction_text) // Check how many airstrikes a faction has left
faction_num = 1
else
else if (map.faction2 == faction_text)
faction_num = 2

switch (faction_num)
Expand All @@ -522,7 +525,7 @@ var/const/enterloopsanity = 100
if (2)
faction2_airstrikes_remaining--

to_chat(world, SPAN_DANGER("<font size=4>The clouds open up as a [aircraft_name] cuts through.</font>"))
to_chat(world, SPAN_DANGER("<font size=4>The clouds open up as a [aircraft_name] [dive_text].</font>"))

var/anti_air_in_range = FALSE
for (var/obj/structure/milsim/anti_air/AA in range(60, T)) // Check if there's anti air within 60 tiles
Expand Down Expand Up @@ -594,41 +597,77 @@ var/const/enterloopsanity = 100

spawn(drop_delay)
for (var/i = 1, i <= strikenum, i++)
var/obj/structure/missile/M = new /obj/structure/missile(null)
switch (direction)
if ("NORTH")
direction_yoffset += 3
xoffset = rand(-2,2)
yoffset = rand(0,1)

M.dir = NORTH
M.pixel_y = -8*32 // 8 tiles and 32 pixels per tile
if ("EAST")
direction_xoffset += 3
xoffset = rand(0,1)
yoffset = rand(-2,2)

M.dir = EAST
M.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
M.pixel_x = -12*32 // 8 tiles and 32 pixels per tile
animate(M, transform = turn(matrix(), 20), time = 10, easing = LINEAR_EASING)
if ("SOUTH")
direction_yoffset -= 3
xoffset = rand(-2,2)
yoffset = rand(0,1)

M.dir = SOUTH
M.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
if ("WEST")
direction_xoffset -= 3
xoffset = rand(0,1)
yoffset = rand(-2,2)

M.dir = WEST
M.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
M.pixel_x = 12*32 // 8 tiles and 32 pixels per tile
animate(M, transform = turn(matrix(), -20), time = 10, easing = LINEAR_EASING)
spawn(i*5)
explosion(locate((T.x + xoffset + direction_xoffset), (T.y + yoffset + direction_yoffset), T.z), 0, 1, 5, 3, sound='sound/weapons/Explosives/FragGrenade.ogg')
if ("Bomb")
M.loc = locate((T.x + xoffset + direction_xoffset), (T.y + yoffset + direction_yoffset), T.z)
animate(M, time = 15, pixel_y = 0, easing = LINEAR_EASING)
animate(M, time = 15, pixel_x = 0, easing = LINEAR_EASING)
M.drop()

return
if ("50kg Bomb")
strikenum = 1
xoffset = rand(-3,3)
yoffset = rand(-3,3)

spawn(drop_delay)
for (var/i = 1, i <= strikenum, i++)
var/obj/structure/bomb/B = new /obj/structure/bomb(locate((T.x + xoffset), (T.y + yoffset), T.z))
playsound(get_turf(B), 'sound/effects/bang.ogg', 70)
var/obj/structure/bomb/B = new /obj/structure/bomb(null)
switch (direction)
if ("NORTH")
B.dir = NORTH
B.pixel_y = -12*32 // 8 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), -45), time = 10)
if ("EAST")
B.dir = EAST
B.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
B.pixel_x = -12*32 // 8 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), 45), time = 10)
if ("SOUTH")
B.dir = SOUTH
B.pixel_y = 12*32 // 8 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), 45), time = 10)
if ("WEST")
B.dir = WEST
B.explode()
B.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
B.pixel_x = 12*32 // 8 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), -45), time = 10)

B.loc = locate((T.x + xoffset), (T.y + yoffset), T.z)
animate(B, time = 15, pixel_y = 0, easing = SINE_EASING | EASE_IN)
animate(B, time = 15, pixel_x = 0, easing = SINE_EASING | EASE_IN)
B.drop()
return
11 changes: 7 additions & 4 deletions code/modules/1713/weapons/zoom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Parts of code courtesy of Super3222

var/airstrikes_remaining

var/call_in_time = 1 SECOND
var/call_in_time = 3 SECONDS
var/cooldown = 30 SECONDS
var/debounce = FALSE

Expand All @@ -138,7 +138,8 @@ Parts of code courtesy of Super3222
icon_state = "binoculars"

call_in_time = 5 SECONDS
payload_list = list("Bomb")
cooldown = 1 MINUTE
payload_list = list("50kg Bomb")

/obj/item/weapon/attachment/scope/adjustable/binoculars/laser_designator/examine(mob/user)
..()
Expand All @@ -147,7 +148,7 @@ Parts of code courtesy of Super3222
var/faction_num
if (map.faction1 == H.faction_text) // Check which faction is using the designator
faction_num = 1
else if (map.faction1 == H.faction_text)
else if (map.faction2 == H.faction_text)
faction_num = 2

if (faction_num)
Expand Down Expand Up @@ -182,7 +183,7 @@ Parts of code courtesy of Super3222
var/faction_num
if (map.faction1 == H.faction_text) // Check which faction is using the designator
faction_num = 1
else if (map.faction1 == H.faction_text)
else if (map.faction2 == H.faction_text)
faction_num = 2

if (faction_num)
Expand All @@ -200,8 +201,10 @@ Parts of code courtesy of Super3222
switch (faction_num)
if (1)
faction1_aircraft_rearming = FALSE
faction1_airstrikes_remaining = faction1_airstrikes_max
if (2)
faction2_aircraft_rearming = FALSE
faction2_airstrikes_remaining = faction2_airstrikes_max
checking = TRUE
var/distcon = max(abs(H.x-target.x),abs(H.y-target.y))
var/gdir = get_dir(H, target)
Expand Down
Binary file modified icons/obj/cannon_ball.dmi
Binary file not shown.
Binary file modified icons/obj/grenade.dmi
Binary file not shown.

0 comments on commit ad9d9ca

Please sign in to comment.