ball tweak
keypad: extract words delimited by spaces
This commit is contained in:
parent
f0a0048c9b
commit
74fa0590ff
6
ball.lua
6
ball.lua
@ -144,7 +144,9 @@ minetest.register_entity("basic_machines:ball",{
|
|||||||
local p = obj:getpos();
|
local p = obj:getpos();
|
||||||
local d = math.sqrt((p.x-pos.x)^2+(p.y-pos.y)^2+(p.z-pos.z)^2);
|
local d = math.sqrt((p.x-pos.x)^2+(p.y-pos.y)^2+(p.z-pos.z)^2);
|
||||||
if d>0 then
|
if d>0 then
|
||||||
if minetest.is_protected(p,self.owner) then return end
|
|
||||||
|
--if minetest.is_protected(p,self.owner) then return end
|
||||||
|
if math.abs(p.x)>32 or math.abs(p.y)>32 or math.abs(p.z)>32 then return end
|
||||||
|
|
||||||
if obj:is_player() then -- dont hurt owner
|
if obj:is_player() then -- dont hurt owner
|
||||||
if obj:get_player_name()==self.owner then break end
|
if obj:get_player_name()==self.owner then break end
|
||||||
@ -513,7 +515,7 @@ minetest.register_tool("basic_machines:ball_spell", {
|
|||||||
local meta = minetest.deserialize(itemstack:get_metadata());
|
local meta = minetest.deserialize(itemstack:get_metadata());
|
||||||
local owner = meta["owner"] or "";
|
local owner = meta["owner"] or "";
|
||||||
|
|
||||||
if minetest.is_protected(pos,owner) then return end
|
--if minetest.is_protected(pos,owner) then return end
|
||||||
|
|
||||||
local t0 = spelltime[owner] or 0;
|
local t0 = spelltime[owner] or 0;
|
||||||
local t1 = minetest.get_gametime();
|
local t1 = minetest.get_gametime();
|
||||||
|
@ -815,7 +815,7 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
|
|||||||
|
|
||||||
--extract i-th word from text
|
--extract i-th word from text
|
||||||
local j = 0;
|
local j = 0;
|
||||||
for word in string.gmatch(text, "%a+") do
|
for word in string.gmatch(text, "%S+") do
|
||||||
j=j+1; if j == i then ttext = word; break; end
|
j=j+1; if j == i then ttext = word; break; end
|
||||||
end
|
end
|
||||||
-- set target keypad's target's infotext
|
-- set target keypad's target's infotext
|
||||||
|
Loading…
x
Reference in New Issue
Block a user