Skip to content

Commit

Permalink
Merge pull request Civ13#2634 from Bierkraan/working-branch
Browse files Browse the repository at this point in the history
Improved re-arming of airstrikes
  • Loading branch information
Bierkraan authored Mar 20, 2024
2 parents ad9d9ca + 34345c2 commit 2f62c6d
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 116 deletions.
8 changes: 4 additions & 4 deletions code/_helpers/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ 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
var/global/faction1_airstrikes_max = list(10, 4, 1) // Airstrikes size: light , medium, large
var/global/faction2_airstrikes_max = list(10, 4, 1) // Airstrikes size: light , medium, large
var/global/faction1_airstrikes_remaining = list(10, 4, 1)
var/global/faction2_airstrikes_remaining = list(10, 4, 1)

// for mass deletion
var/global/list/bullet_casings = list()
Expand Down
8 changes: 7 additions & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@
return
else
var/obj/item/weapon/attachment/scope/adjustable/binoculars/laser_designator/P = H.get_active_hand()
P.rangecheck(H,A)
if (P.needs_instruments)
if (istype(H.get_inactive_hand(), /obj/item/weapon/compass))
P.rangecheck(H,A)
else
to_chat(H, SPAN_DANGER("You need to have a compass in your other hand to this!"))
else
P.rangecheck(H,A)
else
to_chat(H, SPAN_DANGER("You need to have a radio to use this!"))
return
Expand Down
19 changes: 19 additions & 0 deletions code/game/objects/effects/effect_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,25 @@ steam.start() -- spawns the effect
if (!new_player_mob_list.Find(M))
M.client << uploaded_sound

