For test results, bug reports, announcements of new builds etc.
Moderators: winston , another_commander , Getafix
dybal
---- E L I T E ----
Posts: 499 Joined: Mon Feb 10, 2020 12:47 pm
Post
by dybal » Tue Dec 01, 2020 5:27 pm
Ship Storage Helper assigns weapon string to the restored ship's weapon position:
Code: Select all
ship.forwardWeapon = storedShipArray[3];
If that weapon has a condition_script, the context that is passed to its allowAwardEquipment is "purchase" instead of "scripted"
dybal
---- E L I T E ----
Posts: 499 Joined: Mon Feb 10, 2020 12:47 pm
Post
by dybal » Tue Dec 01, 2020 5:47 pm
Changing line 1865 of src/Core/Scripting/OOJSShip.m from
Code: Select all
[entity setWeaponMount:facing toWeapon:sValue];
to
Code: Select all
if (entity == PLAYER) {
[entity setWeaponMount:facing toWeapon:sValue inContext:@"scripted"];
} else {
[entity setWeaponMount:facing toWeapon:sValue];
}
solved it, but I don't know if that's the best solution, or changing the ship outfitting code in the core game to call setWeaponMount with the context "purchase" and changing the version of setWeaponMount without context (called from OJSShip.m) to default to context "scripted".
dybal
---- E L I T E ----
Posts: 499 Joined: Mon Feb 10, 2020 12:47 pm
Post
by dybal » Wed Dec 16, 2020 1:00 pm
I have been using this fix for two weeks, so I created a
Pull Request for it.