Skip to content

Commit

Permalink
Merge pull request Civ13#2670 from Bierkraan/working-branch
Browse files Browse the repository at this point in the history
Update battleships and (modern) battle royale
  • Loading branch information
Bierkraan authored Apr 3, 2024
2 parents 88d095c + b90333c commit 456459e
Show file tree
Hide file tree
Showing 35 changed files with 624 additions and 476 deletions.
2 changes: 1 addition & 1 deletion civ13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1112,5 +1112,5 @@
#include "code\processes\lighting\sources.dm"
#include "interface\interface.dm"
#include "interface\skin.dmf"
#include "maps\1943\smallingrad.dmm"
#include "maps\special\battle_ships.dmm"
// END_INCLUDE
2 changes: 2 additions & 0 deletions code/datums/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ var/global/list/round_voters = list() //Keeps track of the individuals voting fo
for (var/cur_option in options)
if (clients.len < options[cur_option])
disabled[cur_option] = "[options[cur_option]] players needed"
if (cur_option == "Small Ships" && (clients.len > 20))
disabled[cur_option] = "20 players maximum"

else
return FALSE
Expand Down
8 changes: 8 additions & 0 deletions code/game/mob/living/carbon/human/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@
if (map.ID == MAP_CAMPAIGN)
client.next_normal_respawn = world.realtime + 1800 + (client.respawn_count * 600)
client.respawn_count++
else if (map.ID == MAP_BATTLE_SHIPS)
var/obj/map_metadata/battle_ships/BS = map
if (faction_text == map.faction1)
client.next_normal_respawn = world.realtime + (BS.faction1_engines_killed ? map.respawn_delay : (map.respawn_delay + (map.respawn_delay * 3)))
else if (faction_text == map.faction2)
client.next_normal_respawn = world.realtime + (BS.faction2_engines_killed ? map.respawn_delay : (map.respawn_delay + (map.respawn_delay * 3)))
else
client.next_normal_respawn = world.realtime + (map ? map.respawn_delay : 3000)
else
client.next_normal_respawn = world.realtime + (map ? map.respawn_delay : 3000)
client << RESPAWN_MESSAGE
Expand Down
18 changes: 1 addition & 17 deletions code/game/objects/covers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,7 @@
T.move_delay = 0
return TRUE


/obj/covers/Destroy()
if (map.ID == MAP_BATTLE_SHIPS)
if(istype(get_turf(src), /turf/floor/beach/water))
var/turf/T1 = get_step(get_turf(src), pick(NORTH,NORTHWEST))
if(T1)
new/obj/effect/flooding(T1)
var/turf/T2 = get_step(get_turf(src), pick(EAST,NORTHEAST))
if(T2)
new/obj/effect/flooding(T2)
var/turf/T3 = get_step(get_turf(src), pick(WEST,SOUTHWEST))
if(T3)
new/obj/effect/flooding(T3)
var/turf/T4 = get_step(get_turf(src), pick(SOUTH,SOUTHEAST))
if(T4)
new/obj/effect/flooding(T4)

/obj/covers/Destroy()
var/area/caribbean/CURRENTAREA = get_area(src)
if (!istype(CURRENTAREA, /area/caribbean/void/caves))
if (wall && !incomplete)
Expand Down
15 changes: 0 additions & 15 deletions code/game/objects/covers_types/cover_floortypes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,6 @@
visible_message("<span class='danger'>\The [src] is broken into pieces!</span>")
Destroy()

/obj/covers/repairedfloor/ship/Destroy()
if(istype(src.loc, /turf/floor/beach/water) && map.ID == MAP_BATTLE_SHIPS)
var/turf/T1 = get_step(src.loc,pick(NORTH,NORTHWEST))
if(T1)
new/obj/effect/flooding(T1)
var/turf/T2 = get_step(src.loc,pick(EAST,NORTHEAST))
if(T2)
new/obj/effect/flooding(T2)
var/turf/T3 = get_step(src.loc,pick(WEST,SOUTHWEST))
if(T3)
new/obj/effect/flooding(T3)
var/turf/T4 = get_step(src.loc,pick(SOUTH,SOUTHEAST))
if(T4)
new/obj/effect/flooding(T4)
..()
/obj/covers/repairedfloor/ship/south
icon = 'icons/obj/vehicles/vehicleparts_boats.dmi'
icon_state = "boat_floor_south1"
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,10 @@
var/spread_range = 7

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

/obj/structure/payload/proc/drop()
density = FALSE
Expand Down Expand Up @@ -1131,7 +1131,7 @@
/obj/structure/payload/bomb/kg50
name = "50 kg bomb"

scale = 0.6
scale = 0.7
devastation_range = 2
heavy_impact_range = 3
light_impact_range = 5
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/map_metadata/2Fort.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
ambience = list('sound/ambience/jungle1.ogg')
gamemode = "King of the Hill"
grace_wall_timer = 3600
obj/map_metadata/camp/job_enabled_specialcheck(var/datum/job/J)
/obj/map_metadata/camp/job_enabled_specialcheck(var/datum/job/J)
..()
if (J.is_medieval == TRUE)
if (J.is_medieval && !J.is_deathmatch)
. = TRUE
else
. = FALSE
Expand Down
96 changes: 52 additions & 44 deletions code/game/objects/map_metadata/battle_ships.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
var/ship_faction1 = null
var/ship_faction2 = null
var/island = null
var/faction1_engine_amount = 6
var/faction2_engine_amount = 6

var/faction1_engines_killed = FALSE
var/faction1_initial_engine_amount = null
var/faction1_engine_amount = null

var/faction2_engines_killed = FALSE
var/faction2_initial_engine_amount = null
var/faction2_engine_amount = null

var/roundend_msg = "The round has ended in a stalemate!"
var/no_spam = FALSE

Expand Down Expand Up @@ -59,73 +66,70 @@
var/amount_of_turfs = 0
for (var/turf/T in get_area_turfs(/area/caribbean/faction1/ship/lower))
amount_of_turfs++
amount_of_turfs = Floor(amount_of_turfs * 0.6)
return amount_of_turfs

/obj/map_metadata/battle_ships/proc/get_sink_faction1()
var/t_level = 0
for (var/obj/effect/flooding/F in get_area_all_atoms(/area/caribbean/faction1/ship/lower))
t_level += F.flood_level*2
for (var/turf/T in get_area_all_atoms(/area/caribbean/faction1/ship/lower))
var/found_cover = FALSE
for (var/obj/covers/C in T)
found_cover = TRUE
if (!found_cover)
t_level += 5
if (((faction1_engine_amount / faction1_initial_engine_amount) * 100) < 25)
t_level += 50
return t_level

/obj/map_metadata/battle_ships/proc/pump_faction1()
check_engines_faction1()
if (faction1_engine_amount > 0)
for(var/obj/effect/flooding/F in get_area_all_atoms(/area/caribbean/faction1/ship/lower))
F.flood_level--
if (F.flood_level <= 0)
qdel(F)
else
var/sound/uploaded_sound = sound('sound/machines/atomic_turbine_exterior_ending.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/M in get_area_turfs(/area/caribbean/faction1/ship))
M << SPAN_DANGER("<font size=4>The ship grumbles as the water pumps shut down.</font>")
if (M.client)
M.client << uploaded_sound

/obj/map_metadata/battle_ships/proc/check_engines_faction1()
var/amount_of_engines = 0
for (var/obj/structure/engine/E in get_area_all_atoms(/area/caribbean/faction1/ship/lower/engine))
amount_of_engines++
faction1_engine_amount = amount_of_engines


if (!faction1_engines_killed)
if (faction1_engine_amount <= 0)
faction1_engines_killed = TRUE
var/sound/uploaded_sound = sound('sound/machines/atomic_turbine_exterior_ending.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/living/human/M in get_area_all_atoms(/area/caribbean/faction1/ship))
to_chat(M, SPAN_DANGER("<font size=4>The ship grumbles as the last engine shut down.</font><br><font size=5>RESPAWNS ARE NOW DELAYED</font>"))
if (M.client)
M.client << uploaded_sound

////////////////////////// Faction 2 procs //////////////////////////
/obj/map_metadata/battle_ships/proc/get_sinkable_amount_faction2()
var/amount_of_turfs = 0
for (var/turf/T in get_area_turfs(/area/caribbean/faction2/ship/lower))
amount_of_turfs++
amount_of_turfs = Floor(amount_of_turfs * 0.6)
return amount_of_turfs

/obj/map_metadata/battle_ships/proc/get_sink_faction2()
var/t_level = 0
for (var/obj/effect/flooding/F in get_area_all_atoms(/area/caribbean/faction2/ship/lower))
t_level += F.flood_level*2
for (var/turf/T in get_area_all_atoms(/area/caribbean/faction2/ship/lower))
var/found_cover = FALSE
for (var/obj/covers/C in T)
found_cover = TRUE
if (!found_cover)
t_level += 5
if (((faction2_engine_amount / faction2_initial_engine_amount) * 100) < 25)
t_level += 50
return t_level

/obj/map_metadata/battle_ships/proc/pump_faction2()
check_engines_faction2()
if (faction2_engine_amount > 0)
for (var/obj/effect/flooding/F in get_area_all_atoms(/area/caribbean/faction2/ship/lower))
F.flood_level--
if (F.flood_level <= 0)
qdel(F)
else
var/sound/uploaded_sound = sound('sound/machines/atomic_turbine_exterior_ending.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/M in get_area_turfs(/area/caribbean/faction2/ship))
M << SPAN_DANGER("<font size=4>The ship grumbles as the water pumps shut down.</font>")
if (M.client)
M.client << uploaded_sound

/obj/map_metadata/battle_ships/proc/check_engines_faction2()
var/amount_of_engines = 0
for(var/obj/structure/engine/E in get_area_all_atoms(/area/caribbean/faction2/ship/lower/engine))
amount_of_engines++
faction2_engine_amount = amount_of_engines


if (!faction2_engines_killed)
if (faction2_engine_amount <= 0)
faction2_engines_killed = TRUE
var/sound/uploaded_sound = sound('sound/machines/atomic_turbine_exterior_ending.ogg', repeat = FALSE, wait = TRUE, channel = 777)
uploaded_sound.priority = 250
for (var/mob/living/human/M in get_area_all_atoms(/area/caribbean/faction2/ship))
to_chat(M, SPAN_DANGER("<font size=4>The ship grumbles as the last engine shut down.<br><font size=5>RESPAWNS ARE NOW DELAYED</font>"))
if (M.client)
M.client << uploaded_sound

////////////////////////// Round control //////////////////////////
/obj/map_metadata/battle_ships/proc/check_roundend_conditions()
Expand Down Expand Up @@ -161,12 +165,12 @@

/obj/map_metadata/battle_ships/proc/announce_sink_status()
spawn(600) // 1 minute
check_engines_faction1()
var/ship_status_faction1 = "The <b><font color='red'>Redmenian</font> [ship_faction1]</b> has been flooded for <b>[get_sink_faction1() / get_sinkable_amount_faction1() * 100]/100%</b>"
if (faction1_engine_amount > 0)
pump_faction1()

check_engines_faction2()
var/ship_status_faction2 = "The <b><font color='blue'>Blugoslavian</font> [ship_faction2]</b> has been flooded for <b>[get_sink_faction2() / get_sinkable_amount_faction2() * 100]/100%</b>"
if (faction2_engine_amount > 0)
pump_faction2()

to_chat(world, "<font size=4>[ship_status_faction1]</font>")
to_chat(world, "<font size=4>[ship_status_faction2]</font>")
announce_sink_status()
Expand Down Expand Up @@ -202,11 +206,15 @@

switch (location)
if ("south")
check_engines_faction1()
faction1_initial_engine_amount = faction1_engine_amount
ship_faction1 = capitalize(replacetext(mapname, "_", " "))
to_chat(world, "<font size=4 color='red'>The Redmenian ship in this battle is the <b>[ship_faction1]</b>.</font>")
if ("middle")
island = mapname
if ("north")
check_engines_faction2()
faction2_initial_engine_amount = faction2_engine_amount
ship_faction2 = capitalize(replacetext(mapname, "_", " "))
to_chat(world, "<font size=4 color='blue'>The Blugoslavian ship in this battle is the <b>[ship_faction2]</b>.</font>")

Expand Down
Loading

0 comments on commit 456459e

Please sign in to comment.