From a45ae75fd8c3bcf7bc3a1aac38f6591bff88b0eb Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Mon, 13 Jun 2022 21:44:41 +0200 Subject: [PATCH] Fixed Bag of crafting not working --- eid_bagofcrafting.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index e73dc53f..769afb19 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -217,9 +217,18 @@ local recheckPickups = false local customRNGSeed = 0x77777770 local customRNGShift = {0,0,0} +local function RNGNext() + local num = customRNGSeed + num = num ~ ((num >> customRNGShift[1]) & 4294967295) + num = num ~ ((num << customRNGShift[2]) & 4294967295) + num = num ~ ((num >> customRNGShift[3]) & 4294967295) + customRNGSeed = num >> 0; + return customRNGSeed; +end + local function nextFloat() local multi = 2.3283061589829401E-10; - return EID:RNGNext(customRNGSeed, customRNGShift[1], customRNGShift[2], customRNGShift[3]) * multi; + return RNGNext() * multi; end -- Convert a pickup's ID into what ingredient it counts as @@ -378,7 +387,7 @@ function EID:calculateBagOfCrafting(componentsTable) compCounts[compId + 1] = compCounts[compId + 1] + 1 compTotalWeight = compTotalWeight + pickupValues[compId + 1] customRNGShift = componentShifts[compId + 1] - EID:RNGNext(customRNGSeed, customRNGShift[1], customRNGShift[2], customRNGShift[3]) + RNGNext() end customRNGShift = componentShifts[7]