Because an E2's code on a local server or singleplayer game is already immediately available when the E2 is created, the code immediately starts running as soon as the expression exists in the world. However, the function holoCreate waits until the minimum amount of time has passed (after Uploading has disappared from the toolgun screen) before doing anything.
This can lead to cases where if you have an E2 that uses an iterator on an interval/tick to create holos, any holograms created in the first second are never created.
To reproduce: After starting either a singleplayer game or a local server, use this expression 2 code: (edited)
if(clk()){ #second execution
holoCreate(2)
print(holoEntity(2),holoEntity(2):pos())
}else{ #first execution
interval(1000)
holoCreate(1)
print(holoEntity(1),holoEntity(1):pos())
entity():setPos(entity():toWorld(vec(0,0,30))) # set pos upward after the first hologram tries to create. Visibly leaves the hologram behind on multiplayer.
}
It should print the first holo's pos [0,0,0] immediately as the toolgun fires (a null entity), and then the second holo's pos after 1 second. (correctly created)
Lowering the interval below one second, puts the second hologram below the minimum time threshold for code uploading, and then you'll have both holograms print pos [0,0,0].
Trying this on a multiplayer server works correctly, as the first hologram is created when the e2 is finished uploading and runs, as does the second hologram after 1 second.
Because an E2's code on a local server or singleplayer game is already immediately available when the E2 is created, the code immediately starts running as soon as the expression exists in the world. However, the function holoCreate waits until the minimum amount of time has passed (after Uploading has disappared from the toolgun screen) before doing anything.
This can lead to cases where if you have an E2 that uses an iterator on an interval/tick to create holos, any holograms created in the first second are never created.
To reproduce: After starting either a singleplayer game or a local server, use this expression 2 code: (edited)
It should print the first holo's pos [0,0,0] immediately as the toolgun fires (a null entity), and then the second holo's pos after 1 second. (correctly created)
Lowering the interval below one second, puts the second hologram below the minimum time threshold for code uploading, and then you'll have both holograms print pos [0,0,0].
Trying this on a multiplayer server works correctly, as the first hologram is created when the e2 is finished uploading and runs, as does the second hologram after 1 second.