Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
minetest_game
Commits
ddebdecc
Unverified
Commit
ddebdecc
authored
3 years ago
by
Paramat
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add open/close sound gains to the Doors API, balance sound levels (#2768)
parent
71ea0c65
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
game_api.txt
+4
-0
4 additions, 0 deletions
game_api.txt
mods/doors/init.lua
+35
-6
35 additions, 6 deletions
mods/doors/init.lua
mods/xpanes/init.lua
+4
-0
4 additions, 0 deletions
mods/xpanes/init.lua
with
43 additions
and
6 deletions
game_api.txt
+
4
−
0
View file @
ddebdecc
...
...
@@ -225,6 +225,8 @@ The doors mod allows modders to register custom doors and trapdoors.
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
gain_open = 0.3, -- optional, defaults to 0.3
gain_close = 0.3, -- optional, defaults to 0.3
protected = false, -- If true, only placer can open the door (locked for others)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
-- optional function containing the on_rightclick callback, defaults to a doors.door_toggle-wrapper
...
...
@@ -244,6 +246,8 @@ The doors mod allows modders to register custom doors and trapdoors.
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
gain_open = 0.3, -- optional, defaults to 0.3
gain_close = 0.3, -- optional, defaults to 0.3
protected = false, -- If true, only placer can open the door (locked for others)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
-- function containing the on_rightclick callback
...
...
This diff is collapsed.
Click to expand it.
mods/doors/init.lua
+
35
−
6
View file @
ddebdecc
...
...
@@ -170,10 +170,10 @@ function doors.door_toggle(pos, node, clicker)
if
state
%
2
==
0
then
minetest
.
sound_play
(
def
.
door
.
sounds
[
1
],
{
pos
=
pos
,
gain
=
0
.
3
,
max_hear_distance
=
10
},
true
)
{
pos
=
pos
,
gain
=
def
.
door
.
gains
[
1
]
,
max_hear_distance
=
10
},
true
)
else
minetest
.
sound_play
(
def
.
door
.
sounds
[
2
],
{
pos
=
pos
,
gain
=
0
.
3
,
max_hear_distance
=
10
},
true
)
{
pos
=
pos
,
gain
=
def
.
door
.
gains
[
2
]
,
max_hear_distance
=
10
},
true
)
end
minetest
.
swap_node
(
pos
,
{
...
...
@@ -364,12 +364,21 @@ function doors.register(name, def)
def
.
sound_close
=
"doors_door_close"
end
if
not
def
.
gain_open
then
def
.
gain_open
=
0
.
3
end
if
not
def
.
gain_close
then
def
.
gain_close
=
0
.
3
end
def
.
groups
.
not_in_creative_inventory
=
1
def
.
groups
.
door
=
1
def
.
drop
=
name
def
.
door
=
{
name
=
name
,
sounds
=
{
def
.
sound_close
,
def
.
sound_open
},
sounds
=
{
def
.
sound_close
,
def
.
sound_open
},
gains
=
{
def
.
gain_close
,
def
.
gain_open
},
}
if
not
def
.
on_rightclick
then
def
.
on_rightclick
=
function
(
pos
,
node
,
clicker
,
itemstack
,
pointed_thing
)
...
...
@@ -461,6 +470,8 @@ doors.register("door_wood", {
description
=
S
(
"Wooden Door"
),
inventory_image
=
"doors_item_wood.png"
,
groups
=
{
node
=
1
,
choppy
=
2
,
oddly_breakable_by_hand
=
2
,
flammable
=
2
},
gain_open
=
0
.
06
,
gain_close
=
0
.
13
,
recipe
=
{
{
"group:wood"
,
"group:wood"
},
{
"group:wood"
,
"group:wood"
},
...
...
@@ -477,6 +488,8 @@ doors.register("door_steel", {
sounds
=
default
.
node_sound_metal_defaults
(),
sound_open
=
"doors_steel_door_open"
,
sound_close
=
"doors_steel_door_close"
,
gain_open
=
0
.
2
,
gain_close
=
0
.
2
,
recipe
=
{
{
"default:steel_ingot"
,
"default:steel_ingot"
},
{
"default:steel_ingot"
,
"default:steel_ingot"
},
...
...
@@ -492,6 +505,8 @@ doors.register("door_glass", {
sounds
=
default
.
node_sound_glass_defaults
(),
sound_open
=
"doors_glass_door_open"
,
sound_close
=
"doors_glass_door_close"
,
gain_open
=
0
.
3
,
gain_close
=
0
.
25
,
recipe
=
{
{
"default:glass"
,
"default:glass"
},
{
"default:glass"
,
"default:glass"
},
...
...
@@ -507,6 +522,8 @@ doors.register("door_obsidian_glass", {
sounds
=
default
.
node_sound_glass_defaults
(),
sound_open
=
"doors_glass_door_open"
,
sound_close
=
"doors_glass_door_close"
,
gain_open
=
0
.
3
,
gain_close
=
0
.
25
,
recipe
=
{
{
"default:obsidian_glass"
,
"default:obsidian_glass"
},
{
"default:obsidian_glass"
,
"default:obsidian_glass"
},
...
...
@@ -553,12 +570,12 @@ function doors.trapdoor_toggle(pos, node, clicker)
if
string.sub
(
node
.
name
,
-
5
)
==
"_open"
then
minetest
.
sound_play
(
def
.
sound_close
,
{
pos
=
pos
,
gain
=
0
.
3
,
max_hear_distance
=
10
},
true
)
{
pos
=
pos
,
gain
=
def
.
gain_close
,
max_hear_distance
=
10
},
true
)
minetest
.
swap_node
(
pos
,
{
name
=
string.sub
(
node
.
name
,
1
,
string.len
(
node
.
name
)
-
5
),
param1
=
node
.
param1
,
param2
=
node
.
param2
})
else
minetest
.
sound_play
(
def
.
sound_open
,
{
pos
=
pos
,
gain
=
0
.
3
,
max_hear_distance
=
10
},
true
)
{
pos
=
pos
,
gain
=
def
.
gain_open
,
max_hear_distance
=
10
},
true
)
minetest
.
swap_node
(
pos
,
{
name
=
node
.
name
..
"_open"
,
param1
=
node
.
param1
,
param2
=
node
.
param2
})
end
...
...
@@ -641,6 +658,14 @@ function doors.register_trapdoor(name, def)
def
.
sound_close
=
"doors_door_close"
end
if
not
def
.
gain_open
then
def
.
gain_open
=
0
.
3
end
if
not
def
.
gain_close
then
def
.
gain_close
=
0
.
3
end
local
def_opened
=
table
.
copy
(
def
)
local
def_closed
=
table
.
copy
(
def
)
...
...
@@ -694,6 +719,8 @@ doors.register_trapdoor("doors:trapdoor", {
wield_image
=
"doors_trapdoor.png"
,
tile_front
=
"doors_trapdoor.png"
,
tile_side
=
"doors_trapdoor_side.png"
,
gain_open
=
0
.
06
,
gain_close
=
0
.
13
,
groups
=
{
choppy
=
2
,
oddly_breakable_by_hand
=
2
,
flammable
=
2
,
door
=
1
},
})
...
...
@@ -707,6 +734,8 @@ doors.register_trapdoor("doors:trapdoor_steel", {
sounds
=
default
.
node_sound_metal_defaults
(),
sound_open
=
"doors_steel_door_open"
,
sound_close
=
"doors_steel_door_close"
,
gain_open
=
0
.
2
,
gain_close
=
0
.
2
,
groups
=
{
cracky
=
1
,
level
=
2
,
door
=
1
},
})
...
...
@@ -747,7 +776,7 @@ function doors.register_fencegate(name, def)
on_rightclick
=
function
(
pos
,
node
,
clicker
,
itemstack
,
pointed_thing
)
local
node_def
=
minetest
.
registered_nodes
[
node
.
name
]
minetest
.
swap_node
(
pos
,
{
name
=
node_def
.
gate
,
param2
=
node
.
param2
})
minetest
.
sound_play
(
node_def
.
sound
,
{
pos
=
pos
,
gain
=
0
.
3
,
minetest
.
sound_play
(
node_def
.
sound
,
{
pos
=
pos
,
gain
=
0
.
15
,
max_hear_distance
=
8
},
true
)
return
itemstack
end
,
...
...
This diff is collapsed.
Click to expand it.
mods/xpanes/init.lua
+
4
−
0
View file @
ddebdecc
...
...
@@ -227,6 +227,8 @@ if minetest.get_modpath("doors") then
sounds
=
default
.
node_sound_metal_defaults
(),
sound_open
=
"xpanes_steel_bar_door_open"
,
sound_close
=
"xpanes_steel_bar_door_close"
,
gain_open
=
0
.
15
,
gain_close
=
0
.
13
,
recipe
=
{
{
"xpanes:bar_flat"
,
"xpanes:bar_flat"
},
{
"xpanes:bar_flat"
,
"xpanes:bar_flat"
},
...
...
@@ -245,6 +247,8 @@ if minetest.get_modpath("doors") then
sounds
=
default
.
node_sound_metal_defaults
(),
sound_open
=
"xpanes_steel_bar_door_open"
,
sound_close
=
"xpanes_steel_bar_door_close"
,
gain_open
=
0
.
15
,
gain_close
=
0
.
13
,
})
minetest
.
register_craft
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment