daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Jul 7th, 2018 3 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- on_activate() SNIPPET
  2.  
  3. if string.sub(staticdata, 1, string.len("return")) ~= "return" then
  4.                 return
  5.         end
  6.         local data = minetest.deserialize(staticdata)
  7.         if type(data) ~= "table" then
  8.                 return
  9.         end
  10.         self.railtype = data.railtype
  11.         if data.old_dir then
  12.                 self.old_dir = data.old_dir
  13.         end
  14.  
  15.         if data.placets then
  16.         self.placets = data.placets
  17.         end
  18.  
  19.         if not self.placets then
  20.         self.placets = os.time() + 180
  21.         end
  22.  
  23.         if os.time() > self.placets then
  24.         self.object:remove()
  25.         return
  26.         end
  27.  
  28. end
  29.  
  30. --- get_staticdata() SNIPPET
  31.  
  32. return minetest.serialize({
  33.                 railtype = self.railtype,
  34.                 old_dir = self.old_dir,
  35.                 placets = self.placets
  36.         })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top