steam engine sound bugfix
This commit is contained in:
parent
73c33a6e7a
commit
df1c1937ee
@ -20,8 +20,8 @@ local ore_probability = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local ProbabilityCorrections = {
|
local ProbabilityCorrections = {
|
||||||
["default:coal_lump"] = 0.5, -- extensively used
|
["default:coal_lump"] = 0.3, -- extensively used
|
||||||
["default:iron_lump"] = 0.5, -- extensively used
|
["default:iron_lump"] = 0.4, -- extensively used
|
||||||
["techage:baborium_lump"] = 99999, -- mining required
|
["techage:baborium_lump"] = 99999, -- mining required
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ for idx = 0,3 do
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {choppy = 2, cracky = 1, not_in_creative_inventory = (idx == 3) and 0 or 1},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, not_in_creative_inventory = (idx == 3) and 0 or 1},
|
||||||
drop = "techage:sieve3",
|
drop = "techage:sieve3",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -162,7 +162,7 @@ minetest.register_node("techage:sieved_gravel", {
|
|||||||
minetest.register_node("techage:compressed_gravel", {
|
minetest.register_node("techage:compressed_gravel", {
|
||||||
description = I("Compressed Gravel"),
|
description = I("Compressed Gravel"),
|
||||||
tiles = {"techage_compressed_gravel.png"},
|
tiles = {"techage_compressed_gravel.png"},
|
||||||
groups = {cracky=2, crumbly = 2, cracky = 2},
|
groups = {cracky=2, crumbly = 2},
|
||||||
sounds = default.node_sound_gravel_defaults(),
|
sounds = default.node_sound_gravel_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -43,41 +43,46 @@ local function formspec(self, pos, mem)
|
|||||||
default.get_hotbar_bg(0, 3)
|
default.get_hotbar_bg(0, 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_cylinder(pos, on)
|
local function start_cylinder(pos, on, mem)
|
||||||
|
if not on then
|
||||||
|
if mem.handle then
|
||||||
|
minetest.sound_stop(mem.handle)
|
||||||
|
mem.handle = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos2 = techage.get_pos(pos, 'L')
|
||||||
local trd = TRD(pos2)
|
local trd = TRD(pos2)
|
||||||
if trd and trd.start_cylinder then
|
if trd and trd.start_cylinder then
|
||||||
return trd.start_cylinder(pos2, on)
|
return trd.start_cylinder(pos2, on, mem)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_start(pos, mem, state)
|
local function can_start(pos, mem, state)
|
||||||
return start_cylinder(pos, true)
|
return start_cylinder(pos, true, mem)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function play_sound(pos)
|
local function play_sound(pos)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
mem.handle = minetest.sound_play("techage_steamengine", {
|
if mem.techage_state == techage.RUNNING then
|
||||||
pos = pos,
|
mem.handle = minetest.sound_play("techage_steamengine", {
|
||||||
gain = 0.5,
|
pos = pos,
|
||||||
max_hear_distance = 10})
|
gain = 0.5,
|
||||||
minetest.after(2, play_sound, pos)
|
max_hear_distance = 10})
|
||||||
|
minetest.after(2, play_sound, pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_node(pos, mem, state)
|
local function start_node(pos, mem, state)
|
||||||
print("start_node")
|
|
||||||
generator.turn_power_on(pos, POWER_CAPACITY)
|
generator.turn_power_on(pos, POWER_CAPACITY)
|
||||||
|
mem.techage_state = techage.RUNNING
|
||||||
play_sound(pos)
|
play_sound(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stop_node(pos, mem, state)
|
local function stop_node(pos, mem, state)
|
||||||
start_cylinder(pos, false)
|
mem.techage_state = techage.STOPPED
|
||||||
|
start_cylinder(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
if mem.handle then
|
|
||||||
minetest.sound_stop(mem.handle)
|
|
||||||
mem.handle = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local State = techage.NodeStates:new({
|
local State = techage.NodeStates:new({
|
||||||
@ -96,20 +101,19 @@ local function distibuting(pos, mem)
|
|||||||
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_cylinder(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
print("flywheel node_timer")
|
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos2 = techage.get_pos(pos, 'L')
|
||||||
if minetest.get_node(pos2).name == "techage:cylinder_on" and tubelib2.get_mem(pos2).running then
|
if minetest.get_node(pos2).name == "techage:cylinder_on" and tubelib2.get_mem(pos2).running then
|
||||||
distibuting(pos, mem)
|
distibuting(pos, mem)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_cylinder(pos, false, mem)
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
return State:is_active(mem)
|
return State:is_active(mem)
|
||||||
@ -125,7 +129,7 @@ local function turn_power_on(pos, in_dir, sum)
|
|||||||
mem.power_result = sum
|
mem.power_result = sum
|
||||||
if State:is_active(mem) and sum <= 0 then
|
if State:is_active(mem) and sum <= 0 then
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_cylinder(pos, false)
|
start_cylinder(pos, false, mem)
|
||||||
-- No automatic turn on
|
-- No automatic turn on
|
||||||
mem.power_capacity = 0
|
mem.power_capacity = 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user