diff options
| author | Anthony Zhang <azhang9@gmail.com> | 2012-07-22 15:55:49 -0400 | 
|---|---|---|
| committer | Anthony Zhang <azhang9@gmail.com> | 2012-07-22 15:55:49 -0400 | 
| commit | a4a361317075c7cdf1d9f92131ad4d9d03221c41 (patch) | |
| tree | 010f750fcd481b751ddc18b907b8697346d71ff8 | |
| parent | 9067f733494930bb7bff98932164a765d054fdda (diff) | |
Remove WorldEdit markers if they are invalid.
| -rw-r--r-- | mark.lua | 12 | 
1 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,7 @@ worldedit.mark_pos1 = function(name)  	end
  	if pos ~= nil then --add marker
  		worldedit.marker1[name] = minetest.env:add_entity(pos, "worldedit:pos1")
 +		worldedit.marker1[name]:get_luaentity().active = true
  	end
  end
 @@ -22,6 +23,7 @@ worldedit.mark_pos2 = function(name)  	end
  	if pos ~= nil then --add marker
  		worldedit.marker2[name] = minetest.env:add_entity(pos, "worldedit:pos2")
 +		worldedit.marker2[name]:get_luaentity().active = true
  	end
  end
 @@ -34,6 +36,11 @@ minetest.register_entity("worldedit:pos1", {  			"worldedit_pos1.png", "worldedit_pos1.png"},
  		collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
  	},
 +	on_step = function(self, dtime)
 +		if self.active == nil then
 +			self.object:remove()
 +		end
 +	end,
  	on_punch = function(self, hitter)
  		self.object:remove()
  		local name = hitter:get_player_name()
 @@ -50,6 +57,11 @@ minetest.register_entity("worldedit:pos2", {  			"worldedit_pos2.png", "worldedit_pos2.png"},
  		collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
  	},
 +	on_step = function(self, dtime)
 +		if self.active == nil then
 +			self.object:remove()
 +		end
 +	end,
  	on_punch = function(self, hitter)
  		self.object:remove()
  		local name = hitter:get_player_name()
  | 
