1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

replaced math.sin with lua implementation

This commit is contained in:
Maik Wild 2018-09-28 16:26:50 +02:00
parent 8d620eb1d8
commit 7e0194996d
2 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,7 @@
require 'config'
require 'utils.utils'
require 'utils.list_utils'
require 'utils.math_fix'
local Game = require 'utils.game'

20
utils/math_fix.lua Normal file
View File

@ -0,0 +1,20 @@
local _sin = math.sin
local _cos = math.cos
math.sin = function(x)
local sign = 1
x = x % 360
if x < 0 then
x = - x
sign = - sign
end
if x > 180 then sign = - sign end
x = x % 180
if x == 0 then return 0 end
return sign * 4 * x *(180 - x) / (40500 - (x * (180 - x)))
end
math.cos = function(x)
return math.sin(x + 90)
end