Skip to content

Instantly share code, notes, and snippets.

@GreenXenith
Created October 13, 2018 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenXenith/0ba0edfe1f1686f06a877905bab712db to your computer and use it in GitHub Desktop.
Save GreenXenith/0ba0edfe1f1686f06a877905bab712db to your computer and use it in GitHub Desktop.
Entity staticdata
on_activate = function(self, staticdata)
if staticdata ~= "" and staticdata ~= nil then
local data = minetest.deserialize(staticdata)
if data ~= nil then
self.props = data.props
self.attach = data.attach
self.object:set_attach(self.attach)
self.object:set_properties(self.props)
self.object:set_armor_groups({immortal = 1})
end
end
end,
get_staticdata = function(self)
local data = {
props = self.object:get_properties(),
attach = self.object:get_attach(),
}
return minetest.serialize(data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment