Script that makes everything liquid

  • alice_loona_OT12
    19th August Member 0 Permalink

    The most epickest script ever!!1111! It makes everything liquid (you have to restart TPT to undo it). It can be run in the console.

     

    Edit: Actually makes everything liquid now, but has to be run as a file

    --https://stackoverflow.com/a/32387452 code by ryanpattison
    local mask = tonumber("11111111111111111111111111100000",2);
    
    function bitand(a, b)
        local result = 0
        local bitval = 1
        while a > 0 and b > 0 do
          if a % 2 == 1 and b % 2 == 1 then -- test the rightmost bits
              result = result + bitval      -- set the current bit
          end
          bitval = bitval * 2 -- shift left
          a = math.floor(a/2) -- shift right
          b = math.floor(b/2)
        end
        return result
    end
    
    for n,p in pairs(tpt.el) do
    	--[[local props = p.properties;
    	if props % 16 == 0 then
    		props = props - 14
    	elseif props % 8 == 0 then
    		props = props - 6
    	elseif props % 4 == 0 then
    		props = props - 2
    	elseif props % 2 == 1
    		then props = props + 1
    	end;
    	tpt.el[n].properties = props;
    	]]
    	tpt.el[n].properties = bitand(tpt.el[n].properties,mask) + 2;
    	tpt.el[n].falldown = 2;
    	if tpt.el[n].gravity == 0 then
    		tpt.el[n].gravity = tpt.el.glow.gravity
    	end;
    	if tpt.el[n].loss == 0 then
    		tpt.el[n].loss = tpt.el.oil.loss
    	end;
    	if tpt.el[n].airdrag == 0 then
    		tpt.el[n].airdrag = tpt.el.oil.airdrag
    	end;
    	if tpt.el[n].diffusion > 1 then
    		tpt.el[n].diffusion = 1
    	end
    end
    Edited 2 times by alice_loona_OT12. Last: 21st August