Skip to content

Commit

Permalink
Finished transitions between levels. Added hive level (although unfin…
Browse files Browse the repository at this point in the history
…ished).
  • Loading branch information
Watermelon914 authored and Watermelon914 committed Apr 26, 2021
1 parent 277070b commit 101007d
Show file tree
Hide file tree
Showing 33 changed files with 13,961 additions and 426,037 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,8 @@

/// from /obj/structure/resource_node/set_tree(): (datum/techtree/tree)
#define COMSIG_RESOURCE_NODE_SET_TREE "resource_node_set_tree"

#define COMSIG_SHUTTLE_CAN_MOVE_TOPIC "shuttle_can_move_topic"
#define COMPONENT_SHUTTLE_PREVENT_MOVE (1<<0)

#define COMSIG_SHUTTLE_ON_DOCK "shuttle_on_dock"
2 changes: 2 additions & 0 deletions code/__DEFINES/maps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require only minor tweaks.
#define ZTRAIT_LOWORBIT "LowOrbit"
#define ZTRAIT_INTERIORS "Interiors"
#define ZTRAIT_TECHTREE "TechTree"
#define ZTRAIT_HIVE "Hive"

#define ZTRAIT_FOG "Fog"
#define ZTRAIT_LOCKDOWN "Lockdown"
Expand Down Expand Up @@ -68,6 +69,7 @@ require only minor tweaks.
#define ZTRAITS_LOWORBIT list(ZTRAIT_LOWORBIT = TRUE)
#define ZTRAITS_SPACE list(ZTRAIT_LINKAGE = CROSSLINKED, ZTRAIT_SPACE_RUINS = TRUE)
#define ZTRAITS_INTERIORS list(ZTRAIT_INTERIORS = TRUE)
#define ZTRAITS_HIVE list(ZTRAIT_HIVE = TRUE)

#define DL_NAME "name"
#define DL_TRAITS "traits"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#define SS_INIT_PLANT 21.5
#define SS_INIT_HUMANS 21
#define SS_INIT_MAP 20
#define SS_INIT_TICKER 19.9
#define SS_INIT_COMPONENT 19.5
#define SS_INIT_POWER 19
#define SS_INIT_OBJECT 18
Expand All @@ -82,7 +83,6 @@
#define SS_INIT_UNSPECIFIED 0
#define SS_INIT_EMERGENCY_SHUTTLE -19
#define SS_INIT_ASSETS -20
#define SS_INIT_TICKER -21
#define SS_INIT_VOTE -23
#define SS_INIT_FINISH -24
#define SS_INIT_MINIMAP -25
Expand Down
9 changes: 5 additions & 4 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ SUBSYSTEM_DEF(mapping)
INIT_ANNOUNCE("Loading [ground_map.map_name]...")
Loadground(FailedZs, ground_map.map_name, ground_map.map_path, ground_map.map_file, ground_map.traits, ZTRAITS_GROUND)

if(ground_map.include_ship_map)
var/datum/map_config/ship_map = configs[SHIP_MAP]
INIT_ANNOUNCE("Loading [ship_map.map_name]...")
Loadship(FailedZs, ship_map.map_name, ship_map.map_path, ship_map.map_file, ship_map.traits, ZTRAITS_MAIN_SHIP)
var/datum/map_config/ship_map = configs[SHIP_MAP]
if(ground_map.ship_map_override)
ship_map = ground_map.ship_map_override
INIT_ANNOUNCE("Loading [ship_map.map_name]...")
Loadship(FailedZs, ship_map.map_name, ship_map.map_path, ship_map.map_file, ship_map.traits, ZTRAITS_MAIN_SHIP)

if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen
var/msg = "RED ALERT! The following map files failed to load: [FailedZs[1]]"
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/music.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ SUBSYSTEM_DEF(music)

if(!C.queued_music || C.prefs?.music_volume == 0)
if(C.current_music)
var/sound/stop_music = sound(C.queued_music, FALSE)
var/sound/stop_music = sound(C.queued_music, FALSE, channel = SOUND_CHANNEL_MUSIC)
stop_music.status = SOUND_UPDATE
stop_music.repeat = FALSE
sound_to(C, stop_music)
C.current_music = null

GLOB.processing_music_clients -= C
continue

if(C.current_music && C.queued_music == C.current_music)
continue


var/sound/S = sound(C.queued_music, TRUE, FALSE, SOUND_CHANNEL_MUSIC, C.prefs.music_volume)
C.current_music = C.queued_music
S.status = SOUND_STREAM
Expand Down
16 changes: 13 additions & 3 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ SUBSYSTEM_DEF(ticker)

