X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mods%2Fitemhandling%2Fmagnet.lua;h=9a9d7372939d4db207cf6a8769398697e971c50d;hb=c35e0a98606cce8dd376de48bbda16e81a50a939;hp=a93cdc03b4689ea8951afbc4b0322506fd146dc0;hpb=1475bf11de84f719e7fdf41bf189f0e3563764e1;p=Crafter.git diff --git a/mods/itemhandling/magnet.lua b/mods/itemhandling/magnet.lua index a93cdc0..9a9d737 100644 --- a/mods/itemhandling/magnet.lua +++ b/mods/itemhandling/magnet.lua @@ -23,8 +23,8 @@ local entity local tick = false local function magnet(player) --don't magnetize to dead players + name = player:get_player_name() if player:get_hp() > 0 then - name = player:get_player_name() pos = player:get_pos() inv = player:get_inventory() if tick == true and pool[name] > 0 then @@ -33,7 +33,11 @@ local function magnet(player) gain = 0.4, pitch = math.random(60,100)/100 }) - pool[name] = pool[name] - 1 + if pool[name] > 6 then + pool[name] = 6 + else + pool[name] = pool[name] - 1 + end end --radial detection for _,object in ipairs(minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 2)) do