You got itCommander McLane wrote:A new event handler shipFiredMissile(missile,target), sent to the firing ship, both player and NPC. Should return the missile entity and the target the missile was fired at.

Moderators: winston, another_commander
It does trigger for escape pods. However, it only triggers for scripted cargo. This was already so in 1.65. So you must define cargo_type = CARGO_SCRIPTED_ITEM. Only than it executes legacy script_actions or sends the handlers. This info was present on the page with these handlers.Commander McLane wrote:Following my trials and tribulations up to here, I'd like to know: Is there a good reason that the shipWasScooped and shipScoopedOther handlers do not fire if the scooped entity is an escape pod?
This not working is an Oolite bug. Adding a target with JS is handled as - (void) setTargetForScript:(ShipEntity *)target in "EntityOOJavaScriptExtension.m" . There is an explicit check to remove the target when the transferred target is nil. So it was always the intention to handle this.Commander McLane wrote:A way to clear a ship's target via JS. (Or tell me how it is done, I can't figure it out.)
this.ship.target = null doesn't do anything and is reported as an error, same for this.ship.target = "". I guess that is because it actually points to another ship, which can't be nullified.
Therefore another way to reset the target of an NPC (or even the player) is needed. Probably a method.
It should trigger the "TARGET_LOST" message in the AI.
Code: Select all
if (target != nil && target != me) [me addTarget:target];
else [me removeTarget:[me primaryTarget]];
All that should be in trunk already. I'll need to double check if things work ok when assigning missiles, though. Something to keep me busy this evening!Commander McLane wrote:Move awardEquipment() from PlayerShip to Ship. Possible?
Or, perhaps even better: expose the has_foo shipdata-keys to JS, as read/write properties. Include missiles as well.
Not yet, only hasEquipment() but now awardEquipment() I just tried a few days back to remove equipment by script for a griff-krait when the corresponding subentity was shot awayKaks wrote:All that should be in trunk already. I'll need to double check if things work ok when assigning missiles, though. Something to keep me busy this evening!Commander McLane wrote:Move awardEquipment() from PlayerShip to Ship. Possible?
Or, perhaps even better: expose the has_foo shipdata-keys to JS, as read/write properties. Include missiles as well.
And I actually would prefer my second request: having hasECM, hasEscapePod, etc. as r/w properties, instead of the award/removeEquipment() methods. But if those are easier to implement (and somehow through hasEquipment() the road is already paved), I am also fine with that.Eric Walch wrote:Not yet, only hasEquipment() but now awardEquipment() I just tried a few days back to remove equipment by script for a griff-krait when the corresponding subentity was shot awayKaks wrote:All that should be in trunk already. I'll need to double check if things work ok when assigning missiles, though. Something to keep me busy this evening!
Code: Select all
economy = (
"Rich Industrial",
"Average Industrial",
"Poor Industrial",
"Mainly Industrial",
"Mainly Agricultural",
"Rich Agricultural",
"Average Agricultural",
"Poor Agricultural"
);
Code: Select all
expandDescription("[economy]");
Code: Select all
expandDescription("[economy]", 0);
Code: Select all
expandDescription("[economy]", 7);
It happened in Dark Wheel too I see to recall - the ship made a jump 0.2ly jump into deep space, to meet up with the chap (name evades me) who was playing host to some spider eggs.Commander McLane wrote:A reminder to something I requested a while back:And the other thing I requested back then: Can player.ship.galaxyCoordinates be made writable in connection with player.ship.scriptedMisjump? The result would be that the script could determine where the player ends up in interstellar space. Or, if this is too much freedom, could we instead get another property with a value from [0..1], which determines where along the way to his destination system the player falls out of his wormhole. What I'm requesting is a situation like described in Status Quo, where our heroes jump to Rafe Zetter's Anaconda, which is located not halfway between two systems, but at one tenth of the distance.Commander McLane wrote:A system-property that contains all systems in jumprange, depending on the player's current fuel, perhaps in an array. So if(system.systemsInRange.length == 0), we know that the player is stuck. (Of course it would have to work in interstellar space as well.) The engine already does the calculation when 'H' is pressed, or when an NPC performs performHyperSpaceExit, I only don't know how difficult it is to make it available to JS.
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
How about this Ahruman even provided a small script example.Commander McLane wrote:A reminder to something I requested a while back:Commander McLane wrote:A system-property that contains all systems in jumprange, depending on the player's current fuel, perhaps in an array. So if(system.systemsInRange.length == 0), we know that the player is stuck. (Of course it would have to work in interstellar space as well.) The engine already does the calculation when 'H' is pressed, or when an NPC performs performHyperSpaceExit, I only don't know how difficult it is to make it available to JS.