/datum/controller/subsystem/ticker/Initialize(timeofday)
load_mode()
mode = config.pick_mode(GLOB.master_mode)
var/list/FailedZs
mode.load_maps(FailedZs)

if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen
var/msg = "RED ALERT! The following map files failed to load: [FailedZs[1]]"
if(FailedZs.len > 1)
for(var/I in 2 to FailedZs.len)
msg += ", [FailedZs[I]]"
msg += ". Yell at your server host!"
to_chat(world, SPAN_WARNING(msg))
log_world(msg)

if(CONFIG_GET(flag/nightmare_enabled))
NM = new
Expand Down Expand Up @@ -170,8 +182,6 @@ SUBSYSTEM_DEF(ticker)
/datum/controller/subsystem/ticker/proc/setup()
to_chat(world, SPAN_BOLDNOTICE("Enjoy the game!"))
var/init_start = world.timeofday
//Create and announce mode
mode = config.pick_mode(GLOB.master_mode)

CHECK_TICK
if(!mode.can_start(bypass_checks))
Expand All @@ -183,7 +193,7 @@ SUBSYSTEM_DEF(ticker)
CHECK_TICK
if(!mode.pre_setup() && !bypass_checks)
QDEL_NULL(mode)
to_chat(world, "<b>Error in pre-setup for [GLOB.master_mode].</b> Reverting to pre-game lobby.")
to_chat(world, "<b>Error in pre-setup for [mode.name].</b> Reverting to pre-game lobby.")
RoleAuthority.reset_roles()
return FALSE

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ SUBSYSTEM_DEF(vote)
maps += i

choices.Add(maps)
if(length(choices) < 2)
if(length(choices) < 1)
return FALSE
SSentity_manager.filter_then(/datum/entity/map_vote, null, CALLBACK(src, .proc/carry_over_callback))

Expand Down
14 changes: 11 additions & 3 deletions code/datums/map_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

var/force_mode

var/include_ship_map = TRUE
var/datum/map_config/ship_map_override

var/list/monkey_types = list(/mob/living/carbon/human/monkey)

Expand Down Expand Up @@ -209,8 +209,16 @@
if(json["force_mode"])
force_mode = json["force_mode"]

if(json["no_ship_map"])
include_ship_map = !json["no_ship_map"]
temp = json["ship_map"]
if(temp)
for(var/i in config.maplist[SHIP_MAP])
var/datum/map_config/VM = config.maplist[SHIP_MAP][i]
if(VM.map_name == temp)
ship_map_override = VM
break

if(!ship_map_override)
log_world("map_config ship_map is set to an incorrect map! ([temp])")

if(json["announce_text"])
announce_text = replacetext(json["announce_text"], "###SHIPNAME###", MAIN_SHIP_NAME)
Expand Down
14 changes: 14 additions & 0 deletions code/game/area/BigRed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ GLOBAL_DATUM_INIT(rain_effect, /obj/effect/weather_vfx_holder/rain, new)
soundscape_interval = 30
soundscape_playlist = SCAPE_PL_THUNDER

/area/bigredv2/outside/unknown
name = "\improper Unknown Area"

/area/bigredv2/outside/ne
name = "\improper Northeast Colony Grounds"
icon_state = "northeast"
Expand Down Expand Up @@ -623,3 +626,14 @@ GLOBAL_DATUM_INIT(rain_effect, /obj/effect/weather_vfx_holder/rain, new)
name = "\improper LZ2 'Cargo'"
icon_state = "tcomsatcham"
requires_power = 0

/area/bigredv2/hive
name = "\improper Xenomorph Hive"
requires_power = FALSE
lighting_use_dynamic = FALSE
luminosity = TRUE
icon_state = "caves_north"
ceiling = CEILING_MAX
ceiling_muffle = FALSE
ambience_exterior = AMBIENCE_YAUTJA
soundscape_playlist = SCAPE_PL_ELEVATOR_MUSIC
95 changes: 69 additions & 26 deletions code/game/gamemodes/colonialmarines/colonialmarines_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,35 @@
SQUAD_NAME_1
)

var/outpost_name = "USCM Outpost Alpha"

var/spawn_flags = XENO_SPAWN_T1

var/list/objectives = list()
var/initial_objectives = 0

var/list/lootbox_amounts = list(
/obj/structure/closet/crate/loot/objects = 4,
/obj/structure/closet/crate/loot/weapons = 4
/obj/structure/closet/crate/loot/objects = 200,
/obj/structure/closet/crate/loot/weapons = 200
)

