mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add sound.dig
This commit is contained in:
parent
74780134f2
commit
06e93f8d95
5 changed files with 28 additions and 9 deletions
16
src/game.cpp
16
src/game.cpp
|
@ -2250,10 +2250,18 @@ void the_game(
|
|||
params = getDigParams(nodedef->get(n).groups, tp);
|
||||
}
|
||||
|
||||
if(params.main_group != ""){
|
||||
soundmaker.m_player_leftpunch_sound.gain = 0.5;
|
||||
soundmaker.m_player_leftpunch_sound.name =
|
||||
std::string("default_dig_") + params.main_group;
|
||||
SimpleSoundSpec sound_dig = nodedef->get(n).sound_dig;
|
||||
if(sound_dig.exists()){
|
||||
if(sound_dig.name == "__group"){
|
||||
if(params.main_group != ""){
|
||||
soundmaker.m_player_leftpunch_sound.gain = 0.5;
|
||||
soundmaker.m_player_leftpunch_sound.name =
|
||||
std::string("default_dig_") +
|
||||
params.main_group;
|
||||
}
|
||||
} else{
|
||||
soundmaker.m_player_leftpunch_sound = sound_dig;
|
||||
}
|
||||
}
|
||||
|
||||
float dig_time_complete = 0.0;
|
||||
|
|
|
@ -156,6 +156,7 @@ void ContentFeatures::reset()
|
|||
legacy_facedir_simple = false;
|
||||
legacy_wallmounted = false;
|
||||
sound_footstep = SimpleSoundSpec();
|
||||
sound_dig = SimpleSoundSpec("__group");
|
||||
sound_dug = SimpleSoundSpec();
|
||||
}
|
||||
|
||||
|
@ -204,6 +205,7 @@ void ContentFeatures::serialize(std::ostream &os)
|
|||
writeU8(os, legacy_facedir_simple);
|
||||
writeU8(os, legacy_wallmounted);
|
||||
serializeSimpleSoundSpec(sound_footstep, os);
|
||||
serializeSimpleSoundSpec(sound_dig, os);
|
||||
serializeSimpleSoundSpec(sound_dug, os);
|
||||
}
|
||||
|
||||
|
@ -258,6 +260,7 @@ void ContentFeatures::deSerialize(std::istream &is)
|
|||
legacy_wallmounted = readU8(is);
|
||||
try{
|
||||
deSerializeSimpleSoundSpec(sound_footstep, is);
|
||||
deSerializeSimpleSoundSpec(sound_dig, is);
|
||||
deSerializeSimpleSoundSpec(sound_dug, is);
|
||||
}catch(SerializationError &e) {};
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ struct ContentFeatures
|
|||
|
||||
// Sound properties
|
||||
SimpleSoundSpec sound_footstep;
|
||||
SimpleSoundSpec sound_dig;
|
||||
SimpleSoundSpec sound_dug;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1062,6 +1062,9 @@ static ContentFeatures read_content_features(lua_State *L, int index)
|
|||
lua_getfield(L, -1, "footstep");
|
||||
read_soundspec(L, -1, f.sound_footstep);
|
||||
lua_pop(L, 1);
|
||||
lua_getfield(L, -1, "dig");
|
||||
read_soundspec(L, -1, f.sound_dig);
|
||||
lua_pop(L, 1);
|
||||
lua_getfield(L, -1, "dug");
|
||||
read_soundspec(L, -1, f.sound_dug);
|
||||
lua_pop(L, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue