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:
parent
8d620eb1d8
commit
7e0194996d
@ -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
20
utils/math_fix.lua
Normal 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
|
Loading…
x
Reference in New Issue
Block a user