n3paste.de

::

a haskell happstack pastebin

  • New paste
  • View pastes

  • Login

  • About
  • Most recent pastes (filtered)

    Filter pastes (help):

    18:21 - Sat 2012.02.11

    Lua

    Paste: /OP/Show related

    No description.

    		local function attractor(distance, entity)
    			if get_player(entity) == get_player() then
    				if get_type(entity) == BASE or get_type(entity) == PLANET then
    					if distance < 500 then
    						return -1
    					else
    						return 2 * math.exp((0-distance) / 2000)
    					end
    				else
    					--if distance < 500 then
    						return math.max(-10, ((0-700)/distance))
    					--else
    					--	return 0
    					--end
    				end
    			elseif get_player(entity) ~= 0 then
    				if get_type(entity) == SHIP then
    					return math.max(-10, math.min(1, math.pow((distance - 300) / 300, 3)))
    				else
    					return math.max(-10, math.min(10, math.pow((distance - 300) / 300, 3)))