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

Small bug fixes #1046

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
331 changes: 197 additions & 134 deletions _maps/map_files/Theseus/Theseus.dmm

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions code/__DEFINES/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,30 @@ do { \
#define LIGHTS_RANDOMLY_BROKEN

#define TURF_IS_DYNAMICALLY_LIT(T) (!(T.always_lit || T.loc.luminosity))

// Machinery lights
///How much power emergency lights will consume per tick
#define LIGHT_EMERGENCY_POWER_USE 0.2
// status values shared between lighting fixtures and items
#define LIGHT_OK 0
#define LIGHT_EMPTY 1
#define LIGHT_BROKEN 2
#define LIGHT_BURNED 3

///Min time for a spark to happen in a broken light
#define BROKEN_SPARKS_MIN (3 MINUTES)
///Max time for a spark to happen in a broken light
#define BROKEN_SPARKS_MAX (9 MINUTES)

///Amount of time that takes an ethereal to take energy from the lights
#define LIGHT_DRAIN_TIME 2.5 SECONDS
///Amount of charge the ethereal gain after the drain
#define LIGHT_POWER_GAIN 35

///How many reagents the lights can hold
#define LIGHT_REAGENT_CAPACITY 5

//Status for light constructs
#define LIGHT_CONSTRUCT_EMPTY 1
#define LIGHT_CONSTRUCT_WIRED 2
#define LIGHT_CONSTRUCT_CLOSED 3
16 changes: 16 additions & 0 deletions code/controllers/subsystem/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,22 @@ SUBSYSTEM_DEF(explosions)
far_dist += devastation_range * 20
shake_the_room(epicenter, original_max_distance, far_dist, devastation_range, heavy_impact_range)

// Flicker lights
var/effective_range = devastation_range * 5 + heavy_impact_range * 2 + light_impact_range
for(var/obj/machinery/light/L as anything in INSTANCES_OF(/obj/machinery/light))
if(!isturf(L.loc))
continue

var/dist = get_dist_euclidean(L.loc, epicenter)
if(dist > effective_range)
continue

var/delay = clamp(ceil(dist) * (0.1 SECONDS), 0, 5 SECONDS)
if(delay)
addtimer(CALLBACK(L, TYPE_PROC_REF(/obj/machinery/light, flicker), pick(1, 3)), delay)
else
L.flicker(pick(1, 3))

/datum/controller/subsystem/explosions/proc/perform_explosion(epicenter, list/act_turfs, heavy_power, dev_power, flame_power, turf_tally_ptr, movable_tally_ptr)
var/turf_tally = 0
var/movable_tally = 0
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/sound_cache.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SUBSYSTEM_DEF(sound_cache)
for(var/i in 1 to length(paths))
reconstructed[i] = "[paths[i]]"

var/list/out = rustg_sound_length_list(paths)
var/list/out = rustg_sound_length_list(reconstructed)
var/list/successes = out[RUSTG_SOUNDLEN_SUCCESSES]
for(var/sound_path in successes)
sound_lengths[sound_path] = text2num(successes[sound_path])
Expand Down
1 change: 1 addition & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ SUBSYSTEM_DEF(ticker)
living.notransform = TRUE
living.client?.init_verbs()
livings += living

if(livings.len)
addtimer(CALLBACK(src, PROC_REF(release_characters), livings), 30, TIMER_CLIENT_TIME)

Expand Down
4 changes: 2 additions & 2 deletions code/datums/chatmessage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
return

// Non mobs speakers can be small
if (!ismob(target))
extra_classes |= "small"
if (target.chat_class)
extra_classes |= target.chat_class

var/list/prefixes

Expand Down
17 changes: 16 additions & 1 deletion code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@

var/datum/alarm_handler/alarm_manager

/// A lazylist of ckeys that have entered this area. See display_flavor()
var/list/ckeys_that_have_been_here
/// A weighted list of flavor texts for display_flavor().
var/list/flavor_texts

/**
* A list of teleport locations
*
Expand Down Expand Up @@ -478,7 +483,11 @@ GLOBAL_LIST_EMPTY(teleportlocs)

/// Called when a living mob that spawned here, joining the round, receives the player client.
/area/proc/on_joining_game(mob/living/boarder)
return
SHOULD_CALL_PARENT(TRUE)
if(prob(5) && boarder.client && ishuman(boarder))
LAZYADDASSOC(ckeys_that_have_been_here, boarder.ckey, TRUE)
spawn(0)
display_flavor(boarder)

///Called by airalarms and firealarms to communicate the status of the area to relevant machines
/area/proc/communicate_fire_alert(code)
Expand All @@ -505,3 +514,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
var/old = spook_level
spook_level += adj
SEND_SIGNAL(src, AREA_SPOOK_LEVEL_CHANGED, src, old)

/area/proc/display_flavor(mob/living/carbon/human/pawn)
if(!length(flavor_texts))
return

to_chat(pawn, pick_weight(flavor_texts))
9 changes: 8 additions & 1 deletion code/game/area/areas/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,16 @@
/area/shuttle/arrival
name = "Arrival Shuttle"
area_flags = UNIQUE_AREA// SSjob refers to this area for latejoiners

flavor_texts = list(
span_statsgood("Bootprints paint the floor with grime. You are home.") = 1,
span_statsgood("The quiet metallic creaking of the shuttle comforts you as it pulls into the station.") = 1,
span_statsgood("Hundreds, perhaps thousands of footsteps have eaten away at the floors where you stand.") = 1,
span_statsgood("The soft droning of the vessel's drive is comforting. You can hear your heart beating in it's cage.") = 1,
span_statsgood("Thousands of scratches adorn the view ports from the unspeakable volume of particles brushing against them.") = 1
)

/area/shuttle/arrival/on_joining_game(mob/living/boarder)
. = ..()
boarder.update_parallax_teleport()

/area/shuttle/pod_1
Expand Down
2 changes: 2 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
var/tmp/chat_color
/// A luminescence-shifted value of the last color calculated for chatmessage overlays
var/tmp/chat_color_darkened
/// Class to attach to runechat.
var/tmp/chat_class

///Holds merger groups currently active on the atom. Do not access directly, use GetMergeGroup() instead.
var/tmp/list/datum/merger/mergers
Expand Down
142 changes: 142 additions & 0 deletions code/game/machinery/projector.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// This is currently just used for the sec intro and is written as such. Fix it if you want to use it. Or bug me about it.
/obj/machinery/projector
name = "projector"
icon = 'icons/obj/machines/projector.dmi'
base_icon_state = "projector"
icon_state = "projector0"

dir = SOUTH
light_on = FALSE
light_color = LIGHT_COLOR_BABY_BLUE
light_power = 0.4
light_inner_range = 0.8
light_outer_range = 3

var/playing = FALSE

/obj/machinery/projector/Initialize(mapload)
. = ..()
if(!SSticker.HasRoundStarted())
SSticker.OnRoundstart(CALLBACK(src, PROC_REF(play), 5 SECONDS))

/obj/machinery/projector/update_icon_state()
icon_state = "[base_icon_state][playing]"
return ..()

/obj/machinery/projector/proc/play(initial_delay = 3 SECONDS)
set waitfor = FALSE

say("Incoming transmission.")
if(initial_delay)
sleep(initial_delay)

var/turf/destination = get_ranged_target_turf(src, SOUTH, 2)
var/obj/effect/overlay/holoray/ray = new(loc)
var/obj/effect/abstract/projected_image/guy = new(destination)


guy.icon = icon
guy.icon_state = "sec"

guy.makeHologram()
guy.add_overlay(emissive_appearance(guy.icon, guy.icon_state, alpha = 180))

guy.alpha = 0
ray.alpha = 0
update_ray(ray, destination, destination)

animate(ray, alpha = 255, time = 2 SECONDS)
animate(guy, alpha = 255, time = 2 SECONDS)

visible_message("[icon2html(src, viewers(src))] [src] clicks on.")
playing = TRUE
set_light(l_on = TRUE)
update_appearance()

sleep(4 SECONDS)

var/list/phrases = list(
'sound/misc/sec_intro/1.ogg' = "BEGIN TRANSMISSION.",
'sound/misc/sec_intro/2.ogg' = "HELLO PEACEKEEPERS.",
'sound/misc/sec_intro/3.ogg' = "YOUR JOB IS TO ENSURE COMPLIANCE WITH THE MANAGERS.",
'sound/misc/sec_intro/4.ogg' = "THIS IS TO ENSURE THE SAFETY OF THE PUBLIC.",
'sound/misc/sec_intro/5.ogg' = "YOU WILL BE PAID HANDSOMELY FOR YOUR WORK.",
'sound/misc/sec_intro/6.ogg' = "DO NOT ALLOW THE TERRIBLE THING TO SPREAD.",
'sound/misc/sec_intro/7.ogg' = "END TRANSMISSION.",
)

SSsound_cache.cache_sounds(phrases)

for(var/sound in phrases)
guy.say(phrases[sound])
playsound(src, sound, 100, FALSE)
sleep(SSsound_cache.get_sound_length(sound) + 0.6 SECONDS)

animate(guy, alpha = 0, time = 2 SECONDS)
animate(ray, alpha = 0, time = 2 SECONDS)

sleep(2 SECONDS)

visible_message("[icon2html(src, viewers(src))] [src] clicks off.")
playing = FALSE
set_light(l_on = FALSE)
update_appearance()

qdel(guy)
qdel(ray)

/obj/machinery/projector/proc/update_ray(obj/effect/overlay/holoray/ray, turf/new_turf, turf/old_turf, animate = TRUE)
var/disty = old_turf.y - ray.y
var/distx = old_turf.x - ray.x
var/newangle
if(!disty)
if(distx >= 0)
newangle = 90
else
newangle = 270
else
newangle = arctan(distx/disty)
if(disty < 0)
newangle += 180
else if(distx < 0)
newangle += 360

var/matrix/new_transform = matrix()
new_transform.Scale(1, sqrt(distx * distx + disty * disty))
new_transform.Turn(newangle)

if (animate)
animate(ray, transform = new_transform, time = 1)
else
ray.transform = new_transform

/obj/machinery/projector/proc/makeicon()
var/mob/living/carbon/human/H = new()
H.equipOutfit(new /datum/outfit/centcom/ert/commander)

var/icon/icon = getFlatIcon(H)
// Zoom in on the top of the head and the chest
// I have no idea how to do this dynamically.
icon.Scale(64, 64)

// This is probably better as a Crop, but I cannot figure it out.
icon.Shift(WEST, 15)
icon.Shift(SOUTH, 30)

icon.Crop(1, 1, 32, 32)

if(!fexists("data/saved_icons.dmi"))
fcopy("", "data/saved_icons.dmi")

var/icon/local = icon("data/saved_icons.dmi")
local.Insert(icon, "temp")
fcopy(local, "data/saved_icons.dmi")

/obj/effect/abstract/projected_image
name = "projection"
chat_class = null

light_color = LIGHT_COLOR_BABY_BLUE
light_power = 0.4
light_inner_range = 0.5
light_outer_range = 2
36 changes: 36 additions & 0 deletions code/game/objects/effects/landmarks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,63 @@ INITIALIZE_IMMEDIATE(/obj/effect/landmark)
var/high_priority = FALSE
/// Does what it says on the tin.
var/delete_after_roundstart = TRUE
/// Does this delete itself if the marked atom is deleted?
var/delete_if_marked_atom_deleted = FALSE
/// Tracks if this spawn has been used or not.
var/used = FALSE

/// The atom we're tracking.
var/atom/marked_atom

/obj/effect/landmark/start/proc/after_round_start()
if(delete_after_roundstart)
qdel(src)

/obj/effect/landmark/start/Initialize(mapload)
. = ..()
set_marked_atom(find_marked_atom())

GLOB.start_landmarks_list += src
LAZYADD(GLOB.start_landmarks_by_name[name], src)
if(high_priority)
LAZYADD(GLOB.high_priority_spawns[name], src)

/obj/effect/landmark/start/Destroy()
if(marked_atom)
unset_marked_atom()

GLOB.start_landmarks_list -= src
LAZYREMOVE(GLOB.start_landmarks_by_name[name], src)
if(high_priority)
LAZYREMOVE(GLOB.high_priority_spawns[name], src)
return ..()

/// Returns the landmark atom. Allows job landmarks to define the actual atom to call JoinPlayerHere() on.
/obj/effect/landmark/start/proc/find_marked_atom()
return locate(/obj/structure/chair, loc) || src

/// Call this to get the actual spawn location of the atom.
/obj/effect/landmark/start/proc/get_spawn_location()
return marked_atom

/obj/effect/landmark/start/proc/set_marked_atom(atom/new_atom)
PRIVATE_PROC(TRUE)

marked_atom = new_atom
if(marked_atom != src)
RegisterSignal(marked_atom, COMSIG_PARENT_QDELETING, PROC_REF(marked_gone))

/obj/effect/landmark/start/proc/unset_marked_atom()
PRIVATE_PROC(TRUE)

marked_atom = null

/obj/effect/landmark/start/proc/marked_gone(datum/source)
SIGNAL_HANDLER
unset_marked_atom()
if(delete_if_marked_atom_deleted)
qdel(src)

// START LANDMARKS FOLLOW. Don't change the names unless
// you are refactoring shitty landmark code.
/obj/effect/landmark/start/assistant
Expand Down
10 changes: 0 additions & 10 deletions code/game/objects/items/devices/lightreplacer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
//
// The explosion cannot insta-kill anyone with 30% or more health.

#define LIGHT_OK 0
#define LIGHT_EMPTY 1
#define LIGHT_BROKEN 2
#define LIGHT_BURNED 3


/obj/item/lightreplacer

Expand Down Expand Up @@ -258,8 +253,3 @@
/obj/item/lightreplacer/cyborg/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_NODROP, CYBORG_ITEM_TRAIT)

#undef LIGHT_OK
#undef LIGHT_EMPTY
#undef LIGHT_BROKEN
#undef LIGHT_BURNED
2 changes: 2 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/obj
animate_movement = SLIDE_STEPS
speech_span = SPAN_ROBOT
chat_class = "small"

var/obj_flags = CAN_BE_HIT

var/damtype = BRUTE
Expand Down
3 changes: 3 additions & 0 deletions code/modules/admin/verbs/admingame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@

if(!ishuman(H))
return
if(!H.time_of_death_stats)
to_chat(usr, span_warning("[H] has not died."))
return

H.show_death_stats(usr)

Expand Down
Loading
Loading