MemeMayhem / ModExamples

11 stars 3 forks source link

Random module #108

Closed AirHater closed 1 month ago

AirHater commented 1 month ago

can i request to add Random module to available Api

GoodCrispyShark commented 1 month ago

@fx013 what do you think?

fx013 commented 1 month ago

Can Lua's math.random() be used instead of the Random module? It looks to me the Random module is mostly some utility functions built on top of a random generator. Mod creator should be able to create it entirely in their mod without us exposing the game's Random module.

AirHater commented 1 month ago

@fx013 im already using custom random, but imo its not ideal to extract wave seed from run instance on basically every wave/random action also for that to happen im pretty sure i need something to link onBeforeBattle callback, so i need to either hardcode this to starting relic or starting missiles

fx013 commented 1 month ago

@GoodCrispyShark Does the Random module handle the random seed automatically? If so, I think it's useful to include in the mod API.

GoodCrispyShark commented 1 month ago

random module handles the random seed automatically in a way that each wave has a non-battle seed and a battle seed to make sure everything is sync

i do agree we should give the random API

fx013 commented 1 month ago

@ninjaaquaoutlook Can you help add the Random module to the mod API and also add a wiki page for it?

ninjaaquaoutlook commented 1 month ago

API:RandomInt(min, max) and API:RandomFloat(min, max) APIs will be added in the new release.