Skip to content
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

Secret Gateways: Config loaded Away Missions + Anti-observing Z level traits #61719

Merged
merged 5 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/__DEFINES/maps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ require only minor tweaks.
#define ZTRAIT_ASHSTORM "Weather_Ashstorm"
#define ZTRAIT_VOIDSTORM "Weather_Voidstorm"

// boolean - does this z prevent ghosts from observing it
Fikou marked this conversation as resolved.
Show resolved Hide resolved
#define ZTRAIT_SECRET "Secret"

// number - bombcap is multiplied by this before being applied to bombs
#define ZTRAIT_BOMBCAP_MULTIPLIER "Bombcap Multiplier"

Expand Down Expand Up @@ -76,6 +79,8 @@ require only minor tweaks.
ZTRAIT_LAVA_RUINS = TRUE, \
ZTRAIT_BOMBCAP_MULTIPLIER = 2, \
ZTRAIT_BASETURF = /turf/open/lava/smooth/lava_land_surface)
#define ZTRAITS_AWAY list(ZTRAIT_AWAY = TRUE)
#define ZTRAITS_AWAY_SECRET list(ZTRAIT_AWAY = TRUE, ZTRAIT_SECRET = TRUE)

#define DL_NAME "name"
#define DL_TRAITS "traits"
Expand Down
5 changes: 5 additions & 0 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@
integer = FALSE
min_val = 0

/datum/config_entry/number/config_gateway_chance
integer = FALSE
min_val = 0
max_val = 100

/datum/config_entry/flag/ghost_interaction

/datum/config_entry/flag/near_death_experience //If carbons can hear ghosts when unconscious and very close to death
Expand Down
12 changes: 7 additions & 5 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SUBSYSTEM_DEF(mapping)

// Pick a random away mission.
if(CONFIG_GET(flag/roundstart_away))
createRandomZlevel()
createRandomZlevel(prob(CONFIG_GET(number/config_gateway_chance)))

// Load the virtual reality hub
if(CONFIG_GET(flag/virtual_reality))
Expand Down Expand Up @@ -480,8 +480,10 @@ GLOBAL_LIST_EMPTY(the_station_areas)
var/list/possible_options = GLOB.potentialRandomZlevels + "Custom"
var/away_name
var/datum/space_level/away_level

var/answer = input("What kind ? ","Away") as null|anything in possible_options
var/secret = FALSE
if(tgui_alert(usr, "Do you want your mission secret? (This will prevent ghosts from looking at your map in any way other than through a living player's eyes.)", "Are you $$$ekret?", list("Yes", "No")) == "Yes")
secret = TRUE
var/answer = input("What kind?","Away") as null|anything in possible_options
switch(answer)
if("Custom")
var/mapfile = input("Pick file:", "File") as null|file
Expand All @@ -490,13 +492,13 @@ GLOBAL_LIST_EMPTY(the_station_areas)
away_name = "[mapfile] custom"
to_chat(usr,span_notice("Loading [away_name]..."))
var/datum/map_template/template = new(mapfile, "Away Mission")
away_level = template.load_new_z()
away_level = template.load_new_z(secret)
else
if(answer in GLOB.potentialRandomZlevels)
away_name = answer
to_chat(usr,span_notice("Loading [away_name]..."))
var/datum/map_template/template = new(away_name, "Away Mission")
away_level = template.load_new_z()
away_level = template.load_new_z(secret)
else
return

Expand Down
3 changes: 3 additions & 0 deletions code/game/area/areas/away_content.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Unused icons for new areas are "awaycontent1" ~ "awaycontent30"
has_gravity = STANDARD_GRAVITY
ambience_index = AMBIENCE_AWAY
sound_environment = SOUND_ENVIRONMENT_ROOM
area_flags = UNIQUE_AREA|NO_ALERTS

/area/awaymission/beach
name = "Beach"
Expand All @@ -26,3 +27,5 @@ Unused icons for new areas are "awaycontent1" ~ "awaycontent30"

has_gravity = STANDARD_GRAVITY