/obj/effect/plane_flyby/il2/New()
..()
spawn(10)
var/sound/uploaded_sound = sound('sound/effects/aircraft/il2.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/M in player_list)
if (!new_player_mob_list.Find(M))
M << SPAN_NOTICE("<font size=3>The air vibrates as a IL-2 flies overhead.</font>")
M.client << uploaded_sound

/obj/effect/plane_flyby/il2_no_message/New()
..()
spawn(10)
var/sound/uploaded_sound = sound('sound/effects/aircraft/il2.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/M in player_list)
if (!new_player_mob_list.Find(M))
M.client << uploaded_sound

/obj/effect/plane_flyby/p47/New()
..()
spawn(10)
Expand Down
47 changes: 40 additions & 7 deletions code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1055,21 +1055,27 @@
qdel(src)

/obj/structure/bomb
name = "50 kg bomb"
name = "100 kg bomb"
desc = "Uhm..."
icon = 'icons/obj/grenade.dmi'
icon_state = "aircraft_bomb"
anchored = TRUE
density = TRUE
opacity = FALSE
var/scale = 1
var/timer = 1 SECOND

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

/obj/structure/bomb/New()
var/matrix/M = matrix()
M.Scale(scale, scale)
src.transform = M

/obj/structure/bomb/proc/drop()
density = FALSE
spawn(15)
Expand All @@ -1085,7 +1091,7 @@
spawn(timer)
if (prob(99))
var/turf/T = get_turf(src)
explosion(T, 2, 3, 5, 4)
explosion(T, 2, 4, 7, 8)
if (!ismob(loc))
var/list/target_turfs = getcircle(T, spread_range)
var/fragments_per_projectile = round(num_fragments/target_turfs.len)
Expand All @@ -1105,17 +1111,44 @@
explode()
return

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

scale = 0.6
num_fragments = 30
fragment_damage = 20

/obj/structure/bomb/kg50/explode()
spawn(timer)
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/kg250
name = "250 kg bomb"

num_fragments = 50
fragment_damage = 30

/obj/structure/bomb/kg150/explode()
/obj/structure/bomb/kg250/explode()
spawn(timer)
if (prob(99))
var/turf/T = get_turf(src)
explosion(T, 3, 5, 8, 5)
explosion(T, 3, 5, 8, 10)
if (!ismob(loc))
var/list/target_turfs = getcircle(T, spread_range)
var/fragments_per_projectile = round(num_fragments/target_turfs.len)
Expand Down
120 changes: 80 additions & 40 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -476,54 +476,41 @@ var/const/enterloopsanity = 100
/turf/proc/can_build_cable(var/mob/user)
return FALSE

/turf/proc/try_airstrike(var/ckey, var/faction_text, var/direction = "NORTH", var/payload = "Rockets")
/turf/proc/try_airstrike(var/ckey, var/faction_text, var/aircraft_name, var/direction = "NORTH", var/payload = "Rockets", var/payload_class = 1)
var/turf/T = src

message_admins("[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 towards</a>)", ckey)
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/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)
if (aircraft_name) switch(aircraft_name) // Check what faction has called in the airstrike and select an aircraft.
if ("F-16")
new /obj/effect/plane_flyby/f16_no_message(T)
aircraft_name = "F-16"
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"
dive_text = "dives down"
drop_delay = 18 SECONDS
if (AMERICAN)
new /obj/effect/plane_flyby/f16_no_message(T)
aircraft_name = "F-16"
if ("Su-25")
new /obj/effect/plane_flyby/su25_no_message(T)
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 = 1 SECONDS
if ("Ju 87 Stuka")
new /obj/effect/plane_flyby/ju87_no_message(T)
dive_text = "dives down"
drop_delay = 18 SECONDS
if ("IL-2")
new /obj/effect/plane_flyby/il2_no_message(T)
dive_text = "dives down"
drop_delay = 5 SECONDS

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

switch (faction_num)
if (1)
faction1_airstrikes_remaining--
faction1_airstrikes_remaining[payload_class]--
if (2)
faction2_airstrikes_remaining--
faction2_airstrikes_remaining[payload_class]--

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

Expand Down Expand Up @@ -553,7 +540,7 @@ var/const/enterloopsanity = 100
if (M.client)
M.client << uploaded_sound

switch (faction_num)
switch (faction_num) // Send the jet to re-arm, it is unavailible for 5 minutes
if (1)
faction1_aircraft_rearming = TRUE
faction1_aircraft_cooldown = world.time + 5 MINUTES
Expand Down Expand Up @@ -613,7 +600,7 @@ var/const/enterloopsanity = 100

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
M.pixel_x = -12*32 // 12 tiles and 32 pixels per tile
animate(M, transform = turn(matrix(), 20), time = 10, easing = LINEAR_EASING)
if ("SOUTH")
direction_yoffset -= 3
Expand All @@ -629,7 +616,7 @@ var/const/enterloopsanity = 100

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
M.pixel_x = 12*32 // 12 tiles and 32 pixels per tile
animate(M, transform = turn(matrix(), -20), time = 10, easing = LINEAR_EASING)
spawn(i*5)
M.loc = locate((T.x + xoffset + direction_xoffset), (T.y + yoffset + direction_yoffset), T.z)
Expand All @@ -638,32 +625,85 @@ var/const/enterloopsanity = 100
M.drop()

return
if ("50kg Bomb")
if ("50 kg 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(null)
var/obj/structure/bomb/B = new /obj/structure/bomb/kg50(null)
switch (direction)
if ("NORTH")
xoffset = rand(-2,2)
yoffset = rand(-1,3)

B.dir = NORTH
B.pixel_y = -12*32 // 8 tiles and 32 pixels per tile
B.pixel_y = -12*32 // 12 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), -45), time = 10)
if ("EAST")
xoffset = rand(-1,3)
yoffset = rand(-2,2)

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
B.pixel_x = -12*32 // 12 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), 45), time = 10)
if ("SOUTH")
xoffset = rand(-2,2)
yoffset = rand(-3,1)

B.dir = SOUTH
B.pixel_y = 12*32 // 8 tiles and 32 pixels per tile
B.pixel_y = 12*32 // 12 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), 45), time = 10)
if ("WEST")
xoffset = rand(-3,1)
yoffset = rand(-2,2)

B.dir = WEST
B.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
B.pixel_x = 12*32 // 12 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
if ("250 kg Bomb")
strikenum = 1

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

B.dir = NORTH
B.pixel_y = -12*32 // 12 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), -45), time = 10)
if ("EAST")
xoffset = rand(-1,3)
yoffset = rand(-2,2)

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

B.dir = SOUTH
B.pixel_y = 12*32 // 12 tiles and 32 pixels per tile
animate(B, transform = turn(matrix(), 45), time = 10)
if ("WEST")
xoffset = rand(-3,1)
yoffset = rand(-2,2)

B.dir = WEST
B.pixel_y = 8*32 // 8 tiles and 32 pixels per tile
B.pixel_x = 12*32 // 8 tiles and 32 pixels per tile
B.pixel_x = 12*32 // 12 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)
Expand Down
Loading

0 comments on commit 2f62c6d

Please sign in to comment.