mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2025-05-13 20:21:24 -05:00
Fixed RNG in replays being different each time
This commit is contained in:
@@ -8,13 +8,13 @@ CRAP.hash = "Completely Random Auto-Positioner"
|
||||
CRAP.world = true
|
||||
CRAP.colors={"C","O","M","R","G","Y","B"}
|
||||
CRAP.colourscheme = {
|
||||
I = CRAP.colors[math.ceil(math.random(7))],
|
||||
L = CRAP.colors[math.ceil(math.random(7))],
|
||||
J = CRAP.colors[math.ceil(math.random(7))],
|
||||
S = CRAP.colors[math.ceil(math.random(7))],
|
||||
Z = CRAP.colors[math.ceil(math.random(7))],
|
||||
O = CRAP.colors[math.ceil(math.random(7))],
|
||||
T = CRAP.colors[math.ceil(math.random(7))],
|
||||
I = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
L = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
J = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
S = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
Z = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
O = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
T = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
}
|
||||
CRAP.softdrop_lock = true
|
||||
CRAP.harddrop_lock = false
|
||||
@@ -111,8 +111,8 @@ end
|
||||
function CRAP:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
||||
|
||||
for i=1,20 do
|
||||
dx=math.floor(math.random(11))-5
|
||||
dy=math.floor(math.random(11))-5
|
||||
dx=math.floor(love.math.random(11))-5
|
||||
dy=math.floor(love.math.random(11))-5
|
||||
if grid:canPlacePiece(new_piece:withOffset({x=dx, y=dy})) then
|
||||
self:onPieceRotate(piece, grid)
|
||||
piece:setRelativeRotation(rot_dir):setOffset({x=dx, y=dy})
|
||||
@@ -147,13 +147,13 @@ function CRAP:get180RotationValue() return 2 end
|
||||
|
||||
function CRAP:randomizeColours()
|
||||
CRAP.colourscheme = {
|
||||
I = CRAP.colors[math.ceil(math.random(7))],
|
||||
L = CRAP.colors[math.ceil(math.random(7))],
|
||||
J = CRAP.colors[math.ceil(math.random(7))],
|
||||
S = CRAP.colors[math.ceil(math.random(7))],
|
||||
Z = CRAP.colors[math.ceil(math.random(7))],
|
||||
O = CRAP.colors[math.ceil(math.random(7))],
|
||||
T = CRAP.colors[math.ceil(math.random(7))],
|
||||
I = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
L = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
J = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
S = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
Z = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
O = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
T = CRAP.colors[math.ceil(love.math.random(7))],
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ function H:attemptRotate(new_inputs, piece, grid, initial)
|
||||
end
|
||||
|
||||
function H:getDefaultOrientation()
|
||||
return math.random(4)
|
||||
return love.math.random(4)
|
||||
end
|
||||
|
||||
return H
|
||||
@@ -23,8 +23,8 @@ function RandomPieces:generateBlockOffsets()
|
||||
local generated_offset = {}
|
||||
repeat
|
||||
generated_offset = {
|
||||
x = math.random(-1, 1),
|
||||
y = math.random(-2, 0)
|
||||
x = love.math.random(-1, 1),
|
||||
y = love.math.random(-2, 0)
|
||||
}
|
||||
until not containsPoint(offsets, generated_offset)
|
||||
offsets[i] = generated_offset
|
||||
|
||||
@@ -89,7 +89,7 @@ function Shirase:onPieceMove(piece) piece.lock_delay = 0 end
|
||||
function Shirase:onPieceRotate(piece) piece.lock_delay = 0 end
|
||||
|
||||
function Shirase:getDefaultOrientation()
|
||||
return math.random(4)
|
||||
return love.math.random(4)
|
||||
end
|
||||
|
||||
return Shirase
|
||||
@@ -35,7 +35,7 @@ end
|
||||
function Trans:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
||||
local pieces = {"I", "J", "L", "O", "S", "T", "Z"}
|
||||
repeat
|
||||
new_piece.shape = pieces[math.random(7)]
|
||||
new_piece.shape = pieces[love.math.random(7)]
|
||||
until piece.shape ~= new_piece.shape
|
||||
|
||||
local offsets = {{x=0, y=0}, {x=1, y=0}, {x=-1, y=0}}
|
||||
|
||||
Reference in New Issue
Block a user