diff --git a/files/audio/GUIDs.txt b/files/audio/GUIDs.txt
index 6d2e185..a8a3bee 100644
--- a/files/audio/GUIDs.txt
+++ b/files/audio/GUIDs.txt
@@ -19,8 +19,8 @@
{fd468381-c98d-41be-9be3-09b5d255ccad} event:/akanechan/player/buy/temple_products
{39fd5b19-b7ac-469e-8862-baf88373cd64} event:/akanechan/player/dead
{784a8eb4-d6d3-41cf-a997-8ecaa6251dab} event:/akanechan/player/kick
-{94462a59-9dea-42a8-b738-9853069151b7} event:/akanechan/player/pickup/health
{c98a2fd1-09a6-47b7-a361-b8cad7764bde} event:/akanechan/player/pickup/refresher
+{94462a59-9dea-42a8-b738-9853069151b7} event:/akanechan/player/pickup/temple_health
{5f3332d1-3750-45b2-9fd2-b64f5b2f3498} event:/akanechan/player/pickup/wand
{ce13fec0-e96a-40d6-aa44-4f57000ee4b2} event:/akanechan/player/spawn
{65674dc5-e109-4a98-9541-04bfb3df21f0} event:/akanechan/player/take_damage/heavy
diff --git a/files/audio/mod_voices.bank b/files/audio/mod_voices.bank
index 2998e8f..375d7dc 100644
Binary files a/files/audio/mod_voices.bank and b/files/audio/mod_voices.bank differ
diff --git a/files/entities/extend_heart_fullhp_temple_voices.xml b/files/entities/extend_heart_fullhp_temple_voices.xml
index 03baa13..4365ed6 100644
--- a/files/entities/extend_heart_fullhp_temple_voices.xml
+++ b/files/entities/extend_heart_fullhp_temple_voices.xml
@@ -7,6 +7,6 @@
>
+ script_item_picked_up="mods/akanechan_voice/files/scripts/player/pickup/temple_health.lua" >
diff --git a/files/entities/extend_player_voices.xml b/files/entities/extend_player_voices.xml
index 2496fc3..a2f732d 100644
--- a/files/entities/extend_player_voices.xml
+++ b/files/entities/extend_player_voices.xml
@@ -1,57 +1,18 @@
-
-
+
+
-
+ script_source_file="mods/akanechan_voice/files/scripts/player/spawn.lua">
+
-
+
-
+
-
-
diff --git a/files/entities/extend_wand_voices.xml b/files/entities/extend_wand_voices.xml
index 9dcf6bc..7f91baf 100644
--- a/files/entities/extend_wand_voices.xml
+++ b/files/entities/extend_wand_voices.xml
@@ -9,7 +9,4 @@
-
-
diff --git a/files/entities/sounds/damage_received/heavy_damage_voice.xml b/files/entities/sounds/damage_received/heavy_damage_voice.xml
new file mode 100644
index 0000000..24362e3
--- /dev/null
+++ b/files/entities/sounds/damage_received/heavy_damage_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/damage_received/low_helth_damage_voice.xml b/files/entities/sounds/damage_received/low_helth_damage_voice.xml
new file mode 100644
index 0000000..4d2249b
--- /dev/null
+++ b/files/entities/sounds/damage_received/low_helth_damage_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/damage_received/mild_damage_voice.xml b/files/entities/sounds/damage_received/mild_damage_voice.xml
new file mode 100644
index 0000000..0dd9d9e
--- /dev/null
+++ b/files/entities/sounds/damage_received/mild_damage_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/damage_received/on_fire_damage_voice.xml b/files/entities/sounds/damage_received/on_fire_damage_voice.xml
new file mode 100644
index 0000000..946d871
--- /dev/null
+++ b/files/entities/sounds/damage_received/on_fire_damage_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/enemy/pickup/wand.xml b/files/entities/sounds/enemy/pickup/wand.xml
new file mode 100644
index 0000000..38540d9
--- /dev/null
+++ b/files/entities/sounds/enemy/pickup/wand.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/kick_voice.xml b/files/entities/sounds/kick_voice.xml
new file mode 100644
index 0000000..39be5f1
--- /dev/null
+++ b/files/entities/sounds/kick_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/pickup/refresher.xml b/files/entities/sounds/pickup/refresher.xml
new file mode 100644
index 0000000..fdac299
--- /dev/null
+++ b/files/entities/sounds/pickup/refresher.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/pickup/shop_wand.xml b/files/entities/sounds/pickup/shop_wand.xml
new file mode 100644
index 0000000..b6889b5
--- /dev/null
+++ b/files/entities/sounds/pickup/shop_wand.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/pickup/temple_health.xml b/files/entities/sounds/pickup/temple_health.xml
new file mode 100644
index 0000000..c7f5d4e
--- /dev/null
+++ b/files/entities/sounds/pickup/temple_health.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/pickup/wand.xml b/files/entities/sounds/pickup/wand.xml
new file mode 100644
index 0000000..3a16496
--- /dev/null
+++ b/files/entities/sounds/pickup/wand.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/start_voice.xml b/files/entities/sounds/start_voice.xml
new file mode 100644
index 0000000..b995ef4
--- /dev/null
+++ b/files/entities/sounds/start_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/throw/emerald_tablet_voice copy.xml b/files/entities/sounds/throw/emerald_tablet_voice copy.xml
new file mode 100644
index 0000000..5072880
--- /dev/null
+++ b/files/entities/sounds/throw/emerald_tablet_voice copy.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/throw/item_voice.xml b/files/entities/sounds/throw/item_voice.xml
new file mode 100644
index 0000000..44401a1
--- /dev/null
+++ b/files/entities/sounds/throw/item_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/entities/sounds/throw/wand_voice.xml b/files/entities/sounds/throw/wand_voice.xml
new file mode 100644
index 0000000..62ad2aa
--- /dev/null
+++ b/files/entities/sounds/throw/wand_voice.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/files/scripts/lib/utilities.lua b/files/scripts/lib/utilities.lua
index 9286733..9960cbc 100644
--- a/files/scripts/lib/utilities.lua
+++ b/files/scripts/lib/utilities.lua
@@ -1,3 +1,23 @@
+function p(message)
+ print(tostring(message))
+end
+
+function split(str, sep)
+ if sep == nil then
+ return {}
+ end
+
+ local t = {}
+
+ local i = 1
+ for s in string.gmatch(str, "([^" .. sep .. "]+)") do
+ t[i] = s
+ i = i + 1
+ end
+
+ return t
+end
+
dofile_once("mods/akanechan_voice/files/scripts/lib/utils/global_values.lua")
dofile_once("mods/akanechan_voice/files/scripts/lib/utils/variable_storage.lua")
dofile_once("mods/akanechan_voice/files/scripts/lib/utils/player.lua")
@@ -5,8 +25,4 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utils/calculate.lua")
-- has dependent
dofile_once("mods/akanechan_voice/files/scripts/lib/utils/wait_frame.lua")
-
-
-function p(message)
- print(tostring(message))
-end
+dofile_once("mods/akanechan_voice/files/scripts/lib/utils/sound_player.lua")
diff --git a/files/scripts/lib/utils/global_values.lua b/files/scripts/lib/utils/global_values.lua
index fda0c80..6908320 100644
--- a/files/scripts/lib/utils/global_values.lua
+++ b/files/scripts/lib/utils/global_values.lua
@@ -1,10 +1,8 @@
AKANECHAN = {
- prefix = "akanechan_voice.",
- RECEIVED_DAMAGE = function(self) return self.prefix .. "received_damage" end,
- RECEIVED_FIRE_DAMAGE = function(self) return self.prefix .. "received_fire_damage" end,
- PICKED_TEMPLE_ITEMS =function(self) return self.prefix .. "picked_temple_items" end,
- PICKED_WAND = function(self) return self.prefix .. "picked_wand" end,
- ENEMY_PICKED_WAND = function(self) return self.prefix .. "enemy_picked_wand" end,
- IS_THROWED_WAND = function(self) return self.prefix .. "is_throwed_wand" end,
- IS_PICKED_WAND = function(self) return self.prefix .. "is_picked_wand" end -- 投擲音声を鳴らすかの判定用
+ SOUND_PLAYER_NAME = "akanechan_voice",
+ SOUND_FILE_STORAGE_NAME = function(self) return self.SOUND_PLAYER_NAME .. "." .. "sound_xml_file" end,
+ RECEIVED_DAMAGE = function(self) return self.SOUND_PLAYER_NAME .. "." .. "received_damage" end,
+ RECEIVED_FIRE_DAMAGE = function(self) return self.SOUND_PLAYER_NAME .. "." .. "received_fire_damage" end,
+ PICKED_WAND = function(self) return self.SOUND_PLAYER_NAME .. "." .. "picked_wand" end,
+ ENEMY_PICKED_WAND = function(self) return self.SOUND_PLAYER_NAME .. "." .. "enemy_picked_wand" end,
}
diff --git a/files/scripts/lib/utils/sound_player.lua b/files/scripts/lib/utils/sound_player.lua
new file mode 100644
index 0000000..80e5bb8
--- /dev/null
+++ b/files/scripts/lib/utils/sound_player.lua
@@ -0,0 +1,182 @@
+-- 音声再生を行うObject
+-- Note: Noitaの音声はframe計測ではなくリアルタイム計測(ポーズメニュー時にも流れる)なため注意すること
+SoundPlayer = {
+ IS_LOADED_VARIABLE_NAME = "is_Loaded_variable_name",
+ SOUND_TYPE_VARIABLE_NAME = "sound_type_variable_name",
+ XML_FILE_VARIABLE_NAME = "xml_file_variable_name",
+ SOUND_TYPES = {
+ FORCE = "force", -- 強制的に他の音声を止めてから再生する
+ COVER = "cover", -- 他の音声と被せて音声を再生する
+ ONLY_EMPTY = 'only_empty', -- 他の音声が登録されている場合、再生しない
+ },
+
+ create = function(self, target_entity_id, sound_player_name, xml_file_variable_name)
+ local sound_player_entity_id = EntityCreateNew(sound_player_name)
+ addNewInternalVariable(sound_player_entity_id, self.XML_FILE_VARIABLE_NAME, "value_string", xml_file_variable_name)
+ EntityAddChild(target_entity_id, sound_player_entity_id)
+ return sound_player_entity_id
+ end,
+
+ playSound = function(self, sound_player_entity_id)
+ local playlist = EntityGetAllChildren(sound_player_entity_id)
+ if playlist == nil or #playlist == 0 then
+ return
+ end
+
+ self:_syncEntityPosition(sound_player_entity_id, playlist)
+
+ local hasForceType = false
+ local hasCoverType = false
+ local hasOnlyEmpty = false
+ for i, sound_entity_id in ipairs(playlist) do
+ local sound_type = getInternalVariableValue(sound_entity_id, self.SOUND_TYPE_VARIABLE_NAME, "value_string")
+ if sound_type == self.SOUND_TYPES.FORCE then
+ hasForceType = true
+ elseif sound_type == self.SOUND_TYPES.COVER then
+ hasCoverType = true
+ elseif sound_type == self.SOUND_TYPES.ONLY_EMPTY then
+ hasOnlyEmpty = true
+ end
+ end
+
+ if hasOnlyEmpty then
+ self:_playOnlyEmptySound(sound_player_entity_id, playlist)
+ return
+ end
+
+ if hasForceType then
+ self:_playForceSound(sound_player_entity_id, playlist)
+ return
+ end
+
+ if hasCoverType then
+ self:_playCoverSound(sound_player_entity_id, playlist)
+ end
+
+ self:_playSound(sound_player_entity_id, playlist[1])
+ end,
+
+ seachSoundPlayer = function(self, parent_entity_id, sound_player_name)
+ if parent_entity_id == nil then
+ return nil
+ end
+
+ for _, child_entity_id in ipairs(EntityGetAllChildren(parent_entity_id)) do
+ if EntityGetName(child_entity_id) == sound_player_name then
+ return child_entity_id
+ end
+ end
+
+ return nil
+ end,
+
+ registerSoundEntity = function(self, sound_player_entity_id, xml_file_name)
+ self:_registerSoundEntity(sound_player_entity_id, xml_file_name, nil)
+ end,
+
+ registerForceSoundEntity = function(self, sound_player_entity_id, xml_file_name)
+ self:_registerSoundEntity(sound_player_entity_id, xml_file_name, self.SOUND_TYPES.FORCE)
+ end,
+
+ registerCoverSoundEntity = function(self, sound_player_entity_id, xml_file_name)
+ self:_registerSoundEntity(sound_player_entity_id, xml_file_name, self.SOUND_TYPES.COVER)
+ end,
+
+ registerOnlyEmptySoundEntity = function(self, sound_player_entity_id, xml_file_name)
+ self:_registerSoundEntity(sound_player_entity_id, xml_file_name, self.SOUND_TYPES.ONLY_EMPTY)
+ end,
+
+ deleteSoundEntity = function(self, sound_entity_id)
+ EntityKill(sound_entity_id)
+ end,
+
+ _registerSoundEntity = function(self, sound_player_entity_id, xml_file_name, type)
+ local sound_entity_id = EntityCreateNew(xml_file_name)
+ local xml_file_variable_name = getInternalVariableValue(sound_player_entity_id, self.XML_FILE_VARIABLE_NAME, "value_string")
+ addNewInternalVariable(sound_entity_id, xml_file_variable_name, "value_string", xml_file_name)
+
+ if type ~= nil then
+ addNewInternalVariable(sound_entity_id, self.SOUND_TYPE_VARIABLE_NAME, "value_string", type)
+ end
+
+ EntityAddChild(sound_player_entity_id, sound_entity_id)
+ end,
+
+ _syncEntityPosition = function(self, sound_player_entity_id, playlist)
+ for _, sound_entity_id in ipairs(playlist) do
+ local x, y = EntityGetTransform(EntityGetParent(sound_player_entity_id))
+ EntitySetTransform(sound_entity_id, x, y)
+ end
+ end,
+
+ _playForceSound = function(self, sound_player_entity_id, playlist)
+ local force_entity_ids = {}
+ for _, sound_entity_id in ipairs(playlist) do
+ local sound_type = getInternalVariableValue(sound_entity_id, self.SOUND_TYPE_VARIABLE_NAME, "value_string")
+ if sound_type == self.SOUND_TYPES.FORCE then
+ table.insert(force_entity_ids, sound_entity_id)
+ end
+ end
+
+ self:_printPlaylist(force_entity_ids)
+
+ -- 最終のforceSoundのみ残す
+ if #force_entity_ids > 1 then
+ for i, sound_entity_id in ipairs(force_entity_ids) do
+ if i ~= #force_entity_ids then
+ EntityKill(sound_entity_id)
+ end
+ end
+ end
+
+ self:_playSound(sound_player_entity_id, playlist[1])
+ end,
+
+ _playCoverSound = function(self, sound_player_entity_id, playlist)
+ for _, sound_entity_id in ipairs(playlist) do
+ local sound_type = getInternalVariableValue(sound_entity_id, self.SOUND_TYPE_VARIABLE_NAME, "value_string")
+ if sound_type == self.SOUND_TYPES.COVER then
+ self:_playSound(sound_player_entity_id, sound_entity_id)
+ end
+ end
+ end,
+
+ _playOnlyEmptySound = function(self, sound_player_entity_id, playlist)
+ for _, sound_entity_id in ipairs(playlist) do
+ local sound_type = getInternalVariableValue(sound_entity_id, self.SOUND_TYPE_VARIABLE_NAME, "value_string")
+ if sound_type == self.SOUND_TYPES.ONLY_EMPTY then
+ if #playlist > 1 then
+ EntityKill(sound_entity_id)
+ self:playSound(sound_player_entity_id)
+ else
+ self:_playSound(sound_player_entity_id, sound_entity_id)
+ end
+ end
+ end
+ end,
+
+ _playSound = function(self, sound_player_entity_id, sound_entity_id)
+ local is_loaded = getInternalVariableValue(sound_entity_id, self.IS_LOADED_VARIABLE_NAME, "value_bool") or false
+ if is_loaded then
+ return
+ end
+
+ local xml_file_variable_name = getInternalVariableValue(sound_player_entity_id, self.XML_FILE_VARIABLE_NAME, "value_string")
+ local xml_file_name = getInternalVariableValue(sound_entity_id, xml_file_variable_name, "value_string")
+
+ if xml_file_name == nil then
+ p("===\nreturn xml_file not found\n===")
+ return
+ end
+
+ EntityLoadToEntity(xml_file_name, sound_entity_id)
+ addNewInternalVariable(sound_entity_id, self.IS_LOADED_VARIABLE_NAME, "value_bool", true)
+ end,
+
+ _printPlaylist = function(self, playlist)
+ for i, sound_entity_id in ipairs(playlist) do
+ p(EntityGetName(sound_entity_id))
+ end
+ end,
+}
+
diff --git a/files/scripts/player/damage_received.lua b/files/scripts/player/damage_received.lua
index 7e5c276..5c13e1c 100644
--- a/files/scripts/player/damage_received.lua
+++ b/files/scripts/player/damage_received.lua
@@ -2,28 +2,7 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
local BIG_DAMAGE = 0.8 -- 20
-local function playHeavyDamageSound(player_entity_id)
- p("heavy")
- GameEntityPlaySound(player_entity_id, "player/take_damage/heavy")
-end
-
-local function playMildDamageSound(player_entity_id)
- p("mild")
- GameEntityPlaySound(player_entity_id, "player/take_damage/mild")
-end
-
-local function playLowHealthDamageSound(player_entity_id)
- p("low_helth")
- GameEntityPlaySound(player_entity_id, "player/take_damage/low_helth")
-end
-
-local function playFireDamageSound(player_entity_id)
- WaitFrame:tryCall(player_entity_id, AKANECHAN:RECEIVED_FIRE_DAMAGE(), function()
- GameEntityPlaySound(player_entity_id, "player/take_damage/on_fire")
- end, 60 * 3)
-end
-
-local function playDamageSound(player_entity_id, damage)
+local function playDamageSound(player_entity_id, akanechan_voice, damage)
for _, damage_model in ipairs(EntityGetComponent(player_entity_id, "DamageModelComponent") or {}) do
local is_low_helth = math.floor(getPlayerHealth() / getPlayerMaxHealth() * 100) <= 25
@@ -32,17 +11,24 @@ local function playDamageSound(player_entity_id, damage)
if is_on_fire then
if take_big_damage then
- playHeavyDamageSound(player_entity_id)
+ SoundPlayer:registerForceSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/damage_received/heavy_damage_voice.xml")
else
- playFireDamageSound(player_entity_id)
+ WaitFrame:tryCall(player_entity_id, AKANECHAN:RECEIVED_FIRE_DAMAGE(), function()
+ SoundPlayer:registerOnlyEmptySoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/damage_received/on_fire_damage_voice.xml")
+ end, 60 * 4)
end
elseif is_low_helth then
- playLowHealthDamageSound(player_entity_id)
+ WaitFrame:tryCall(player_entity_id, AKANECHAN:RECEIVED_DAMAGE(), function()
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/damage_received/low_helth_damage_voice.xml")
+ end, 60 * 1)
elseif take_big_damage then
- playHeavyDamageSound(player_entity_id)
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/damage_received/heavy_damage_voice.xml")
else
- playMildDamageSound(player_entity_id)
+ WaitFrame:tryCall(player_entity_id, AKANECHAN:RECEIVED_DAMAGE(), function()
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/damage_received/mild_damage_voice.xml")
+ end, 60 * 1)
end
+
end
end
@@ -51,12 +37,12 @@ end
--------------
function damage_received(damage, desc, entity_who_caused, is_fatal)
local player_entity_id = GetUpdatedEntityID()
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
if is_fatal then
- GameEntityPlaySound(player_entity_id, "player/dead")
+ -- playerが死ぬとsound_playerも消え、死亡ボイスがながれない
+ -- 死亡ボイスは必ず流したいため、直接callする
+ GameEntityPlaySound(GetUpdatedEntityID(), "player/dead")
else
- WaitFrame:tryCall(player_entity_id, AKANECHAN:RECEIVED_DAMAGE(), function()
- playDamageSound(player_entity_id, damage)
- end)
+ playDamageSound(player_entity_id, akanechan_voice, damage)
end
end
-
diff --git a/files/scripts/player/kick.lua b/files/scripts/player/kick.lua
index f2c9847..37b33fd 100644
--- a/files/scripts/player/kick.lua
+++ b/files/scripts/player/kick.lua
@@ -1,5 +1,9 @@
dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+--------------
+-- main
+--------------
function kick(entity_who_kicked)
- GameEntityPlaySound( getPlayerEntity(), "player/kick" )
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/kick_voice.xml")
end
diff --git a/files/scripts/player/pickup/health.lua b/files/scripts/player/pickup/health.lua
deleted file mode 100644
index d1ddd75..0000000
--- a/files/scripts/player/pickup/health.lua
+++ /dev/null
@@ -1,11 +0,0 @@
-dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
-
---------------
--- main
---------------
-function item_pickup(item_entity_id, pickupper_entity_id, item_name)
- local player_entity_id = getPlayerEntity()
- WaitFrame:tryCall(player_entity_id, AKANECHAN:PICKED_TEMPLE_ITEMS(), function()
- GameEntityPlaySound(player_entity_id, "player/pickup/health")
- end)
-end
diff --git a/files/scripts/player/pickup/refresher.lua b/files/scripts/player/pickup/refresher.lua
index f92ef9d..75c259a 100644
--- a/files/scripts/player/pickup/refresher.lua
+++ b/files/scripts/player/pickup/refresher.lua
@@ -4,8 +4,6 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
-- main
--------------
function item_pickup(item_entity_id, pickupper_entity_id, item_name)
- local player_entity_id = getPlayerEntity()
- WaitFrame:tryCall(player_entity_id, AKANECHAN:PICKED_TEMPLE_ITEMS(), function()
- GameEntityPlaySound(player_entity_id, "player/pickup/refresher")
- end)
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerForceSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/pickup/refresher.xml")
end
diff --git a/files/scripts/player/pickup/temple_health.lua b/files/scripts/player/pickup/temple_health.lua
new file mode 100644
index 0000000..170ac8e
--- /dev/null
+++ b/files/scripts/player/pickup/temple_health.lua
@@ -0,0 +1,9 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+--------------
+-- main
+--------------
+function item_pickup(item_entity_id, pickupper_entity_id, item_name)
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerForceSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/pickup/temple_health.xml")
+end
diff --git a/files/scripts/player/pickup/wand.lua b/files/scripts/player/pickup/wand.lua
index 04a4b6d..edbdd54 100644
--- a/files/scripts/player/pickup/wand.lua
+++ b/files/scripts/player/pickup/wand.lua
@@ -1,50 +1,33 @@
dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
-local function playPlayerPickupSound(player_entity_id)
- GameEntityPlaySound(player_entity_id, "player/pickup/wand")
-end
local function playEnemyPickupSound(player_entity_id)
GameEntityPlaySound(player_entity_id, "enemy/pickup/wand")
end
-local function playBuyProductSound(player_entity_id)
- GameEntityPlaySound(player_entity_id, "player/buy/temple_products")
-end
-
-
--------------
-- main
--------------
function item_pickup(item_entity_id, pickupper_entity_id, item_name)
- print("pickup wand")
local player_entity_id = getPlayerEntity()
-
- if getInternalVariableValue(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool") == nil then
- addNewInternalVariable(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool", true)
- else
- setInternalVariableValue(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool", true)
- end
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
if player_entity_id == pickupper_entity_id then
local is_shop_item = (EntityGetComponent(item_entity_id, "ItemCostComponent", "shop_cost") ~= nil)
-
if is_shop_item then
- WaitFrame:tryCall(player_entity_id, AKANECHAN:PICKED_WAND(), function()
- playBuyProductSound(player_entity_id)
- end, 60 * 1)
+ SoundPlayer:registerForceSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/pickup/shop_wand.xml")
else
WaitFrame:tryCall(player_entity_id, AKANECHAN:PICKED_WAND(), function()
- playPlayerPickupSound(player_entity_id)
- end, 60 * 10)
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/pickup/wand.xml")
+ end, 60 * 2)
end
else
local x, y = EntityGetTransform(player_entity_id)
local enemies = EntityGetInRadiusWithTag(x, y, 120, "enemy")
for _, enemy_entity_id in ipairs(enemies) do
- if (enemy_entity_id == pickupper_entity_id) then
+ if enemy_entity_id == pickupper_entity_id then
WaitFrame:tryCall(player_entity_id, AKANECHAN:ENEMY_PICKED_WAND(), function()
- playEnemyPickupSound(player_entity_id)
- end, 600)
+ SoundPlayer:registerForceSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/enemy/pickup/wand.xml")
+ end, 60 * 2)
end
end
end
diff --git a/files/scripts/player/spawn.lua b/files/scripts/player/spawn.lua
new file mode 100644
index 0000000..c712dbf
--- /dev/null
+++ b/files/scripts/player/spawn.lua
@@ -0,0 +1,7 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+--------------
+-- main
+--------------
+local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
+SoundPlayer:registerSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/start_voice.xml")
diff --git a/files/scripts/player/throw_emerald_tablet.lua b/files/scripts/player/throw_emerald_tablet.lua
index ea02894..7707ee3 100644
--- a/files/scripts/player/throw_emerald_tablet.lua
+++ b/files/scripts/player/throw_emerald_tablet.lua
@@ -1,9 +1,11 @@
dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
function throw_item(from_x, from_y, to_x, to_y)
- local player_pos_x, player_pos_y = EntityGetTransform(getPlayerEntity())
+ local player_entity_id = getPlayerEntity()
+ local player_pos_x, player_pos_y = EntityGetTransform(player_entity_id)
local r = math.floor(calcRadius(player_pos_x, player_pos_y, from_x, from_y) + 0.5)
if r <= 9 then
- GameEntityPlaySound(getPlayerEntity(), "player/throw/emerald_tablet")
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(player_entity_id, AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/throw/emerald_tablet_voice.xml")
end
end
diff --git a/files/scripts/player/throw_item.lua b/files/scripts/player/throw_item.lua
index befdd62..a5460a6 100644
--- a/files/scripts/player/throw_item.lua
+++ b/files/scripts/player/throw_item.lua
@@ -5,25 +5,13 @@ function throw_item(from_x, from_y, to_x, to_y)
local player_pos_x, player_pos_y = EntityGetTransform(getPlayerEntity())
local r = math.floor(calcRadius(player_pos_x, player_pos_y, from_x, from_y) + 0.5)
if r <= 9 then
- SetTimeOut(0.1, "mods/akanechan_voice/files/scripts/player/throw_item.lua", "throwing_item")
+ SetTimeOut(0.15, "mods/akanechan_voice/files/scripts/player/throw_item.lua", "throwing_item")
end
end
function throwing_item()
- p("throwing item")
local player_entity_id = getPlayerEntity()
- local is_picked_wand = getInternalVariableValue(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool") or false
- local is_threw_wand = getInternalVariableValue(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool") or false
-
- p("is_picked_wand: " .. tostring(is_picked_wand))
- if is_picked_wand then
- if WaitFrame:canCall(player_entity_id, AKANECHAN:PICKED_WAND()) then
- GameEntityPlaySound(player_entity_id, "player/throw/something")
- end
- setInternalVariableValue(player_entity_id, AKANECHAN:IS_PICKED_WAND(), "value_bool", false)
- elseif is_threw_wand then
- setInternalVariableValue(player_entity_id, AKANECHAN:IS_THROWED_WAND(), "value_bool", false)
- else
- GameEntityPlaySound(player_entity_id, "player/throw/something")
- end
+
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(player_entity_id, AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerOnlyEmptySoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/throw/item_voice.xml")
end
diff --git a/files/scripts/player/throw_wand.lua b/files/scripts/player/throw_wand.lua
index 6cd96d6..5425c3e 100644
--- a/files/scripts/player/throw_wand.lua
+++ b/files/scripts/player/throw_wand.lua
@@ -2,10 +2,6 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
local player_entity_id = getPlayerEntity()
function throw_item(from_x, from_y, to_x, to_y)
- if getInternalVariableValue(player_entity_id, AKANECHAN:IS_THROWED_WAND(), "value_bool") == nil then
- addNewInternalVariable(player_entity_id, AKANECHAN:IS_THROWED_WAND(), "value_bool", true)
- else
- setInternalVariableValue(player_entity_id, AKANECHAN:IS_THROWED_WAND(), "value_bool", true)
- end
- GameEntityPlaySound(player_entity_id, "player/throw/wand")
-end
\ No newline at end of file
+ local akanechan_voice = SoundPlayer:seachSoundPlayer(getPlayerEntity(), AKANECHAN.SOUND_PLAYER_NAME)
+ SoundPlayer:registerCoverSoundEntity(akanechan_voice, "mods/akanechan_voice/files/entities/sounds/throw/wand_voice.xml")
+end
diff --git a/files/scripts/player/init_voices.lua b/files/scripts/sounds/damage_received/death_voice.lua
similarity index 51%
rename from files/scripts/player/init_voices.lua
rename to files/scripts/sounds/damage_received/death_voice.lua
index 0ba939b..d9febdf 100644
--- a/files/scripts/player/init_voices.lua
+++ b/files/scripts/sounds/damage_received/death_voice.lua
@@ -3,5 +3,4 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
--------------
-- main
--------------
-local player_entity_id = getPlayerEntity()
-GameEntityPlaySound( player_entity_id, "player/spawn" )
+
diff --git a/files/scripts/sounds/damage_received/heavy_damage_voice.lua b/files/scripts/sounds/damage_received/heavy_damage_voice.lua
new file mode 100644
index 0000000..9af4c3f
--- /dev/null
+++ b/files/scripts/sounds/damage_received/heavy_damage_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/take_damage/heavy")
diff --git a/files/scripts/sounds/damage_received/low_helth_damage_voice.lua b/files/scripts/sounds/damage_received/low_helth_damage_voice.lua
new file mode 100644
index 0000000..07f1bf1
--- /dev/null
+++ b/files/scripts/sounds/damage_received/low_helth_damage_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/take_damage/low_helth")
diff --git a/files/scripts/sounds/damage_received/mild_damage_voice.lua b/files/scripts/sounds/damage_received/mild_damage_voice.lua
new file mode 100644
index 0000000..b1731bd
--- /dev/null
+++ b/files/scripts/sounds/damage_received/mild_damage_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/take_damage/mild")
diff --git a/files/scripts/sounds/damage_received/on_fire_damage_voice.lua b/files/scripts/sounds/damage_received/on_fire_damage_voice.lua
new file mode 100644
index 0000000..de59d3f
--- /dev/null
+++ b/files/scripts/sounds/damage_received/on_fire_damage_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/take_damage/on_fire")
diff --git a/files/scripts/sounds/enemy/pickup/wand.lua b/files/scripts/sounds/enemy/pickup/wand.lua
new file mode 100644
index 0000000..f503d34
--- /dev/null
+++ b/files/scripts/sounds/enemy/pickup/wand.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "enemy/pickup/wand")
diff --git a/files/scripts/sounds/kick_voice.lua b/files/scripts/sounds/kick_voice.lua
new file mode 100644
index 0000000..d90047e
--- /dev/null
+++ b/files/scripts/sounds/kick_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/kick")
diff --git a/files/scripts/sounds/pickup/refresher.lua b/files/scripts/sounds/pickup/refresher.lua
new file mode 100644
index 0000000..0eff2e1
--- /dev/null
+++ b/files/scripts/sounds/pickup/refresher.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/pickup/refresher")
diff --git a/files/scripts/sounds/pickup/shop_wand.lua b/files/scripts/sounds/pickup/shop_wand.lua
new file mode 100644
index 0000000..5e5ef63
--- /dev/null
+++ b/files/scripts/sounds/pickup/shop_wand.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/buy/temple_products")
diff --git a/files/scripts/sounds/pickup/temple_health.lua b/files/scripts/sounds/pickup/temple_health.lua
new file mode 100644
index 0000000..6e3cfc5
--- /dev/null
+++ b/files/scripts/sounds/pickup/temple_health.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/pickup/temple_health")
diff --git a/files/scripts/sounds/pickup/wand.lua b/files/scripts/sounds/pickup/wand.lua
new file mode 100644
index 0000000..998a2db
--- /dev/null
+++ b/files/scripts/sounds/pickup/wand.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/pickup/wand")
diff --git a/files/scripts/sounds/start_voice.lua b/files/scripts/sounds/start_voice.lua
new file mode 100644
index 0000000..f21c2c3
--- /dev/null
+++ b/files/scripts/sounds/start_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/spawn")
diff --git a/files/scripts/sounds/throw/emerald_tablet_voice.lua b/files/scripts/sounds/throw/emerald_tablet_voice.lua
new file mode 100644
index 0000000..ce955ca
--- /dev/null
+++ b/files/scripts/sounds/throw/emerald_tablet_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/throw/emerald_tablet")
diff --git a/files/scripts/sounds/throw/item_voice.lua b/files/scripts/sounds/throw/item_voice.lua
new file mode 100644
index 0000000..81da99f
--- /dev/null
+++ b/files/scripts/sounds/throw/item_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/throw/something")
diff --git a/files/scripts/sounds/throw/wand_voice.lua b/files/scripts/sounds/throw/wand_voice.lua
new file mode 100644
index 0000000..40c0d76
--- /dev/null
+++ b/files/scripts/sounds/throw/wand_voice.lua
@@ -0,0 +1,10 @@
+dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")
+
+function audio_event_dead(bank_file, event_root)
+ SoundPlayer:deleteSoundEntity(GetUpdatedEntityID())
+end
+
+--------------
+-- main
+--------------
+GameEntityPlaySound(GetUpdatedEntityID(), "player/throw/wand")
diff --git a/init.lua b/init.lua
index c7474c4..c5f7687 100644
--- a/init.lua
+++ b/init.lua
@@ -5,11 +5,22 @@ print("akanechan_voice load")
function OnPlayerSpawned(player_entity_id)
local loaded = getInternalVariableValue(player_entity_id, "akanechan_voice.loaded?", "value_bool") or false
if not loaded then
+ local player_entity_id = getPlayerEntity()
+ AkanechanVoice = SoundPlayer:create(player_entity_id, AKANECHAN.SOUND_PLAYER_NAME, AKANECHAN:SOUND_FILE_STORAGE_NAME())
+
+ -- spawn時にアクションを行いたいため、xml拡張ではなくentityに対しての代入となっている
EntityLoadToEntity("mods/akanechan_voice/files/entities/extend_player_voices.xml", player_entity_id)
addNewInternalVariable(player_entity_id, "akanechan_voice.loaded?", "value_bool", true)
end
end
+function OnWorldPreUpdate()
+ if AkanechanVoice ~= nil then
+ SoundPlayer:playSound(AkanechanVoice)
+ end
+end
+
+
-- 音声ファイルロード
dofile_once("mods/akanechan_voice/files/scripts/load_extends_voice.lua")
diff --git a/resources/FMOD/Build/Desktop/Master Bank.strings.bank b/resources/FMOD/Build/Desktop/Master Bank.strings.bank
index 1dde514..bf963e7 100644
Binary files a/resources/FMOD/Build/Desktop/Master Bank.strings.bank and b/resources/FMOD/Build/Desktop/Master Bank.strings.bank differ
diff --git a/resources/FMOD/Build/Desktop/mod_voices.bank b/resources/FMOD/Build/Desktop/mod_voices.bank
index 2998e8f..375d7dc 100644
Binary files a/resources/FMOD/Build/Desktop/mod_voices.bank and b/resources/FMOD/Build/Desktop/mod_voices.bank differ
diff --git a/resources/FMOD/Build/GUIDs.txt b/resources/FMOD/Build/GUIDs.txt
index 6d2e185..a8a3bee 100644
--- a/resources/FMOD/Build/GUIDs.txt
+++ b/resources/FMOD/Build/GUIDs.txt
@@ -19,8 +19,8 @@
{fd468381-c98d-41be-9be3-09b5d255ccad} event:/akanechan/player/buy/temple_products
{39fd5b19-b7ac-469e-8862-baf88373cd64} event:/akanechan/player/dead
{784a8eb4-d6d3-41cf-a997-8ecaa6251dab} event:/akanechan/player/kick
-{94462a59-9dea-42a8-b738-9853069151b7} event:/akanechan/player/pickup/health
{c98a2fd1-09a6-47b7-a361-b8cad7764bde} event:/akanechan/player/pickup/refresher
+{94462a59-9dea-42a8-b738-9853069151b7} event:/akanechan/player/pickup/temple_health
{5f3332d1-3750-45b2-9fd2-b64f5b2f3498} event:/akanechan/player/pickup/wand
{ce13fec0-e96a-40d6-aa44-4f57000ee4b2} event:/akanechan/player/spawn
{65674dc5-e109-4a98-9541-04bfb3df21f0} event:/akanechan/player/take_damage/heavy
diff --git a/resources/FMOD/Metadata/Event/{39fd5b19-b7ac-469e-8862-baf88373cd64}.xml b/resources/FMOD/Metadata/Event/{39fd5b19-b7ac-469e-8862-baf88373cd64}.xml
index 1593fd0..1835c57 100644
--- a/resources/FMOD/Metadata/Event/{39fd5b19-b7ac-469e-8862-baf88373cd64}.xml
+++ b/resources/FMOD/Metadata/Event/{39fd5b19-b7ac-469e-8862-baf88373cd64}.xml
@@ -101,7 +101,7 @@