mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-05 15:05:57 +02:00
Merge branch 'develop' into scenario/diggy
This commit is contained in:
commit
ba739a8563
@ -13,8 +13,11 @@ treasure chests get better with distance
|
||||
random game events // earthquake, biters, rock treasure, messages
|
||||
]]--
|
||||
|
||||
|
||||
|
||||
local simplex_noise = require 'map_gen.shared.simplex_noise'
|
||||
local Event = require 'utils.event'
|
||||
local math = require 'utils.math'
|
||||
local market_items = require "map_gen.combined.cave_miner.market_items"
|
||||
local Game = require 'utils.game'
|
||||
|
||||
|
@ -82,9 +82,9 @@ return function(x, y)
|
||||
return nil
|
||||
end
|
||||
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
local d_sq = x * x + y * y
|
||||
local name
|
||||
if d < 200 then
|
||||
if d_sq < 40000 then
|
||||
name = 'car'
|
||||
else
|
||||
if math.random(10) == 1 then
|
||||
|
@ -17,8 +17,8 @@ end
|
||||
Event.on_init(run_ores_module_setup)
|
||||
|
||||
return function(x, y, world)
|
||||
local d = math.sqrt(world.x * world.x + world.y * world.y)
|
||||
if d < 96 then
|
||||
local d_sq = world.x * world.x + world.y * world.y
|
||||
if d_sq < 9216 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -9,6 +9,7 @@ end
|
||||
Event.on_init(init)
|
||||
|
||||
local radius = 10
|
||||
local radius_sq = radius * radius
|
||||
|
||||
return function(x, y, world)
|
||||
local entities = world.surface.find_entities_filtered {position = {world.x + 0.5, world.y + 0.5}, type = "resource"}
|
||||
@ -38,9 +39,9 @@ return function(x, y, world)
|
||||
|
||||
local x = world.x - world.top_x - 16
|
||||
local y = world.y - world.top_y - 16
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
local d_sq = x * x + y * y
|
||||
|
||||
if d < radius then
|
||||
if d_sq < radius_sq then
|
||||
local ore_spawn = world.ore_spawn
|
||||
local resource_amount = world.resource_amount
|
||||
|
||||
@ -49,9 +50,9 @@ return function(x, y, world)
|
||||
amount = world.oil_amount
|
||||
else
|
||||
amount = resource_amount
|
||||
if d < radius / 2 then
|
||||
if d_sq < radius_sq / 4 then
|
||||
amount = resource_amount * 1.5
|
||||
elseif d < radius / 3 then
|
||||
elseif d_sq < radius_sq / 9 then
|
||||
amount = resource_amount * 2
|
||||
end
|
||||
end
|
||||
|
@ -4,6 +4,8 @@ For bruteforce usage, not efficient nor fast
|
||||
|
||||
Force scales to from inf to 1 at R
|
||||
--]]--
|
||||
|
||||
local math = require "utils.math"
|
||||
local _M = {}
|
||||
local sqrt = math.sqrt
|
||||
local cos = math.cos
|
||||
@ -28,7 +30,7 @@ function MetaBall:force(x, y)
|
||||
return (self.radius / force)^self.goo
|
||||
end
|
||||
|
||||
--Ellipse
|
||||
--Ellipse
|
||||
local MetaEllipse = {x=0, y=0, radius=0, angle=0, x_scale=1, y_scale=1, type="MetaEllipse"}
|
||||
MetaEllipse.__index = MetaEllipse
|
||||
_M.MetaEllipse=MetaEllipse
|
||||
@ -45,7 +47,7 @@ end
|
||||
|
||||
function MetaEllipse:force(x, y)
|
||||
--Calculate force at point x y
|
||||
local force = sqrt( (( (x - self.x)*self.cosa + (y - self.y)*self.sina )^2)/(self.x_scale) +
|
||||
local force = sqrt( (( (x - self.x)*self.cosa + (y - self.y)*self.sina )^2)/(self.x_scale) +
|
||||
(( (y - self.y)*self.cosa - (x - self.x)*self.sina )^2)/(self.y_scale) )
|
||||
if force == 0 then return zero_value end
|
||||
return (self.radius / force)^self.goo
|
||||
@ -68,8 +70,8 @@ end
|
||||
|
||||
function MetaSquare:force(x, y)
|
||||
--Calculate force at point x y
|
||||
local force = ( abs( (x - self.x)*self.cosa + (y - self.y)*self.sina )/self.x_scale +
|
||||
abs( (y - self.y)*self.cosa - (x - self.x)*self.sina )/self.y_scale )
|
||||
local force = ( abs( (x - self.x)*self.cosa + (y - self.y)*self.sina )/self.x_scale +
|
||||
abs( (y - self.y)*self.cosa - (x - self.x)*self.sina )/self.y_scale )
|
||||
if force == 0 then return zero_value end
|
||||
return (self.radius / force)^self.goo
|
||||
end
|
||||
@ -94,11 +96,11 @@ end
|
||||
|
||||
function MetaDonut:force(x, y)
|
||||
--Calculate force at point x y
|
||||
local force = abs(self.radius - sqrt( (( (x - self.x)*self.cosa + (y - self.y)*self.sina )^2)/(self.x_scale) +
|
||||
local force = abs(self.radius - sqrt( (( (x - self.x)*self.cosa + (y - self.y)*self.sina )^2)/(self.x_scale) +
|
||||
(( (y - self.y)*self.cosa - (x - self.x)*self.sina )^2)/(self.y_scale) ))
|
||||
if force == 0 then return zero_value end
|
||||
return (self.radius2 / force)^self.goo
|
||||
|
||||
|
||||
end
|
||||
|
||||
return _M
|
||||
return _M
|
||||
|
@ -5,6 +5,7 @@ require("util")
|
||||
require("rso_resource_config")
|
||||
local Utils = require "utils.utils"
|
||||
local Game = require 'utils.game'
|
||||
local math = require 'utils.math'
|
||||
|
||||
local MB=require "metaball"
|
||||
local drand = require 'drand'
|
||||
@ -1167,11 +1168,11 @@ local Event = require 'utils.event'
|
||||
local function run_ores_module(event) -- AKA RSO_ChunkGenerated(event)
|
||||
local c_x = event.area.left_top.x
|
||||
local c_y = event.area.left_top.y
|
||||
|
||||
|
||||
RSO_init()
|
||||
|
||||
|
||||
roll_region(c_x, c_y)
|
||||
roll_chunk(event.surface, c_x, c_y)
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_chunk_generated, run_ores_module)
|
||||
|
||||
Event.add(defines.events.on_chunk_generated, run_ores_module)
|
||||
|
@ -20,8 +20,8 @@ Global.register_init(
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ (pow / 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local math = require "utils.math"
|
||||
|
||||
local ore_seed1 = 11000
|
||||
local ore_seed2 = ore_seed1 * 2
|
||||
|
@ -6,6 +6,7 @@ local b = require 'map_gen.shared.builders'
|
||||
local Global = require('utils.global')
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local OutpostBuilder = require 'map_gen.presets.crash_site.outpost_builder'
|
||||
local math = require "utils.math"
|
||||
|
||||
-- leave seeds nil to have them filled in based on teh map seed.
|
||||
local outpost_seed = nil --91000
|
||||
@ -392,12 +393,12 @@ local function init()
|
||||
|
||||
local function enemy(x, y, world)
|
||||
local wx, wy = world.x, world.y
|
||||
local d = math.sqrt(wx * wx + wy * wy)
|
||||
local d_sq = wx * wx + wy * wy
|
||||
|
||||
--[[ if Perlin.noise(x * scale_factor, y * scale_factor, enemy_seed) < 0 then
|
||||
return nil
|
||||
end ]]
|
||||
local spawner_chance = d - 128
|
||||
local spawner_chance = d_sq - 16384 --d - 128
|
||||
|
||||
if spawner_chance > 0 then
|
||||
spawner_chance = spawner_chance * spawner_chance_factor
|
||||
@ -408,26 +409,26 @@ local function init()
|
||||
end
|
||||
end
|
||||
|
||||
local worm_chance = d - 128
|
||||
local worm_chance = d_sq - 16384 --d - 128
|
||||
|
||||
if worm_chance > 0 then
|
||||
worm_chance = worm_chance * worm_chance_factor
|
||||
worm_chance = math.min(worm_chance, max_worm_chance)
|
||||
|
||||
if math.random() < worm_chance then
|
||||
if d < 256 then
|
||||
if d_sq < 65536 then --d < 256
|
||||
return {name = 'small-worm-turret'}
|
||||
else
|
||||
local max_lvl
|
||||
local min_lvl
|
||||
if d < 512 then
|
||||
if d_sq < 262144 then --d < 512
|
||||
max_lvl = 2
|
||||
min_lvl = 1
|
||||
else
|
||||
max_lvl = 3
|
||||
min_lvl = 2
|
||||
end
|
||||
local lvl = math.random() ^ (384 / d) * max_lvl
|
||||
local lvl = math.random() ^ (147456 / d_sq) * max_lvl --384 / d
|
||||
lvl = math.ceil(lvl)
|
||||
--local lvl = math.floor(d / 256) + 1
|
||||
lvl = math.clamp(lvl, min_lvl, 3)
|
||||
@ -442,8 +443,8 @@ local function init()
|
||||
local ores_patch = b.circle(16)
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ (pow / 2) -- d^pow
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
local PlayerStats = require 'player_stats'
|
||||
local Game = require 'utils.game'
|
||||
local math = require "utils.math"
|
||||
|
||||
local Public = {}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Global = require 'utils.global'
|
||||
local math = require "utils.math"
|
||||
|
||||
local oil_seed
|
||||
local uranium_seed
|
||||
|
@ -2,6 +2,7 @@
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
|
||||
local ball_r = 16
|
||||
local big_circle = b.circle(ball_r)
|
||||
|
@ -4,6 +4,7 @@ This map removes and adds it's own water, in terrain settings use water frequenc
|
||||
This map has isolated areas, it's recommend turning biters to peaceful to reduce stress on the pathfinder.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 12345
|
||||
|
@ -4,6 +4,7 @@ This map removes and adds it's own water, in terrain settings use water frequenc
|
||||
This map has isolated areas, it's recommend turning biters to peaceful to reduce stress on the pathfinder.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 17000
|
||||
@ -11,8 +12,8 @@ local seed2 = seed1 * 2
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ (pow / 2) -- d ^ pow
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,8 +46,8 @@ local ore_spider = b.scale(spider, 0.125, 0.125)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ ( pow / 2 ) -- d ^ pow
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
|
||||
local value = b.exponential_value
|
||||
|
||||
|
@ -18,8 +18,8 @@ local ball_shape = b.any {ball, line1, line2}
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ ( pow / 2 ) -- d ^ pow
|
||||
end
|
||||
end
|
||||
local ore_shape = b.circle(5)
|
||||
|
@ -1,5 +1,6 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local math = require "utils.math"
|
||||
|
||||
local seed1 = 17000
|
||||
local seed2 = seed1 * 2
|
||||
@ -97,8 +98,6 @@ end
|
||||
|
||||
local map_ores = do_resources()
|
||||
|
||||
local root2 = math.sqrt(2)
|
||||
|
||||
local big_circle = b.circle(150)
|
||||
local small_circle = b.circle(140)
|
||||
local crop = b.rectangle(300, 150)
|
||||
@ -121,8 +120,9 @@ local function h_arc()
|
||||
return b.any {arc, ball1, ball2, ball3, arm1, arm2, arm3}
|
||||
end
|
||||
|
||||
local div_100_sqrt2 = 100 / math.sqrt2
|
||||
local function v_arc()
|
||||
local circle = b.circle(100 / root2)
|
||||
local circle = b.circle(div_100_sqrt2)
|
||||
circle = b.apply_entity(circle, map_ores)
|
||||
local ball1 = b.translate(circle, -0, 385)
|
||||
local ball2 = b.translate(circle, -460, 345)
|
||||
@ -140,7 +140,7 @@ arc1 = b.single_pattern(arc1, 1380, 1380)
|
||||
local arc2 = v_arc()
|
||||
arc2 = b.single_pattern(arc2, 1380, 1380)
|
||||
arc2 = b.rotate(arc2, degrees(45))
|
||||
arc2 = b.scale(arc2, root2, root2)
|
||||
arc2 = b.scale(arc2, math.sqrt2, math.sqrt2)
|
||||
arc2 = b.translate(arc2, -165, -688)
|
||||
|
||||
local map = b.any {arc1, arc2}
|
||||
|
@ -1,5 +1,6 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local math = require "utils.math"
|
||||
|
||||
local track_seed1 = 37000
|
||||
local track_seed2 = track_seed1 * 2
|
||||
|
@ -65,7 +65,7 @@ local function effect(x, y, world, tile)
|
||||
end
|
||||
|
||||
--[[
|
||||
|
||||
|
||||
if max_axis_distance(world_x, world_y, -2144, 0) < safe_distance then
|
||||
for _, e in ipairs(surface.find_entities_filtered({ force = "enemy", position = { world_x, world_y } } )) do
|
||||
e.destroy()
|
||||
@ -75,12 +75,12 @@ local function effect(x, y, world, tile)
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for _, e in ipairs(surface.find_entities_filtered({ type = "resource", area = {{world_x, world_y }, {world_x + 1, world_y + 1 } } })) do -- I want to use position but for some reason it doesn't seem to work for ores.
|
||||
local dist1 = distance(world_x, world_y, -2144, 0)
|
||||
local dist2 = distance(world_x, world_y, 2144, 0)
|
||||
local amount = math.min(dist1, dist2)
|
||||
|
||||
|
||||
local name = e.name
|
||||
if name == "iron-ore" then
|
||||
amount = 800 + 0.4 * amount
|
||||
@ -95,10 +95,10 @@ local function effect(x, y, world, tile)
|
||||
elseif name == "crude-oil" then
|
||||
amount = 50000 + 50 * amount
|
||||
end
|
||||
|
||||
|
||||
e.amount = amount
|
||||
end
|
||||
|
||||
|
||||
--]]
|
||||
return tile
|
||||
end
|
||||
|
@ -16,8 +16,8 @@ map = b.scale(map, 64)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ (pow / 2) --d ^ pow
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2,6 +2,7 @@ local b = require 'map_gen.shared.builders'
|
||||
local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
local math = require "utils.math"
|
||||
|
||||
local oil_seed
|
||||
local uranium_seed
|
||||
|
@ -277,9 +277,9 @@ local function loot(x, y)
|
||||
return nil
|
||||
end
|
||||
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
local d_sq = x * x + y * y
|
||||
local name
|
||||
if d < 600 then
|
||||
if d_sq < 360000 then --d < 600
|
||||
name = 'car'
|
||||
else
|
||||
if math.random(5) == 1 then
|
||||
|
@ -63,24 +63,26 @@ local function sprinkle(shape)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function radial(shape, radius)
|
||||
local stone_r = radius * 0.55
|
||||
local coal_r = radius * 0.65
|
||||
local copper_r = radius * 0.8
|
||||
local radius_sq = radius * radius
|
||||
local stone_r_sq = radius * 0.3025 -- radius * 0.55
|
||||
local coal_r_sq = radius * 0.4225 -- radius * 0.65
|
||||
local copper_r_sq = radius * 0.64 -- radius * 0.8
|
||||
|
||||
return function(x, y, world)
|
||||
if not shape(x, y) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
local d_sq = x * x + y * y
|
||||
|
||||
local ore
|
||||
if d < stone_r then
|
||||
if d_sq < stone_r_sq then
|
||||
ore = ores[4]
|
||||
elseif d < coal_r then
|
||||
elseif d_sq < coal_r_sq then
|
||||
ore = ores[3]
|
||||
elseif d < copper_r then
|
||||
elseif d_sq < copper_r_sq then
|
||||
ore = ores[2]
|
||||
else
|
||||
ore = ores[1]
|
||||
|
@ -4,8 +4,8 @@ local inv_pi = 1 / math.pi
|
||||
local thickness2 = thickness * 2
|
||||
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
if d < 128 then
|
||||
local d_sq = x * x + y * y
|
||||
if d_sq < 16384 then --d < 128
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
local math = require "utils.math"
|
||||
|
||||
-- helpers
|
||||
tau = 2 * math.pi
|
||||
deg_to_rad = tau / 360
|
||||
@ -1435,8 +1437,8 @@ end
|
||||
|
||||
function Builders.exponential_value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d = math.sqrt(x * x + y * y)
|
||||
return base + mult * d ^ pow
|
||||
local d_sq = x * x + y * y
|
||||
return base + mult * d_sq ^ (pow / 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,16 +38,16 @@ local function dot(g, ...)
|
||||
return sum
|
||||
end
|
||||
|
||||
local F2 = 0.5*(math.sqrt(3.0)-1.0)
|
||||
local G2 = (3.0-math.sqrt(3.0))/6.0
|
||||
function Simplex.d2(xin, yin,seed)
|
||||
xin = xin + seed
|
||||
yin = yin + seed
|
||||
local n0, n1, n2 -- Noise contributions from the three corners
|
||||
-- Skew the input space to determine which simplex cell we're in
|
||||
local F2 = 0.5*(math.sqrt(3.0)-1.0)
|
||||
local s = (xin+yin)*F2; -- Hairy factor for 2D
|
||||
local i = math.floor(xin+s)
|
||||
local j = math.floor(yin+s)
|
||||
local G2 = (3.0-math.sqrt(3.0))/6.0
|
||||
local t = (i+j)*G2
|
||||
local X0 = i-t -- Unskew the cell origin back to (x,y) space
|
||||
local Y0 = j-t
|
||||
@ -103,4 +103,4 @@ function Simplex.d2(xin, yin,seed)
|
||||
return 70.0 * (n0 + n1 + n2)
|
||||
end
|
||||
|
||||
return Simplex
|
||||
return Simplex
|
||||
|
@ -3,8 +3,7 @@ local Game = require 'utils.game'
|
||||
|
||||
local mines_factor = 1
|
||||
|
||||
--Do not change this:
|
||||
mines_factor = 16384 / mines_factor
|
||||
mines_factor_sq = 16384 * 16384 / mines_factor / mines_factor
|
||||
|
||||
local death_messages = {
|
||||
"went exploring, and didn't bring a minesweeping kit.",
|
||||
@ -47,13 +46,13 @@ end
|
||||
Event.add(defines.events.on_player_died, player_died)
|
||||
|
||||
return function(x, y)
|
||||
local distance = math.sqrt(x * x + y * y)
|
||||
local distance_sq = x * x + y * y
|
||||
|
||||
if distance <= 210 then
|
||||
if distance_sq <= 44100 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local chance = math.floor(mines_factor / distance) + 1
|
||||
local chance = math.floor(mines_factor_sq / distance_sq) + 1
|
||||
|
||||
if math.random(chance) == 1 then
|
||||
return {name = 'land-mine', force = 'enemy'}
|
||||
|
@ -7,6 +7,7 @@ local PlayerStats = require 'player_stats'
|
||||
local Utils = require 'utils.utils'
|
||||
local Report = require 'report'
|
||||
local Game = require 'utils.game'
|
||||
local name = require "utils.math"
|
||||
|
||||
local poke_messages = require 'resources.poke_messages'
|
||||
local player_sprites = require 'resources.player_sprites'
|
||||
|
1
poll.lua
1
poll.lua
@ -3,6 +3,7 @@ local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local UserGroups = require 'user_groups'
|
||||
local Game = require 'utils.game'
|
||||
local math = require "utils.math"
|
||||
|
||||
local default_poll_duration = 300 * 60 -- in ticks
|
||||
local duration_max = 3600 -- in seconds
|
||||
|
@ -998,5 +998,12 @@ return {
|
||||
['InphinitePhractals'] = true,
|
||||
['Breadface'] = true,
|
||||
['safariursis'] = true,
|
||||
['Marucan'] = true
|
||||
['Marucan'] = true,
|
||||
['rykstar'] = true,
|
||||
['CommanderFrog'] = true,
|
||||
['SchniSchnaSchnuck'] = true,
|
||||
['Ronin114'] = true,
|
||||
['masoudd'] = true,
|
||||
['powder12321'] = true,
|
||||
['KipenKnos'] = true
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ local Global = require 'utils.global'
|
||||
local UserGroups = require 'user_groups'
|
||||
local Utils = require 'utils.utils'
|
||||
local Game = require 'utils.game'
|
||||
local math = require "utils.math"
|
||||
|
||||
local normal_color = {r = 1, g = 1, b = 1}
|
||||
local focus_color = {r = 1, g = 0.55, b = 0.1}
|
||||
|
@ -9,6 +9,24 @@ math.cos = function(x)
|
||||
return math.floor(_cos(x) * 10000000 + 0.5) / 10000000
|
||||
end
|
||||
|
||||
-- rounds number (num) to certain number of decimal places (idp)
|
||||
math.round = function(num, idp)
|
||||
local mult = 10 ^ (idp or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
math.clamp = function(num, min, max)
|
||||
if num < min then
|
||||
return min
|
||||
elseif num > max then
|
||||
return max
|
||||
else
|
||||
return num
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
math.sqrt2 = math.sqrt(2)
|
||||
math.inv_sqrt2 = 1 / math.sqrt2
|
||||
|
||||
return math
|
||||
|
@ -7,22 +7,6 @@ Module.distance = function(pos1, pos2)
|
||||
return math.sqrt(dx * dx + dy * dy)
|
||||
end
|
||||
|
||||
-- rounds number (num) to certain number of decimal places (idp)
|
||||
math.round = function(num, idp)
|
||||
local mult = 10 ^ (idp or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
function math.clamp(num, min, max)
|
||||
if num < min then
|
||||
return min
|
||||
elseif num > max then
|
||||
return max
|
||||
else
|
||||
return num
|
||||
end
|
||||
end
|
||||
|
||||
Module.print_except = function(msg, player)
|
||||
for _, p in pairs(game.players) do
|
||||
if p.connected and p ~= player then
|
||||
|
Loading…
x
Reference in New Issue
Block a user