/area/awaymission/secret
area_flags = UNIQUE_AREA|NOTELEPORT|HIDDEN_AREA|NO_ALERTS
2 changes: 1 addition & 1 deletion code/game/objects/effects/phased_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
if(newloc.flags_1 & NOJAUNT)
to_chat(user, span_warning("Some strange aura is blocking the way."))
return
if(destination_area.area_flags & NOTELEPORT)
if(destination_area.area_flags & NOTELEPORT || SSmapping.level_trait(newloc.z, ZTRAIT_SECRET))
to_chat(user, span_danger("Some dull, universal force is blocking the way. It's overwhelmingly oppressive force feels dangerous."))
return
return newloc
Expand Down
27 changes: 21 additions & 6 deletions code/modules/awaymissions/zlevel.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// How much "space" we give the edge of the map
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.config.directory]/awaymissionconfig.txt"))
GLOBAL_LIST_INIT(potentialConfigRandomZlevels, generateConfigMapList(directory = "[global.config.directory]/away_missions/"))

/proc/createRandomZlevel()
if(GLOB.potentialRandomZlevels && GLOB.potentialRandomZlevels.len)
to_chat(world, span_boldannounce("Loading away mission..."))
var/map = pick(GLOB.potentialRandomZlevels)
load_new_z_level(map, "Away Mission")
to_chat(world, span_boldannounce("Away mission loaded."))
/proc/createRandomZlevel(config_gateway = FALSE)
var/map
if(config_gateway && GLOB.potentialConfigRandomZlevels?.len)
map = pick(GLOB.potentialConfigRandomZlevels)
else if(GLOB.potentialRandomZlevels?.len)
map = pick(GLOB.potentialRandomZlevels)
else
return
to_chat(world, span_boldannounce("Loading away mission..."))
load_new_z_level(map, "Away Mission", config_gateway)
to_chat(world, span_boldannounce("Away mission loaded."))

/obj/effect/landmark/awaystart
name = "away mission spawn"
Expand Down Expand Up @@ -60,3 +66,12 @@ GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.con
continue

. += t

/proc/generateConfigMapList(directory)
var/list/config_maps = list()
var/list/maps = flist(directory)
for(var/map_file in maps)
if(findtext(map_file, ".md"))
Fikou marked this conversation as resolved.
Show resolved Hide resolved
continue
config_maps += (directory + map_file)
return config_maps
8 changes: 4 additions & 4 deletions code/modules/mapping/map_template.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@
affected_turf.air_update_turf(TRUE, TRUE)
affected_turf.levelupdate()

/datum/map_template/proc/load_new_z()
/datum/map_template/proc/load_new_z(secret = FALSE)
var/x = round((world.maxx - width) * 0.5) + 1
var/y = round((world.maxy - height) * 0.5) + 1

var/datum/space_level/level = SSmapping.add_new_zlevel(name, list(ZTRAIT_AWAY = TRUE))
var/datum/space_level/level = SSmapping.add_new_zlevel(name, secret ? ZTRAITS_AWAY_SECRET : ZTRAITS_AWAY)
var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=should_place_on_top)
var/list/bounds = parsed.bounds
if(!bounds)
Expand Down Expand Up @@ -181,6 +181,6 @@

//for your ever biggening badminnery kevinz000
//❤ - Cyberboss
/proc/load_new_z_level(file, name)
/proc/load_new_z_level(file, name, secret)
var/datum/map_template/template = new(file, name)
template.load_new_z()
template.load_new_z(secret)
2 changes: 2 additions & 0 deletions code/modules/mob/dead/observer/logout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
target.observers -= src
UNSETEMPTY(target.observers)
observetarget = null
client?.perspective = initial(client.perspective)
sight = initial(sight)
..()
spawn(0)
if(src && !key) //we've transferred to another mob. This ghost should be deleted.
Expand Down
17 changes: 16 additions & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)

update_appearance()

if(!T)
if(!T || SSmapping.level_trait(T.z, ZTRAIT_SECRET))
var/list/turfs = get_area_turfs(/area/shuttle/arrival)
if(turfs.len)
T = pick(turfs)
Expand Down Expand Up @@ -365,6 +365,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!can_reenter_corpse)
to_chat(src, span_warning("You cannot re-enter your body."))
return
if(SSmapping.level_trait(mind.current.z, ZTRAIT_SECRET) && !client.holder)
Fikou marked this conversation as resolved.
Show resolved Hide resolved
to_chat(src, span_warning("Mystical energies are making your body resist you."))
return
if(mind.current.key && mind.current.key[1] != "@") //makes sure we don't accidentally kick any clients
to_chat(usr, span_warning("Another consciousness is in your body...It is resisting you."))
return
Expand Down Expand Up @@ -848,6 +851,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(ismob(client.eye) && (client.eye != src))
var/mob/target = client.eye
observetarget = null
client.perspective = initial(client.perspective)
sight = initial(sight)
if(target.observers)
target.observers -= src
UNSETEMPTY(target.observers)
Expand Down Expand Up @@ -890,13 +895,23 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
//Istype so we filter out points of interest that are not mobs
if(client && mob_eye && istype(mob_eye))
client.eye = mob_eye
client.perspective = EYE_PERSPECTIVE
if(SSmapping.level_trait(mob_eye.z, ZTRAIT_SECRET) && !client?.holder)
sight = null //we dont want ghosts to see through walls in secret areas
RegisterSignal(mob_eye, COMSIG_MOVABLE_Z_CHANGED, .proc/on_observing_z_changed)
Fikou marked this conversation as resolved.
Show resolved Hide resolved
if(mob_eye.hud_used)
client.screen = list()
LAZYINITLIST(mob_eye.observers)
mob_eye.observers |= src
mob_eye.hud_used.show_hud(mob_eye.hud_used.hud_version, src)
observetarget = mob_eye

/mob/dead/observer/proc/on_observing_z_changed(datum/source, turf/old_turf, turf/new_turf)
Fikou marked this conversation as resolved.
Show resolved Hide resolved
if(SSmapping.level_trait(new_turf.z, ZTRAIT_SECRET) && !client?.holder)
sight = null //we dont want ghosts to see through walls in secret areas
else
sight = initial(sight)

/mob/dead/observer/verb/register_pai_candidate()
set category = "Ghost"
set name = "pAI Setup"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
timeofdeath = world.time
tod = station_time_timestamp()
var/turf/T = get_turf(src)
if(SSmapping.level_trait(T.z, ZTRAIT_SECRET) && !client?.holder)
Fikou marked this conversation as resolved.
Show resolved Hide resolved
ghostize(TRUE)
if(mind && mind.name && mind.active && !istype(T.loc, /area/ctf))
deadchat_broadcast(" has died at <b>[get_area_name(T)]</b>.", "<b>[mind.name]</b>", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE)
if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] && !client?.holder)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/mob_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -549,3 +549,9 @@
/// Can this mob move between z levels
/mob/proc/canZMove(direction, turf/target)
return FALSE

/mob/abstract_move(atom/destination)
var/turf/new_turf = get_turf(destination)
if(SSmapping.level_trait(new_turf.z, ZTRAIT_SECRET) && !client?.holder)
return
return ..()
Watermelon914 marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 3 additions & 2 deletions code/modules/vehicles/mecha/_mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@
return ..()
if(phase_state)
flick(phase_state, src)
var/area/destination_area = get_step(loc, movement_dir).loc
if(destination_area.area_flags & NOTELEPORT)
var/turf/destination_turf = get_step(loc, movement_dir)
var/area/destination_area = destination_turf.loc
if(destination_area.area_flags & NOTELEPORT || SSmapping.level_trait(destination_turf.z, ZTRAIT_SECRET))
Fikou marked this conversation as resolved.
Show resolved Hide resolved
return FALSE
return TRUE

Expand Down
3 changes: 3 additions & 0 deletions config/away_missions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add away mission dmms here.

**These are fully cached so keep this directory empty by default.**
4 changes: 3 additions & 1 deletion config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ ALLOW_AI_MULTICAM
## Uncomment to load the virtual reality hub map
#VIRTUAL_REALITY

## Uncomment to load one of the missions from awaymissionconfig.txt at roundstart.
## Uncomment to load one of the missions from awaymissionconfig.txt or away_missions/ at roundstart.
#ROUNDSTART_AWAY

## How long the delay is before the Away Mission gate opens. Default is half an hour.
## 600 is one minute.
GATEWAY_DELAY 18000

## The probability of the gateway mission being a config one
CONFIG_GATEWAY_CHANCE 0

## ACCESS ###

Expand Down