Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- on_activate() SNIPPET
- if string.sub(staticdata, 1, string.len("return")) ~= "return" then
- return
- end
- local data = minetest.deserialize(staticdata)
- if type(data) ~= "table" then
- return
- end
- self.railtype = data.railtype
- if data.old_dir then
- self.old_dir = data.old_dir
- end
- if data.placets then
- self.placets = data.placets
- end
- if not self.placets then
- self.placets = os.time() + 180
- end
- if os.time() > self.placets then
- self.object:remove()
- return
- end
- end
- --- get_staticdata() SNIPPET
- return minetest.serialize({
- railtype = self.railtype,
- old_dir = self.old_dir,
- placets = self.placets
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement