aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-10-26 15:30:27 +0200
committerorwell96 <mono96.mml@gmail.com>2016-10-26 15:30:27 +0200
commit6a406505ea1c12e8bce7836b245042abb83c3f8c (patch)
tree5ad28ec346e9073eb295c9ff4babc7f48a1f97af /wagons.lua
parent33fe29b3a5b5636761e14aae23b1cfe04397e0a7 (diff)
downloadadvtrains-6a406505ea1c12e8bce7836b245042abb83c3f8c.tar.gz
advtrains-6a406505ea1c12e8bce7836b245042abb83c3f8c.tar.bz2
advtrains-6a406505ea1c12e8bce7836b245042abb83c3f8c.zip
add smoke to steam engine
feature may behave strange or not work at all until latest git version!
Diffstat (limited to 'wagons.lua')
-rw-r--r--wagons.lua34
1 files changed, 33 insertions, 1 deletions
diff --git a/wagons.lua b/wagons.lua
index e543d0c..1966ebe 100644
--- a/wagons.lua
+++ b/wagons.lua
@@ -89,6 +89,10 @@ function wagon:on_activate(staticdata, dtime_s)
end
advtrains.update_trainpart_properties(self.train_id)
minetest.after(1, function() self:reattach_all() end)
+
+ if self.custom_on_activate then
+ self:custom_on_activate(staticdata_table, dtime_s)
+ end
end
function wagon:get_staticdata()
@@ -203,7 +207,7 @@ function wagon:on_step(dtime)
--custom on_step function
if self.custom_on_step then
- self.custom_on_step(self, dtime)
+ self:custom_on_step(self, dtime)
end
--driver control
@@ -526,6 +530,34 @@ advtrains.register_wagon("newlocomotive", "steam",{
--self.old_anim_velocity=advtrains.abs_ceil(velocity)
--end
end,
+ custom_on_activate = function(self, staticdata_table, dtime_s)
+ minetest.add_particlespawner({
+ amount = 10,
+ time = 0,
+ -- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base
+ minpos = {x=0, y=2, z=1.2},
+ maxpos = {x=0, y=2, z=1.2},
+ minvel = {x=0, y=1.8, z=0},
+ maxvel = {x=0, y=2, z=0},
+ minacc = {x=0, y=-0.1, z=0},
+ maxacc = {x=0, y=-0.3, z=0},
+ minexptime = 2,
+ maxexptime = 4,
+ minsize = 1,
+ maxsize = 5,
+ -- ^ The particle's properties are random values in between the bounds:
+ -- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
+ -- ^ minsize/maxsize, minexptime/maxexptime (expirationtime)
+ collisiondetection = true,
+ -- ^ collisiondetection: if true uses collision detection
+ vertical = false,
+ -- ^ vertical: if true faces player using y axis only
+ texture = "smoke_puff.png",
+ -- ^ Uses texture (string)
+ attached = self.object,
+ })
+ minetest.chat_send_all("added ParticleSpawner")
+ end,
drops={"default:steelblock 4"},
}, "Steam Engine", "advtrains_newlocomotive_inv.png")
advtrains.register_wagon("wagon_default", "steam",{