I suggest an addition of a directive starfall, related to waiting for the the duplication that this starfall chip is running on to finish pasting.
Something like
--@dupefinished
This would delay the execution of the starfall until the duplication that the chip is on has finished pasting.
I suggest this because when the SF runs (specifically when being duplicated), it may run before other entities/wirelinked entities are created, therefore when you check if the wirelink/entity is valid when the sf first runs, you could run into problems where it eventually is valid, just takes a moment to become valid.
You should be using hooks to detect this. There's a "postentitypaste" hook that fires once all entities have been restored, and the "input" hook will be triggered when wiring is established.
Use those in conjunction with starfall.isSpawnedFromDuplicator to either wait for the postentitypaste hook to run if the chip actually has been placed from the duplicator and then to do your setup, or to do it instantly if it wasn't placed as part of a dupe.
Before I forget to also mention another hook, I don't know specifically what you are doing with it but PreEntityCopy is incredibly useful to save all used wirelinks and etc data.
"with it's superior software, i have no doubt it will succeed in finding fuck all" - T-17, 2016
[Super Member] [ENCOM] т-ѕсм.Red The Blue Color™: server do you support Hitler?
[Server] srcds_linux: The probabilty is about 99.99%, so interpret that how you want to.