Skip to content

Commit

Permalink
Misc Fixes (#359)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Mullen <[email protected]>
Co-authored-by: Drathek <[email protected]>
Co-authored-by: ihatethisengine <[email protected]>
Co-authored-by: fira <[email protected]>
Co-authored-by: Vero <[email protected]>
Co-authored-by: MrDas <[email protected]>
Co-authored-by: SabreML <[email protected]>
Co-authored-by: BeagleGaming1 <[email protected]>
  • Loading branch information
9 people authored Aug 9, 2024
1 parent ed6c6a1 commit 5a75cc1
Show file tree
Hide file tree
Showing 30 changed files with 317 additions and 219 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
///from mind/transfer_to. Sent after the mind has been transferred to a different body: (mob/previous_body)
#define COMSIG_MIND_TRANSFERRED "mind_transferred"
8 changes: 6 additions & 2 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@
#define COMSIG_MOB_PRE_CLICK "mob_pre_click"
#define COMPONENT_INTERRUPT_CLICK (1<<0)

///from base of /mob/Login(): ()
/// From base of /mob/Login(), called when a client logs into this mob: ()
/// Not to be confused with [COMSIG_MOB_LOGGED_IN]
#define COMSIG_MOB_LOGIN "mob_login"
///from base of /mob/Logout(): ()
/// From base of /mob/Login(), called after a client logs into this mob: ()
/// Not to be confused with [COMSIG_MOB_LOGIN]
#define COMSIG_MOB_LOGGED_IN "mob_logged_in"
/// From base of /mob/Logout(): ()
#define COMSIG_MOB_LOGOUT "mob_logout"

//from /mob/proc/on_deafness_gain()
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/dcs/signals/signals_client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
/// Called after one or more verbs are added: (list of verbs added)
#define COMSIG_CLIENT_VERB_REMOVED "client_verb_removed"

/// Called after a client logs into a mob: (mob)
#define COMSIG_CLIENT_MOB_LOGIN "client_mob_changed"
/// Called from /mob/Login() after a client logs into a mob: (mob)
#define COMSIG_CLIENT_MOB_LOGGED_IN "client_mob_logged_in"

/// Called when something is added to a client's screen : /client/proc/add_to_screen(screen_add)
#define COMSIG_CLIENT_SCREEN_ADD "client_screen_add"
Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/dcs/signals/signals_global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@

#define COMSIG_GLOB_REMOVE_VOTE_BUTTON "!remove_vote_button"

#define COMSIG_GLOB_CLIENT_LOGIN "!client_login"
/// Called from /client/New() when a client logs in to the game: (client)
#define COMSIG_GLOB_CLIENT_LOGGED_IN "!client_logged_in"

#define COMSIG_GLOB_MOB_LOGIN "!mob_login"
/// Called from /mob/Login() when a client logs into a mob: (mob)
#define COMSIG_GLOB_MOB_LOGGED_IN "!mob_logged_in"

///from /datum/controller/subsystem/ticker/PostSetup
#define COMSIG_GLOB_POST_SETUP "!post_setup"
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
#define SOUND_ENVIRONMENT_DIZZY 24
#define SOUND_ENVIRONMENT_PSYCHOTIC 25

#define SOUND_ECHO_REVERB_ON list(0, 0, 0, 0, 0, 0.0, 0, 0.25, 1.5, 1.0, 0, 1.0, 0, 0.0, 0.0, 0.0, 1.0, 0)
#define SOUND_ECHO_REVERB_OFF list(0, 0, -10000, -10000, 0, 0.0, 0, 0.25, 1.5, 1.0, 0, 1.0, 0, 0.0, 0.0, 0.0, 1.0, 0) //-10000 to Room & RoomHF makes enviromental reverb effectively inaudible

#define AMBIENCE_SHIP 'sound/ambience/shipambience.ogg'
#define AMBIENCE_JUNGLE 'sound/ambience/ambienceLV624.ogg'
#define AMBIENCE_RIVER 'sound/ambience/ambienceriver.ogg'
Expand Down
10 changes: 6 additions & 4 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@
/atom/movable/screen/action_button/attack_ghost(mob/dead/observer/user)
return

/atom/movable/screen/action_button/clicked(mob/user)
/atom/movable/screen/action_button/clicked(mob/user, list/mods)
if(!user || !source_action)
return TRUE
if(source_action.owner != user)
return TRUE

if(source_action.can_use_action())
source_action.action_activate()
Expand Down Expand Up @@ -97,7 +99,7 @@
icon_state = "hide"
var/hidden = 0

/atom/movable/screen/action_button/hide_toggle/clicked(mob/user, mods)
/atom/movable/screen/action_button/hide_toggle/clicked(mob/user, list/mods)
user.hud_used.action_buttons_hidden = !user.hud_used.action_buttons_hidden
hidden = user.hud_used.action_buttons_hidden
if(hidden)
Expand All @@ -107,7 +109,7 @@
name = "Hide Buttons"
icon_state = "hide"
user.update_action_buttons()
return 1
return TRUE

/atom/movable/screen/action_button/ghost/minimap/get_button_screen_loc(button_number)
return "SOUTH:6,CENTER+1:24"
Expand Down Expand Up @@ -214,7 +216,7 @@
/atom/movable/screen/zone_sel/robot
icon = 'icons/mob/hud/screen1_robot.dmi'

/atom/movable/screen/clicked(mob/user)
/atom/movable/screen/clicked(mob/user, list/mods)
if(!user)
return TRUE

Expand Down
10 changes: 10 additions & 0 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ SUBSYSTEM_DEF(minimaps)
user.client.register_map_obj(map_holder.map)
ui = new(user, src, "TacticalMap")
ui.open()
RegisterSignal(user.mind, COMSIG_MIND_TRANSFERRED, PROC_REF(on_mind_transferred))

/datum/tacmap/drawing/tgui_interact(mob/user, datum/tgui/ui)
var/mob/living/carbon/xenomorph/xeno = user
Expand Down Expand Up @@ -755,6 +756,7 @@ SUBSYSTEM_DEF(minimaps)
tacmap_ready_time = SSminimaps.next_fire + 2 SECONDS
addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire - world.time + 1 SECONDS)
user.client.register_map_obj(map_holder.map)
RegisterSignal(user.mind, COMSIG_MIND_TRANSFERRED, PROC_REF(on_mind_transferred))

ui = new(user, src, "TacticalMap")
ui.open()
Expand Down Expand Up @@ -835,6 +837,9 @@ SUBSYSTEM_DEF(minimaps)

return data

/datum/tacmap/ui_close(mob/user)
UnregisterSignal(user.mind, COMSIG_MIND_TRANSFERRED)

/datum/tacmap/drawing/ui_close(mob/user)
. = ..()
action_queue_change = 0
Expand Down Expand Up @@ -950,6 +955,11 @@ SUBSYSTEM_DEF(minimaps)

return UI_INTERACTIVE

// This gets removed when the player changes bodies (i.e. xeno evolution), so re-register it when that happens.
/datum/tacmap/proc/on_mind_transferred(datum/mind/source, mob/previous_body)
SIGNAL_HANDLER
source.current.client.register_map_obj(map_holder.map)

/datum/tacmap_holder
var/map_ref
var/atom/movable/screen/minimap/map
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ SUBSYSTEM_DEF(ticker)
CHECK_TICK
mode.announce()
if(mode.taskbar_icon)
RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN, PROC_REF(handle_mode_icon))
RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN, PROC_REF(handle_mode_icon))
set_clients_taskbar_icon(mode.taskbar_icon)

if(GLOB.perf_flags & PERF_TOGGLE_LAZYSS)
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SUBSYSTEM_DEF(vote)
voting.Cut()
remove_action_buttons()

UnregisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN)
UnregisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN)

for(var/c in GLOB.player_list)
update_static_data(c)
Expand Down Expand Up @@ -370,7 +370,7 @@ SUBSYSTEM_DEF(vote)
if(send_clients_vote)
C.mob.vote()

RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN, PROC_REF(handle_client_joining))
RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN, PROC_REF(handle_client_joining))
SStgui.update_uis(src)
return TRUE
return FALSE
Expand Down
8 changes: 4 additions & 4 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
var/cost = 0 // By default an action has no cost -> will be utilized by skill actions/xeno actions
var/action_flags = 0 // Check out __game.dm for flags
/// Whether the action is hidden from its owner
/// Useful for when you want to preserve action state while preventing
/// a mob from using said action
var/hidden = FALSE
var/hidden = FALSE //Preserve action state while preventing mob from using action
///Hide the action from the owner without preventing them from using it (incase of keybind listen_signal)
var/player_hidden = FALSE
var/unique = TRUE
/// A signal on the mob that will cause the action to activate
var/listen_signal
Expand Down Expand Up @@ -227,7 +227,7 @@
var/atom/movable/screen/action_button/B = A.button
if(reload_screen)
client.add_to_screen(B)
if(A.hidden)
if(A.hidden || A.player_hidden)
B.screen_loc = null
continue
button_number++
Expand Down
21 changes: 16 additions & 5 deletions code/datums/components/overlay_lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@
get_new_turfs()


///Adds the luminosity and source for the afected movable atoms to keep track of their visibility.
///Adds the luminosity and source for the affected movable atoms to keep track of their visibility.
/datum/component/overlay_lighting/proc/add_dynamic_lumi()
LAZYSET(current_holder.affected_movable_lights, src, lumcount_range + 1)
current_holder.underlays += visible_mask
current_holder.update_dynamic_luminosity()
if(directional)
current_holder.underlays += cone

///Removes the luminosity and source for the afected movable atoms to keep track of their visibility.
///Removes the luminosity and source for the affected movable atoms to keep track of their visibility.
/datum/component/overlay_lighting/proc/remove_dynamic_lumi()
LAZYREMOVE(current_holder.affected_movable_lights, src)
current_holder.underlays -= visible_mask
Expand Down Expand Up @@ -267,6 +267,9 @@
///Used to determine the new valid current_holder from the parent's loc.
/datum/component/overlay_lighting/proc/check_holder()
var/atom/movable/movable_parent = GET_PARENT
if(QDELETED(movable_parent))
set_holder(null)
return
if(isturf(movable_parent.loc))
set_holder(movable_parent)
return
Expand All @@ -275,13 +278,21 @@
set_holder(null)
return
if(isturf(inside.loc))
set_holder(inside)
// storage items block light, also don't be moving into a qdeleted item
if(QDELETED(inside) || istype(inside, /obj/item/storage))
set_holder(null)
else
set_holder(inside)
return
set_holder(null)


///Called when the current_holder is qdeleted, to remove the light effect.
/datum/component/overlay_lighting/proc/on_holder_qdel(atom/movable/source, force)
SIGNAL_HANDLER
if(QDELETED(current_holder))
set_holder(null)
return
UnregisterSignal(current_holder, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_MOVED))
if(directional)
UnregisterSignal(current_holder, COMSIG_ATOM_DIR_CHANGE)
Expand All @@ -290,6 +301,7 @@

///Called when current_holder changes loc.
/datum/component/overlay_lighting/proc/on_holder_moved(atom/movable/source, OldLoc, Dir, Forced)
SIGNAL_HANDLER
if(!(overlay_lighting_flags & LIGHTING_ON))
return
make_luminosity_update()
Expand Down Expand Up @@ -450,8 +462,7 @@
. = lum_power
lum_power = new_lum_power
var/difference = . - lum_power
for(var/t in affected_turfs)
var/turf/lit_turf = t
for(var/turf/lit_turf as anything in affected_turfs)
lit_turf.dynamic_lumcount -= difference

///Here we append the behavior associated to changing lum_power.
Expand Down
5 changes: 3 additions & 2 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
msg_admin_niche("[key]/[ckey] has tried to transfer to deleted [new_character].")
return

SEND_SIGNAL(current.client, COMSIG_CLIENT_MIND_TRANSFER, new_character)

var/mob/old_current = current
if(current)
current.mind = null //remove ourself from our old body's mind variable
nanomanager.user_transferred(current, new_character) // transfer active NanoUI instances to new user
SStgui.on_transfer(current, new_character) // and active TGUI instances

if(key)
if(new_character.key != key)
Expand Down Expand Up @@ -66,6 +66,7 @@
continue
player_entity = setup_player_entity(ckey)

SEND_SIGNAL(src, COMSIG_MIND_TRANSFERRED, old_current)
SEND_SIGNAL(new_character, COMSIG_MOB_NEW_MIND, current.client)

new_character.refresh_huds(current) //inherit the HUDs from the old body
Expand Down
75 changes: 63 additions & 12 deletions code/datums/soundOutput.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@
var/list/soundscape_playlist = list() //Updated on changing areas
var/ambience = null //The file currently being played as ambience
var/status_flags = 0 //For things like ear deafness, psychodelic effects, and other things that change how all sounds behave
var/list/echo
/datum/soundOutput/New(client/C)
if(!C)

/// Currently applied environmental reverb.
VAR_PROTECTED/owner_environment = SOUND_ENVIRONMENT_NONE

/datum/soundOutput/New(client/client)
if(!client)
qdel(src)
return
owner = C
. = ..()
owner = client
RegisterSignal(owner.mob, COMSIG_MOVABLE_MOVED, PROC_REF(on_mob_moved))
RegisterSignal(owner.mob, COMSIG_MOB_LOGOUT, PROC_REF(on_mob_logout))
RegisterSignal(owner, COMSIG_CLIENT_MOB_LOGGED_IN, PROC_REF(on_client_mob_logged_in))
return ..()

/datum/soundOutput/Destroy()
UnregisterSignal(owner.mob, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_LOGOUT))
UnregisterSignal(owner, COMSIG_CLIENT_MOB_LOGGED_IN)
owner = null
return ..()

/datum/soundOutput/proc/process_sound(datum/sound_template/T)
var/sound/S = sound(T.file, T.repeat, T.wait)
Expand All @@ -24,7 +36,6 @@
S.offset = T.offset
S.pitch = T.pitch
S.status = T.status
S.echo = T.echo
if(T.x && T.y && T.z)
var/turf/owner_turf = get_turf(owner.mob)
if(owner_turf)
Expand All @@ -40,16 +51,12 @@
S.x = T.x - owner_turf.x
S.y = 0
S.z = T.y - owner_turf.y
var/area/A = owner_turf.loc
S.environment = A.sound_environment
S.y += T.y_s_offset
S.x += T.x_s_offset
S.echo = SOUND_ECHO_REVERB_ON //enable environment reverb for positional sounds
if(owner.mob.ear_deaf > 0)
S.status |= SOUND_MUTE

if(owner.mob.sound_environment_override != SOUND_ENVIRONMENT_NONE)
S.environment = owner.mob.sound_environment_override

sound_to(owner,S)

/datum/soundOutput/proc/update_ambience(area/target_area, ambience_override, force_update = FALSE)
Expand Down Expand Up @@ -86,7 +93,6 @@
S.status = status_flags

if(target_area)
S.environment = target_area.sound_environment
var/muffle
if(target_area.ceiling_muffle)
switch(target_area.ceiling)
Expand Down Expand Up @@ -130,6 +136,51 @@
S.status = SOUND_UPDATE
sound_to(owner, S)

/// Pulls mob's area's sound_environment and applies if necessary and not overridden.
/datum/soundOutput/proc/update_area_environment()
var/area/owner_area = get_area(owner.mob)
var/new_environment = owner_area.sound_environment

if(owner.mob.sound_environment_override != SOUND_ENVIRONMENT_NONE) //override in effect, can't apply
return

set_owner_environment(new_environment)

/// Pulls mob's sound_environment_override and applies if necessary.
/datum/soundOutput/proc/update_mob_environment_override()
var/new_environment_override = owner.mob.sound_environment_override

if(new_environment_override == SOUND_ENVIRONMENT_NONE) //revert to area environment
update_area_environment()
return

set_owner_environment(new_environment_override)

/// Pushes new_environment to owner and updates owner_environment var.
/datum/soundOutput/proc/set_owner_environment(new_environment = SOUND_ENVIRONMENT_NONE)
if(new_environment ~= src.owner_environment) //no need to change
return

var/sound/sound = sound()
sound.environment = new_environment
sound_to(owner, sound)

src.owner_environment = new_environment

/datum/soundOutput/proc/on_mob_moved(datum/source, atom/oldloc, direction, Forced)
SIGNAL_HANDLER //COMSIG_MOVABLE_MOVED
update_area_environment()

/datum/soundOutput/proc/on_mob_logout(datum/source)
SIGNAL_HANDLER //COMSIG_MOB_LOGOUT
UnregisterSignal(owner.mob, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_LOGOUT))

/datum/soundOutput/proc/on_client_mob_logged_in(datum/source, mob/new_mob)
SIGNAL_HANDLER //COMSIG_CLIENT_MOB_LOGGED_IN
RegisterSignal(owner.mob, COMSIG_MOVABLE_MOVED, PROC_REF(on_mob_moved))
RegisterSignal(owner.mob, COMSIG_MOB_LOGOUT, PROC_REF(on_mob_logout))
update_mob_environment_override()

/client/proc/adjust_volume_prefs(volume_key, prompt = "", channel_update = 0)
volume_preferences[volume_key] = (tgui_input_number(src, prompt, "Volume", volume_preferences[volume_key]*100)) / 100
if(volume_preferences[volume_key] > 1)
Expand Down
Loading

0 comments on commit 5a75cc1

Please sign in to comment.