Skip to content

Commit

Permalink
Hardcode Rework (#6586)
Browse files Browse the repository at this point in the history
# About the pull request

Added ECHO support to sounds (byond function implementation to be
accessible), some changes from one letter vars.

Rework of admin shoot the ship pannel, so now it's not hardoced

# Explain why it's good for the game

Just backend rework, almost same

:cl: BlackCrystalic
add: Byond backed function of sound ECHO ported
refactor: refactor of weaponhits hardcode
/:cl:

---------

Co-authored-by: harryob <[email protected]>
Co-authored-by: Deleted user <ghost>
  • Loading branch information
blackcrystall and harryob authored Aug 5, 2024
1 parent bf0593f commit fbe0943
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 413 deletions.
22 changes: 22 additions & 0 deletions code/__DEFINES/sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@
#define SOUND_CHANNEL_LOBBY 1023
#define SOUND_CHANNEL_Z 1024


//default byond sound echo list index positions.
//ECHO_DIRECT and ECHO_ROOM are the only two that actually appear to do anything, and represent the dry and wet channels of the environment effects, respectively.
#define ECHO_DIRECT 1
#define ECHO_DIRECTHF 2
#define ECHO_ROOM 3
#define ECHO_ROOMHF 4
#define ECHO_OBSTRUCTION 5
#define ECHO_OBSTRUCTIONLFRATIO 6
#define ECHO_OCCLUSION 7
#define ECHO_OCCLUSIONLFRATIO 8
#define ECHO_OCCLUSIONROOMRATIO 9
#define ECHO_OCCLUSIONDIRECTRATIO 10
#define ECHO_EXCLUSION 11
#define ECHO_EXCLUSIONLFRATIO 12
#define ECHO_OUTSIDEVOLUMEHF 13
#define ECHO_DOPPLERFACTOR 14
#define ECHO_ROLLOFFFACTOR 15
#define ECHO_ROOMROLLOFFFACTOR 16
#define ECHO_AIRABSORPTIONFACTOR 17
#define ECHO_FLAGS 18

//default byond sound environments
#define SOUND_ENVIRONMENT_NONE -1
#define SOUND_ENVIRONMENT_GENERIC 0
Expand Down
17 changes: 17 additions & 0 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ GLOBAL_LIST_INIT_TYPED(chemical_gen_classes_list, /list, list("C" = list(),"C1"
//properties generated in chemicals, helps to make sure the same property doesn't show up 10 times
GLOBAL_LIST_INIT_TYPED(generated_properties, /list, list("positive" = list(), "negative" = list(), "neutral" = list()))

GLOBAL_LIST_INIT_TYPED(space_weapons, /datum/space_weapon, setup_ship_weapon())
GLOBAL_LIST_INIT_TYPED(space_weapons_ammo, /datum/space_weapon_ammo, setup_ship_ammo())

GLOBAL_LIST_INIT_TYPED(ammo_list, /datum/ammo, setup_ammo()) //List of all ammo types. Used by guns to tell the projectile how to act.
GLOBAL_REFERENCE_LIST_INDEXED(joblist, /datum/job, title) //List of all jobstypes, minus borg and AI

Expand Down Expand Up @@ -348,6 +351,20 @@ GLOBAL_LIST_INIT(hj_emotes, setup_hazard_joe_emotes())
all_species[S.name] = S
return all_species

/proc/setup_ship_weapon()
var/list/ammo_list = list()
for(var/weapon_type in subtypesof(/datum/space_weapon))
var/datum/space_weapon/new_weapon = new weapon_type
ammo_list[new_weapon.type] = new_weapon
return ammo_list

/proc/setup_ship_ammo()
var/list/ammo_list = list()
for(var/ammo_type in subtypesof(/datum/space_weapon_ammo))
var/datum/space_weapon_ammo/new_ammo = new ammo_type
ammo_list[new_ammo.type] = new_ammo
return ammo_list

/proc/setup_ammo()
var/list/blacklist = list(/datum/ammo/energy, /datum/ammo/energy/yautja, /datum/ammo/energy/yautja/rifle, /datum/ammo/bullet/shotgun, /datum/ammo/xeno)
var/list/ammo_list = list()
Expand Down
6 changes: 5 additions & 1 deletion code/datums/soundOutput.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@
S.y += T.y_s_offset
S.x += T.x_s_offset
S.echo = SOUND_ECHO_REVERB_ON //enable environment reverb for positional sounds
for(var/pos = 1 to length(T.echo))
if(!T.echo[pos])
continue
S.echo[pos] = T.echo[pos]
if(owner.mob.ear_deaf > 0)
S.status |= SOUND_MUTE

sound_to(owner,S)
sound_to(owner, S)

/datum/soundOutput/proc/update_ambience(area/target_area, ambience_override, force_update = FALSE)
var/status_flags = SOUND_STREAM
Expand Down
Loading

0 comments on commit fbe0943

Please sign in to comment.