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)))
    

    15:50 - Fri 2012.02.03

    Lua

    Paste: /5n/Show related

    No description.

    		function attraction(dist, entity)
    			if get_type(entity) == PLANET and get_player(entity) == 0 then
    				return 1
    			else
    				return 0 - ((5000 - dist) / 20000)
    			end
    		end
    
    		function swarm_move()
    			local curr_x, curr_y = get_position(self)
    			local att_x = 0
    			local att_y = 0
    
    			for _, v in pairs(get_entities(5000, SHIP + PLANET + BASE + ASTEROID)) do
    
    				-- If we're close to a free planet - try to colonize
    				if get_type(v) == PLANET and get_player(v) == 0 and get_distance(v) <= 100 then
    						if colonize(v) then
    							print("new colony!")
    						else
    

    06:47 - Mon 2012.01.09

    Lua

    Paste: /zHhV/Show related

    crtmpserver.lua

    -- Start of the configuration. This is the only node in the config file.
    -- The rest of them are sub-nodes
    configuration=
    {
    	-- if true, the server will run as a daemon.
    	-- NOTE: all console appenders will be ignored if this is a daemon
    	daemon=false,
    	-- the OS's path separator. Used in composing paths
    	pathSeparator="/",
    
    	-- this is the place where all the logging facilities are setted up
    	-- you can add/remove any number of locations
    	logAppenders=
    	{
    		{
    			-- name of the appender. Not too important, but is mandatory
    			name="console appender",
    			-- type of the appender. We can have the following values:
    			-- console, coloredConsole and file
    			-- NOTE: console appenders will be ignored if we run the server
    

    23:21 - Wed 2012.01.04

    Lua

    Paste: /D5M/Show related

    No description.

    
    
    
    
    -- OHMYGOSH even more hacks!
    
    -- this file should not be included in normal scripts
    
    local function initGlobalHacks()
        local o = rawget(_G, "__globalhacks_origs")
        if not o then
            o = {}
            rawset(_G, "__globalhacks_origs", o )
            for i, x in pairs(_G) do
                o[i] = x
            end
            o.v = nil -- this must never be stored!
            o._G = o
            setmetatable(o, getmetatable(_G))
        end