Vastly improve the boat with sound, texture, model
The boat has been revised with all-new textures, new exhaust, a better model with few/no shading errors, animated door and sounds. The model format had to be changed to b3d as obj does not support animation.
125
init.lua
@ -148,16 +148,46 @@ if minetest.get_modpath("advtrains_interlocking") ~= nil then
|
||||
dofile(minetest.get_modpath("linetrack") .. "/interlocking.lua")
|
||||
end
|
||||
|
||||
local exhaust_particle_spawner_base = {
|
||||
amount = 10,
|
||||
time = 0,
|
||||
minpos = {x=-1, y=2.8, z=-3.4},
|
||||
maxpos = {x=-1, y=2.8, z=-3.4},
|
||||
minvel = {x=-0.2, y=1.8, z=-0.2},
|
||||
maxvel = {x=0.2, y=2, z=0.2},
|
||||
minacc = {x=0, y=-0.1, z=0},
|
||||
maxacc = {x=0, y=-0.3, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 4,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
texture = "smoke_puff.png",
|
||||
}
|
||||
|
||||
advtrains.register_wagon("boat", {
|
||||
mesh="linetrack_boat.obj",
|
||||
textures = {"linetrack_boat.png"},
|
||||
mesh="linetrack_boat.b3d",
|
||||
textures = {
|
||||
"doors_door_steel.png",--y
|
||||
"linetrack_steel_tile_dark.png", --y(exhaust)
|
||||
"default_coal_block.png",
|
||||
"linetrack_steel_tile_light.png",--y
|
||||
"linetrack_steel_tile_dark.png",
|
||||
"linetrack_steel_tile_blue.png",--y
|
||||
"linetrack_diamond_plate_steel_blue.png",--y
|
||||
"linetrack_steel_tile_dark.png",--y(hull)
|
||||
"default_wood.png", --y
|
||||
"linetrack_lifering.png", --y
|
||||
"linetrack_boat_windows.png",
|
||||
},
|
||||
drives_on={waterline=true},
|
||||
max_speed=10,
|
||||
seats = {
|
||||
{
|
||||
name="Driver stand",
|
||||
attach_offset={x=0, y=2, z=12},
|
||||
view_offset={x=0, y=0, z=0},
|
||||
attach_offset={x=6, y=2, z=10},
|
||||
view_offset={x=6, y=0, z=8},
|
||||
group="dstand",
|
||||
},
|
||||
{
|
||||
@ -234,6 +264,18 @@ advtrains.register_wagon("boat", {
|
||||
require_doors_open=true,
|
||||
},
|
||||
},
|
||||
doors={
|
||||
open={
|
||||
[-1]={frames={x=0, y=1}, time=1},
|
||||
[1]={frames={x=0, y=1}, time=1},
|
||||
sound = "doors_steel_door_open",
|
||||
},
|
||||
close={
|
||||
[-1]={frames={x=2, y=3}, time=1},
|
||||
[1]={frames={x=2, y=3}, time=1},
|
||||
sound = "doors_steel_door_close",
|
||||
}
|
||||
},
|
||||
assign_to_seat_group = {"pass", "dstand"},
|
||||
door_entry={-1, 1},
|
||||
visual_size = {x=1, y=1},
|
||||
@ -242,8 +284,79 @@ advtrains.register_wagon("boat", {
|
||||
is_locomotive=true,
|
||||
wagon_width=5,
|
||||
drops={"default:steelblock 4"},
|
||||
horn_sound = "advtrains_subway_horn",
|
||||
glow = -1, --supposed to disable effect of light to texture color, so that the entity always appears as full-bright
|
||||
horn_sound = "linetrack_boat_horn",
|
||||
custom_on_destroy = function(self)
|
||||
if (self.sound_loop_handle) then
|
||||
minetest.sound_stop(self.sound_loop_handle) --don't loop forever D:
|
||||
end
|
||||
return true
|
||||
end,
|
||||
custom_on_velocity_change = function(self, velocity, old_velocity, dtime)
|
||||
if not velocity or not old_velocity then return end
|
||||
if old_velocity == 0 and velocity > 0 then
|
||||
self.particlespawners = {
|
||||
minetest.add_particlespawner(advtrains.merge_tables(exhaust_particle_spawner_base,
|
||||
{minpos = {x=1, y=2.8, z=-3.4}, maxpos = {x=1, y=2.9, z=-3.4}, attached = self.object})),
|
||||
minetest.add_particlespawner(advtrains.merge_tables(exhaust_particle_spawner_base,
|
||||
{minpos = {x=-1, y=2.8, z=-3.4}, minpos = {x=-1, y=2.8, z=-3.4}, attached = self.object})),
|
||||
}
|
||||
minetest.sound_play("linetrack_boat_start", {object = self.object})
|
||||
return
|
||||
end
|
||||
if velocity == 0 then
|
||||
if self.sound_loop_handle then
|
||||
minetest.sound_stop(self.sound_loop_handle)
|
||||
self.sound_loop_handle = nil
|
||||
end
|
||||
if self.particlespawners then
|
||||
for k,v in pairs(self.particlespawners) do
|
||||
minetest.delete_particlespawner(v)
|
||||
end
|
||||
end
|
||||
if old_velocity > 0 then
|
||||
minetest.sound_play("linetrack_boat_stop", {object = self.object})
|
||||
end
|
||||
return
|
||||
end
|
||||
if self.rev_tmr then
|
||||
delta = minetest.get_us_time()- self.rev_start
|
||||
if delta >= self.rev_tmr then
|
||||
self.rev_tmr = nil
|
||||
if self.rev_high then
|
||||
self.sound_loop_handle = minetest.sound_play({name="linetrack_boat_idle_high", gain=0.3}, {object = self.object, loop=true})
|
||||
else
|
||||
self.sound_loop_handle = minetest.sound_play({name="linetrack_boat_idle_low", gain=0.3}, {object = self.object, loop=true})
|
||||
end
|
||||
end
|
||||
elseif velocity > 0 then
|
||||
if self.sound_loop_handle == nil then
|
||||
if velocity > 5 then
|
||||
self.sound_loop_handle = minetest.sound_play({name="linetrack_boat_idle_high", gain=0.3}, {object = self.object, loop=true})
|
||||
else
|
||||
self.sound_loop_handle = minetest.sound_play({name="linetrack_boat_idle_low", gain=0.3}, {object = self.object, loop=true})
|
||||
end
|
||||
return
|
||||
end
|
||||
if velocity ~= old_velocity then
|
||||
if old_velocity < 5 and velocity > 5 then
|
||||
minetest.sound_stop(self.sound_loop_handle)
|
||||
self.sound_loop_handle = nil
|
||||
minetest.sound_play({name="linetrack_boat_revup", gain=0.3}, {object = self.object})
|
||||
self.rev_start = minetest.get_us_time()
|
||||
self.rev_tmr = 2813000
|
||||
self.rev_high = true
|
||||
elseif old_velocity > 5 and velocity < 5 then
|
||||
minetest.sound_stop(self.sound_loop_handle)
|
||||
self.sound_loop_handle = nil
|
||||
minetest.sound_play({name="linetrack_boat_revdown", gain=0.3}, {object = self.object})
|
||||
self.rev_start = minetest.get_us_time()
|
||||
self.rev_tmr = 373000
|
||||
self.rev_high = false
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}, "Boat", "linetrack_boat_inv.png")
|
||||
|
||||
minetest.register_node("linetrack:invisible_platform", {
|
||||
|
BIN
models/linetrack_boat.b3d
Normal file
BIN
sounds/linetrack_boat_horn.ogg
Normal file
BIN
sounds/linetrack_boat_idle_high.ogg
Normal file
BIN
sounds/linetrack_boat_idle_low.ogg
Normal file
BIN
sounds/linetrack_boat_revdown.ogg
Normal file
BIN
sounds/linetrack_boat_revup.ogg
Normal file
BIN
sounds/linetrack_boat_start.ogg
Normal file
BIN
sounds/linetrack_boat_stop.ogg
Normal file
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 219 B |
BIN
textures/linetrack_boat_windows.png
Normal file
After Width: | Height: | Size: 680 B |
BIN
textures/linetrack_diamond_plate_steel_blue.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
textures/linetrack_lifering.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
textures/linetrack_steel_tile_blue.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
textures/linetrack_steel_tile_dark.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
textures/linetrack_steel_tile_light.png
Normal file
After Width: | Height: | Size: 701 B |