forked from mtcontrib/maidroid
Fix egg writer
This commit is contained in:
parent
51f55e4229
commit
d5c10eee5f
@ -63,7 +63,7 @@ function maidroid_tool.register_writer(nodename, options)
|
||||
swap_node(pos, nodename)
|
||||
|
||||
if on_deactivate ~= nil then -- call on_deactivate callback.
|
||||
on_deactivate(pos)
|
||||
on_deactivate(pos, output)
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -86,7 +86,7 @@ function maidroid_tool.register_writer(nodename, options)
|
||||
swap_node(pos, nodename .. "_active")
|
||||
|
||||
if on_activate ~= nil then -- call on_activate callback.
|
||||
on_activate(pos, output)
|
||||
on_activate(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -140,12 +140,12 @@ do -- register egg writer
|
||||
return nil
|
||||
end
|
||||
|
||||
local function on_deactivate(pos)
|
||||
local function on_deactivate(pos, output)
|
||||
local egg_entity = get_nearest_egg_entity(pos)
|
||||
egg_entity:stop_move()
|
||||
egg_entity:stop_move(output)
|
||||
end
|
||||
|
||||
local function on_activate(pos, output)
|
||||
local function on_activate(pos)
|
||||
local egg_entity = get_nearest_egg_entity(pos)
|
||||
egg_entity.object:set_properties{textures={"maidroid:empty_egg"}}
|
||||
egg_entity:start_move(output)
|
||||
@ -192,7 +192,6 @@ do -- register a definition of an egg entity
|
||||
|
||||
self.is_moving = data["is_moving"]
|
||||
self.center_position = data["center_position"]
|
||||
self.output = data["output"]
|
||||
self.current_egg = data["current_egg"]
|
||||
|
||||
self.object:set_properties{textures={self.current_egg}}
|
||||
@ -208,21 +207,18 @@ do -- register a definition of an egg entity
|
||||
|
||||
local function start_move(self, output)
|
||||
self.is_moving = true
|
||||
self.output = output
|
||||
end
|
||||
|
||||
local function stop_move(self)
|
||||
self.object:set_properties{textures={self.output}}
|
||||
local function stop_move(self, output)
|
||||
self.object:set_properties{textures={output}}
|
||||
self.is_moving = false
|
||||
self.current_egg = self.output
|
||||
self.output = ""
|
||||
self.current_egg = output
|
||||
end
|
||||
|
||||
local function get_staticdata(self)
|
||||
local data = {
|
||||
["is_moving"] = self.is_moving,
|
||||
["center_position"] = self.center_position,
|
||||
["output"] = self.output,
|
||||
["current_egg"] = self.current_egg,
|
||||
}
|
||||
return minetest.serialize(data)
|
||||
@ -273,7 +269,6 @@ do -- register a definition of an egg entity
|
||||
get_staticdata = get_staticdata,
|
||||
on_step = on_step,
|
||||
initialize = initialize,
|
||||
output = "",
|
||||
current_egg = "maidroid:empty_egg",
|
||||
center_position = nil,
|
||||
is_moving = false,
|
||||
|
Loading…
Reference in New Issue
Block a user