diff --git a/scripts/gravityuse.lua b/scripts/gravityuse.lua index 18f6397..047588c 100644 --- a/scripts/gravityuse.lua +++ b/scripts/gravityuse.lua @@ -48,7 +48,7 @@ minetest.register_entity( time = 0.1, portalgun_power = 1, portalgun = 1, - lifelime = 100, + lifetime = 100, on_activate = function(self, staticdata) if portalgun_power.user then self.user = portalgun_power.user @@ -78,8 +78,8 @@ minetest.register_entity( end end if self.player then - self.lifelime = self.lifelime - 1 - if self.lifelime < 0 then + self.lifetime = self.lifetime - 1 + if self.lifetime < 0 then self.target:set_detach() return self end @@ -118,7 +118,7 @@ minetest.register_entity( time = 0.025, portalgun_power = 1, portalgun = 1, - lifelime = 1000, + lifetime = 1000, v = 0.3, ltime = 0, on_activate = function(self, staticdata) @@ -150,16 +150,16 @@ minetest.register_entity( self.ltime = self.ltime - self.v if self.ltime < self.v or (v2.x + v2.y + v2.z == 0) then - self.lifelime = -1 + self.lifetime = -1 end local nexpos = {x = pos.x + (v.x * 0.05), y = pos.y + (v.y * 0.05) + 1, z = pos.z + (v.z * 0.05)} if minetest.registered_nodes[minetest.get_node(nexpos).name].walkable then - self.lifelime = -1 + self.lifetime = -1 end - self.lifelime = self.lifelime - 1 - if self.lifelime < 0 then + self.lifetime = self.lifetime - 1 + if self.lifetime < 0 then self.target:set_detach() end diff --git a/scripts/portalgun.lua b/scripts/portalgun.lua index 55b0713..bd37666 100644 --- a/scripts/portalgun.lua +++ b/scripts/portalgun.lua @@ -3,7 +3,7 @@ portalgun_portal_tmp_user_abort = 0 portalgun_portal_tmp_user = "" local portalgun_timer = 1.2 local portalgun_time = 0 -portalgun_lifelime = 1200 --deletes portals that not used after a while +portalgun_lifetime = 1200 --deletes portals that not used after a while portalgun_max_rage = 100 portalgun_max_use_per_secund_time = 4 --destroys the portal if excessive used portalgun_max_use_per_secund = 25 --4 & 25 is default = teleported (teleported 25 times in 4 sec) @@ -101,15 +101,15 @@ portalgun_on_step = function(self, dtime) return self end - if portalgun_portal[name].lifelime < 0 then + if portalgun_portal[name].lifetime < 0 then portal_delete(name, 0) return self end if portalgun_portal[name].portal1_active and portalgun_portal[name].portal2_active then -- makes lifetime equal when both is acive, or it will be half - portalgun_portal[name].lifelime = portalgun_portal[name].lifelime - 0.5 + portalgun_portal[name].lifetime = portalgun_portal[name].lifetime - 0.5 else - portalgun_portal[name].lifelime = portalgun_portal[name].lifelime - 1 + portalgun_portal[name].lifetime = portalgun_portal[name].lifetime - 1 return self -- abort when only 1 is active (saves cpu) end @@ -274,7 +274,7 @@ portalgun_on_step = function(self, dtime) portalgun_portal[name].timer = 0.2 self.portal_max_use = self.portal_max_use + 1 ob:set_pos(obpos, false) - portalgun_portal[name].lifelime = portalgun_lifelime + portalgun_portal[name].lifetime = portalgun_lifetime minetest.sound_play( "portalgun_teleport", {pos = portalgun_portal[name].portal1_pos, max_hear_distance = 10, gain = 30} @@ -433,8 +433,6 @@ local function rnd(r) return math.floor(r + 0.5) end -minetest.register_privilege("allblocksportal", "Can use place portals everywhere") - function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun if pointed_thing.type == "object" then portalgun_gravity(itemstack, user, pointed_thing) @@ -449,7 +447,7 @@ function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun local item = itemstack:to_table() local ob = {} ob.project = 1 - ob.lifelime = portalgun_lifelime + ob.lifetime = portalgun_lifetime ob.portal1 = 0 ob.portal2 = 0 ob.portal1_dir = 0 @@ -460,7 +458,7 @@ function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun if portalgun_portal[name] == nil then -- new portal profile portalgun_portal[name] = { - lifelime = portalgun_lifelime, + lifetime = portalgun_lifetime, project = 1, timer = 0, portal1_active = false, @@ -480,19 +478,16 @@ function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun -- the project for i = 1, portalgun_max_rage, 0.5 do - local nname = - minetest.get_node({x = pos.x + (dir.x * i), y = pos.y + (dir.y * i), z = pos.z + (dir.z * i)}).name + local nname = minetest.get_node({x = pos.x + (dir.x * i), y = pos.y + (dir.y * i), z = pos.z + (dir.z * i)}).name if minetest.registered_nodes[nname].walkable then - portalgun_portal[name].lifelime = portalgun_lifelime + portalgun_portal[name].lifetime = portalgun_lifetime -- if minetest.get_node_group(nname, "antiportal") > 0 then -- minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3}) -- return itemstack -- end - --check if the name doesnt start with portalgun:testblock or if has priv allblocksportal - local allplace = minetest.check_player_privs(user:get_player_name(), {allblocksportal = true}) local istestblock = string.find(nname, "portalgun:testblock", 1) - if not istestblock and not allplace then + if not istestblock then minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3}) return itemstack end