aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
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",{