Skip to content

Commit

Permalink
Merge pull request #29 from den3606/develop
Browse files Browse the repository at this point in the history
fix: noita再起動時に茜ちゃんがしゃべらない問題を修正した
  • Loading branch information
den3606 authored Jul 11, 2022
2 parents 35cb028 + d343eeb commit 457057b
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="damage_received.heavy_damage_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="damage_received.low_helth_damage_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="damage_received.mild_damage_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="damage_received.on_fire_damage_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/enemy/pickup/wand.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="enemy.pickup.wand">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/kick_voice.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="kick_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/pickup/refresher.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="refresher">
<Entity name="pickup.refresher">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/pickup/shop_wand.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="pickup.shop_wand">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/pickup/temple_health.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="refresher">
<Entity name="pickup.temple_health">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/pickup/wand.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="pickup.wand">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="throw.emerald_tablet_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/throw/item_voice.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="throw.item_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
2 changes: 1 addition & 1 deletion files/entities/sounds/throw/wand_voice.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Entity name="start_voice">
<Entity name="throw.wand_voice">
<AudioComponent file="mods/akanechan_voice/files/audio/mod_voices.snd"
event_root="akanechan"
audio_physics_material="character_player"
Expand Down
14 changes: 14 additions & 0 deletions files/scripts/lib/utils/sound_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ SoundPlayer = {
return nil
end,

destroySoundPlayer = function(self, parent_entity_id, sound_player_name)
if parent_entity_id == nil then
return false
end

for _, child_entity_id in ipairs(EntityGetAllChildren(parent_entity_id)) do
if EntityGetName(child_entity_id) == sound_player_name then
EntityKill(child_entity_id)
end
end

return true
end,

registerSoundEntity = function(self, sound_player_entity_id, xml_file_name)
self:_registerSoundEntity(sound_player_entity_id, xml_file_name, nil)
end,
Expand Down
3 changes: 1 addition & 2 deletions files/scripts/player/throw_item.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")

function throw_item(from_x, from_y, to_x, to_y)
print("throw item")
p("throw item")
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
Expand All @@ -11,7 +11,6 @@ end

function throwing_item()
local player_entity_id = getPlayerEntity()

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
17 changes: 11 additions & 6 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ dofile_once("mods/akanechan_voice/files/scripts/lib/utilities.lua")

print("akanechan_voice load")

function OnModInit()
-- 音声ファイルロード
dofile("mods/akanechan_voice/files/scripts/load_extends_voice.lua")
end

function OnPlayerSpawned(player_entity_id)
local player_entity_id = getPlayerEntity()

SoundPlayer:destroySoundPlayer(player_entity_id, AKANECHAN.SOUND_PLAYER_NAME)
AkanechanVoice = SoundPlayer:create(player_entity_id, AKANECHAN.SOUND_PLAYER_NAME, AKANECHAN:SOUND_FILE_STORAGE_NAME())

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)
Expand All @@ -20,8 +27,6 @@ function OnWorldPreUpdate()
end
end

print("akanechan_voice loaded")

-- 音声ファイルロード
dofile_once("mods/akanechan_voice/files/scripts/load_extends_voice.lua")

print("akanechan_voice loaded")

0 comments on commit 457057b

Please sign in to comment.