EquipmentInfo.techLevel has, as per the wiki, "The raw tech level required to purchase this item" (emphasis mine).
When Ship Storage Helper OXP is restoring a ship and tries to award an equipment with higher EquipmentInfo.techLevel than the currents system's, the awardEquipment fails. It then changes the system's tech level to a higher value so the awardEquipment succeeds, but that is a costly change, I've seen it taking 0.5s going up and 0.1s going down.
Since the wiki says that techLevel limitation is for purchasing, and scripts can get around it anyway, if costly, wouldn't it be better to not check tech level on awardEquipment?
scripts awarding equipments with high TL
Moderators: winston, another_commander
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: scripts awarding equipments with high TL
If the only check for TL is in an
In the case of Ship Storage Helper, changing the system TL is a bit of a last-ditch attempt to give the equipment to the player, due to it failing earlier in the process. Ultimately, what would be ideal is for all
awardEquipment
script, that's probably true. However, there might be multiple factors that make checking TL in the script preferable (for instance, a combination of TL and Eco, or government type). In the case of Ship Storage Helper, changing the system TL is a bit of a last-ditch attempt to give the equipment to the player, due to it failing earlier in the process. Ultimately, what would be ideal is for all
awardEquipment
scripts to do a check for context == "scripted"
and then return true before any other checks are made. That would allow the equipment to be awarded by scripts, regardless of location or TL or any other limitation.Re: scripts awarding equipments with high TL
Sorry people, the problem was a bug in Ship Storage Helper that prevented it from trying again if any awarding failed (because of required equipments and awarding in not-the-optimal order), so instead of awarding those equipments that didn't require anything (the ones that have requirements would fail), then trying to award those that failed (because of requirements) until it could award anything, is was going directly from the first pass to the "let's change the context" last-ditch attempts...
My bad... (not the bug, but assuming it was a core game issue...)
On the plus side, with that fixed even my iron-assed (kitted with everything and the kitchen sink ) escorts are now being restored in 0.012s
My bad... (not the bug, but assuming it was a core game issue...)
On the plus side, with that fixed even my iron-assed (kitted with everything and the kitchen sink ) escorts are now being restored in 0.012s