Page 4 of 7
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 3:08 pm
by Cholmondely
Cmdr James wrote: ↑Sun Jun 06, 2021 3:01 pm
Cholmondely wrote: ↑Sun Jun 06, 2021 1:05 pm
Docking Fee's images worked on my Mac. But when I dissected Docking Fees I could find nothing obvious that put them on the screen of my Mac. So once again, I find myself in the coding quagmire, whose level is now over my head!
Which docking fees are we talking about? Layne's Docking Fees Version 1.6 ? (though oddly verion 1.6 does say internally that its 1.7!)
That neither contains any images nor does it make any effort to use other images. All it does (like, literally everything it does) is calculate a cost based on the tech level, try to deduct the fee and add a message to the dock screen.
The handling of everything it does seems to be in PlayerEntityContracts.m in method setGuiToDockingReportScreen which you can have a look at, but I cannot see any possible way the docking fees oxp )assuming we are talking about the same thing) can have any impact.
Poor documentation, which I've only just now been trying to correct on the wiki. DF feeds off HDBG. I can only presume that HDBG is the successful sticker of images on the AppleMac screen. Don't understand how or why, but will go over Phkb's response above, and see if I can find anything relevant in the wiki.
Are there any other relevant OXPs which I should try on my Mac (to see if they work where the others don't? - and hopefully narrow down the problem).
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 3:53 pm
by phkb
Cholmondely wrote: ↑Sun Jun 06, 2021 3:08 pm
Are there any other relevant OXPs which I should try on my Mac (to see if they work where the others don't? - and hopefully narrow down the problem).
XenonUI (with and without Library), or BGS (which will need to have Library) - both these packs are heavy on background images, most of which will be loaded via
setScreenBackground
.
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 4:05 pm
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 3:53 pm
Cholmondely wrote: ↑Sun Jun 06, 2021 3:08 pm
Are there any other relevant OXPs which I should try on my Mac (to see if they work where the others don't? - and hopefully narrow down the problem).
XenonUI (with and without Library), or BGS (which will need to have Library) - both these packs are heavy on background images, most of which will be loaded via
setScreenBackground
.
BGS works fine. As done XenonUI.
Funny. I so much regard them as part of the basic game, I never even thought of either!
I'll try replacing the code with
setScreenBackground
. I'm currently working up a new chap to go to Biarge and start the whole thing again, with save files at various places along the way for analysing my attempts at tweaking LWA.
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 4:09 pm
by phkb
Cholmondely wrote: ↑Sun Jun 06, 2021 4:05 pm
BGS works fine. As done XenonUI.
Both of which utilise
setScreenBackground
to display images. Not sure what the difference is internally in the core code (and I don't know if I'd be able to tell the difference in any case), but it's certainly more evidence that there must be something different there somewhere.
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 4:12 pm
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 4:09 pm
Cholmondely wrote: ↑Sun Jun 06, 2021 4:05 pm
BGS works fine. As done XenonUI.
Both of which utilise
setScreenBackground
to display images. Not sure what the difference is internally in the core code (and I don't know if I'd be able to tell the difference in any case), but it's certainly more evidence that there must be something different there somewhere.
I would have thought that the other method should work too, if the semicolons are all crossed and the commas dotted. I can't imagine that the code would have been changed in such a way that the AppleMac didn't work! Who introduced the change? Ahruman presumably ... with A_C_?
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 4:15 pm
by phkb
Cholmondely wrote: ↑Sun Jun 06, 2021 4:12 pm
Who introduced the change? Ahruman presumably ... with A_C_?
Or neither. It could be a case that older Mac OS systems work fine, but newer ones have a problem.
Can I get you to try something? If you've got the debug console working, can you copy this code and run it while you're docked somewhere?
Code: Select all
mission.runScreen(
{
screenID: "longwayround",
title: "Incoming Message",
overlay: "loyalistflag.png",
exitScreen: "GUI_SCREEN_STATUS",
messageKey: "long_way_round_Qubeen_briefing"
}
);
Just want to see if overlays on runScreen are working, even if backgrounds aren't.
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 5:29 pm
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 4:15 pm
Cholmondely wrote: ↑Sun Jun 06, 2021 4:12 pm
Who introduced the change? Ahruman presumably ... with A_C_?
Or neither. It could be a case that older Mac OS systems work fine, but newer ones have a problem.
Can I get you to try something? If you've got the debug console working, can you copy this code and run it while you're docked somewhere?
Code: Select all
mission.runScreen(
{
screenID: "longwayround",
title: "Incoming Message",
overlay: "loyalistflag.png",
exitScreen: "GUI_SCREEN_STATUS",
messageKey: "long_way_round_Qubeen_briefing"
}
);
Just want to see if overlays on runScreen are working, even if backgrounds aren't.
It works!!
Well done! They shall chant your name with Huzzahs as they march on Qubeen leading the counter-revolution ....
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 9:59 pm
by phkb
OK, one more. Can you uninstall XenonUI and run this version of that code snippet instead?
Code: Select all
mission.runScreen(
{
screenID: "longwayround",
title: "Incoming Message",
background: "loyalistflag.png",
exitScreen: "GUI_SCREEN_STATUS",
messageKey: "long_way_round_Qubeen_briefing"
}
);
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 10:46 pm
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 9:59 pm
OK, one more. Can you uninstall XenonUI and run this version of that code snippet instead?
Code: Select all
mission.runScreen(
{
screenID: "longwayround",
title: "Incoming Message",
background: "loyalistflag.png",
exitScreen: "GUI_SCREEN_STATUS",
messageKey: "long_way_round_Qubeen_briefing"
}
);
It quit twice (during loading and selecting New Commander), but the third time it worked with both flag & message. I do not think that this has happened before.
Console Log (with obviously irrelevant stuff omitted):
Code: Select all
ship got EQ_ECM
ship got EQ_FUEL_SCOOPS
TalkingShip changed to false
Appearance changed to Retractable (0)
Material test suite is installed.
ship got EQ_BREAKABLE_ENERGY_UNIT_MEDIUM
Wrapping SniperLock's sniperLock function
ship got EQ_BREAKABLE_SHIELD_FORE_MEDIUM
ship got EQ_BREAKABLE_SHIELD_AFT_MEDIUM
Populators:
{"oolite-thargoid-scouts":{"priority":40,"location":"LANE_WPS","groupCount":0},
...
"oolite-pirate-light-triangle":{"priority":40,"location":"LANE_WPS","groupCount":1}}
ship got EQ_SHIPS_LIBRARY
HUDs: Default HUD,hud,ExtraLarge HUD with 10 MFDs and custom dials,hudselector-extralarge,hudselector-extralarge10,Large HUD with 10 MFDs and custom dials,hudselector-large,Small HUD with 10 MFDs and custom dials,hudselector-small,VimanaHUD 6 MFDs,VimanaHUD,,,VimanaHUD 12 MFDs,VimanaHUD-mfds,,
HUDSelectorCallBack, off:true, pship.hud:hudselector-large.plist
system information changed in galaxy 0 system 9 key description to This planet is mildly fabled for its inhabitants' eccentric love for tourists. The truth is that there is not a single good reason for a tourist to set foot on this planet. The feudal society is primitive and the simple industrial cities are filthy. The famous edible moth is very dangerous when driven into a corner but is almost everywhere. The insect is hunted by the Diusrezans for pest control and for food. Tasting a Mothburger is almost a mandatory evil at every party. The taste is reported as awful. This planet has rings.
...
system information changed in galaxy 5 system 66 key description to The world Isaanus is reasonably fabled for its exciting Isaanusian lethal brandy and its exotic night life. This planet has rings.
...
system information changed in galaxy 7 system 255 key description to The planet Intiso is most famous for the Intisoian spotted shrew and the Intisoian edible poet. This planet has rings.
startUp in ms: 0
startUp in ms: 259
startUp in ms: 0
startUp in ms: 0
startUp in ms: 13
startUp in ms: 0
startUp in ms: 17
startUp in ms: 0
gui screen will change from GUI_SCREEN_LOAD to GUI_SCREEN_STATUS
gui screen changed from GUI_SCREEN_LOAD to GUI_SCREEN_STATUS
mission screen opportunity
Warning! Global namespace polluted by:
["pow","mkPlanetIndex","i","j","c"]
gui screen changed from GUI_SCREEN_STATUS to GUI_SCREEN_MISSION
Scanner NonLinear:false UltraZoom:false HUD:hudselector-large.plist Crosshairs: null, scanner settings is not fixed.
HUDSelectorCallBack, off:true, pship.hud:hudselector-large.plist
Awarding Extra Energy Unit to Gecko: Ouedor's Savanna
Gecko: Ouedor's Savanna: Extra Energy Unit enabled, energy recharge 4.0->7.2
...
Sidewinder Scout Ship: Metamorph: Extra Energy Unit enabled, energy recharge 2.0->3.6
Coriolis Station 21495 spawned at 0 km
Krait 9572 spawned at 5 km
Navigation Buoy 23756 spawned at 10 km
Revolutionary Guard 7715 spawned at 34 km
...
Rock Hermit 27779 spawned at 380 km
Abandoned Rock Hermit 13022 spawned at 561 km
Created 50 asteroids around Rock Hermit: Stso's Duty
Rock Hermit: Stso's Duty (role rockhermit) has a beacon with range of 500km
gui screen will change from GUI_SCREEN_MISSION to GUI_SCREEN_STATUS
gui screen changed from GUI_SCREEN_MISSION to GUI_SCREEN_STATUS
mission screen ended
mission screen opportunity
> mission.runScreen(
{
screenID: "longwayround",
title: "Incoming Message",
background: "loyalistflag.png",
exitScreen: "GUI_SCREEN_STATUS",
messageKey: "long_way_round_Qubeen_briefing"
}
);
gui screen changed from GUI_SCREEN_STATUS to GUI_SCREEN_MISSION
true
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 11:00 pm
by phkb
Cholmondely wrote: ↑Sun Jun 06, 2021 10:46 pm
It quit twice (during loading and selecting New Commander)
Well, running a mission screen during loading or selecting a new commander is not likely to end well - neither state is designed to have a mission screen popup. After a commander is loaded, at the F5 screen is probably the best time to run it.
But, the issue you're running into is not anything to do with the Mac. It's to do with the way I made XenonUI work. From the Wiki entry
The method used to add the backgrounds will mean that the background images of most other OXP's, if they set a background, will be overridden with the Xenon UI images. This is by design, in order to maintain the illusion that the player is looking at the game world through a computer monitor with a standard interface.
I'm adding a fix to XenonUI so that Ship's Library will get it's pictures back. I've got a new release of Long Way Round that will fix it's issue. Any more you find let me know and I'll address them.
Re: Licensing OXPs
Posted: Sun Jun 06, 2021 11:26 pm
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 11:00 pm
Cholmondely wrote: ↑Sun Jun 06, 2021 10:46 pm
It quit twice (during loading and selecting New Commander)
Well, running a mission screen during loading or selecting a new commander is not likely to end well - neither state is designed to have a mission screen popup. After a commander is loaded, at the F5 screen is probably the best time to run it.
But, the issue you're running into is not anything to do with the Mac. It's to do with the way I made XenonUI work. From the Wiki entry
The method used to add the backgrounds will mean that the background images of most other OXP's, if they set a background, will be overridden with the Xenon UI images. This is by design, in order to maintain the illusion that the player is looking at the game world through a computer monitor with a standard interface.
I'm adding a fix to XenonUI so that Ship's Library will get it's pictures back. I've got a new release of Long Way Round that will fix it's issue. Any more you find let me know and I'll address them.
Well done, Sir! And, in confirmation, now that I'm Xenonless, the Ship's Manual shows all the pictures!
Re: Licensing OXPs
Posted: Mon Jun 07, 2021 7:01 am
by Cholmondely
phkb wrote: ↑Sun Jun 06, 2021 11:00 pm
I'm adding a fix to XenonUI so that Ship's Library will get it's pictures back. I've got a new release of Long Way Round that will fix it's issue. Any more you find let me know and I'll address them.
Here's another:
New Cargoes - I never even realised that it
had such an array of graphic backdrops!
The backdrop for SothisTC is rather natty - Spara did a good job! Since the only working versions will be those that the owners have tweaked (unless running Oolite v.1.79 or earlier) , all that needs to be published is the tweak. We could add it to the wiki page...
Re: Licensing OXPs
Posted: Tue Jun 08, 2021 6:10 am
by phkb
Cholmondely wrote: ↑Mon Jun 07, 2021 7:01 am
Here's another: New Cargoes - I never even realised that it had such an array of graphic backdrops!
The backdrop for SothisTC is rather natty - Spara did a good job! Since the only working versions will be those that the owners have tweaked (unless running Oolite v.1.79 or earlier) , all that needs to be published is the tweak. We could add it to the wiki page...
New Xenon UI release should fix all the issues noted previously. Maybe post any further issues in that thread, rather than clog this one up with unrelated info.
Re: Licensing OXPs
Posted: Mon Jul 12, 2021 8:28 pm
by Milo
Apologies for derailing this thread by returning the topic of discussion back to licensing... but I still need guidance on the question I asked earlier (quoted below). How to reconcile an OXP licensed under CC with inclusion of Priority AI scripts which are licensed under GPLv2? I have an in-progress update of Thargoid's Armoury, but I'm not sure how to release it.
Milo wrote: ↑Fri Jun 19, 2020 3:41 am
I want to add Priority AI scripts derived from Oolite Priority AI core scripts (such as oolite-missileAI.js) to Armoury OXP, which is licensed under CC-BY-NC-SA 3.0. Priority AI scripts are licensed under GPL v2 or later. CC-BY-NC-SA 3.0 and GPL v2 are incompatible.
CC-BY-NC-SA 4.0 is
one-way compatible with GPL v3 (which is "or later").
CC-BY-NC-SA 3.0
can be upgraded to 4.0, but the copyright holder(s) need to agree (Thargoid gave special permission in his adoption thread for anyone to take over his work and said that supersedes the license, which I think means that he is giving adopters of his work a proxy to act on his behalf with respect to the copyright, so I could in theory upgrade the license to CC-BY-NC-SA 4.0 in this particular case).
What is the community's view on this? Does including Priority AI scripts in OXPs mean that those OXPs must be released under GPL licenses? Can Priority AI be provided to OXP authors under a different, CC-BY-NC-SA 3.0 compatible license? Does transformative, creative, non-commercial, derivative use of Priority AI in the context of creating an expansion pack (which can be seen as a form of comment/criticism) represent
fair use?
As a specific example, here's a script I want to include in the OXP:
Code: Select all
// Armoury OXP Field Missile AI adapted from oolite-missileAI.js
// Licensed under CC-BY-NC-SA 3.0 with clauses - see readme
// Derived from a work licensed under GNU GPL v2 (or later) as indicated below.
/*
missileAI.js
Priority-based AI for missiles
Oolite
Copyright © 2004-2013 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
"use strict";
this.name = "Armoury Field Missile AI";
this.aiStarted = function() {
var ai = new worldScripts["oolite-libPriorityAI"].PriorityAIController(this.ship);
/* This is probably too effective for standard missile AI, but
* might be worth setting separately on ships that use missile
* swarms as their main weapon. It makes the missiles avoid each
* other a bit, so that the detonation of the first missile won't
* destroy the remainder. */
// ai.setParameter("oolite_flag_autoSpreadMissiles",true);
/* Launch correction when fired at target in aft arc */
if (this.ship.target && this.ship.target.position.subtract(this.ship.position).direction().dot(this.ship.vectorForward) < -0.8)
{
this.oolite_priorityai.setParameter("oolite_flag_launchAdjustMissile",true);
}
// prevent deceleration on launch
this.ship.desiredSpeed = this.ship.maxSpeed;
ai.setPriorities([
{
condition: ai.conditionMissileOutOfFuel, // The missile has traveled beyond the maximum missile range. The default is 30km, but this may be overridden by the oolite_missile_range parameter in shipdata script info.
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
},
{
preconfiguration: ai.configurationCheckScanner, // Scans the missile's scanner range, placing a list of detected targets into the "oolite_scanResults" parameter. This is generally called in a preconfiguration before the first use of a conditionScannerContains... condition in the priority list. If the scanner is particularly full, the list will not contain all visible objects. The current scan limit is 16.
condition: ai.conditionScannerContainsUnspreadMissile, // The scan contains a missile which has the same target and owner as this missile, but is closer to the target and within 500 metres of this missile. This is mainly used for "smart" missiles to ensure that impact times for a salvo are spread out.
configuration: ai.configurationMissileAdjustSpread, // This function sets an intermediate destination for "smart" missiles which are adjusting their flight path to spread out a salvo's impacts on target.
// This configuration sets a destination, a desired range and a desired speed suitable for use with behaviourApproachDestination. Unless otherwise stated, cruiseSpeed (80%) will be used as the desired speed.
behaviour: ai.behaviourApproachDestination, // Travels from the current position to within desiredRange of destination, avoiding obstacles on the way.
reconsider: 2
},
{
condition: ai.conditionMissileNeedsLaunchEvasion, // This function checks if the oolite_flag_launchAdjustMissile parameter is set to a non-null value, and returns true if so.
configuration: ai.configurationMissileAdjustLaunch, // This function causes the missile to dive sharply. The intended use is in conjunction with conditionMissileNeedsLaunchEvasion to avoid collisions with the launching ship.
// This configuration sets a destination, a desired range and a desired speed suitable for use with behaviourApproachDestination. Unless otherwise stated, cruiseSpeed (80%) will be used as the desired speed.
behaviour: ai.behaviourApproachDestination, // Travels from the current position to within desiredRange of destination, avoiding obstacles on the way.
reconsider: 2
},
{
condition: ai.conditionHasTarget, // The missile's target is not null.
behaviour: ai.behaviourMissileInterceptTarget, // Close to the desired missile range (default 25m, or specified by the oolite_missile_proximity key in script info), detonating when reached.
reconsider: 5
},
/* If target cloaks, go to last known location */
{
condition: ai.conditionHasInterceptCoordinates, // The missile has intercept coordinates set in the parameter "oolite_interceptCoordinates". These are used by missiles to home in on a last-known location if the target cloaks.
behaviour: ai.behaviourMissileInterceptCoordinates, // Close to the desired missile range (default 25m, or specified by the oolite_missile_proximity key in script info), detonating when reached. The coordinates to close in on are specified in the "oolite_interceptCoordinates". This is used to track missile targets which cloak.
reconsider: 1
},
/* Target lost. Self-destruct */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
]);
}
/* ECM response function, which must be set in shipdata script_info as oolite_missile_ecmResponse = "_ecmMissileResponse"; */
this._ecmMissileResponse = function()
{
switch (1 + Math.floor(Math.random() * 20)) // roll d20 (1 - 20)
{
case 1: // 5% chance spawn mines around target position (or around missile location, if target lost) and detonate missile
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by throwing mines around target and detonating");
this.ship.AIScript._dropMines();
this.ship.AIScript.shipAchievedDesiredRange(); // Detonate the missile and damage nearby ships (adjust with script_info oolite_missile_blastPower, oolite_missile_blastRadius, oolite_missile_blastShaping)
return;
case 2: // 5% chance brief tumble, then explode (no damage)
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by tumbling and exploding (no damage)");
this.oolite_priorityai.behaviourTumble(); // Start tumbling. Unlike most behaviours, this one does not include the standard responses, so you will need to manually request a reconsideration of priorities if one is needed.
this.oolite_priorityai.setPriorities([ // replace the priorities list from aiStarted with new priorities: self-destruct only
/* Self-destruct. */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
], 0.25 + Math.random() * 1.50); // delay for 0.25 to (almost) 1.50 seconds [setPriorities implicitly triggers a reconsideration of priorities]
return;
case 3: // 5% chance scatter mines around missile location, brief tumble, then explode (no damage)
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by scattering mines, tumbling and exploding (no damage)");
this.ship.AIScript._scatterMines();
this.oolite_priorityai.behaviourTumble(); // Start tumbling. Unlike most behaviours, this one does not include the standard responses, so you will need to manually request a reconsideration of priorities if one is needed.
this.oolite_priorityai.setPriorities([ // replace the priorities list from aiStarted with new priorities: self-destruct only
/* Self-destruct. */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
], 0.25 + Math.random() * 1.50); // delay for 0.25 to (almost) 1.50 seconds [setPriorities implicitly triggers a reconsideration of priorities]
return;
default: // 85% chance no effect
return;
}
}
this._dropMines = function () {
if (this.ship.target && this.ship.target.isValid && this.ship.position.distanceTo(this.ship.target.position) < 500) // if the missile has a valid target within 0.5km, spawn mines around the target
{
var mineCount = Math.ceil(Math.random() * 11) + 19; // 20-30 mines to be thrown around target position (250m radius)
system.addShips("armoury_fieldMine", mineCount, this.ship.target.position, 250);
}
else // otherwise just scatter mines wherever the missile is now
{
this._scatterMines();
}
}
this._scatterMines = function () {
var mineCount = Math.ceil(Math.random() * 11) + 19; // 20-30 mines to be thrown around missile position (250m radius)
system.addShips("armoury_fieldMine", mineCount, this.ship.position, 250);
}
Re: Licensing OXPs
Posted: Mon Jul 12, 2021 9:34 pm
by Cholmondely
Milo wrote: ↑Mon Jul 12, 2021 8:28 pm
Apologies for derailing this thread by returning the topic of discussion back to licensing... but I still need guidance on the question I asked earlier (quoted below). How to reconcile an OXP licensed under CC with inclusion of Priority AI scripts which are licensed under GPLv2? I have an in-progress update of Thargoid's Armoury, but I'm not sure how to release it.
Milo wrote: ↑Fri Jun 19, 2020 3:41 am
I want to add Priority AI scripts derived from Oolite Priority AI core scripts (such as oolite-missileAI.js) to Armoury OXP, which is licensed under CC-BY-NC-SA 3.0. Priority AI scripts are licensed under GPL v2 or later. CC-BY-NC-SA 3.0 and GPL v2 are incompatible.
CC-BY-NC-SA 4.0 is
one-way compatible with GPL v3 (which is "or later").
CC-BY-NC-SA 3.0
can be upgraded to 4.0, but the copyright holder(s) need to agree (Thargoid gave special permission in his adoption thread for anyone to take over his work and said that supersedes the license, which I think means that he is giving adopters of his work a proxy to act on his behalf with respect to the copyright, so I could in theory upgrade the license to CC-BY-NC-SA 4.0 in this particular case).
What is the community's view on this? Does including Priority AI scripts in OXPs mean that those OXPs must be released under GPL licenses? Can Priority AI be provided to OXP authors under a different, CC-BY-NC-SA 3.0 compatible license? Does transformative, creative, non-commercial, derivative use of Priority AI in the context of creating an expansion pack (which can be seen as a form of comment/criticism) represent
fair use?
As a specific example, here's a script I want to include in the OXP:
Code: Select all
// Armoury OXP Field Missile AI adapted from oolite-missileAI.js
// Licensed under CC-BY-NC-SA 3.0 with clauses - see readme
// Derived from a work licensed under GNU GPL v2 (or later) as indicated below.
/*
missileAI.js
Priority-based AI for missiles
Oolite
Copyright © 2004-2013 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
"use strict";
this.name = "Armoury Field Missile AI";
this.aiStarted = function() {
var ai = new worldScripts["oolite-libPriorityAI"].PriorityAIController(this.ship);
/* This is probably too effective for standard missile AI, but
* might be worth setting separately on ships that use missile
* swarms as their main weapon. It makes the missiles avoid each
* other a bit, so that the detonation of the first missile won't
* destroy the remainder. */
// ai.setParameter("oolite_flag_autoSpreadMissiles",true);
/* Launch correction when fired at target in aft arc */
if (this.ship.target && this.ship.target.position.subtract(this.ship.position).direction().dot(this.ship.vectorForward) < -0.8)
{
this.oolite_priorityai.setParameter("oolite_flag_launchAdjustMissile",true);
}
// prevent deceleration on launch
this.ship.desiredSpeed = this.ship.maxSpeed;
ai.setPriorities([
{
condition: ai.conditionMissileOutOfFuel, // The missile has traveled beyond the maximum missile range. The default is 30km, but this may be overridden by the oolite_missile_range parameter in shipdata script info.
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
},
{
preconfiguration: ai.configurationCheckScanner, // Scans the missile's scanner range, placing a list of detected targets into the "oolite_scanResults" parameter. This is generally called in a preconfiguration before the first use of a conditionScannerContains... condition in the priority list. If the scanner is particularly full, the list will not contain all visible objects. The current scan limit is 16.
condition: ai.conditionScannerContainsUnspreadMissile, // The scan contains a missile which has the same target and owner as this missile, but is closer to the target and within 500 metres of this missile. This is mainly used for "smart" missiles to ensure that impact times for a salvo are spread out.
configuration: ai.configurationMissileAdjustSpread, // This function sets an intermediate destination for "smart" missiles which are adjusting their flight path to spread out a salvo's impacts on target.
// This configuration sets a destination, a desired range and a desired speed suitable for use with behaviourApproachDestination. Unless otherwise stated, cruiseSpeed (80%) will be used as the desired speed.
behaviour: ai.behaviourApproachDestination, // Travels from the current position to within desiredRange of destination, avoiding obstacles on the way.
reconsider: 2
},
{
condition: ai.conditionMissileNeedsLaunchEvasion, // This function checks if the oolite_flag_launchAdjustMissile parameter is set to a non-null value, and returns true if so.
configuration: ai.configurationMissileAdjustLaunch, // This function causes the missile to dive sharply. The intended use is in conjunction with conditionMissileNeedsLaunchEvasion to avoid collisions with the launching ship.
// This configuration sets a destination, a desired range and a desired speed suitable for use with behaviourApproachDestination. Unless otherwise stated, cruiseSpeed (80%) will be used as the desired speed.
behaviour: ai.behaviourApproachDestination, // Travels from the current position to within desiredRange of destination, avoiding obstacles on the way.
reconsider: 2
},
{
condition: ai.conditionHasTarget, // The missile's target is not null.
behaviour: ai.behaviourMissileInterceptTarget, // Close to the desired missile range (default 25m, or specified by the oolite_missile_proximity key in script info), detonating when reached.
reconsider: 5
},
/* If target cloaks, go to last known location */
{
condition: ai.conditionHasInterceptCoordinates, // The missile has intercept coordinates set in the parameter "oolite_interceptCoordinates". These are used by missiles to home in on a last-known location if the target cloaks.
behaviour: ai.behaviourMissileInterceptCoordinates, // Close to the desired missile range (default 25m, or specified by the oolite_missile_proximity key in script info), detonating when reached. The coordinates to close in on are specified in the "oolite_interceptCoordinates". This is used to track missile targets which cloak.
reconsider: 1
},
/* Target lost. Self-destruct */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
]);
}
/* ECM response function, which must be set in shipdata script_info as oolite_missile_ecmResponse = "_ecmMissileResponse"; */
this._ecmMissileResponse = function()
{
switch (1 + Math.floor(Math.random() * 20)) // roll d20 (1 - 20)
{
case 1: // 5% chance spawn mines around target position (or around missile location, if target lost) and detonate missile
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by throwing mines around target and detonating");
this.ship.AIScript._dropMines();
this.ship.AIScript.shipAchievedDesiredRange(); // Detonate the missile and damage nearby ships (adjust with script_info oolite_missile_blastPower, oolite_missile_blastRadius, oolite_missile_blastShaping)
return;
case 2: // 5% chance brief tumble, then explode (no damage)
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by tumbling and exploding (no damage)");
this.oolite_priorityai.behaviourTumble(); // Start tumbling. Unlike most behaviours, this one does not include the standard responses, so you will need to manually request a reconsideration of priorities if one is needed.
this.oolite_priorityai.setPriorities([ // replace the priorities list from aiStarted with new priorities: self-destruct only
/* Self-destruct. */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
], 0.25 + Math.random() * 1.50); // delay for 0.25 to (almost) 1.50 seconds [setPriorities implicitly triggers a reconsideration of priorities]
return;
case 3: // 5% chance scatter mines around missile location, brief tumble, then explode (no damage)
log("fieldMissile launched by " + this.ship.displayName + " responding to ECM by scattering mines, tumbling and exploding (no damage)");
this.ship.AIScript._scatterMines();
this.oolite_priorityai.behaviourTumble(); // Start tumbling. Unlike most behaviours, this one does not include the standard responses, so you will need to manually request a reconsideration of priorities if one is needed.
this.oolite_priorityai.setPriorities([ // replace the priorities list from aiStarted with new priorities: self-destruct only
/* Self-destruct. */
{
behaviour: ai.behaviourMissileSelfDestruct // Destroys the missile without detonating the payload.
}
], 0.25 + Math.random() * 1.50); // delay for 0.25 to (almost) 1.50 seconds [setPriorities implicitly triggers a reconsideration of priorities]
return;
default: // 85% chance no effect
return;
}
}
this._dropMines = function () {
if (this.ship.target && this.ship.target.isValid && this.ship.position.distanceTo(this.ship.target.position) < 500) // if the missile has a valid target within 0.5km, spawn mines around the target
{
var mineCount = Math.ceil(Math.random() * 11) + 19; // 20-30 mines to be thrown around target position (250m radius)
system.addShips("armoury_fieldMine", mineCount, this.ship.target.position, 250);
}
else // otherwise just scatter mines wherever the missile is now
{
this._scatterMines();
}
}
this._scatterMines = function () {
var mineCount = Math.ceil(Math.random() * 11) + 19; // 20-30 mines to be thrown around missile position (250m radius)
system.addShips("armoury_fieldMine", mineCount, this.ship.position, 250);
}
It really looks as though we need either a lawyer (Littlebear?)
or someone who isn't but who understands this sort of law (Ahruman?) to give some advice.