Kaks,
Nice work. What we need are some good examples of working JS. This one will help with this.
1.70 is not fully working. Specially escorts are not working, therefor a 1.70 minimum version is not wise.
When I said escorts are not working I didn't mend that it will crash or something. Under 1.70 the mothership is just not able to send the escorts to the attacker because the internal function "deployEscorts" is not working. So they are an easy pray for an attacker. On being attacked escorted traders do always a flee themself and trust on his escorts to defend him. Only when the last escort is killed he will start defending himself. This means even a commander James can shoot an escorted trader as he never will fire back, nor the escorts.
It is possible to fix this in the AI with additional commands but when 1.71 comes out nobody will use 1.70 anymore.
Normally the OXP should also have a pirate-victim-roles.plist to make that pirates see them as pray. But for this OXP it is just theoretical as this option is introduced in 1.70 were the escorts don't defend the mother. For 1.71 these ships will be included in the plist inside oolite itself.
I noticed that the version.plist will not open with my plist editor. Meaning it has buggy syntax. But you did it in ascii plist and this one should be in XML plist. The function of this plist is to let old Oolite versions know that this OXP is to new for them. And old oolite versions only know XML plist
Version testing seems to work for transports, but in general will not work for 1.68 and 1.69. Those two have a very early JS implementation and don't recognise everything. I noticed that the JS script in hyperradio is rejected with syntax errors and my JS implementation in UPS is also rejected on syntax errors with those two versions. So the code that does the checking does not even run. Both OXP's load errorfree and run on 1.70 though. Meaning my binary version will work on 1.65 onwards, but not on testversions 1.68 and 1.69 (But that shouldn't be a problem as they are just test versions)
Than there is still a logistic bug in the script.plist. A lot of OXP's have this bug. When you add something on a launch you must make sure it only happens once otherwise repeated launching will keep adding ships. There are several ways to test this, but in this case the best would be to add a local variable:
Code: Select all
{
conditions = (
"status_string equal STATUS_LAUNCHING",
"systemGovernment_number greaterthan 4",
"d100_number greaterthan 80",
"local_transports undefined"
);
do = ("addSystemShips: liner 1 0.92", "addSystemShips: fueltransport 1 0.8", "set: local_transports SETUP");
},
Only the first launch after loading a game the ships are added on launch. After that, the local variable is defined and will prevent further additions. after a jump, the ships are already there and should not be added anymore on a launch. local_variables have a bug under 1.69 but then the JS version takes it over from legacy scripting