aboutsummaryrefslogtreecommitdiff
path: root/advtrains/models/advtrains_retrosignal_on_60.b3d
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-11-29 16:59:07 +0100
committerorwell96 <orwell@bleipb.de>2018-11-29 17:00:57 +0100
commit01ffee4d58316c74c90a36b491770ee358fd3f98 (patch)
treedc0b6163f68101a276d28097211370b9e5182b73 /advtrains/models/advtrains_retrosignal_on_60.b3d
parent0f295ec4a94b25920d4ac1e107cfc469a70c8455 (diff)
downloadadvtrains-01ffee4d58316c74c90a36b491770ee358fd3f98.tar.gz
advtrains-01ffee4d58316c74c90a36b491770ee358fd3f98.tar.bz2
advtrains-01ffee4d58316c74c90a36b491770ee358fd3f98.zip
Implement new position encoding function and benchmark it
This shall replace all "pos_to_string" hashes in the long term. Performs a bit better than pos_to_string (but still worse than the "nested tables" layout the nodedb uses (an unmatched open parenthesis leaves a tension that will stay all day... 2 do even more
Diffstat (limited to 'advtrains/models/advtrains_retrosignal_on_60.b3d')
0 files changed, 0 insertions, 0 deletions
uot;, { initial_properties = { hp_max = 1, physical = true, collisionbox = {-0.17,-0.17,-0.17, 0.17,0.17,0.17}, visual = "sprite", visual_size = {x=0.5, y=0.5}, textures = {""}, spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, is_visible = false, }, itemstring = '', physical_state = true, set_item = function(self, itemstring) self.itemstring = itemstring local stack = ItemStack(itemstring) local itemtable = stack:to_table() local itemname = nil if itemtable then itemname = stack:to_table().name end local item_texture = nil local item_type = "" if minetest.registered_items[itemname] then item_texture = minetest.registered_items[itemname].inventory_image item_type = minetest.registered_items[itemname].type end prop = { is_visible = true, visual = "sprite", textures = {"unknown_item.png"} } if item_texture and item_texture ~= "" then prop.visual = "sprite" prop.textures = {item_texture} prop.visual_size = {x=0.50, y=0.50} else prop.visual = "wielditem" prop.textures = {itemname} prop.visual_size = {x=0.20, y=0.20} prop.automatic_rotate = math.pi * 0.25 end self.object:set_properties(prop) end, get_staticdata = function(self) --return self.itemstring return minetest.serialize({ itemstring = self.itemstring, always_collect = self.always_collect, }) end, on_activate = function(self, staticdata) if string.sub(staticdata, 1, string.len("return")) == "return" then local data = minetest.deserialize(staticdata) if data and type(data) == "table" then self.itemstring = data.itemstring self.always_collect = data.always_collect end else self.itemstring = staticdata end self.object:set_armor_groups({immortal=1}) self.object:setvelocity({x=0, y=2, z=0}) self.object:setacceleration({x=0, y=-10, z=0}) self:set_item(self.itemstring) end, on_step = function(self, dtime) local p = self.object:getpos() p.y = p.y - 0.3 local nn = minetest.env:get_node(p).name -- If node is not registered or node is walkably solid and resting on nodebox