var/endgame_launch_time = 5 MINUTES
var/endgame_spawn_amount = 4
var/endgame_shuttle = "alamo"
var/endgame_spawn_amount = 3
var/endgame_remaining_spawns = 8
var/game_shuttle_id = "alamo"

var/endgame_map_path = "map_files/Hive"
var/endgame_map_file = "Hive.dmm"
var/list/endgame_map_traits = list()

var/game_started = FALSE

var/obj/docking_port/mobile/marine_dropship/game_shuttle
var/music_range = 12

/datum/game_mode/colonialmarines/ai/load_maps(var/list/FailedZs)
SSmapping.LoadGroup(FailedZs, "The Hive", endgame_map_path, endgame_map_file, endgame_map_traits, ZTRAITS_HIVE, TRUE)

/datum/game_mode/colonialmarines/ai/pre_setup()
game_shuttle = SSshuttle.getShuttle(game_shuttle_id)

RegisterSignal(SSdcs, COMSIG_GLOB_XENO_SPAWN, .proc/handle_xeno_spawn)
for(var/i in RoleAuthority.squads.Copy())
var/datum/squad/S = i
Expand Down Expand Up @@ -74,13 +85,13 @@
if(A.start_charge == initial(A.start_charge))
A.cell?.charge = 0

. = ..()
RegisterSignal(game_shuttle, COMSIG_SHUTTLE_CAN_MOVE_TOPIC, .proc/shuttle_launch_handler)
RegisterSignal(game_shuttle, COMSIG_SHUTTLE_ON_DOCK, .proc/handle_dock)
for(var/i in GLOB.shuttle_controls_list)
var/obj/structure/machinery/computer/shuttle/S = i
S.possible_destinations = "lz1;lz2"

/datum/game_mode/colonialmarines/ai/map_announcement()
if(SSmapping.configs[GROUND_MAP].announce_text)
var/announce_text = SSmapping.configs[GROUND_MAP].announce_text
announce_text = replacetext(announce_text, "####OUTPOSTNAME####", outpost_name)
marine_announcement(SSmapping.configs[GROUND_MAP].announce_text, outpost_name)
. = ..()

/datum/game_mode/colonialmarines/ai/announce_bioscans()
return
Expand All @@ -102,24 +113,47 @@
spawn_flags |= XENO_SPAWN_T3

if(!length(objectives))
enter_endgame()
INVOKE_ASYNC(src, .proc/enter_endgame)

/datum/game_mode/colonialmarines/ai/proc/enter_endgame()
marine_announcement("Dropship landing shortly arriving to LZ2. You have [DisplayTimeText(endgame_launch_time)] to board before it launches. You may launch earlier. The xeno horde has been unleashed.", "Marine Broadcast", 'sound/misc/queen_alarm.ogg')
marine_announcement("Massive biosignatures detected. Xenomorph hive located. Please board the dropship and launch as soon as possible. Autopilot co-ordinates set for Xenomorph Hive", "Outpost Alpha AI", 'sound/misc/queen_alarm.ogg')
for(var/i in GLOB.xeno_ai_spawns)
var/obj/effect/landmark/xeno_ai/XA = i
XA.remaining_spawns = 500
XA.remaining_spawns = endgame_remaining_spawns

CONFIG_SET(number/ai_director/max_xeno_per_player, endgame_spawn_amount)
var/obj/docking_port/mobile/marine_dropship/ship = SSshuttle.getShuttle(endgame_shuttle)
addtimer(CALLBACK(src, .proc/launch_and_end, ship), endgame_launch_time)

/datum/game_mode/colonialmarines/ai/proc/launch_and_end(var/obj/docking_port/mobile/marine_dropship/ship)
if(QDELETED(ship))
return
for(var/i in GLOB.shuttle_controls_list)
var/obj/structure/machinery/computer/shuttle/S = i
S.possible_destinations = "hive"

/datum/game_mode/colonialmarines/ai/proc/shuttle_launch_handler(var/obj/docking_port/mobile/marine_dropship/DS, var/mob/user)
SIGNAL_HANDLER
if(is_mainship_level(DS.z))
for(var/i in GLOB.alive_client_human_list)
var/mob/M = i
if(is_ground_level(M.z))
continue

if(!istype(get_area(M), /area/shuttle))
to_chat(user, SPAN_WARNING("You must wait for everyone else to be on the dropship!"))
return COMPONENT_SHUTTLE_PREVENT_MOVE

/datum/game_mode/colonialmarines/ai/proc/handle_dock(var/obj/docking_port/mobile/marine_dropship/DS, var/obj/docking_port/stationary/current_dock)
SIGNAL_HANDLER
if(!game_started)
for(var/i in GLOB.human_mob_list)
var/mob/M = i
if(M.z == DS.z)
continue

if(!M.client)
qdel(M)
continue
M.forceMove(get_turf(DS))
flags_round_type |= MODE_NO_LATEJOIN
game_started = TRUE

ship.jumpToNullSpace()
round_finished = MODE_PVE_WIN

/datum/game_mode/colonialmarines/ai/end_round_message()
switch(round_finished)
Expand Down Expand Up @@ -167,8 +201,11 @@ GLOBAL_LIST_INIT(t3_ais, list(
if(X.health > 0)
for(var/h in GLOB.clients)
var/client/C = h
if(get_dist(X, C.mob) <= music_range)
targetted_players[h] += X.tier
if(get_dist(X, C.mob) <= music_range && X.z == C.mob.z)
if(X.current_target || X.current_path)
targetted_players[h] += X.tier
else
targetted_players[h] = max(targetted_players[h], 1)

for(var/i in targetted_players)
var/client/C = i
Expand All @@ -179,7 +216,9 @@ GLOBAL_LIST_INIT(t3_ais, list(

var/new_threat = targetted_players[C]
if(!new_threat)
new_threat = 0
C.set_queued_music(null)
continue

SET_THREAT(C, new_threat)

var/list/xenos_to_spawn = list()
Expand Down Expand Up @@ -210,6 +249,10 @@ GLOBAL_LIST_INIT(t3_ais, list(
continue

for(var/h in GLOB.alive_client_human_list)
var/mob/M = h
if(M.z != XA.z)
continue

var/distance = get_dist(h, XA)
if(distance < MIN_RANGE_TO_SPAWN_XENO)
within_range = 0
Expand Down
2 changes: 2 additions & 0 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ var/global/cas_tracking_id_increment = 0 //this var used to assign unique tracki
to_chat_spaced(world, margin_top = 2, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDHEADER("|Round Complete|"))
to_chat_spaced(world, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDBODY("Thus ends the story of the brave men and women of the [MAIN_SHIP_NAME] and their struggle on [SSmapping.configs[GROUND_MAP].map_name].\nThe game-mode was: [master_mode]!\nEnd of Round Grief (EORG) is an IMMEDIATE 3 hour ban with no warnings, see rule #3 for more details."))

/datum/game_mode/proc/load_maps(var/list/FailedZs)

/datum/game_mode/proc/declare_completion()
if(round_statistics)
round_statistics.track_round_end()
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/doors/shutters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
return

/obj/structure/machinery/door/poddoor/shutters/open()
set waitfor = FALSE
if(operating == 1) //doors can still open when emag-disabled
return
if(!operating) //in case of emag
Expand All @@ -50,6 +51,7 @@
return 1

/obj/structure/machinery/door/poddoor/shutters/close()
set waitfor = FALSE
if(operating)
return
operating = 1
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/topic/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@
if(!check_rights(R_ADMIN|R_SERVER)) return

GLOB.master_mode = href_list["c_mode2"]
message_staff("[key_name_admin(usr)] set the mode as [GLOB.master_mode].")
to_world(SPAN_NOTICE("<b><i>The mode is now: [GLOB.master_mode]!</i></b>"))
message_staff("[key_name_admin(usr)] set the mode as [GLOB.master_mode] for next round.")
to_world(SPAN_NOTICE("<b><i>Mode set to [GLOB.master_mode] for next round!</i></b>"))
Game() // updates the main game menu
SSticker.save_mode(GLOB.master_mode)
.(href, list("c_mode"=1))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/get_status_tab_items()
. = ..()
. += ""
. += "Game Mode: [GLOB.master_mode]"
. += "Game Mode: [SSticker.mode?.name]"

if(SSticker.HasRoundStarted())
return
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@
var/smallest_distance = INFINITY
for(var/l in GLOB.alive_client_human_list)
var/mob/living/carbon/human/H = l
if(z != H.z)
continue
var/distance = get_dist(src, H)
if(distance < smallest_distance)
smallest_distance = distance
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
/mob/new_player/get_status_tab_items()
. = ..()
. += ""
. += "Game Mode: [GLOB.master_mode]"
. += "Game Mode: [SSticker.mode?.name]"

if(SSticker.HasRoundStarted())
return
Expand Down
Loading

0 comments on commit 101007d

Please sign in to comment.