i need to check for an entity on boot whats the best way to check if its there by the netid? how do i wait tell its booted to check?
Run code after server loaded all entities on boot?
this is what i need to run after server has loaded all entitys.
Merged post
would private void OnServerInitialized() be the best way?
void checkbox()
{
Puts("debug");
foreach (var printer in pcdData.pEntity.Values.ToList())
{
if (pcdData.pEntity.ContainsKey(printer.batt))
{
var find = BaseNetworkable.serverEntities.Find(printer.batt);
if (find == null)
{
pcdData.pEntity.Remove(printer.batt);
}
else if (find != null)
{
SpawnRefresh(find);
var printer1 = BaseNetworkable.serverEntities.Find(printer.printer);
if (printer1 != null) SpawnRefresh(printer1);
var counter = BaseNetworkable.serverEntities.Find(printer.counter);
if (counter != null) SpawnRefresh(counter);
var light = BaseNetworkable.serverEntities.Find(printer.light);
if (light != null) SpawnRefresh(light);
}
}
}
SaveData();
}Merged post
would private void OnServerInitialized() be the best way?
OnServerInitialized should always be when the server has fully initalized, so yes.