-
Notifications
You must be signed in to change notification settings - Fork 0
Generating the numbers
Telecotxesco edited this page Dec 12, 2020
·
32 revisions
There are multiple ways to generate the numbers:
- Defining them manually
- Sequence from starting number to ending number
- Random secuence from a pattern
Before continue, we should have the model start like:
local kaminari_numbers
-- Function to check if a module available
function isModuleAvailable(name)
if package.loaded[name] then return true end
for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name)
if type(loader) == 'function' then
package.preload[name] = loader
return true
end
end
return false
end
-- Main model's data() function
function data()
local platesLeft = {} -- Here we will place the identification numbers who will be shown on left side
local platesRight = {} -- Here we will place the identification numbers who will be shown on right side
-- If "kaminari_numbers" module is available, then we proceed loading the module. This way we prevent breaking any previous save game.
if isModuleAvailable( "kaminari_numbers" ) then
-- LOAD THE MOUDLE
kaminari_numbers = require "kaminari_numbers"
-- HERE WE WILL GENERATE THE NUMBERS
else
print("Warning: kaminari_numbers is not available/found. Please subscribe it on Steam Workshop, activate and make sure it is loaded before all the rest of mods.")
end
-- HERE BEGINS THE USUAL RETURN DATA OF THE MODEL
return {
boundingInfo = {
bbMax = { 6.7790122032166, 1.5564205646515, 4.2407073974609, },
bbMin = { -7.0255718231201, -1.5564205646515, -0.036832869052887, },
},
-- Rest of the model data [...]
}
end
Each digit adds 2 polygons to the model, and because of each identification number may have numerous digits, and a group of generated identification numbers may have
** NOTE ** From now we will insert the code after the -- HERE WE WILL GENERATE THE NUMBERS
line.
To add a number from a manual list, simply call the following function:
local myList = {"V 100-1035","V 100-1023"}
platesLeft = kaminari_numbers.getChildrenColorNumber( myList, "white", "Helvetica", 10.0, 2.20, -1.00, 2.05, 180, 0, 0 ),
platesRight = kaminari_numbers.getChildrenColorNumber( myList, "white", "Helvetica", 10.0, 2.20, -1.00, 2.05, 180, 0, 0 ),
This will print and cycle throug "V 100-1035" and "V 100-1023". You can add as many you want.