diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index bea1d7975688..3440b855e959 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -314,3 +314,25 @@ // magic value to use for indicating a proc slept #define PROC_RETURN_SLEEP -1 + +//Defines for 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. +//The rest of the defines are there primarily for the sake of completeness. It might be worth testing on EAX-enabled hardware, and on future BYOND versions (I've tested with 511, 512, and 513) +#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 diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index e663bc287946..33ba25a5af02 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -124,6 +124,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 @@ -320,6 +323,22 @@ GLOBAL_LIST_INIT(hj_emotes, setup_hazard_joe_emotes()) all_species[S.name] = S return all_species +/proc/setup_ship_weapon() + var/list/blacklist = list() + var/list/ammo_list = list() + for(var/T in subtypesof(/datum/space_weapon) - blacklist) + var/datum/space_weapon/A = new T + ammo_list[A.type] = A + return ammo_list + +/proc/setup_ship_ammo() + var/list/blacklist = list() + var/list/ammo_list = list() + for(var/T in subtypesof(/datum/space_weapon_ammo) - blacklist) + var/datum/space_weapon_ammo/A = new T + ammo_list[A.type] = A + 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() diff --git a/code/game/sound.dm b/code/game/sound.dm index 29c471f06e9d..b909dbf09e63 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -11,7 +11,7 @@ var/falloff = 1 var/volume_cat = VOLUME_SFX var/range = 0 - var/list/echo + var/list/echo = new(18) var/x //Map coordinates, not sound coordinates var/y var/z @@ -35,116 +35,127 @@ //status: the regular 4 sound flags //falloff: max range till sound volume starts dropping as distance increases -/proc/playsound(atom/source, soundin, vol = 100, vary = FALSE, sound_range, vol_cat = VOLUME_SFX, channel = 0, status , falloff = 1, echo, y_s_offset,x_s_offset) +/proc/playsound(atom/source, sound/soundin, vol = 100, vary = FALSE, sound_range, vol_cat = VOLUME_SFX, channel = 0, status, falloff = 1, list/echo, y_s_offset, x_s_offset) if(isarea(source)) error("[source] is an area and is trying to make the sound: [soundin]") return FALSE - var/datum/sound_template/S = new() - var/sound/SD = soundin - if(istype(SD)) - S.file = SD.file - S.wait = SD.wait - S.repeat = SD.repeat + var/datum/sound_template/template = new() + if(istype(soundin)) + template.file = soundin.file + template.wait = soundin.wait + template.repeat = soundin.repeat else - S.file = get_sfx(soundin) - S.channel = channel ? channel : get_free_channel() - S.status = status - S.falloff = falloff - S.volume = vol - S.volume_cat = vol_cat - S.echo = echo - S.y_s_offset = y_s_offset - S.x_s_offset = x_s_offset + template.file = get_sfx(soundin) + template.channel = channel ? channel : get_free_channel() + template.status = status + template.falloff = falloff + template.volume = vol + template.volume_cat = vol_cat + for(var/pos = 1 to length(echo)) + if(!echo[pos]) + continue + template.echo[pos] = echo[pos] + template.y_s_offset = y_s_offset + template.x_s_offset = x_s_offset if(vary != FALSE) if(vary > 1) - S.frequency = vary + template.frequency = vary else - S.frequency = GET_RANDOM_FREQ // Same frequency for everybody + template.frequency = GET_RANDOM_FREQ // Same frequency for everybody if(!sound_range) sound_range = floor(0.25*vol) //if no specific range, the max range is equal to a quarter of the volume. - S.range = sound_range + template.range = sound_range var/turf/turf_source = get_turf(source) if(!turf_source || !turf_source.z) return FALSE - S.x = turf_source.x - S.y = turf_source.y - S.z = turf_source.z + template.x = turf_source.x + template.y = turf_source.y + template.z = turf_source.z if(!SSinterior) - SSsound.queue(S) - return S.channel + SSsound.queue(template) + return template.channel var/list/datum/interior/extra_interiors = list() // If we're in an interior, range the chunk, then adjust to do so from outside instead if(SSinterior.in_interior(turf_source)) - var/datum/interior/VI = SSinterior.get_interior_by_coords(turf_source.x, turf_source.y, turf_source.z) - if(VI?.ready) - extra_interiors |= VI - if(VI.exterior) - var/turf/new_turf_source = get_turf(VI.exterior) - S.x = new_turf_source.x - S.y = new_turf_source.y - S.z = new_turf_source.z + var/datum/interior/vehicle_interior = SSinterior.get_interior_by_coords(turf_source.x, turf_source.y, turf_source.z) + if(vehicle_interior?.ready) + extra_interiors |= vehicle_interior + if(vehicle_interior.exterior) + var/turf/new_turf_source = get_turf(vehicle_interior.exterior) + template.x = new_turf_source.x + template.y = new_turf_source.y + template.z = new_turf_source.z else sound_range = 0 // Range for 'nearby interiors' aswell - for(var/datum/interior/VI in SSinterior.interiors) - if(VI?.ready && VI.exterior?.z == turf_source.z && get_dist(VI.exterior, turf_source) <= sound_range) - extra_interiors |= VI + for(var/datum/interior/vehicle_interior in SSinterior.interiors) + if(vehicle_interior?.ready && vehicle_interior.exterior?.z == turf_source.z && get_dist(vehicle_interior.exterior, turf_source) <= sound_range) + extra_interiors |= vehicle_interior - SSsound.queue(S, null, extra_interiors) - return S.channel + SSsound.queue(template, null, extra_interiors) + return template.channel //This is the replacement for playsound_local. Use this for sending sounds directly to a client -/proc/playsound_client(client/client, soundin, atom/origin, vol = 100, random_freq, vol_cat = VOLUME_SFX, channel = 0, status, list/echo, y_s_offset, x_s_offset) - if(!istype(client) || !client.soundOutput) return FALSE - var/datum/sound_template/S = new() +/proc/playsound_client(client/client, sound/soundin, atom/origin, vol = 100, random_freq, vol_cat = VOLUME_SFX, channel = 0, status, list/echo, y_s_offset, x_s_offset) + if(!istype(client) || !client.soundOutput) + return FALSE + + var/datum/sound_template/template = new() if(origin) var/turf/T = get_turf(origin) if(T) - S.x = T.x - S.y = T.y - S.z = T.z - var/sound/SD = soundin - if(istype(SD)) - S.file = SD.file - S.wait = SD.wait - S.repeat = SD.repeat + template.x = T.x + template.y = T.y + template.z = T.z + if(istype(soundin)) + template.file = soundin.file + template.wait = soundin.wait + template.repeat = soundin.repeat else - S.file = get_sfx(soundin) + template.file = get_sfx(soundin) if(random_freq) - S.frequency = GET_RANDOM_FREQ - S.volume = vol - S.volume_cat = vol_cat - S.channel = channel - S.status = status - S.echo = echo - S.y_s_offset = y_s_offset - S.x_s_offset = x_s_offset - SSsound.queue(S, list(client)) + template.frequency = GET_RANDOM_FREQ + template.volume = vol + template.volume_cat = vol_cat + template.channel = channel + template.status = status + for(var/pos = 1 to length(echo)) + if(!echo[pos]) + continue + template.echo[pos] = echo[pos] + template.y_s_offset = y_s_offset + template.x_s_offset = x_s_offset + SSsound.queue(template, list(client)) /// Plays sound to all mobs that are map-level contents of an area /proc/playsound_area(area/A, soundin, vol = 100, channel = 0, status, vol_cat = VOLUME_SFX, list/echo, y_s_offset, x_s_offset) if(!isarea(A)) return FALSE - var/datum/sound_template/S = new() - S.file = soundin - S.volume = vol - S.channel = channel - S.status = status - S.volume_cat = vol_cat + + var/datum/sound_template/template = new() + template.file = soundin + template.volume = vol + template.channel = channel + template.status = status + template.volume_cat = vol_cat + for(var/pos = 1 to length(echo)) + if(!echo[pos]) + continue + template.echo[pos] = echo[pos] var/list/hearers = list() for(var/mob/living/M in A.contents) if(!M || !M.client || !M.client.soundOutput) continue hearers += M.client - SSsound.queue(S, hearers) + SSsound.queue(template, hearers) /client/proc/playtitlemusic() if(!SSticker?.login_music) @@ -155,228 +166,231 @@ /// Play sound for all on-map clients on a given Z-level. Good for ambient sounds. /proc/playsound_z(z, soundin, volume = 100, vol_cat = VOLUME_SFX, echo, y_s_offset, x_s_offset) - var/datum/sound_template/S = new() - S.file = soundin - S.volume = volume - S.channel = SOUND_CHANNEL_Z - S.volume_cat = vol_cat - S.echo = echo - S.y_s_offset = y_s_offset - S.x_s_offset = x_s_offset + var/datum/sound_template/template = new() + template.file = soundin + template.volume = volume + template.channel = SOUND_CHANNEL_Z + template.volume_cat = vol_cat + for(var/pos = 1 to length(echo)) + if(!echo[pos]) + continue + template.echo[pos] = echo[pos] + template.y_s_offset = y_s_offset + template.x_s_offset = x_s_offset var/list/hearers = list() for(var/mob/M in GLOB.player_list) if((M.z in z) && M.client.soundOutput) hearers += M.client - SSsound.queue(S, hearers) + SSsound.queue(template, hearers) // The pick() proc has a built-in chance that can be added to any option by adding ,X; to the end of an option, where X is the % chance it will play. -/proc/get_sfx(S) - if(istext(S)) - switch(S) +/proc/get_sfx(sound) + if(istext(sound)) + switch(sound) // General effects if("shatter") - S = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg') + sound = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg') if("windowshatter") //meaty window shattering sound - S = pick('sound/effects/window_shatter1.ogg','sound/effects/window_shatter2.ogg','sound/effects/window_shatter3.ogg') + sound = pick('sound/effects/window_shatter1.ogg','sound/effects/window_shatter2.ogg','sound/effects/window_shatter3.ogg') if("glassbreak") //small breaks for bottles/etc. - S = pick('sound/effects/glassbreak1.ogg','sound/effects/glassbreak2.ogg','sound/effects/glassbreak3.ogg','sound/effects/glassbreak4.ogg') + sound = pick('sound/effects/glassbreak1.ogg','sound/effects/glassbreak2.ogg','sound/effects/glassbreak3.ogg','sound/effects/glassbreak4.ogg') if("explosion") - S = pick('sound/effects/explosion1.ogg','sound/effects/explosion2.ogg','sound/effects/explosion3.ogg','sound/effects/explosion4.ogg','sound/effects/explosion5.ogg') + sound = pick('sound/effects/explosion1.ogg','sound/effects/explosion2.ogg','sound/effects/explosion3.ogg','sound/effects/explosion4.ogg','sound/effects/explosion5.ogg') if("bigboom") - S = pick('sound/effects/bigboom1.ogg','sound/effects/bigboom2.ogg','sound/effects/bigboom3.ogg','sound/effects/bigboom4.ogg') + sound = pick('sound/effects/bigboom1.ogg','sound/effects/bigboom2.ogg','sound/effects/bigboom3.ogg','sound/effects/bigboom4.ogg') if("sparks") - S = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg') + sound = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg') if("rustle") - S = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg') + sound = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg') if("toolbox") - S = pick('sound/effects/toolbox.ogg') + sound = pick('sound/effects/toolbox.ogg') if("pillbottle") - S = pick('sound/effects/pillbottle.ogg') + sound = pick('sound/effects/pillbottle.ogg') if("rip") - S = pick('sound/effects/rip1.ogg','sound/effects/rip2.ogg') + sound = pick('sound/effects/rip1.ogg','sound/effects/rip2.ogg') if("lighter") - S = pick('sound/effects/lighter1.ogg','sound/effects/lighter2.ogg','sound/effects/lighter3.ogg') + sound = pick('sound/effects/lighter1.ogg','sound/effects/lighter2.ogg','sound/effects/lighter3.ogg') if("zippo_open") - S = pick('sound/effects/zippo_open.ogg') + sound = pick('sound/effects/zippo_open.ogg') if("zippo_close") - S = pick('sound/effects/zippo_close.ogg') + sound = pick('sound/effects/zippo_close.ogg') if("bonk") //somewhat quiet, increase volume - S = pick('sound/machines/bonk.ogg') + sound = pick('sound/machines/bonk.ogg') if("cane_step") - S = pick('sound/items/cane_step_1.ogg', 'sound/items/cane_step_2.ogg', 'sound/items/cane_step_3.ogg', 'sound/items/cane_step_4.ogg', 'sound/items/cane_step_5.ogg', ) + sound = pick('sound/items/cane_step_1.ogg', 'sound/items/cane_step_2.ogg', 'sound/items/cane_step_3.ogg', 'sound/items/cane_step_4.ogg', 'sound/items/cane_step_5.ogg', ) if("match") - S = pick('sound/effects/match.ogg') + sound = pick('sound/effects/match.ogg') if("punch") - S = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg') + sound = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg') if("swing_hit") - S = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg') + sound = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg') if("clan_sword_hit") - S = pick('sound/weapons/clan_sword_hit_1.ogg', 'sound/weapons/clan_sword_hit_2.ogg') + sound = pick('sound/weapons/clan_sword_hit_1.ogg', 'sound/weapons/clan_sword_hit_2.ogg') if("slam") - S = pick('sound/effects/slam1.ogg','sound/effects/slam2.ogg','sound/effects/slam3.ogg', 0.1;'sound/effects/slam_rare_1.ogg') + sound = pick('sound/effects/slam1.ogg','sound/effects/slam2.ogg','sound/effects/slam3.ogg', 0.1;'sound/effects/slam_rare_1.ogg') if("pageturn") - S = pick('sound/effects/pageturn1.ogg', 'sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg') + sound = pick('sound/effects/pageturn1.ogg', 'sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg') if("terminal_button") - S = pick('sound/machines/terminal_button01.ogg', 'sound/machines/terminal_button02.ogg', 'sound/machines/terminal_button03.ogg','sound/machines/terminal_button04.ogg', 'sound/machines/terminal_button05.ogg', 'sound/machines/terminal_button06.ogg', 'sound/machines/terminal_button07.ogg', 'sound/machines/terminal_button08.ogg') + sound = pick('sound/machines/terminal_button01.ogg', 'sound/machines/terminal_button02.ogg', 'sound/machines/terminal_button03.ogg','sound/machines/terminal_button04.ogg', 'sound/machines/terminal_button05.ogg', 'sound/machines/terminal_button06.ogg', 'sound/machines/terminal_button07.ogg', 'sound/machines/terminal_button08.ogg') if("keyboard") - S = pick('sound/machines/keyboard1.ogg', 'sound/machines/keyboard2.ogg','sound/machines/keyboard3.ogg') + sound = pick('sound/machines/keyboard1.ogg', 'sound/machines/keyboard2.ogg','sound/machines/keyboard3.ogg') if("keyboard_alt") - S = pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg') + sound = pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg') if("gunrustle") - S = pick('sound/effects/gunrustle1.ogg', 'sound/effects/gunrustle2.ogg','sound/effects/gunrustle3.ogg') + sound = pick('sound/effects/gunrustle1.ogg', 'sound/effects/gunrustle2.ogg','sound/effects/gunrustle3.ogg') if("gunequip") - S = pick('sound/handling/gunequip1.ogg','sound/handling/gunequip2.ogg','sound/handling/gunequip3.ogg') + sound = pick('sound/handling/gunequip1.ogg','sound/handling/gunequip2.ogg','sound/handling/gunequip3.ogg') if("shotgunpump") - S = pick('sound/weapons/shotgunpump1.ogg','sound/weapons/shotgunpump2.ogg') + sound = pick('sound/weapons/shotgunpump1.ogg','sound/weapons/shotgunpump2.ogg') if("clothingrustle") - S = pick('sound/handling/clothingrustle1.ogg', 'sound/handling/clothingrustle2.ogg','sound/handling/clothingrustle3.ogg','sound/handling/clothingrustle4.ogg','sound/handling/clothingrustle5.ogg') + sound = pick('sound/handling/clothingrustle1.ogg', 'sound/handling/clothingrustle2.ogg','sound/handling/clothingrustle3.ogg','sound/handling/clothingrustle4.ogg','sound/handling/clothingrustle5.ogg') if("armorequip") - S = pick('sound/handling/armorequip_1.ogg','sound/handling/armorequip_2.ogg') + sound = pick('sound/handling/armorequip_1.ogg','sound/handling/armorequip_2.ogg') if("pry") - S = pick('sound/effects/pry1.ogg', 'sound/effects/pry2.ogg','sound/effects/pry3.ogg','sound/effects/pry4.ogg') + sound = pick('sound/effects/pry1.ogg', 'sound/effects/pry2.ogg','sound/effects/pry3.ogg','sound/effects/pry4.ogg') if("metalbang") - S = pick('sound/effects/thud1.ogg','sound/effects/thud2.ogg','sound/effects/thud3.ogg') + sound = pick('sound/effects/thud1.ogg','sound/effects/thud2.ogg','sound/effects/thud3.ogg') if("paper_writing") - S = pick('sound/items/writing_noises/paper_writing_1.wav', 'sound/items/writing_noises/paper_writing_2.wav', 'sound/items/writing_noises/paper_writing_3.wav', 'sound/items/writing_noises/paper_writing_4.ogg') + sound = pick('sound/items/writing_noises/paper_writing_1.wav', 'sound/items/writing_noises/paper_writing_2.wav', 'sound/items/writing_noises/paper_writing_3.wav', 'sound/items/writing_noises/paper_writing_4.ogg') // Weapons/bullets if("shell_load") - S = pick('sound/weapons/shell_load1.ogg','sound/weapons/shell_load2.ogg','sound/weapons/shell_load3.ogg','sound/weapons/shell_load4.ogg') + sound = pick('sound/weapons/shell_load1.ogg','sound/weapons/shell_load2.ogg','sound/weapons/shell_load3.ogg','sound/weapons/shell_load4.ogg') if("ballistic_hit") - S = pick('sound/bullets/bullet_impact1.ogg','sound/bullets/bullet_impact2.ogg','sound/bullets/bullet_impact1.ogg','sound/bullets/impact_flesh_1.ogg','sound/bullets/impact_flesh_2.ogg','sound/bullets/impact_flesh_3.ogg','sound/bullets/impact_flesh_4.ogg') + sound = pick('sound/bullets/bullet_impact1.ogg','sound/bullets/bullet_impact2.ogg','sound/bullets/bullet_impact1.ogg','sound/bullets/impact_flesh_1.ogg','sound/bullets/impact_flesh_2.ogg','sound/bullets/impact_flesh_3.ogg','sound/bullets/impact_flesh_4.ogg') if("ballistic_armor") - S = pick('sound/bullets/bullet_armor1.ogg','sound/bullets/bullet_armor2.ogg','sound/bullets/bullet_armor3.ogg','sound/bullets/bullet_armor4.ogg') + sound = pick('sound/bullets/bullet_armor1.ogg','sound/bullets/bullet_armor2.ogg','sound/bullets/bullet_armor3.ogg','sound/bullets/bullet_armor4.ogg') if("ballistic_miss") - S = pick('sound/bullets/bullet_miss1.ogg','sound/bullets/bullet_miss2.ogg','sound/bullets/bullet_miss3.ogg','sound/bullets/bullet_miss4.ogg') + sound = pick('sound/bullets/bullet_miss1.ogg','sound/bullets/bullet_miss2.ogg','sound/bullets/bullet_miss3.ogg','sound/bullets/bullet_miss4.ogg') if("ballistic_bounce") - S = pick('sound/bullets/bullet_ricochet1.ogg','sound/bullets/bullet_ricochet2.ogg','sound/bullets/bullet_ricochet3.ogg','sound/bullets/bullet_ricochet4.ogg','sound/bullets/bullet_ricochet5.ogg','sound/bullets/bullet_ricochet6.ogg','sound/bullets/bullet_ricochet7.ogg','sound/bullets/bullet_ricochet8.ogg') + sound = pick('sound/bullets/bullet_ricochet1.ogg','sound/bullets/bullet_ricochet2.ogg','sound/bullets/bullet_ricochet3.ogg','sound/bullets/bullet_ricochet4.ogg','sound/bullets/bullet_ricochet5.ogg','sound/bullets/bullet_ricochet6.ogg','sound/bullets/bullet_ricochet7.ogg','sound/bullets/bullet_ricochet8.ogg') if("ballistic_shield_hit") - S = pick('sound/bullets/shield_impact_c1.ogg','sound/bullets/shield_impact_c2.ogg','sound/bullets/shield_impact_c3.ogg','sound/bullets/shield_impact_c4.ogg') + sound = pick('sound/bullets/shield_impact_c1.ogg','sound/bullets/shield_impact_c2.ogg','sound/bullets/shield_impact_c3.ogg','sound/bullets/shield_impact_c4.ogg') if("shield_shatter") - S = pick('sound/bullets/shield_break_c1.ogg') + sound = pick('sound/bullets/shield_break_c1.ogg') if("rocket_bounce") - S = pick('sound/bullets/rocket_ricochet1.ogg','sound/bullets/rocket_ricochet2.ogg','sound/bullets/rocket_ricochet3.ogg') + sound = pick('sound/bullets/rocket_ricochet1.ogg','sound/bullets/rocket_ricochet2.ogg','sound/bullets/rocket_ricochet3.ogg') if("energy_hit") - S = pick('sound/bullets/energy_impact1.ogg') + sound = pick('sound/bullets/energy_impact1.ogg') if("energy_miss") - S = pick('sound/bullets/energy_miss1.ogg') + sound = pick('sound/bullets/energy_miss1.ogg') if("energy_bounce") - S = pick('sound/bullets/energy_ricochet1.ogg') + sound = pick('sound/bullets/energy_ricochet1.ogg') if("alloy_hit") - S = pick('sound/bullets/spear_impact1.ogg') + sound = pick('sound/bullets/spear_impact1.ogg') if("alloy_armor") - S = pick('sound/bullets/spear_armor1.ogg') + sound = pick('sound/bullets/spear_armor1.ogg') if("alloy_bounce") - S = pick('sound/bullets/spear_ricochet1.ogg','sound/bullets/spear_ricochet2.ogg') + sound = pick('sound/bullets/spear_ricochet1.ogg','sound/bullets/spear_ricochet2.ogg') if("gun_silenced") - S = pick('sound/weapons/gun_silenced_shot1.ogg','sound/weapons/gun_silenced_shot2.ogg') + sound = pick('sound/weapons/gun_silenced_shot1.ogg','sound/weapons/gun_silenced_shot2.ogg') if("gun_pulse") - S = pick('sound/weapons/gun_m41a_1.ogg','sound/weapons/gun_m41a_2.ogg','sound/weapons/gun_m41a_3.ogg','sound/weapons/gun_m41a_4.ogg','sound/weapons/gun_m41a_5.ogg','sound/weapons/gun_m41a_6.ogg') + sound = pick('sound/weapons/gun_m41a_1.ogg','sound/weapons/gun_m41a_2.ogg','sound/weapons/gun_m41a_3.ogg','sound/weapons/gun_m41a_4.ogg','sound/weapons/gun_m41a_5.ogg','sound/weapons/gun_m41a_6.ogg') if("gun_smartgun") - S = pick('sound/weapons/gun_smartgun1.ogg', 'sound/weapons/gun_smartgun2.ogg', 'sound/weapons/gun_smartgun3.ogg', 'sound/weapons/gun_smartgun4.ogg') + sound = pick('sound/weapons/gun_smartgun1.ogg', 'sound/weapons/gun_smartgun2.ogg', 'sound/weapons/gun_smartgun3.ogg', 'sound/weapons/gun_smartgun4.ogg') if("gun_smartgun_rattle") - S = pick('sound/weapons/gun_smartgun1_rattle.ogg', 'sound/weapons/gun_smartgun2_rattle.ogg', 'sound/weapons/gun_smartgun3_rattle.ogg', 'sound/weapons/gun_smartgun4_rattle.ogg') + sound = pick('sound/weapons/gun_smartgun1_rattle.ogg', 'sound/weapons/gun_smartgun2_rattle.ogg', 'sound/weapons/gun_smartgun3_rattle.ogg', 'sound/weapons/gun_smartgun4_rattle.ogg') if("gun_jam_rack") - S = pick('sound/weapons/handling/gun_jam_rack_1.ogg', 'sound/weapons/handling/gun_jam_rack_2.ogg', 'sound/weapons/handling/gun_jam_rack_3.ogg') + sound = pick('sound/weapons/handling/gun_jam_rack_1.ogg', 'sound/weapons/handling/gun_jam_rack_2.ogg', 'sound/weapons/handling/gun_jam_rack_3.ogg') //A:CM gun sounds if("gun_shotgun_tactical") - S = pick('sound/weapons/gun_shotgun_tactical_1.ogg','sound/weapons/gun_shotgun_tactical_2.ogg','sound/weapons/gun_shotgun_tactical_3.ogg','sound/weapons/gun_shotgun_tactical_4.ogg') + sound = pick('sound/weapons/gun_shotgun_tactical_1.ogg','sound/weapons/gun_shotgun_tactical_2.ogg','sound/weapons/gun_shotgun_tactical_3.ogg','sound/weapons/gun_shotgun_tactical_4.ogg') if("m4a3") - S = pick('sound/weapons/gun_m4a3_1.ogg','sound/weapons/gun_m4a3_2.ogg','sound/weapons/gun_m4a3_3.ogg','sound/weapons/gun_m4a3_4.ogg','sound/weapons/gun_m4a3_5.ogg') + sound = pick('sound/weapons/gun_m4a3_1.ogg','sound/weapons/gun_m4a3_2.ogg','sound/weapons/gun_m4a3_3.ogg','sound/weapons/gun_m4a3_4.ogg','sound/weapons/gun_m4a3_5.ogg') if("88m4") - S = pick('sound/weapons/gun_88m4_v7.ogg') + sound = pick('sound/weapons/gun_88m4_v7.ogg') if("gun_casing_shotgun") - S = pick ('sound/bullets/bulletcasing_shotgun_fall1.ogg') + sound = pick ('sound/bullets/bulletcasing_shotgun_fall1.ogg') if("gun_nsg23") - S = pick('sound/weapons/gun_nsg23_1.ogg','sound/weapons/gun_nsg23_2.ogg') + sound = pick('sound/weapons/gun_nsg23_1.ogg','sound/weapons/gun_nsg23_2.ogg') if("gun_pkd") - S = pick('sound/weapons/gun_pkd_fire01.ogg','sound/weapons/gun_pkd_fire02.ogg','sound/weapons/gun_pkd_fire03.ogg') + sound = pick('sound/weapons/gun_pkd_fire01.ogg','sound/weapons/gun_pkd_fire02.ogg','sound/weapons/gun_pkd_fire03.ogg') // Xeno if("acid_hit") - S = pick('sound/bullets/acid_impact1.ogg') + sound = pick('sound/bullets/acid_impact1.ogg') if("acid_strike") - S = pick('sound/weapons/alien_acidstrike1.ogg','sound/weapons/alien_acidstrike2.ogg') + sound = pick('sound/weapons/alien_acidstrike1.ogg','sound/weapons/alien_acidstrike2.ogg') if("acid_spit") - S = pick('sound/voice/alien_spitacid.ogg','sound/voice/alien_spitacid2.ogg') + sound = pick('sound/voice/alien_spitacid.ogg','sound/voice/alien_spitacid2.ogg') if("acid_sizzle") - S = pick('sound/effects/acid_sizzle1.ogg','sound/effects/acid_sizzle2.ogg','sound/effects/acid_sizzle3.ogg','sound/effects/acid_sizzle4.ogg') + sound = pick('sound/effects/acid_sizzle1.ogg','sound/effects/acid_sizzle2.ogg','sound/effects/acid_sizzle3.ogg','sound/effects/acid_sizzle4.ogg') if("alien_doorpry") - S = pick('sound/effects/alien_doorpry1.ogg','sound/effects/alien_doorpry2.ogg') + sound = pick('sound/effects/alien_doorpry1.ogg','sound/effects/alien_doorpry2.ogg') if("acid_bounce") - S = pick('sound/bullets/acid_impact1.ogg') + sound = pick('sound/bullets/acid_impact1.ogg') if("alien_claw_flesh") - S = pick('sound/weapons/alien_claw_flesh1.ogg','sound/weapons/alien_claw_flesh2.ogg','sound/weapons/alien_claw_flesh3.ogg','sound/weapons/alien_claw_flesh4.ogg','sound/weapons/alien_claw_flesh5.ogg','sound/weapons/alien_claw_flesh6.ogg') + sound = pick('sound/weapons/alien_claw_flesh1.ogg','sound/weapons/alien_claw_flesh2.ogg','sound/weapons/alien_claw_flesh3.ogg','sound/weapons/alien_claw_flesh4.ogg','sound/weapons/alien_claw_flesh5.ogg','sound/weapons/alien_claw_flesh6.ogg') if("alien_claw_metal") - S = pick('sound/weapons/alien_claw_metal1.ogg','sound/weapons/alien_claw_metal2.ogg','sound/weapons/alien_claw_metal3.ogg') + sound = pick('sound/weapons/alien_claw_metal1.ogg','sound/weapons/alien_claw_metal2.ogg','sound/weapons/alien_claw_metal3.ogg') if("alien_bite") - S = pick('sound/weapons/alien_bite1.ogg','sound/weapons/alien_bite2.ogg') + sound = pick('sound/weapons/alien_bite1.ogg','sound/weapons/alien_bite2.ogg') if("alien_footstep_large") - S = pick('sound/effects/alien_footstep_large1.ogg','sound/effects/alien_footstep_large2.ogg','sound/effects/alien_footstep_large3.ogg') + sound = pick('sound/effects/alien_footstep_large1.ogg','sound/effects/alien_footstep_large2.ogg','sound/effects/alien_footstep_large3.ogg') if("alien_footstep_medium") - S = pick('sound/effects/alien_footstep_medium1.ogg','sound/effects/alien_footstep_medium2.ogg','sound/effects/alien_footstep_medium3.ogg') + sound = pick('sound/effects/alien_footstep_medium1.ogg','sound/effects/alien_footstep_medium2.ogg','sound/effects/alien_footstep_medium3.ogg') if("alien_charge") - S = pick('sound/effects/alien_footstep_charge1.ogg','sound/effects/alien_footstep_charge2.ogg','sound/effects/alien_footstep_charge3.ogg') + sound = pick('sound/effects/alien_footstep_charge1.ogg','sound/effects/alien_footstep_charge2.ogg','sound/effects/alien_footstep_charge3.ogg') if("alien_resin_build") - S = pick('sound/effects/alien_resin_build1.ogg','sound/effects/alien_resin_build2.ogg','sound/effects/alien_resin_build3.ogg') + sound = pick('sound/effects/alien_resin_build1.ogg','sound/effects/alien_resin_build2.ogg','sound/effects/alien_resin_build3.ogg') if("alien_resin_break") - S = pick('sound/effects/alien_resin_break1.ogg','sound/effects/alien_resin_break2.ogg','sound/effects/alien_resin_break3.ogg') + sound = pick('sound/effects/alien_resin_break1.ogg','sound/effects/alien_resin_break2.ogg','sound/effects/alien_resin_break3.ogg') if("alien_resin_move") - S = pick('sound/effects/alien_resin_move1.ogg','sound/effects/alien_resin_move2.ogg') + sound = pick('sound/effects/alien_resin_move1.ogg','sound/effects/alien_resin_move2.ogg') if("alien_talk") - S = pick('sound/voice/alien_talk.ogg','sound/voice/alien_talk2.ogg','sound/voice/alien_talk3.ogg') + sound = pick('sound/voice/alien_talk.ogg','sound/voice/alien_talk2.ogg','sound/voice/alien_talk3.ogg') if("hiss_talk") - S = pick('sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg') + sound = pick('sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg') if("alien_growl") - S = pick('sound/voice/alien_growl1.ogg','sound/voice/alien_growl2.ogg','sound/voice/alien_growl3.ogg') + sound = pick('sound/voice/alien_growl1.ogg','sound/voice/alien_growl2.ogg','sound/voice/alien_growl3.ogg') if("alien_hiss") - S = pick('sound/voice/alien_hiss1.ogg','sound/voice/alien_hiss2.ogg','sound/voice/alien_hiss3.ogg') + sound = pick('sound/voice/alien_hiss1.ogg','sound/voice/alien_hiss2.ogg','sound/voice/alien_hiss3.ogg') if("alien_tail_swipe") - S = pick('sound/effects/alien_tail_swipe1.ogg','sound/effects/alien_tail_swipe2.ogg','sound/effects/alien_tail_swipe3.ogg') + sound = pick('sound/effects/alien_tail_swipe1.ogg','sound/effects/alien_tail_swipe2.ogg','sound/effects/alien_tail_swipe3.ogg') if("alien_help") - S = pick('sound/voice/alien_help1.ogg','sound/voice/alien_help2.ogg','sound/voice/alien_help3.ogg') + sound = pick('sound/voice/alien_help1.ogg','sound/voice/alien_help2.ogg','sound/voice/alien_help3.ogg') if("alien_drool") - S = pick('sound/voice/alien_drool1.ogg','sound/voice/alien_drool2.ogg') + sound = pick('sound/voice/alien_drool1.ogg','sound/voice/alien_drool2.ogg') if("alien_roar") - S = pick('sound/voice/alien_roar1.ogg','sound/voice/alien_roar2.ogg','sound/voice/alien_roar3.ogg','sound/voice/alien_roar4.ogg','sound/voice/alien_roar5.ogg','sound/voice/alien_roar6.ogg') + sound = pick('sound/voice/alien_roar1.ogg','sound/voice/alien_roar2.ogg','sound/voice/alien_roar3.ogg','sound/voice/alien_roar4.ogg','sound/voice/alien_roar5.ogg','sound/voice/alien_roar6.ogg') if("alien_roar_larva") - S = pick('sound/voice/alien_roar_larva1.ogg','sound/voice/alien_roar_larva2.ogg') + sound = pick('sound/voice/alien_roar_larva1.ogg','sound/voice/alien_roar_larva2.ogg') if("queen") - S = pick('sound/voice/alien_queen_command.ogg','sound/voice/alien_queen_command2.ogg','sound/voice/alien_queen_command3.ogg') + sound = pick('sound/voice/alien_queen_command.ogg','sound/voice/alien_queen_command2.ogg','sound/voice/alien_queen_command3.ogg') // Human if("male_scream") - S = pick('sound/voice/human_male_scream_1.ogg','sound/voice/human_male_scream_2.ogg','sound/voice/human_male_scream_3.ogg','sound/voice/human_male_scream_4.ogg',5;'sound/voice/human_male_scream_5.ogg',5;'sound/voice/human_jackson_scream.ogg',5;'sound/voice/human_ack_scream.ogg','sound/voice/human_male_scream_6.ogg') + sound = pick('sound/voice/human_male_scream_1.ogg','sound/voice/human_male_scream_2.ogg','sound/voice/human_male_scream_3.ogg','sound/voice/human_male_scream_4.ogg',5;'sound/voice/human_male_scream_5.ogg',5;'sound/voice/human_jackson_scream.ogg',5;'sound/voice/human_ack_scream.ogg','sound/voice/human_male_scream_6.ogg') if("male_pain") - S = pick('sound/voice/human_male_pain_1.ogg','sound/voice/human_male_pain_2.ogg','sound/voice/human_male_pain_3.ogg',5;'sound/voice/tomscream.ogg',5;'sound/voice/human_bobby_pain.ogg',5;'sound/voice/human_tantrum_scream.ogg', 5;'sound/voice/human_male_pain_rare_1.ogg') + sound = pick('sound/voice/human_male_pain_1.ogg','sound/voice/human_male_pain_2.ogg','sound/voice/human_male_pain_3.ogg',5;'sound/voice/tomscream.ogg',5;'sound/voice/human_bobby_pain.ogg',5;'sound/voice/human_tantrum_scream.ogg', 5;'sound/voice/human_male_pain_rare_1.ogg') if("male_fragout") - S = pick('sound/voice/human_male_grenadethrow_1.ogg', 'sound/voice/human_male_grenadethrow_2.ogg', 'sound/voice/human_male_grenadethrow_3.ogg') + sound = pick('sound/voice/human_male_grenadethrow_1.ogg', 'sound/voice/human_male_grenadethrow_2.ogg', 'sound/voice/human_male_grenadethrow_3.ogg') if("male_warcry") - S = pick('sound/voice/warcry/male_go.ogg', 'sound/voice/warcry/male_attack.ogg', 'sound/voice/warcry/male_charge.ogg', 'sound/voice/warcry/male_charge2.ogg', 'sound/voice/warcry/warcry_male_1.ogg', 'sound/voice/warcry/warcry_male_2.ogg', 'sound/voice/warcry/warcry_male_3.ogg', 'sound/voice/warcry/warcry_male_4.ogg', 'sound/voice/warcry/warcry_male_5.ogg', 'sound/voice/warcry/warcry_male_6.ogg', 'sound/voice/warcry/warcry_male_7.ogg', 'sound/voice/warcry/warcry_male_8.ogg', 'sound/voice/warcry/warcry_male_9.ogg', 'sound/voice/warcry/warcry_male_10.ogg', 'sound/voice/warcry/warcry_male_11.ogg', 'sound/voice/warcry/warcry_male_12.ogg', 'sound/voice/warcry/warcry_male_13.ogg', 'sound/voice/warcry/warcry_male_14.ogg', 'sound/voice/warcry/warcry_male_15.ogg', 'sound/voice/warcry/warcry_male_16.ogg', 'sound/voice/warcry/warcry_male_17.ogg', 'sound/voice/warcry/warcry_male_18.ogg', 'sound/voice/warcry/warcry_male_19.ogg', 'sound/voice/warcry/warcry_male_20.ogg', 'sound/voice/warcry/warcry_male_21.ogg', 'sound/voice/warcry/warcry_male_22.ogg', 'sound/voice/warcry/warcry_male_23.ogg', 'sound/voice/warcry/warcry_male_24.ogg', 'sound/voice/warcry/warcry_male_25.ogg', 'sound/voice/warcry/warcry_male_26.ogg', 'sound/voice/warcry/warcry_male_27.ogg', 'sound/voice/warcry/warcry_male_28.ogg', 'sound/voice/warcry/warcry_male_29.ogg', 'sound/voice/warcry/warcry_male_30.ogg', 'sound/voice/warcry/warcry_male_31.ogg', 'sound/voice/warcry/warcry_male_32.ogg', 'sound/voice/warcry/warcry_male_33.ogg', 'sound/voice/warcry/warcry_male_34.ogg', 'sound/voice/warcry/warcry_male_35.ogg', 5;'sound/voice/warcry/warcry_male_rare_1.ogg', 5;'sound/voice/warcry/warcry_male_rare_2.ogg', 5;'sound/voice/warcry/warcry_male_rare_3.ogg', 5;'sound/voice/warcry/warcry_male_rare_4.ogg', 5;'sound/voice/warcry/warcry_male_rare_5.ogg') + sound = pick('sound/voice/warcry/male_go.ogg', 'sound/voice/warcry/male_attack.ogg', 'sound/voice/warcry/male_charge.ogg', 'sound/voice/warcry/male_charge2.ogg', 'sound/voice/warcry/warcry_male_1.ogg', 'sound/voice/warcry/warcry_male_2.ogg', 'sound/voice/warcry/warcry_male_3.ogg', 'sound/voice/warcry/warcry_male_4.ogg', 'sound/voice/warcry/warcry_male_5.ogg', 'sound/voice/warcry/warcry_male_6.ogg', 'sound/voice/warcry/warcry_male_7.ogg', 'sound/voice/warcry/warcry_male_8.ogg', 'sound/voice/warcry/warcry_male_9.ogg', 'sound/voice/warcry/warcry_male_10.ogg', 'sound/voice/warcry/warcry_male_11.ogg', 'sound/voice/warcry/warcry_male_12.ogg', 'sound/voice/warcry/warcry_male_13.ogg', 'sound/voice/warcry/warcry_male_14.ogg', 'sound/voice/warcry/warcry_male_15.ogg', 'sound/voice/warcry/warcry_male_16.ogg', 'sound/voice/warcry/warcry_male_17.ogg', 'sound/voice/warcry/warcry_male_18.ogg', 'sound/voice/warcry/warcry_male_19.ogg', 'sound/voice/warcry/warcry_male_20.ogg', 'sound/voice/warcry/warcry_male_21.ogg', 'sound/voice/warcry/warcry_male_22.ogg', 'sound/voice/warcry/warcry_male_23.ogg', 'sound/voice/warcry/warcry_male_24.ogg', 'sound/voice/warcry/warcry_male_25.ogg', 'sound/voice/warcry/warcry_male_26.ogg', 'sound/voice/warcry/warcry_male_27.ogg', 'sound/voice/warcry/warcry_male_28.ogg', 'sound/voice/warcry/warcry_male_29.ogg', 'sound/voice/warcry/warcry_male_30.ogg', 'sound/voice/warcry/warcry_male_31.ogg', 'sound/voice/warcry/warcry_male_32.ogg', 'sound/voice/warcry/warcry_male_33.ogg', 'sound/voice/warcry/warcry_male_34.ogg', 'sound/voice/warcry/warcry_male_35.ogg', 5;'sound/voice/warcry/warcry_male_rare_1.ogg', 5;'sound/voice/warcry/warcry_male_rare_2.ogg', 5;'sound/voice/warcry/warcry_male_rare_3.ogg', 5;'sound/voice/warcry/warcry_male_rare_4.ogg', 5;'sound/voice/warcry/warcry_male_rare_5.ogg') if("male_upp_warcry") - S = pick('sound/voice/upp_warcry/warcry_male_1.ogg', 'sound/voice/upp_warcry/warcry_male_2.ogg') + sound = pick('sound/voice/upp_warcry/warcry_male_1.ogg', 'sound/voice/upp_warcry/warcry_male_2.ogg') if("female_scream") - S = pick('sound/voice/human_female_scream_1.ogg','sound/voice/human_female_scream_2.ogg','sound/voice/human_female_scream_3.ogg','sound/voice/human_female_scream_4.ogg',5;'sound/voice/human_female_scream_5.ogg') + sound = pick('sound/voice/human_female_scream_1.ogg','sound/voice/human_female_scream_2.ogg','sound/voice/human_female_scream_3.ogg','sound/voice/human_female_scream_4.ogg',5;'sound/voice/human_female_scream_5.ogg') if("female_pain") - S = pick('sound/voice/human_female_pain_1.ogg','sound/voice/human_female_pain_2.ogg','sound/voice/human_female_pain_3.ogg') + sound = pick('sound/voice/human_female_pain_1.ogg','sound/voice/human_female_pain_2.ogg','sound/voice/human_female_pain_3.ogg') if("female_fragout") - S = pick("sound/voice/human_female_grenadethrow_1.ogg", 'sound/voice/human_female_grenadethrow_2.ogg', 'sound/voice/human_female_grenadethrow_3.ogg') + sound = pick("sound/voice/human_female_grenadethrow_1.ogg", 'sound/voice/human_female_grenadethrow_2.ogg', 'sound/voice/human_female_grenadethrow_3.ogg') if("female_warcry") - S = pick('sound/voice/warcry/female_charge.ogg', 'sound/voice/warcry/female_yell1.ogg', 'sound/voice/warcry/warcry_female_1.ogg', 'sound/voice/warcry/warcry_female_2.ogg', 'sound/voice/warcry/warcry_female_3.ogg', 'sound/voice/warcry/warcry_female_4.ogg', 'sound/voice/warcry/warcry_female_5.ogg', 'sound/voice/warcry/warcry_female_6.ogg', 'sound/voice/warcry/warcry_female_7.ogg', 'sound/voice/warcry/warcry_female_8.ogg', 'sound/voice/warcry/warcry_female_9.ogg', 'sound/voice/warcry/warcry_female_10.ogg', 'sound/voice/warcry/warcry_female_11.ogg', 'sound/voice/warcry/warcry_female_12.ogg', 'sound/voice/warcry/warcry_female_13.ogg', 'sound/voice/warcry/warcry_female_14.ogg', 'sound/voice/warcry/warcry_female_15.ogg', 'sound/voice/warcry/warcry_female_16.ogg', 'sound/voice/warcry/warcry_female_17.ogg', 'sound/voice/warcry/warcry_female_18.ogg', 'sound/voice/warcry/warcry_female_19.ogg', 'sound/voice/warcry/warcry_female_20.ogg') + sound = pick('sound/voice/warcry/female_charge.ogg', 'sound/voice/warcry/female_yell1.ogg', 'sound/voice/warcry/warcry_female_1.ogg', 'sound/voice/warcry/warcry_female_2.ogg', 'sound/voice/warcry/warcry_female_3.ogg', 'sound/voice/warcry/warcry_female_4.ogg', 'sound/voice/warcry/warcry_female_5.ogg', 'sound/voice/warcry/warcry_female_6.ogg', 'sound/voice/warcry/warcry_female_7.ogg', 'sound/voice/warcry/warcry_female_8.ogg', 'sound/voice/warcry/warcry_female_9.ogg', 'sound/voice/warcry/warcry_female_10.ogg', 'sound/voice/warcry/warcry_female_11.ogg', 'sound/voice/warcry/warcry_female_12.ogg', 'sound/voice/warcry/warcry_female_13.ogg', 'sound/voice/warcry/warcry_female_14.ogg', 'sound/voice/warcry/warcry_female_15.ogg', 'sound/voice/warcry/warcry_female_16.ogg', 'sound/voice/warcry/warcry_female_17.ogg', 'sound/voice/warcry/warcry_female_18.ogg', 'sound/voice/warcry/warcry_female_19.ogg', 'sound/voice/warcry/warcry_female_20.ogg') if("female_upp_warcry") - S = pick('sound/voice/upp_warcry/warcry_female_1.ogg', 'sound/voice/upp_warcry/warcry_female_2.ogg') + sound = pick('sound/voice/upp_warcry/warcry_female_1.ogg', 'sound/voice/upp_warcry/warcry_female_2.ogg') if("rtb_handset") - S = pick('sound/machines/telephone/rtb_handset_1.ogg', 'sound/machines/telephone/rtb_handset_2.ogg', 'sound/machines/telephone/rtb_handset_3.ogg', 'sound/machines/telephone/rtb_handset_4.ogg', 'sound/machines/telephone/rtb_handset_5.ogg') + sound = pick('sound/machines/telephone/rtb_handset_1.ogg', 'sound/machines/telephone/rtb_handset_2.ogg', 'sound/machines/telephone/rtb_handset_3.ogg', 'sound/machines/telephone/rtb_handset_4.ogg', 'sound/machines/telephone/rtb_handset_5.ogg') if("bone_break") - S = pick('sound/effects/bone_break1.ogg','sound/effects/bone_break2.ogg','sound/effects/bone_break3.ogg','sound/effects/bone_break4.ogg','sound/effects/bone_break5.ogg','sound/effects/bone_break6.ogg','sound/effects/bone_break7.ogg') + sound = pick('sound/effects/bone_break1.ogg','sound/effects/bone_break2.ogg','sound/effects/bone_break3.ogg','sound/effects/bone_break4.ogg','sound/effects/bone_break5.ogg','sound/effects/bone_break6.ogg','sound/effects/bone_break7.ogg') if("plush") - S = pick('sound/items/plush1.ogg', 'sound/items/plush2.ogg', 'sound/items/plush3.ogg') + sound = pick('sound/items/plush1.ogg', 'sound/items/plush2.ogg', 'sound/items/plush3.ogg') //misc mobs if("cat_meow") - S = pick('sound/voice/cat_meow_1.ogg','sound/voice/cat_meow_2.ogg','sound/voice/cat_meow_3.ogg','sound/voice/cat_meow_4.ogg','sound/voice/cat_meow_5.ogg','sound/voice/cat_meow_6.ogg','sound/voice/cat_meow_7.ogg') + sound = pick('sound/voice/cat_meow_1.ogg','sound/voice/cat_meow_2.ogg','sound/voice/cat_meow_3.ogg','sound/voice/cat_meow_4.ogg','sound/voice/cat_meow_5.ogg','sound/voice/cat_meow_6.ogg','sound/voice/cat_meow_7.ogg') if("pred_pain") - S = pick('sound/voice/pred_pain1.ogg','sound/voice/pred_pain2.ogg','sound/voice/pred_pain3.ogg','sound/voice/pred_pain4.ogg','sound/voice/pred_pain5.ogg',5;'sound/voice/pred_pain_rare1.ogg') + sound = pick('sound/voice/pred_pain1.ogg','sound/voice/pred_pain2.ogg','sound/voice/pred_pain3.ogg','sound/voice/pred_pain4.ogg','sound/voice/pred_pain5.ogg',5;'sound/voice/pred_pain_rare1.ogg') if("clownstep") - S = pick('sound/effects/clownstep1.ogg', 'sound/effects/clownstep2.ogg') - return S + sound = pick('sound/effects/clownstep1.ogg', 'sound/effects/clownstep2.ogg') + return sound /client/proc/generate_sound_queues() set name = "Queue sounds" @@ -388,21 +402,21 @@ var/x = tgui_input_number(usr, "Center X") var/y = tgui_input_number(usr, "Center Y") var/z = tgui_input_number(usr, "Z level") - var/datum/sound_template/S + var/datum/sound_template/template for(var/i = 1, i <= ammount, i++) - S = new - S.file = get_sfx("male_warcry") // warcry has variable length, lots of variations - S.channel = get_free_channel() // i'm convinced this is bad, but it's here to mirror playsound() behaviour - S.range = range - S.x = x - S.y = y - S.z = z - SSsound.queue(S) + template = new + template.file = get_sfx("male_warcry") // warcry has variable length, lots of variations + template.channel = get_free_channel() // i'm convinced this is bad, but it's here to mirror playsound() behaviour + template.range = range + template.x = x + template.y = y + template.z = z + SSsound.queue(template) /client/proc/sound_debug_query() set name = "Dump Playing Client Sounds" set desc = "dumps info about locally, playing sounds" set category = "Debug" - for(var/sound/S in SoundQuery()) - UNLINT(to_chat(src, "channel#[S.channel]: [S.status] - [S.file] - len=[S.len], wait=[S.wait], offset=[S.offset], repeat=[S.repeat]")) // unlint until spacemandmm suite-1.7 + for(var/sound/soundin in SoundQuery()) + UNLINT(to_chat(src, "channel#[soundin.channel]: [soundin.status] - [soundin.file] - len=[soundin.len], wait=[soundin.wait], offset=[soundin.offset], repeat=[soundin.repeat]")) // unlint until spacemandmm suite-1.7 diff --git a/code/modules/admin/verbs/adminpanelweapons.dm b/code/modules/admin/verbs/adminpanelweapons.dm index 9fde4e96ebee..26d6ca803b60 100644 --- a/code/modules/admin/verbs/adminpanelweapons.dm +++ b/code/modules/admin/verbs/adminpanelweapons.dm @@ -2,120 +2,68 @@ set name = "Weapons" set category = "Admin.Ship" - var/weapontype = tgui_alert(src, "What weapon?", "Choose wisely!", list("Missile", "Railgun"), 20 SECONDS) - if(!weapontype) - return - var/hiteta = tgui_input_number(src, "Give an ETA for the weapon to hit.", "Don't make them wait too long!", 10, 120, 10, 20 SECONDS) - if(!hiteta) - return - var/point_defense = tgui_alert(src, "Allow Point Defence of the ship to intercept, or for the weapon to miss?", "standard PD/miss chance is 30%.", list("Yes", "No"), 20 SECONDS) - if(!point_defense) - return - point_defense = point_defense == "Yes" - var/exactplace = tgui_alert(src, "Shoot it at random places, or where you're at?", "Choose wisely!", list("Random", "Where I am"), 20 SECONDS) - if(!exactplace) + var/list/datum/space_weapon/potential_weapons = list() + for(var/weapon_to_get in GLOB.space_weapons) + var/datum/space_weapon/weapon_to_set = GLOB.space_weapons[weapon_to_get] + LAZYSET(potential_weapons, weapon_to_set.name, weapon_to_set) + + var/weapon_type = tgui_input_list(src, "What weapon?", "Choose wisely!", potential_weapons) + if(!weapon_type) return - exactplace = exactplace == "Where I am" - var/salvo - var/quantity - if(exactplace == FALSE) - salvo = tgui_alert(src, "Make it a salvo or a single fire?", "Choose wisely!", list("Salvo", "Single"), 20 SECONDS) - if(!salvo) - return - salvo = salvo == "Salvo" - if(salvo == TRUE) - quantity = tgui_input_number(src, "How many?", "Don't go overboard. Please.", 2, 10, 2, 20 SECONDS) + var/list/ammo_type = list() + var/answer = tgui_alert(src, "Use all ammo types?", "Ammo selector", list("Yes", "No", "Cancel")) + if(answer == "Yes") + ammo_type = potential_weapons[weapon_type].possibly_ammunition + else if(answer == "No") + var/list/datum/space_weapon_ammo/potential_ammo = list() + for(var/ammo_to_get in potential_weapons[weapon_type].possibly_ammunition) + var/datum/space_weapon_ammo/ammo_to_set = GLOB.space_weapons_ammo[ammo_to_get] + LAZYSET(potential_ammo, ammo_to_set.name, ammo_to_get) - var/prompt = tgui_alert(src, "Are you sure you want to open fire at the USS Almayer with those parameters?", "Choose wisely!", list("Yes", "No"), 20 SECONDS) - if(prompt != "Yes") + while(length(potential_ammo)) + var/additional_ammo = tgui_input_list(src, "Choose ammo", "Ammo selector", potential_ammo, 20 SECONDS) + if(!additional_ammo) + break + ammo_type += potential_ammo[additional_ammo] + potential_ammo -= additional_ammo + else return - var/atom/picked_atom - var/list/targets = list() - switch(weapontype) - if("Missile") - if(exactplace == TRUE) - shipwide_ai_announcement("DANGER: MISSILE WARNING. LAUNCH DETECTED, BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS.", MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 1, mob.loc, point_defense), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a Single Missile at the Almayer at their own location, [mob.loc], with point defense as [point_defense]") - if(point_defense == TRUE) - var/spoolup = hiteta - 4 - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(shipwide_ai_announcement), "ATTENTION: TRACKING TARGET, SPOOLING UP POINT DEFENSE. ATTEMPTING TO INTERCEPT." , MAIN_AI_SYSTEM, 'sound/effects/supercapacitors_charging.ogg'), spoolup SECONDS) + if(!length(ammo_type)) + return - if(exactplace == FALSE) - if(salvo == TRUE) - shipwide_ai_announcement("DANGER: MISSILE SALVO DETECTED, BRACE, BRACE, BRACE. SALVO SIZE: [quantity], ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - targets = shipside_random_turf_picker(quantity) - if(targets == null) - tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) - return - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 1, targets, point_defense, salvo), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a salvo of [quantity] Missiles at the Almayer at random places, with point defense as [point_defense]") - if(point_defense == TRUE) - var/spoolup = hiteta - 4 - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(shipwide_ai_announcement), "ATTENTION: TRACKING TARGETS, SPOOLING UP POINT DEFENSE. ATTEMPTING TO INTERCEPT." , MAIN_AI_SYSTEM, 'sound/effects/supercapacitors_charging.ogg'), spoolup SECONDS) - else - shipwide_ai_announcement("DANGER: MISSILE WARNING. LAUNCH DETECTED, BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS.", MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - picked_atom = shipside_random_turf_picker(1) - if(picked_atom == null) - tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) - return - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 1, picked_atom, point_defense), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a Single Missile at the Almayer at a random place, [picked_atom], with point defense as [point_defense]") - if(point_defense == TRUE) - var/spoolup = hiteta - 4 - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(shipwide_ai_announcement), "ATTENTION: TRACKING TARGET, SPOOLING UP POINT DEFENSE. ATTEMPTING TO INTERCEPT." , MAIN_AI_SYSTEM, 'sound/effects/supercapacitors_charging.ogg'), spoolup SECONDS) + var/hit_eta = tgui_input_number(src, "Give an ETA for the weapon to hit.", "Don't make them wait too long!", 10, 120, 10, 20 SECONDS) + if(!hit_eta) + return - if("Railgun") - if(exactplace == TRUE) - shipwide_ai_announcement("DANGER: RAILGUN EMISSIONS DETECTED, INCOMING SHOT. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 2, mob.loc, point_defense), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a single Railgun Slug at the Almayer at their location, [mob.loc], with the possibility of missing as [point_defense]") + var/intercept_chance = tgui_input_number(src, "Chance Point Defence of the ship to intercept, or for the weapon to miss?", "standard PD chance is 0%.", 0, 100, 0, 20 SECONDS) + var/targets + var/quantity = 1 + if(tgui_alert(src, "Shoot it at random places, or where you're at?", "Choose wisely!", list("Random", "Where I am"), 20 SECONDS) == "Where I am") + targets = list(get_turf(mob)) + else + quantity = tgui_input_number(src, "How many?", "Don't go overboard. Please.", 1, 256, 1, 20 SECONDS) + targets = shipside_random_turf_picker(quantity) + + var/delay = tgui_input_number(src, "Give delay between hits in diceseconds (1/10 of second). (0 async hits, can cause emotional damage)", "Don't make them wait too long!", 0, 600, 0, 20 SECONDS) - if(exactplace == FALSE) - if(salvo == TRUE) - shipwide_ai_announcement("DANGER: RAILGUN EMISSIONS DETECTED, SALVO INCOMING. BRACE, BRACE, BRACE. SALVO SIZE: [quantity], ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - targets = shipside_random_turf_picker(quantity) - if(targets == null) - tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) - return - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 2, targets, point_defense, salvo), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a salvo of Railgun Slugs at the Almayer at random places, with the possibility of missing [point_defense]") - picked_atom = null - targets = null + if(tgui_alert(src, "Are you sure you want to open fire at the [MAIN_SHIP_NAME] with those parameters?", "Choose wisely!", list("Yes", "No")) != "Yes") + return - if(salvo == FALSE) - prompt = tgui_alert(src, "Are you sure you want to shoot a railgun slug at the USS Almayer at a random place?", "Choose wisely!", list("Yes", "No"), 20 SECONDS) - if(prompt == "Yes") - shipwide_ai_announcement("DANGER: RAILGUN EMISSIONS DETECTED, INCOMING SHOT. BRACE, BRACE, BRACE. ESTIMATED TIME: [hiteta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') - picked_atom = shipside_random_turf_picker(1) - if(picked_atom == null) - tgui_alert(src, "Uh oh! Something broke at this point! Contact the coders!", "Acknowledge!", list("ok."), 10 SECONDS) - return - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(weaponhits), 2, picked_atom, point_defense), hiteta SECONDS) - message_admins("[key_name_admin(src)] Fired a single Railgun Slug at the Almayer at a random location, [picked_atom], with the possibility of missing as [point_defense]") + potential_weapons[weapon_type].shot_message(length(targets), hit_eta) + addtimer(CALLBACK(potential_weapons[weapon_type], TYPE_PROC_REF(/datum/space_weapon, on_shot), targets, ammo_type, intercept_chance, delay), hit_eta SECONDS) + message_admins("[key_name_admin(src)] Fired [quantity] form [weapon_type] at the Almayer, with point defense as [intercept_chance]% with delay of [delay/10] seconds between hits") + if(intercept_chance) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(shipwide_ai_announcement), "ATTENTION: TRACKING TARGET[quantity > 1 ? "S" : ""], SPOOLING UP POINT DEFENSE. ATTEMPTING TO INTERCEPT." , MAIN_AI_SYSTEM, 'sound/effects/supercapacitors_charging.ogg'), (hit_eta - 4) SECONDS) /proc/shipside_random_turf_picker(turfquantity) - - var/picked_atom - var/picked_area var/list/targets = list() - var/list/turfs_of_area = list() - for(var/currentturf in 1 to turfquantity) - for(var/limiter in 1 to 120) - picked_area = pick(GLOB.ship_areas) - for(var/turf/my_turf in picked_area) + for(var/currentturf = 1 to turfquantity) + var/list/turfs_of_area = list() + for(var/area in GLOB.ship_areas) + for(var/turf/my_turf in area) turfs_of_area += my_turf - if(turfs_of_area.len > 0) - picked_atom = pick(turfs_of_area) - if (picked_atom != null) - targets += picked_atom - break - - if(targets.len < turfquantity) - return null - else - return targets - + targets += pick(turfs_of_area) + return targets diff --git a/code/modules/almayer/weaponhits.dm b/code/modules/almayer/weaponhits.dm index 1f3a566ebbda..8206fd79b504 100644 --- a/code/modules/almayer/weaponhits.dm +++ b/code/modules/almayer/weaponhits.dm @@ -1,123 +1,145 @@ -#define WEAPON_MISSILE 1 -#define WEAPON_RAILGUN 2 -#define HIT_CHANCE_CHEAT 100 -#define HIT_CHANCE_STANDARD 70 /** - * Proc called to hit the ship with weapons - * - * Hits the ship with the weapon of choice - * Calling Shakeship acoording to the weapon used - * All sounds that should happen when they hit are in here already. - * Probably doesn't work in other shipmaps. - * Arguments: - * * weaponused - chooses the weapon through a switchcase. 1 for missiles, 2 for railguns, 3 for particle cannons. - * * location - location in the ship where the explosion will be created. - * * point_defense - If you want the Almayer to attempt taking down the incoming fire - * * salvo - identifies it as a salvo or not. + * Space weapons it's self for ship to ship or PKO/Xeno PKO things */ -/proc/weaponhits(weaponused, location, point_defense = FALSE, salvo = FALSE) - - - switch(weaponused) - - if(WEAPON_MISSILE) - var/datum/cause_data/ashm_cause_data = create_cause_data("Anti-Ship missile") - if(point_defense == FALSE) - if(salvo == TRUE) - var/shotspacing - for(var/turf/picked_atom in location) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) - shotspacing += 1 - shakeship(10, 10, TRUE, FALSE) - weaponhits_effects(WEAPON_MISSILE) - else - cell_explosion(location, 350, 1, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) - shakeship(10, 10, TRUE, FALSE) - weaponhits_effects(WEAPON_MISSILE) - if(point_defense == TRUE) - var/hitchance = HIT_CHANCE_STANDARD - if(salvo == TRUE) - var/confirmedhit - var/shotspacing - for(var/turf/picked_atom in location) - if(prob(hitchance)) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cell_explosion), picked_atom, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data), shotspacing SECONDS) - shakeship(10, 10, TRUE, FALSE) - confirmedhit += 1 - else - weaponhits_effects(WEAPON_MISSILE, TRUE, shotspacing) - - shotspacing += 1 - if(confirmedhit > 0) - weaponhits_effects(WEAPON_MISSILE, FALSE) - confirmedhit = 0 - else - if(prob(hitchance)) - cell_explosion(location, 400, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, ashm_cause_data) - shakeship(10, 10, TRUE, FALSE) - weaponhits_effects(WEAPON_MISSILE, FALSE) - else - weaponhits_effects(WEAPON_MISSILE, TRUE) - - if(WEAPON_RAILGUN) - var/datum/cause_data/antishiprailgun_cause_data = create_cause_data("Railgun shot") - var/hitchance = HIT_CHANCE_CHEAT - if(point_defense == TRUE) - hitchance = HIT_CHANCE_STANDARD - if(salvo == TRUE) - var/confirmedhit - for(var/turf/picked_atom in location) - if(prob(hitchance)) - cell_explosion(picked_atom, 600, 600, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, antishiprailgun_cause_data) - shakeship(5, 5, FALSE, FALSE) - confirmedhit += 1 - if(confirmedhit > 0) - weaponhits_effects(WEAPON_RAILGUN) - if(confirmedhit < 1) - weaponhits_effects(WEAPON_RAILGUN, TRUE) - - else if(salvo == FALSE) - if(prob(hitchance)) - cell_explosion(location, 600, 600, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, antishiprailgun_cause_data) - shakeship(5, 5, FALSE, FALSE) - weaponhits_effects(WEAPON_RAILGUN) - else - weaponhits_effects(WEAPON_RAILGUN, TRUE) - -/proc/weaponhits_effects(weaponused, weaponmiss = FALSE, shotspacing = 0) - switch(weaponused) - if(WEAPON_MISSILE) - if(!weaponmiss) - for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) - if(!is_mainship_level(current_mob.z)) - continue - playsound_client(current_mob.client, 'sound/effects/metal_crash.ogg', 100 ) - playsound_client(current_mob.client, 'sound/effects/bigboom3.ogg', 100) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/pry2.ogg', 20), 1 SECONDS) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/double_klaxon.ogg'), 2 SECONDS) - else - for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) - if(!is_mainship_level(current_mob.z)) - continue - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/laser_point_defence_success.ogg', 100), shotspacing SECONDS) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), current_mob.client, SPAN_DANGER("You hear the Point Defense systems shooting down a missile!")), shotspacing SECONDS) - - if(WEAPON_RAILGUN) - if(!weaponmiss) - for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) - if(!is_mainship_level(current_mob.z)) - continue - playsound_client(current_mob.client, 'sound/effects/bigboom3.ogg', 50) - playsound_client(current_mob.client, 'sound/effects/railgunhit.ogg', 50) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound_client), current_mob.client, 'sound/effects/double_klaxon.ogg'), 2 SECONDS) - else - for(var/mob/living/carbon/current_mob in GLOB.living_mob_list) - if(!is_mainship_level(current_mob.z)) - continue - playsound_client (current_mob.client, 'sound/effects/railgun_miss.ogg', 60) - to_chat(current_mob.client, SPAN_DANGER("You hear railgun shots barely missing the hull!")) -//REMOVE THIS WHEN WE USE THESE DEFS SOMEWHERE ELSE OR ELSE IT STRAIGHT UP WON'T WORK. -#undef WEAPON_MISSILE -#undef WEAPON_RAILGUN -#undef HIT_CHANCE_CHEAT -#undef HIT_CHANCE_STANDARD +/datum/space_weapon + var/name = "SMP" + var/list/possibly_ammunition = list() + //add some useful things here and make it object... later... skill issue. + +/datum/space_weapon/proc/on_shot(location, list/potential_ammo, intercept_chance, delay = 0) + var/intercepted = 0 + var/missed = 0 + var/hits = 0 + for(var/turf/picked_atom in location) + var/datum/space_weapon_ammo/ammo = GLOB.space_weapons_ammo[pick(potential_ammo)] + var/accuracy = rand(1, 100) + if(ammo.interceptable && intercept_chance > accuracy) + ammo.miss_target(picked_atom, TRUE) + intercepted++ + else if(ammo.base_miss_chance + intercept_chance > accuracy) + ammo.miss_target(picked_atom, FALSE) + missed++ + else + ammo.hit_target(picked_atom) + hits++ + sleep(delay) + shipwide_ai_announcement("WARNING, [hits] HIT SHIP HULL, [missed] MISSED AND [intercepted] INTERCEPTED!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg') + +/datum/space_weapon/proc/shot_message(quantity, hit_eta) + return + +/datum/space_weapon/rail_gun + name = "Railgun" + possibly_ammunition = list( + /datum/space_weapon_ammo/rail_gun, + /datum/space_weapon_ammo/rail_gun/stronk, + ) + +/datum/space_weapon/rail_gun/shot_message(quantity, hit_eta) + shipwide_ai_announcement("DANGER: RAILGUN EMISSIONS DETECTED, INCOMING PROJECTILE[quantity > 1 ? "S" : ""]. BRACE, BRACE, BRACE. [quantity > 1 ? "SALVO SIZE: [quantity]," : ""] ESTIMATED TIME: [hit_eta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') + +/datum/space_weapon/rocket_launcher + name = "Rocket Launcher" + possibly_ammunition = list( + /datum/space_weapon_ammo/rocket_launcher, + /datum/space_weapon_ammo/rocket_launcher/swing_rockets, + ) + +/datum/space_weapon/rocket_launcher/shot_message(quantity, hit_eta) + shipwide_ai_announcement("DANGER: MISSILE WARNING, LAUNCH DETECTED. BRACE, BRACE, BRACE. [quantity > 1 ? "SALVO SIZE: [quantity]," : ""] ESTIMATED TIME: [hit_eta] SECONDS." , MAIN_AI_SYSTEM, 'sound/effects/missile_warning.ogg') + +/** + * Ammo datum for space weapons + */ +/datum/space_weapon_ammo + var/name = "SMP" + var/base_miss_chance = 25 + var/list/miss_sound = list() + var/list/intercept_sound = list() + var/list/hit_sound = list() + var/interceptable = TRUE + +/datum/space_weapon_ammo/proc/miss_target(picked_atom, intercepted) + return + +/datum/space_weapon_ammo/proc/hit_target(picked_atom) + return + +/datum/space_weapon_ammo/rail_gun + name = "Piercing Near-Lightning Railgun Projectile" + base_miss_chance = 35 + miss_sound = list('sound/effects/railgun_miss.ogg') + intercept_sound = list('sound/effects/laser_point_defence_success.ogg') + hit_sound = list('sound/effects/railgunhit.ogg') + +/datum/space_weapon_ammo/rail_gun/miss_target(picked_atom, intercepted) + var/list/echo_list = new(18) + echo_list[ECHO_OBSTRUCTION] = -2500 + if(intercepted) + playsound(picked_atom, pick(intercept_sound), 100, 1, 100, echo = echo_list) + else + playsound(picked_atom, pick(miss_sound), 5, 1, 100, echo = echo_list) + shipwide_ai_announcement("[capitalize(name)] [intercepted ? "INTERCEPTED" : "MISSED"]!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg') + +/datum/space_weapon_ammo/rail_gun/hit_target(picked_atom) + var/list/echo_list = new(18) + echo_list[ECHO_OBSTRUCTION] = -500 + cell_explosion(picked_atom, 1000, 200, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, create_cause_data(name)) + shakeship(5, 5, FALSE, FALSE) + playsound(picked_atom, "bigboom", 50, 1, 200, echo = echo_list) + playsound(picked_atom, pick(hit_sound), 50, 1, 200, echo = echo_list) + shipwide_ai_announcement("WARNING, [capitalize(name)] HIT SHIP HULL, CAUSED MASSIVE DAMAGE!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg') + +/datum/space_weapon_ammo/rail_gun/stronk + name = "Piercing Near-Lightning Railgun Projectile of Increased Strength" + base_miss_chance = 50 + interceptable = FALSE + +/datum/space_weapon_ammo/rocket_launcher + name = "Anti-Ship missile" + base_miss_chance = 15 + miss_sound = list('sound/effects/metal_shatter.ogg') + intercept_sound = list('sound/effects/laser_point_defence_success.ogg') + hit_sound = list('sound/effects/metal_crash.ogg') + +/datum/space_weapon_ammo/rocket_launcher/miss_target(picked_atom, intercepted) + var/list/echo_list = new(18) + echo_list[ECHO_OBSTRUCTION] = -2500 + if(intercepted) + playsound(picked_atom, pick(intercept_sound), 100, 1, 100, echo = echo_list) + else + playsound(picked_atom, pick(miss_sound), 5, 1, 100, echo = echo_list) + shipwide_ai_announcement("[capitalize(name)] [intercepted ? "INTERCEPTED" : "MISSED"]!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg') + +/datum/space_weapon_ammo/rocket_launcher/hit_target(picked_atom) + var/list/echo_list = new(18) + echo_list[ECHO_OBSTRUCTION] = -500 + cell_explosion(picked_atom, 500, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, create_cause_data(name)) + shakeship(5, 5, FALSE, FALSE) + playsound(picked_atom, "bigboom", 50, 1, 200, echo = echo_list) + playsound(picked_atom, pick(hit_sound), 50, 1, 200, echo = echo_list) + playsound(picked_atom, "pry", 25, 1, 200, echo = echo_list) + shipwide_ai_announcement("WARNING, [capitalize(name)] HIT SHIP HULL, CAUSED MASSIVE DAMAGE!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg') + +/datum/space_weapon_ammo/rocket_launcher/swing_rockets + name = "Swing High Pierce Shreder Rockets" + base_miss_chance = 0 + +/datum/space_weapon_ammo/rocket_launcher/swing_rockets/hit_target(picked_atom) + var/list/echo_list = new(18) + echo_list[ECHO_OBSTRUCTION] = -500 + var/list/turf_list = list() + for(var/turf/turf in range(7, picked_atom)) + turf_list += turf + + playsound(picked_atom, "pry", 25, 1, 200, echo = echo_list) + playsound(picked_atom, pick(hit_sound), 50, 1, 200, echo = echo_list) + playsound(picked_atom, "bigboom", 50, 1, 200, echo = echo_list) + for(var/i = 1 to 12) + var/turf/turf = pick(turf_list) + cell_explosion(turf, 100, 10, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL, null, create_cause_data(name)) + playsound(turf, "bigboom", 40, 1, 20, echo = echo_list) + shakeship(2, 2, FALSE, FALSE) + sleep(1) + + shipwide_ai_announcement("WARNING, [capitalize(name)] HIT SHIP HULL, CAUSED MASSIVE DOT DAMAGE!", MAIN_AI_SYSTEM, 'sound/effects/double_klaxon.ogg')