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