* All ships now have a JavaScript script attached, allowing JS scripts to
add behaviours to any ship. * Legacy script_actions, setup_actions, launch_actions and death_actions handled through default JavaScript script. * In order to implement the above, JS Ship now has a runLegacyScriptActions method. This is not to be exposed as an "official" method, though, since we might want to change the mechanism -- for instance, to "compile" legacy scripts into JS. Handling dynamically-generated legacy scripts in that case would be a significant complication. * Updates for Mac OS X 10.5 "Leopard". - Errors on reading/writing plist will not cause a crash if building against the Leopard SDK. (I have no intention of requiring Leopard any time soon, but future-proofing is good.) - OOWeakReference is now more efficient when running under Leopard, by implementing the new "fast forwarding" mechanism. - Threads now have names set under Leopard, which may provide debugging advantages. - Fixed some new build warnings for new version of apple-gcc. - Updated type declarations to identify Oolite saved games as property lists. * Cleaned up PlayerEntityControls.m somewhat. Moved method declarations into files, fixed indentation, broke up monster giant method of doom. * Script-generated asteroids now behave like system populator-generated asteroids (As Seen on BB[TM]). * Minor optimizations and simplifications of legacy script engine. * JS System.filteredEntities() now has sensible behaviour if predicate throws an exception: the predicate is not called again, and null is returned. The exception is reported and not rethrown. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1240 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
5b28eb2b2d
commit
3fbc24887d
@ -26,7 +26,7 @@ endif
|
||||
OBJC_PROGRAM_NAME = oolite
|
||||
|
||||
oolite_C_FILES = legacy_random.c strlcpy.c OOTCPStreamDecoder.c
|
||||
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntityLegacyScriptEngine.m PlayerEntityContracts.m PlayerEntityControls.m PlayerEntityLoadSave.m PlayerEntitySound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntityAI.m ShipEntity.m SkyEntity.m StationEntity.m Universe.m OOSound.m SDLMusic.m NSFileManagerOOExtensions.m JoystickHandler.m PlayerEntityStickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m NSScannerOOExtensions.m OOXMLExtensions.m NSMutableDictionaryOOExtensions.m Geometry.m Octree.m CollisionRegion.m OOColor.m OOLogging.m OOCacheManager.m OOCache.m OOStringParsing.m OOCollectionExtractors.m OOVector.m OOMatrix.m OOQuaternion.m OOVoxel.m OOTriangle.m OOPListParsing.m OOFastArithmetic.m OOTextureScaling.m OOConstToString.m OOScript.m OOJSScript.m OOJavaScriptEngine.m OOPListScript.m NSStringOOExtensions.m PlayerEntityScriptMethods.m OOWeakReference.m OOJSEntity.m EntityOOJavaScriptExtensions.m OOJSQuaternion.m OOMaterial.m OOShaderMaterial.m OOShaderProgram.m OOShaderUniform.m OOTexture.m OOTextureLoader.m OOPNGTextureLoader.m OOOpenGLExtensionManager.m OOBasicMaterial.m OOSingleTextureMaterial.m OOCPUInfo.m OOSelfDrawingEntity.m OOEntityWithDrawable.m OODrawable.m OOJSVector.m OOMesh.m OOOpenGL.m OOGraphicsResetManager.m OOProbabilisticTextureManager.m OODebugGLDrawing.m OOShaderUniformMethodType.m OOAsyncQueue.m TextureStore.m OOOXPVerifier.m OOOXPVerifierStage.m OOFileScannerVerifierStage.m OOCheckRequiresPListVerifierStage.m OOCheckDemoShipsPListVerifierStage.m OOCheckEquipmentPListVerifierStage.m OOTextureVerifierStage.m OOModelVerifierStage.m OOCheckShipDataPListVerifierStage.m OOPListSchemaVerifier.m OOJSShip.m OOJSPlayer.m OOJSCall.m OOJSStation.m OOJSSystem.m OOLegacyEventHandlerScript.m OOJSOolite.m OORoleSet.m OOJSGlobal.m OOJSMissionVariables.m OOJSMission.m OOPriorityQueue.m OOScriptTimer.m OOJSTimer.m OOJSClock.m OODebugSupport.m OODebugMonitor.m OOJSConsole.m OODebugTCPConsoleClient.m OOTCPStreamDecoderAbstractionLayer.m OOEntityFilterPredicate.m OOJSPlanet.m OOJSWorldScripts.m OOJSSun.m
|
||||
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntityLegacyScriptEngine.m PlayerEntityContracts.m PlayerEntityControls.m PlayerEntityLoadSave.m PlayerEntitySound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntityAI.m ShipEntity.m SkyEntity.m StationEntity.m Universe.m OOSound.m SDLMusic.m NSFileManagerOOExtensions.m JoystickHandler.m PlayerEntityStickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m NSScannerOOExtensions.m OOXMLExtensions.m NSMutableDictionaryOOExtensions.m Geometry.m Octree.m CollisionRegion.m OOColor.m OOLogging.m OOCacheManager.m OOCache.m OOStringParsing.m OOCollectionExtractors.m OOVector.m OOMatrix.m OOQuaternion.m OOVoxel.m OOTriangle.m OOPListParsing.m OOFastArithmetic.m OOTextureScaling.m OOConstToString.m OOScript.m OOJSScript.m OOJavaScriptEngine.m OOPListScript.m NSStringOOExtensions.m PlayerEntityScriptMethods.m OOWeakReference.m OOJSEntity.m EntityOOJavaScriptExtensions.m OOJSQuaternion.m OOMaterial.m OOShaderMaterial.m OOShaderProgram.m OOShaderUniform.m OOTexture.m OOTextureLoader.m OOPNGTextureLoader.m OOOpenGLExtensionManager.m OOBasicMaterial.m OOSingleTextureMaterial.m OOCPUInfo.m OOSelfDrawingEntity.m OOEntityWithDrawable.m OODrawable.m OOJSVector.m OOMesh.m OOOpenGL.m OOGraphicsResetManager.m OOProbabilisticTextureManager.m OODebugGLDrawing.m OOShaderUniformMethodType.m OOAsyncQueue.m TextureStore.m OOOXPVerifier.m OOOXPVerifierStage.m OOFileScannerVerifierStage.m OOCheckRequiresPListVerifierStage.m OOCheckDemoShipsPListVerifierStage.m OOCheckEquipmentPListVerifierStage.m OOTextureVerifierStage.m OOModelVerifierStage.m OOCheckShipDataPListVerifierStage.m OOPListSchemaVerifier.m OOJSShip.m OOJSPlayer.m OOJSCall.m OOJSStation.m OOJSSystem.m OOLegacyEventHandlerScript.m OOJSOolite.m OORoleSet.m OOJSGlobal.m OOJSMissionVariables.m OOJSMission.m OOPriorityQueue.m OOScriptTimer.m OOJSTimer.m OOJSClock.m OODebugSupport.m OODebugMonitor.m OOJSConsole.m OODebugTCPConsoleClient.m OOTCPStreamDecoderAbstractionLayer.m OOEntityFilterPredicate.m OOJSPlanet.m OOJSWorldScripts.m OOJSSun.m NSThreadOOExtensions.m
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/objc.make
|
||||
include GNUmakefile.postamble
|
||||
|
@ -354,7 +354,6 @@
|
||||
1A472917096B5454000E78D8 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A472916096B5454000E78D8 /* CoreAudio.framework */; };
|
||||
1A472921096B5468000E78D8 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A47291F096B5468000E78D8 /* AudioToolbox.framework */; };
|
||||
1A472922096B5468000E78D8 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A472920096B5468000E78D8 /* AudioUnit.framework */; };
|
||||
1A4B374B0CAE657F0080887F /* oolite-trumbles.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A4B374A0CAE657F0080887F /* oolite-trumbles.js */; };
|
||||
1A4FB23A0C8D6A9A00DC8E1F /* jsautocfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB2390C8D6A9A00DC8E1F /* jsautocfg.h */; };
|
||||
1A4FB23C0C8D6AA900DC8E1F /* jsapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB23B0C8D6AA900DC8E1F /* jsapi.h */; };
|
||||
1A4FB23F0C8D6AB400DC8E1F /* jspubtd.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB23E0C8D6AB400DC8E1F /* jspubtd.h */; };
|
||||
@ -379,7 +378,13 @@
|
||||
1A5E46300C32DACE008104B4 /* OOShaderUniformMethodType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5E462E0C32DACE008104B4 /* OOShaderUniformMethodType.h */; };
|
||||
1A6515100CCC9E2E0054D01B /* oolite-standard-vertex.vertex in Copy Shaders */ = {isa = PBXBuildFile; fileRef = 1A65150D0CCC9E220054D01B /* oolite-standard-vertex.vertex */; };
|
||||
1A6515110CCC9E2E0054D01B /* oolite-default-shader.fragment in Copy Shaders */ = {isa = PBXBuildFile; fileRef = 1A65150E0CCC9E220054D01B /* oolite-default-shader.fragment */; };
|
||||
1A67050F0C4904ED002551AA /* oolite-cloaking-device.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A67050E0C4904ED002551AA /* oolite-cloaking-device.js */; };
|
||||
1A6518850CCE06960054D01B /* oolite-trumbles-mission.js in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1A6518820CCE06960054D01B /* oolite-trumbles-mission.js */; };
|
||||
1A6518870CCE06960054D01B /* oolite-cloaking-device-mission.js in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1A6518840CCE06960054D01B /* oolite-cloaking-device-mission.js */; };
|
||||
1A6518890CCE06AE0054D01B /* oolite-cloaking-device-pod.js in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1A6518880CCE06AE0054D01B /* oolite-cloaking-device-pod.js */; };
|
||||
1A65188D0CCE06E30054D01B /* oolite-trumbles-mission.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A6518820CCE06960054D01B /* oolite-trumbles-mission.js */; };
|
||||
1A65188E0CCE06E30054D01B /* oolite-cloaking-device-pod.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A6518880CCE06AE0054D01B /* oolite-cloaking-device-pod.js */; };
|
||||
1A65188F0CCE06E30054D01B /* oolite-cloaking-device-mission.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A6518840CCE06960054D01B /* oolite-cloaking-device-mission.js */; };
|
||||
1A6518900CCE06E30054D01B /* oolite-default-ship-script.js in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 1A6517860CCDDD140054D01B /* oolite-default-ship-script.js */; };
|
||||
1A6B1EF00C9AA5C6000717CF /* OOScriptTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B1EEE0C9AA5C6000717CF /* OOScriptTimer.h */; };
|
||||
1A6B1EF10C9AA5C6000717CF /* OOScriptTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B1EEF0C9AA5C6000717CF /* OOScriptTimer.m */; };
|
||||
1A6B1F360C9AAA60000717CF /* OOPriorityQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B1F340C9AAA60000717CF /* OOPriorityQueue.m */; };
|
||||
@ -496,6 +501,10 @@
|
||||
1AD0C3300C463FCC0070BD23 /* autoAImap.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1AD0C32F0C463FCB0070BD23 /* autoAImap.plist */; };
|
||||
1AD0C6C90C47B77E0070BD23 /* SCRDynamicShim.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD0C6C80C47B76F0070BD23 /* SCRDynamicShim.m */; };
|
||||
1AD0C6E60C47B82C0070BD23 /* SmartCrashReportsInstall.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD0C6E40C47B82C0070BD23 /* SmartCrashReportsInstall.h */; };
|
||||
1AD1F4C90CD9E42A00EAE520 /* NSThreadOOExtensions.h in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1AD1F4C70CD9E42A00EAE520 /* NSThreadOOExtensions.h */; };
|
||||
1AD1F4CA0CD9E42A00EAE520 /* NSThreadOOExtensions.m in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1AD1F4C80CD9E42A00EAE520 /* NSThreadOOExtensions.m */; };
|
||||
1AD1F4FF0CD9E83700EAE520 /* NSThreadOOExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD1F4C80CD9E42A00EAE520 /* NSThreadOOExtensions.m */; };
|
||||
1AD1F5000CD9E83800EAE520 /* NSThreadOOExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD1F4C70CD9E42A00EAE520 /* NSThreadOOExtensions.h */; };
|
||||
1AD267650C83058C00B4BFD1 /* Debug.oxp in Copy Debug OXP */ = {isa = PBXBuildFile; fileRef = 1A0519390C7CCAC900BA5CCA /* Debug.oxp */; };
|
||||
1ADBA5500BD0F173008FC99C /* OOBasicMaterial.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ADBA54E0BD0F173008FC99C /* OOBasicMaterial.h */; };
|
||||
1ADBA5510BD0F173008FC99C /* OOBasicMaterial.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBA54F0BD0F173008FC99C /* OOBasicMaterial.m */; };
|
||||
@ -913,9 +922,11 @@
|
||||
dstPath = Scripts;
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
1A4B374B0CAE657F0080887F /* oolite-trumbles.js in Copy Scripts */,
|
||||
1A65188D0CCE06E30054D01B /* oolite-trumbles-mission.js in Copy Scripts */,
|
||||
1A65188E0CCE06E30054D01B /* oolite-cloaking-device-pod.js in Copy Scripts */,
|
||||
1A65188F0CCE06E30054D01B /* oolite-cloaking-device-mission.js in Copy Scripts */,
|
||||
1A6518900CCE06E30054D01B /* oolite-default-ship-script.js in Copy Scripts */,
|
||||
1A34912E0BC25EBC00802DA7 /* oolite-legacy-script.plist in Copy Scripts */,
|
||||
1A67050F0C4904ED002551AA /* oolite-cloaking-device.js in Copy Scripts */,
|
||||
);
|
||||
name = "Copy Scripts";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -950,6 +961,11 @@
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
1AD267650C83058C00B4BFD1 /* Debug.oxp in Copy Debug OXP */,
|
||||
1A6518850CCE06960054D01B /* oolite-trumbles-mission.js in Copy Debug OXP */,
|
||||
1A6518870CCE06960054D01B /* oolite-cloaking-device-mission.js in Copy Debug OXP */,
|
||||
1A6518890CCE06AE0054D01B /* oolite-cloaking-device-pod.js in Copy Debug OXP */,
|
||||
1AD1F4C90CD9E42A00EAE520 /* NSThreadOOExtensions.h in Copy Debug OXP */,
|
||||
1AD1F4CA0CD9E42A00EAE520 /* NSThreadOOExtensions.m in Copy Debug OXP */,
|
||||
);
|
||||
name = "Copy Debug OXP";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -990,7 +1006,7 @@
|
||||
1A2316E70B9CFAD700EF0852 /* keyconfig.plist */ = {isa = PBXFileReference; fileEncoding = 4; languageSpecificationIdentifier = plist; lastKnownFileType = text.xml; path = keyconfig.plist; sourceTree = "<group>"; };
|
||||
1A2316E80B9CFAD700EF0852 /* logcontrol.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = logcontrol.plist; sourceTree = "<group>"; };
|
||||
1A2316E90B9CFAD700EF0852 /* missiontext.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = missiontext.plist; sourceTree = "<group>"; };
|
||||
1A2316EB0B9CFAD700EF0852 /* shipdata.plist */ = {isa = PBXFileReference; fileEncoding = 4; languageSpecificationIdentifier = plist; lastKnownFileType = text.xml; path = shipdata.plist; sourceTree = "<group>"; };
|
||||
1A2316EB0B9CFAD700EF0852 /* shipdata.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipdata.plist; sourceTree = "<group>"; };
|
||||
1A2316EC0B9CFAD700EF0852 /* shipyard.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipyard.plist; sourceTree = "<group>"; };
|
||||
1A2316ED0B9CFAD700EF0852 /* speech_pronunciation_guide.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = speech_pronunciation_guide.plist; sourceTree = "<group>"; };
|
||||
1A2317910B9D022400EF0852 /* buoyAI.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = buoyAI.plist; sourceTree = "<group>"; };
|
||||
@ -1299,7 +1315,6 @@
|
||||
1A472916096B5454000E78D8 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
|
||||
1A47291F096B5468000E78D8 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
|
||||
1A472920096B5468000E78D8 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
|
||||
1A4B374A0CAE657F0080887F /* oolite-trumbles.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-trumbles.js"; sourceTree = "<group>"; };
|
||||
1A4FB2390C8D6A9A00DC8E1F /* jsautocfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsautocfg.h; path = xcode/jsautocfg.h; sourceTree = "<group>"; };
|
||||
1A4FB23B0C8D6AA900DC8E1F /* jsapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsapi.h; path = src/jsapi.h; sourceTree = "<group>"; };
|
||||
1A4FB23E0C8D6AB400DC8E1F /* jspubtd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jspubtd.h; path = src/jspubtd.h; sourceTree = "<group>"; };
|
||||
@ -1322,9 +1337,12 @@
|
||||
1A5DBD570BC17F0900D57389 /* NSStringOOExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSStringOOExtensions.m; sourceTree = "<group>"; };
|
||||
1A5E462D0C32DACE008104B4 /* OOShaderUniformMethodType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOShaderUniformMethodType.m; sourceTree = "<group>"; };
|
||||
1A5E462E0C32DACE008104B4 /* OOShaderUniformMethodType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOShaderUniformMethodType.h; sourceTree = "<group>"; };
|
||||
1A65150D0CCC9E220054D01B /* oolite-standard-vertex.vertex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.frag; path = "oolite-standard-vertex.vertex"; sourceTree = "<group>"; };
|
||||
1A65150E0CCC9E220054D01B /* oolite-default-shader.fragment */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.vert; path = "oolite-default-shader.fragment"; sourceTree = "<group>"; };
|
||||
1A67050E0C4904ED002551AA /* oolite-cloaking-device.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-cloaking-device.js"; sourceTree = "<group>"; };
|
||||
1A65150D0CCC9E220054D01B /* oolite-standard-vertex.vertex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "oolite-standard-vertex.vertex"; sourceTree = "<group>"; };
|
||||
1A65150E0CCC9E220054D01B /* oolite-default-shader.fragment */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "oolite-default-shader.fragment"; sourceTree = "<group>"; };
|
||||
1A6517860CCDDD140054D01B /* oolite-default-ship-script.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-default-ship-script.js"; sourceTree = "<group>"; };
|
||||
1A6518820CCE06960054D01B /* oolite-trumbles-mission.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-trumbles-mission.js"; sourceTree = "<group>"; };
|
||||
1A6518840CCE06960054D01B /* oolite-cloaking-device-mission.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-cloaking-device-mission.js"; sourceTree = "<group>"; };
|
||||
1A6518880CCE06AE0054D01B /* oolite-cloaking-device-pod.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "oolite-cloaking-device-pod.js"; sourceTree = "<group>"; };
|
||||
1A6B1EEE0C9AA5C6000717CF /* OOScriptTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOScriptTimer.h; sourceTree = "<group>"; };
|
||||
1A6B1EEF0C9AA5C6000717CF /* OOScriptTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOScriptTimer.m; sourceTree = "<group>"; };
|
||||
1A6B1F340C9AAA60000717CF /* OOPriorityQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOPriorityQueue.m; sourceTree = "<group>"; };
|
||||
@ -1448,6 +1466,8 @@
|
||||
1AD0C6C80C47B76F0070BD23 /* SCRDynamicShim.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCRDynamicShim.m; sourceTree = "<group>"; };
|
||||
1AD0C6E30C47B82C0070BD23 /* SmartCrashReportsInstall.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = SmartCrashReportsInstall.o; sourceTree = "<group>"; };
|
||||
1AD0C6E40C47B82C0070BD23 /* SmartCrashReportsInstall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartCrashReportsInstall.h; sourceTree = "<group>"; };
|
||||
1AD1F4C70CD9E42A00EAE520 /* NSThreadOOExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSThreadOOExtensions.h; sourceTree = "<group>"; };
|
||||
1AD1F4C80CD9E42A00EAE520 /* NSThreadOOExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSThreadOOExtensions.m; sourceTree = "<group>"; };
|
||||
1ADBA54E0BD0F173008FC99C /* OOBasicMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBasicMaterial.h; sourceTree = "<group>"; };
|
||||
1ADBA54F0BD0F173008FC99C /* OOBasicMaterial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBasicMaterial.m; sourceTree = "<group>"; };
|
||||
1ADF5F110B9E374B00FDB2A3 /* JoystickHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JoystickHandler.h; sourceTree = "<group>"; };
|
||||
@ -1518,7 +1538,7 @@
|
||||
25F3E8A40994FE65002F25FD /* oolite-document.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "oolite-document.icns"; sourceTree = "<group>"; };
|
||||
25F3E8A50994FE65002F25FD /* oolite-expansion-document.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "oolite-expansion-document.icns"; sourceTree = "<group>"; };
|
||||
25F3E8A60994FE65002F25FD /* oolite-icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "oolite-icon.icns"; sourceTree = "<group>"; };
|
||||
25F3E8B30994FE9B002F25FD /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = InfoPlist.strings; sourceTree = "<group>"; };
|
||||
25F3E8B30994FE9B002F25FD /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; path = InfoPlist.strings; sourceTree = "<group>"; };
|
||||
25F3E8BC09950088002F25FD /* Info-Oolite.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "Info-Oolite.plist"; path = "../src/Cocoa/Info-Oolite.plist"; sourceTree = "<group>"; };
|
||||
25F3E8BD09950088002F25FD /* Info-OoliteDev.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "Info-OoliteDev.plist"; path = "../src/Cocoa/Info-OoliteDev.plist"; sourceTree = "<group>"; };
|
||||
25F3E8C3099500F1002F25FD /* SoundInspector.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SoundInspector.nib; path = ../src/Cocoa/SoundInspector.nib; sourceTree = "<group>"; };
|
||||
@ -1970,9 +1990,11 @@
|
||||
1A34912C0BC25EBC00802DA7 /* Scripts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A4B374A0CAE657F0080887F /* oolite-trumbles.js */,
|
||||
1A34912D0BC25EBC00802DA7 /* oolite-legacy-script.plist */,
|
||||
1A67050E0C4904ED002551AA /* oolite-cloaking-device.js */,
|
||||
1A6518820CCE06960054D01B /* oolite-trumbles-mission.js */,
|
||||
1A6518880CCE06AE0054D01B /* oolite-cloaking-device-pod.js */,
|
||||
1A6518840CCE06960054D01B /* oolite-cloaking-device-mission.js */,
|
||||
1A6517860CCDDD140054D01B /* oolite-default-ship-script.js */,
|
||||
);
|
||||
path = Scripts;
|
||||
sourceTree = "<group>";
|
||||
@ -2249,6 +2271,8 @@
|
||||
1A6B1F350C9AAA60000717CF /* OOPriorityQueue.h */,
|
||||
1A43A1840CB9243B00D0E239 /* OOEntityFilterPredicate.h */,
|
||||
1A43A1850CB9243B00D0E239 /* OOEntityFilterPredicate.m */,
|
||||
1AD1F4C70CD9E42A00EAE520 /* NSThreadOOExtensions.h */,
|
||||
1AD1F4C80CD9E42A00EAE520 /* NSThreadOOExtensions.m */,
|
||||
);
|
||||
name = Utilities;
|
||||
sourceTree = "<group>";
|
||||
@ -2683,6 +2707,7 @@
|
||||
1A43A0CC0CB91D2C00D0E239 /* OOJSPlanet.h in Headers */,
|
||||
1A43A1860CB9243B00D0E239 /* OOEntityFilterPredicate.h in Headers */,
|
||||
1A7C75C50CC39EC9005D0AA2 /* OOJSSun.h in Headers */,
|
||||
1AD1F5000CD9E83800EAE520 /* NSThreadOOExtensions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -2758,6 +2783,7 @@
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 08B31CB008FE63D70038D42F /* Build configuration list for PBXProject "Oolite" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* Oolite_GUSTO */;
|
||||
projectDirPath = "";
|
||||
@ -2775,6 +2801,7 @@
|
||||
ProjectRef = 1A5BF2720916D47300BF238F /* Oolite-importer.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
1AD267500C83050800B4BFD1 /* Build All */,
|
||||
0865423506B8447D000CA0AB /* Oolite */,
|
||||
@ -3032,6 +3059,7 @@
|
||||
1A43A1870CB9243B00D0E239 /* OOEntityFilterPredicate.m in Sources */,
|
||||
1AA82C8A0CC10E700023B797 /* OOJSWorldScripts.m in Sources */,
|
||||
1A7C75C30CC39EC3005D0AA2 /* OOJSSun.m in Sources */,
|
||||
1AD1F4FF0CD9E83700EAE520 /* NSThreadOOExtensions.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -3250,8 +3278,10 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = PNG_USER_CONFIG;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/src/Core/Materials/\"";
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.3;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = png;
|
||||
SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = TestRelease;
|
||||
@ -3343,8 +3373,10 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = PNG_USER_CONFIG;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/src/Core/Materials/\"";
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.3;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = png;
|
||||
SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Development;
|
||||
@ -3360,8 +3392,10 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = PNG_USER_CONFIG;
|
||||
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/src/Core/Materials/\"";
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.3;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = png;
|
||||
SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Deployment;
|
||||
|
@ -181,10 +181,6 @@
|
||||
script.debug = $scriptDebugOn;
|
||||
script.debug.message = inherit; // debugMessage: script action
|
||||
script.debug.onOff = inherit; // debugOn/debugOff script actions
|
||||
script.debug.testCondition = inherit;
|
||||
script.debug.testCondition.checkingVariable = inherit;
|
||||
script.debug.testCondition.testValues = inherit;
|
||||
script.debug.testCondition.oneOf = inherit;
|
||||
script.debug.processSceneString.addScene = inherit;
|
||||
script.debug.processSceneString.addModel = inherit;
|
||||
script.debug.processSceneString.addLocalPlanet = inherit;
|
||||
@ -193,7 +189,6 @@
|
||||
script.debug.setSunNovaIn = inherit;
|
||||
|
||||
script.debug.note = inherit;
|
||||
script.debug.note.scriptAction = inherit; // Messages saying a scripting method was called, with no further info
|
||||
script.debug.note.awardCargo = inherit;
|
||||
script.debug.note.removeAllCargo = inherit;
|
||||
script.debug.note.useSpecialCargo = inherit;
|
||||
@ -208,11 +203,20 @@
|
||||
script.debug.note.processSceneString = inherit;
|
||||
script.debug.note.testCondition = no;
|
||||
|
||||
script.debug.trace = off; // Trace messages are very verbose, printing at least one message per script action. They are not available at all in release versions.
|
||||
script.debug.trace.scriptAction = inherit; // Messages for each legacy script action executed.
|
||||
script.debug.trace.testCondition = inherit; // Messages for each legacy script condition evaluated.
|
||||
script.debug.trace.testCondition.checkingVariable = inherit; // Messages for tests of mission/local variables in script conditions.
|
||||
script.debug.trace.testCondition.testValues = inherit; // Messages for string and number comparisons.
|
||||
script.debug.trace.testCondition.oneOf = inherit; // Messages for "oneof" tests.
|
||||
|
||||
script.debug.syntax = $scriptError; // Messages relating to script formatting
|
||||
script.debug.syntax.badConditional = inherit;
|
||||
script.debug.syntax.badComparison = inherit;
|
||||
script.debug.syntax.action = inherit;
|
||||
script.debug.syntax.action.noneSpecified = inherit;
|
||||
script.debug.syntax.action.badSelector = inherit;
|
||||
script.debug.syntax.action.badElement = inherit;
|
||||
script.debug.syntax.scriptCondition.noneSpecified = inherit;
|
||||
script.debug.syntax.setPlanetInfo = inherit;
|
||||
script.debug.syntax.awardCargo = inherit;
|
||||
|
@ -224,8 +224,6 @@
|
||||
<string>inherit</string>
|
||||
<key>script.debug.note.replaceVariablesInString</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.note.scriptAction</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.note.set</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.note.setFuelLeak</key>
|
||||
@ -258,6 +256,8 @@
|
||||
<string>$scriptError</string>
|
||||
<key>script.debug.syntax.action</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.action.badElement</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.action.badSelector</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.action.noneSpecified</key>
|
||||
@ -266,6 +266,8 @@
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.awardCargo</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.badComparison</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.badConditional</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.messageShipAIs</key>
|
||||
@ -278,13 +280,17 @@
|
||||
<string>inherit</string>
|
||||
<key>script.debug.syntax.setPlanetInfo</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.testCondition</key>
|
||||
<key>script.debug.trace</key>
|
||||
<string>off</string>
|
||||
<key>script.debug.trace.scriptAction</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.testCondition.checkingVariable</key>
|
||||
<key>script.debug.trace.testCondition</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.testCondition.oneOf</key>
|
||||
<key>script.debug.trace.testCondition.checkingVariable</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.testCondition.testValues</key>
|
||||
<key>script.debug.trace.testCondition.oneOf</key>
|
||||
<string>inherit</string>
|
||||
<key>script.debug.trace.testCondition.testValues</key>
|
||||
<string>inherit</string>
|
||||
<key>script.error</key>
|
||||
<string>$scriptError</string>
|
||||
|
@ -4,7 +4,6 @@
|
||||
aft_eject_position = "0.0 -4.5 -23.0";
|
||||
ai_type = "scavengerAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
exhaust = ("-5.75 0.0 -22.5 6.0 4.0 4.0", "5.75 0.0 -22.5 6.0 4.0 4.0");
|
||||
@ -127,8 +126,6 @@
|
||||
cargo_type = "CARGO_ALLOY";
|
||||
energy_recharge_rate = 0;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 1;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -145,7 +142,6 @@
|
||||
aft_weapon_type = "WEAPON_PULSE_LASER";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
escort-ship = "cobramk1";
|
||||
@ -276,7 +272,6 @@
|
||||
aft_eject_position = "0.0 -8.0 -21.5";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 4;
|
||||
exhaust = ("0.0 0.0 -35.0 8.0 6.0 8.0");
|
||||
@ -287,7 +282,6 @@
|
||||
has_scoop = 0.99;
|
||||
has_shield_booster = 0.5;
|
||||
likely_cargo = 1;
|
||||
max_cargo = 0;
|
||||
max_energy = 350;
|
||||
max_flight_pitch = 1;
|
||||
max_flight_roll = 2;
|
||||
@ -316,8 +310,6 @@
|
||||
fuel = 70;
|
||||
has_cloaking_device = yes;
|
||||
has_scoop = yes;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 320;
|
||||
max_flight_pitch = 1;
|
||||
max_flight_roll = 2;
|
||||
@ -431,8 +423,6 @@
|
||||
has_ecm = no;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 100;
|
||||
max_flight_pitch = 0.1;
|
||||
max_flight_roll = 0.1;
|
||||
@ -454,6 +444,7 @@
|
||||
specular = (0.1, 0.1, 0.1, 1.0);
|
||||
};
|
||||
};
|
||||
likely_cargo = 4;
|
||||
};
|
||||
"asteroid-alternative" =
|
||||
{
|
||||
@ -468,8 +459,6 @@
|
||||
cargo_type = "CARGO_RANDOM";
|
||||
energy_recharge_rate = 0;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 1;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -489,7 +478,6 @@
|
||||
aft_weapon_type = "WEAPON_BEAM_LASER";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
escorts = 4;
|
||||
@ -522,7 +510,6 @@
|
||||
aft_weapon_type = "WEAPON_BEAM_LASER";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3.2;
|
||||
escorts = 4;
|
||||
@ -743,8 +730,6 @@
|
||||
has_ecm = no;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 25;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -777,12 +762,9 @@
|
||||
{
|
||||
ai_type = "buoyAI.plist";
|
||||
beacon = "N0100 Navigation Buoy";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 250;
|
||||
max_flight_pitch = 2;
|
||||
max_flight_roll = 2;
|
||||
@ -807,12 +789,9 @@
|
||||
{
|
||||
ai_type = "buoyAI.plist";
|
||||
beacon = "W0100 Navigation Buoy (Witchpoint)";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 250;
|
||||
max_flight_pitch = 2;
|
||||
max_flight_roll = 2;
|
||||
@ -838,8 +817,6 @@
|
||||
cargo_type = "CARGO_SCRIPTED_ITEM";
|
||||
energy_recharge_rate = 0;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 5;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -848,6 +825,7 @@
|
||||
name = "Unusual cargo container";
|
||||
roles = "cloaking-device oolite-cloaking-device";
|
||||
scanClass = "CLASS_CARGO";
|
||||
// script = "oolite-cloaking-device-pod.js";
|
||||
script_actions =
|
||||
(
|
||||
"testForEquipment: EQ_CLOAKING_DEVICE",
|
||||
@ -860,10 +838,10 @@
|
||||
"set: mission_TL_FOR_EQ_CLOAKING_DEVICE 14"
|
||||
*/
|
||||
);
|
||||
},
|
||||
{
|
||||
conditions = ("foundEquipment_bool equal YES");
|
||||
do = ("awardCargo: 100 Gold");
|
||||
else =
|
||||
(
|
||||
"awardCargo: 100 Gold"
|
||||
);
|
||||
}
|
||||
);
|
||||
thrust = 0;
|
||||
@ -874,7 +852,6 @@
|
||||
aft_eject_position = "0.0 15.5 -33.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("-19 0.0 -32.5 15.0 7.5 12.5", "19 0.0 -32.5 15.0 7.5 12.5");
|
||||
@ -1030,7 +1007,6 @@
|
||||
aft_eject_position = "0.0 15.5 -33.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
exhaust = ("-19 0.0 -32.5 15.0 7.5 12.5", "19 0.0 -32.5 15.0 7.5 12.5");
|
||||
@ -1061,7 +1037,6 @@
|
||||
aft_eject_position = "0.0 7.5 -21.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
exhaust = ("8.2 0.0 -27.5 6.0 4.0 4.0", "-8.2 0.0 -27.5 6.0 4.0 4.0");
|
||||
@ -1090,7 +1065,6 @@
|
||||
aft_eject_position = "0.0 7.5 -21.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3.75;
|
||||
exhaust = ("8.2 0.0 -27.5 6.0 4.0 4.0", "-8.2 0.0 -27.5 6.0 4.0 4.0");
|
||||
@ -1122,14 +1096,12 @@
|
||||
aft_eject_position = "0.0 7.5 -21.0";
|
||||
ai_type = "minerAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
exhaust = ("8.2 0.0 -27.5 6.0 4.0 4.0", "-8.2 0.0 -27.5 6.0 4.0 4.0");
|
||||
forward_weapon_type = "WEAPON_MINING_LASER";
|
||||
fuel = 70;
|
||||
has_scoop = yes;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 10;
|
||||
max_energy = 150;
|
||||
max_flight_pitch = 1.2;
|
||||
@ -1272,7 +1244,6 @@
|
||||
"coriolis-station" =
|
||||
{
|
||||
ai_type = "stationAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 100;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
@ -1280,8 +1251,6 @@
|
||||
has_ecm = yes;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 25000;
|
||||
max_flight_pitch = 8;
|
||||
max_flight_roll = 8;
|
||||
@ -1334,7 +1303,6 @@
|
||||
"dodecahedron-station" =
|
||||
{
|
||||
ai_type = "stationAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 100;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
@ -1342,8 +1310,6 @@
|
||||
has_ecm = yes;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 25000;
|
||||
max_flight_pitch = 8;
|
||||
max_flight_roll = 8;
|
||||
@ -1379,13 +1345,10 @@
|
||||
"ecm-proof-missile" =
|
||||
{
|
||||
ai_type = "hardMissileAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 0;
|
||||
exhaust = ("0.0 0.0 -3.5 2.0 2.0 4.0");
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 5;
|
||||
max_flight_pitch = 8;
|
||||
max_flight_roll = 10;
|
||||
@ -1403,7 +1366,6 @@
|
||||
{
|
||||
aft_eject_position = "0.0 0.0 -2.0";
|
||||
ai_type = "homeAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_SLAVES";
|
||||
energy_recharge_rate = 2;
|
||||
exhaust =
|
||||
@ -1413,8 +1375,6 @@
|
||||
"-2.56 -1.48 -1.67 0.5 0.5 0.5"
|
||||
);
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 25;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -1441,7 +1401,6 @@
|
||||
aft_eject_position = "0.0 3.0 -38.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 4.5;
|
||||
exhaust = ("0.0 -5.0 -42.5 6.0 6.0 8.0");
|
||||
@ -1567,7 +1526,6 @@
|
||||
aft_eject_position = "0.0 4.5 -11.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 4;
|
||||
exhaust = ("0.0 0.0 -20.0 5.0 4.0 4.0");
|
||||
@ -1607,7 +1565,6 @@
|
||||
"icosahedron-station" =
|
||||
{
|
||||
ai_type = "stationAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 100;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
@ -1615,8 +1572,6 @@
|
||||
has_ecm = yes;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 25000;
|
||||
max_flight_pitch = 8;
|
||||
max_flight_roll = 8;
|
||||
@ -1653,7 +1608,6 @@
|
||||
aft_eject_position = "0.0 7.5 -16.5";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
exhaust = ("-7.5 0.0 -35.58 4.0 4.0 5.0", "7.5 0.0 -35.58 4.0 4.0 5.0");
|
||||
@ -1685,7 +1639,6 @@
|
||||
aft_eject_position = "0.0 5.5 -17.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("0.0 0.0 -27.5 10.0 8.0 12.0");
|
||||
@ -1714,7 +1667,6 @@
|
||||
aft_eject_position = "0.0 5.5 -17.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("0.0 0.0 -27.5 10.0 8.0 12.0");
|
||||
@ -1739,13 +1691,10 @@
|
||||
"missile" =
|
||||
{
|
||||
ai_type = "missileAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 0;
|
||||
exhaust = ("0.0 0.0 -3.5 2.0 2.0 4.0");
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 5;
|
||||
max_flight_pitch = 8;
|
||||
max_flight_roll = 10;
|
||||
@ -1764,7 +1713,6 @@
|
||||
aft_eject_position = "0.0 5.75 -8.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("0.0 -2.0 -30.0 10.0 8.0 16.0");
|
||||
@ -1885,7 +1833,6 @@
|
||||
aft_eject_position = "0.0 5.75 -8.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("0.0 -2.0 -30.0 10.0 8.0 16.0");
|
||||
@ -2024,7 +1971,6 @@
|
||||
aft_eject_position = "0.0 15.5 -50.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
exhaust = ("0.0 0.0 -64.5 12.0 12.0 13.0");
|
||||
@ -2055,7 +2001,6 @@
|
||||
aft_eject_position = "0.0 15.5 -50.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3.5;
|
||||
escorts = 2;
|
||||
@ -2179,7 +2124,6 @@
|
||||
aft_eject_position = "0.0 15.5 -50.0";
|
||||
ai_type = "route1traderAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
escorts = 2;
|
||||
@ -2221,7 +2165,6 @@
|
||||
"rock-hermit" =
|
||||
{
|
||||
ai_type = "rockHermitAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 5;
|
||||
"equipment_price_factor" = 4.5;
|
||||
@ -2231,8 +2174,6 @@
|
||||
has_ecm = yes;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
"max_defense_ships" = 2;
|
||||
max_energy = 1000;
|
||||
max_flight_pitch = 8;
|
||||
@ -2273,8 +2214,6 @@
|
||||
cargo_type = "CARGO_ALLOY";
|
||||
energy_recharge_rate = 0;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 1;
|
||||
max_flight_pitch = 0.5;
|
||||
max_flight_roll = 0.5;
|
||||
@ -2289,7 +2228,6 @@
|
||||
{
|
||||
aft_eject_position = "0.0 0 -18.0";
|
||||
ai_type = "nullAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 1;
|
||||
exhaust = (
|
||||
@ -2299,7 +2237,6 @@
|
||||
"-6.7 -6.7 -17.5 4.0 4.0 5.0"
|
||||
);
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 30;
|
||||
max_energy = 120;
|
||||
max_flight_pitch = 0.9;
|
||||
@ -2321,13 +2258,10 @@
|
||||
aft_eject_position = "0.0 7.5 -18.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
exhaust = ("0.0 0.0 -17.0 8.0 6.0 12.0");
|
||||
forward_weapon_type = "WEAPON_PULSE_LASER";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 240;
|
||||
max_flight_pitch = 1.6;
|
||||
max_flight_roll = 2.8;
|
||||
@ -2348,13 +2282,10 @@
|
||||
aft_eject_position = "0.0 7.5 -18.0";
|
||||
ai_type = "pirateAI.plist";
|
||||
auto_ai = yes;
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2.5;
|
||||
exhaust = ("0.0 0.0 -17.0 8.0 6.0 12.0");
|
||||
forward_weapon_type = "WEAPON_BEAM_LASER";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 240;
|
||||
max_flight_pitch = 1.8;
|
||||
max_flight_roll = 2.8;
|
||||
@ -2380,8 +2311,6 @@
|
||||
has_ecm = no;
|
||||
has_escape_pod = 0;
|
||||
has_scoop = no;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 5;
|
||||
max_flight_pitch = 1;
|
||||
max_flight_roll = 1;
|
||||
@ -2425,8 +2354,6 @@
|
||||
energy_recharge_rate = 3;
|
||||
forward_weapon_type = "WEAPON_PULSE_LASER";
|
||||
laser_color = "greenColor";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 150;
|
||||
max_flight_pitch = 1;
|
||||
max_flight_roll = 2;
|
||||
@ -2457,8 +2384,6 @@
|
||||
fuel = 150;
|
||||
has_ecm = yes;
|
||||
laser_color = "greenColor";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 600;
|
||||
max_flight_pitch = 1;
|
||||
max_flight_roll = 2;
|
||||
@ -2477,12 +2402,10 @@
|
||||
{
|
||||
aft_eject_position = "0.0 5.5 -18.0";
|
||||
ai_type = "nullAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("6.125 -0.75 -17.5 3.0 3.0 4.0", "-6.125 -0.75 -17.5 3.0 3.0 4.0");
|
||||
forward_weapon_type = "WEAPON_PULSE_LASER";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 12;
|
||||
max_energy = 150;
|
||||
max_flight_pitch = 1;
|
||||
@ -2504,13 +2427,11 @@
|
||||
accuracy = 8;
|
||||
aft_eject_position = "0.0 5.5 -18.0";
|
||||
ai_type = "minerAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 3;
|
||||
exhaust = ("6.125 -0.75 -17.5 3.0 3.0 4.0", "-6.125 -0.75 -17.5 3.0 3.0 4.0");
|
||||
forward_weapon_type = "WEAPON_MINING_LASER";
|
||||
has_scoop = yes;
|
||||
likely_cargo = 0;
|
||||
max_cargo = 12;
|
||||
max_energy = 150;
|
||||
max_flight_pitch = 1;
|
||||
@ -2531,15 +2452,12 @@
|
||||
{
|
||||
aft_eject_position = "0.0 6.5 -28.0";
|
||||
ai_type = "route1patrolAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 4;
|
||||
exhaust = ("12.5 0.0 -27.5 6.0 6.0 6.0", "-12.5 0.0 -27.5 6.0 6.0 6.0");
|
||||
forward_weapon_type = "WEAPON_BEAM_LASER";
|
||||
has_ecm = yes;
|
||||
laser_color = "magentaColor";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 180;
|
||||
max_flight_pitch = 1.8;
|
||||
max_flight_roll = 2.8;
|
||||
@ -2574,7 +2492,6 @@
|
||||
{
|
||||
aft_eject_position = "0.0 10.5 -22.0";
|
||||
ai_type = "route1patrolAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 6;
|
||||
exhaust = (
|
||||
@ -2587,8 +2504,6 @@
|
||||
has_ecm = yes;
|
||||
has_fuel_injection = yes;
|
||||
laser_color = "magentaColor";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 280;
|
||||
max_flight_pitch = 2;
|
||||
max_flight_roll = 4.2;
|
||||
@ -2623,15 +2538,12 @@
|
||||
{
|
||||
aft_eject_position = "0.0 6.5 -28.0";
|
||||
ai_type = "route1patrolAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 4;
|
||||
exhaust = ("12.5 0.0 -27.5 6.0 6.0 6.0", "-12.5 0.0 -27.5 6.0 6.0 6.0");
|
||||
forward_weapon_type = "WEAPON_BEAM_LASER";
|
||||
has_ecm = yes;
|
||||
laser_color = "magentaColor";
|
||||
likely_cargo = 0;
|
||||
max_cargo = 0;
|
||||
max_energy = 180;
|
||||
max_flight_pitch = 1.8;
|
||||
max_flight_roll = 2.8;
|
||||
@ -2651,7 +2563,6 @@
|
||||
{
|
||||
aft_eject_position = "0.0 5.0 -9.5";
|
||||
ai_type = "nullAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 2;
|
||||
exhaust = ("0.0 0.0 -17.5 7.0 6.0 6.0");
|
||||
@ -2677,7 +2588,6 @@
|
||||
{
|
||||
aft_eject_position = "0.0 5.0 -9.5";
|
||||
ai_type = "minerAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 1.85;
|
||||
exhaust = ("0.0 0.0 -17.5 6.0 5.0 5.0");
|
||||
@ -2704,7 +2614,6 @@
|
||||
"wreckage-component" =
|
||||
{
|
||||
ai_type = "nullAI.plist";
|
||||
bounty = 0;
|
||||
cargo_type = "CARGO_NOT_CARGO";
|
||||
energy_recharge_rate = 0;
|
||||
forward_weapon_type = "WEAPON_NONE";
|
||||
|
@ -1,5 +1,5 @@
|
||||
(
|
||||
"oolite-legacy-script.plist",
|
||||
"oolite-cloaking-device.js",
|
||||
"oolite-trumbles.js"
|
||||
"oolite-cloaking-device-mission.js",
|
||||
"oolite-trumbles-mission.js"
|
||||
)
|
||||
|
Binary file not shown.
@ -41,7 +41,7 @@ this.willExitWitchSpace = function()
|
||||
if (missionVariables.cloak == null)
|
||||
{
|
||||
// ...then we count of jumps...
|
||||
var cloakCounter = missionVariables.cloakcounter;
|
||||
let cloakCounter = missionVariables.cloakcounter;
|
||||
if (cloakCounter == null) cloakCounter = 1;
|
||||
else cloakCounter++;
|
||||
missionVariables.cloakcounter = cloakCounter;
|
51
Resources/Scripts/oolite-cloaking-device-pod.js
Normal file
51
Resources/Scripts/oolite-cloaking-device-pod.js
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
|
||||
oolite-cloaking-device-pod.js
|
||||
|
||||
Ship script for cloaking device cargo pod.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright © 2007 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.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
this.name = "oolite-cloaking-device-pod";
|
||||
this.author = "Jens Ayton";
|
||||
this.copyright = "© 2007 the Oolite team.";
|
||||
this.version = "1.69.2";
|
||||
|
||||
|
||||
this.wasScooped = function(scooper)
|
||||
{
|
||||
if (scooper == player)
|
||||
{
|
||||
if (!player.hasEquipment("EQ_CLOAKING_DEVICE"))
|
||||
{
|
||||
player.awardEquipment("EQ_CLOAKING_DEVICE")
|
||||
// Should we make it possible to buy a replacement?
|
||||
// missionVariables.TL_FOR_EQ_CLOAKING_DEVICE = 14
|
||||
}
|
||||
else
|
||||
{
|
||||
player.awardCargo("Gold", 100)
|
||||
}
|
||||
}
|
||||
// Should probably award 100 gold to non-player ships too, but they don’t have awardCargo at the moment.
|
||||
}
|
87
Resources/Scripts/oolite-default-ship-script.js
Normal file
87
Resources/Scripts/oolite-default-ship-script.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
|
||||
oolite-default-ship-script.js
|
||||
|
||||
Standard ship script; handles legacy foo_actions.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright © 2007 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.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
this.name = "oolite-default-ship-script";
|
||||
this.author = "Jens Ayton";
|
||||
this.copyright = "© 2007 the Oolite team.";
|
||||
this.description = "Standard script for ships.";
|
||||
this.version = "1.69.2";
|
||||
|
||||
|
||||
// launch_actions handled on didSpawn().
|
||||
if (this.legacy_launchActions != undefined)
|
||||
{
|
||||
this.didSpawn = function()
|
||||
{
|
||||
this.ship.runLegacyScriptActions(this.ship, this.legacy_launchActions);
|
||||
|
||||
// These can only be used once; keeping them around after that is pointless.
|
||||
delete this.didSpawn;
|
||||
delete this.legacy_launchActions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// death_actions handled on didDie().
|
||||
if (this.legacy_deathActions != undefined)
|
||||
{
|
||||
this.didDie = function()
|
||||
{
|
||||
this.ship.runLegacyScriptActions(this.ship, this.legacy_deathActions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// script_actions handled on shipDidDock() and wasScooped().
|
||||
if (this.legacy_scriptActions != undefined)
|
||||
{
|
||||
/* legacy script_actions should be called for stations when the player
|
||||
docks, and for cargo pods when they are is scooped. No sane vessel can
|
||||
be scooped _and_ docked with. Non-sane vessels are certified insane.
|
||||
*/
|
||||
this.shipDidDock = function(docker)
|
||||
{
|
||||
if (docker == player)
|
||||
{
|
||||
this.ship.runLegacyScriptActions(docker, this.legacy_scriptActions);
|
||||
}
|
||||
}
|
||||
this.wasScooped = function(scooper)
|
||||
{
|
||||
// Note "backwards" call, allowing awardEquipment: and similar to affect the scooper rather than the scoopee.
|
||||
scooper.runLegacyScriptActions(this.ship, this.legacy_scriptActions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// setup_actions handled on script initialization.
|
||||
if (this.legacy_setupActions != undefined)
|
||||
{
|
||||
this.ship.runLegacyScriptActions(this.ship, this.legacy_setupActions);
|
||||
delete this.legacy_setupActions;
|
||||
}
|
@ -66,7 +66,7 @@ this.didDock = function()
|
||||
missionVariables.trumbles = "BUY_ME"
|
||||
}
|
||||
|
||||
if (missionVariables.trumbles == "BUY_ME")
|
||||
if (missionVariables.trumbles == "BUY_ME" && player.trumbleCount == 0)
|
||||
{
|
||||
// 20% chance of trumble being offered, if no other script got this dock session first.
|
||||
if (guiScreen == "GUI_SCREEN_STATUS"
|
@ -6,8 +6,15 @@
|
||||
macros (like OOSTD_DIFFUSE_MAP, OOSTD_SPECULAR etc.) which are specific
|
||||
to the default shader.
|
||||
|
||||
A note on the structure of this file: the GLSL implementation on Mac OS X
|
||||
10.4.x can't handle shaders with nested #if/#ifdefs on some systems. I
|
||||
haven't explored this in detail, but it seems to be PowerPC-specific.
|
||||
Avoiding such nesting while dealing with several controlling macros leads
|
||||
to this rather messy code structure.
|
||||
This bug is fixed in Mac OS X 10.5.
|
||||
|
||||
?©2007 Jens Ayton
|
||||
|
||||
© 2007 Jens Ayton
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -3,7 +3,7 @@
|
||||
Basic vertex shader for Oolite ships.
|
||||
|
||||
|
||||
å©2007 Jens Ayton
|
||||
© 2007 Jens Ayton
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -10,10 +10,10 @@ Commander McLane
|
||||
Chris Crowther (hikari)
|
||||
Dave MacLachlan (Jester)
|
||||
Nic
|
||||
No Sleep Nigel
|
||||
Dylan Smith (winston)
|
||||
David Taylor (dajt)
|
||||
Eric Walch
|
||||
Nigel ? (NoSleep)
|
||||
|
||||
|
||||
Library credits:
|
||||
|
@ -62,8 +62,8 @@
|
||||
<string>Oolite Saved Game</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
<string>public.content</string>
|
||||
<string>public.text</string>
|
||||
<string>com.apple.property-list</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
|
@ -62,8 +62,8 @@
|
||||
<string>Oolite Saved Game</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
<string>public.content</string>
|
||||
<string>public.text</string>
|
||||
<string>com.apple.property-list</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
@ -97,6 +97,6 @@
|
||||
<key>SmartCrashReports_EmailTicket</key>
|
||||
<string>SCR-A36F37AFFD</string>
|
||||
<key>SmartCrashReports_CommentsTemplate</key>
|
||||
<string>Please paste the contents of the run log (in your home folder, open Libray, then Logs, then Oolite, then Latest.log) here.</string>
|
||||
<string>Please paste the last few lines of the run log here (in your home folder, open Library, then Logs, then Oolite, then Latest.log). If a large portion of the log appears relevant, consider sending a bug report by e-mail to oolite.bug.reports@gmail.com instead; please include the crash log if you do (Library, Logs, CrashReporter, Oolite.crash.log).</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -50,6 +50,7 @@ SOFTWARE.
|
||||
#import <mach/mach.h>
|
||||
#import <pthread.h>
|
||||
#import </usr/include/libkern/OSAtomic.h>
|
||||
#import "NSThreadOOExtensions.h"
|
||||
|
||||
|
||||
static NSString * const kOOLogSoundNULLError = @"sound.render.undexpectedNull";
|
||||
@ -227,6 +228,7 @@ static BOOL PortWait(mach_port_t inPort, PortMessage *outMessage);
|
||||
OOCASoundChannel *chan;
|
||||
NSAutoreleasePool *pool = nil;
|
||||
|
||||
[NSThread ooSetCurrentThreadName:@"OOCASoundChannel reaper thread"];
|
||||
sReaperRunning = YES;
|
||||
PortSend(sStatusPort, message);
|
||||
|
||||
|
@ -262,7 +262,7 @@ static void MixDown(float *inChan1, float *inChan2, float *outMix, size_t inCoun
|
||||
- (BOOL)readMonoCreatingBuffer:(float **)outBuffer withFrameCount:(size_t *)outSize
|
||||
{
|
||||
float *buffer = NULL, *dst, **src;
|
||||
size_t sizeInFrames, remaining;
|
||||
size_t sizeInFrames = 0, remaining;
|
||||
unsigned chanCount;
|
||||
long framesRead;
|
||||
ogg_int64_t totalSizeInFrames;
|
||||
@ -327,7 +327,7 @@ static void MixDown(float *inChan1, float *inChan2, float *outMix, size_t inCoun
|
||||
- (BOOL)readStereoCreatingLeftBuffer:(float **)outLeftBuffer rightBuffer:(float **)outRightBuffer withFrameCount:(size_t *)outSize;
|
||||
{
|
||||
float *bufferL = NULL, *bufferR = NULL, *dstL, *dstR, **src;
|
||||
size_t sizeInFrames, remaining;
|
||||
size_t sizeInFrames = 0, remaining;
|
||||
unsigned chanCount;
|
||||
long framesRead;
|
||||
ogg_int64_t totalSizeInFrames;
|
||||
|
@ -50,6 +50,7 @@ SOFTWARE.
|
||||
#import "OOCASoundInternal.h"
|
||||
#import "OOCASoundDecoder.h"
|
||||
#import "VirtualRingBuffer.h"
|
||||
#import "NSThreadOOExtensions.h"
|
||||
|
||||
|
||||
static NSString * const kOOLogSoundStreamingRefill = @"sound.streaming.refill";
|
||||
@ -249,6 +250,7 @@ enum
|
||||
|
||||
assert(sFeederQueue != kInvalidID);
|
||||
|
||||
[NSThread ooSetCurrentThreadName:@"OOCAStreamingSound feeder thread"];
|
||||
sFeederThreadActive = YES;
|
||||
|
||||
for (;;)
|
||||
|
@ -56,6 +56,7 @@ SOFTWARE.
|
||||
#import <stdio.h>
|
||||
#import <sys/sysctl.h>
|
||||
#import <mach/machine.h>
|
||||
#import "NSThreadOOExtensions.h"
|
||||
|
||||
|
||||
#undef NSLog // We need to be able to call the real NSLog.
|
||||
@ -414,6 +415,7 @@ enum
|
||||
NSAutoreleasePool *rootPool = nil, *pool = nil;
|
||||
|
||||
rootPool = [[NSAutoreleasePool alloc] init];
|
||||
[NSThread ooSetCurrentThreadName:@"OOLogOutputHandler logging thread"];
|
||||
|
||||
// Signal readiness
|
||||
[messageQueue retain];
|
||||
|
@ -344,8 +344,8 @@ noteChangedConfigrationValue:(in id)newValue
|
||||
if (data == nil)
|
||||
{
|
||||
OOLog(@"debugTCP.conversionFailure", @"Could not convert dictionary to data for transmission to debug console: %@", errorDesc ? errorDesc : @"unknown error.");
|
||||
#if OOLITE_MAC_OS_X
|
||||
[errorDesc release];
|
||||
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errorDesc autorelease];
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ OOALObjectRef OOALPropertyListFromData(OOALMutableDataRef data, OOALStringRef *e
|
||||
errorDescription:errStr];
|
||||
[result retain];
|
||||
|
||||
#ifndef OOLITE_MAC_OS_X
|
||||
#if !OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errStr retain];
|
||||
#endif
|
||||
|
||||
|
@ -114,6 +114,8 @@ typedef struct
|
||||
double cor4k, lim4k;
|
||||
double cor8k, lim8k;
|
||||
double cor16k, lim16k;
|
||||
|
||||
Vector rotationAxis;
|
||||
}
|
||||
|
||||
// straight c
|
||||
|
@ -133,7 +133,9 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
textureData = (unsigned char *)nil;
|
||||
textureData = NULL;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -235,7 +237,7 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
textureData = (unsigned char *)nil;
|
||||
textureData = NULL;
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -410,6 +412,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = planet;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -587,6 +591,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -656,6 +662,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -823,6 +831,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -978,6 +988,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
root_planet = self;
|
||||
|
||||
rotationAxis = kBasisYVector;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -1080,7 +1092,8 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
|
||||
case PLANET_TYPE_MINIATURE:
|
||||
// normal planetary rotation
|
||||
quaternion_rotate_about_y(&orientation, rotational_velocity * delta_t);
|
||||
//quaternion_rotate_about_y(&orientation, rotational_velocity * delta_t);
|
||||
quaternion_rotate_about_axis(&orientation, rotationAxis, rotational_velocity * delta_t);
|
||||
quaternion_normalize(&orientation);
|
||||
quaternion_into_gl_matrix(orientation, rotMatrix);
|
||||
|
||||
@ -1210,7 +1223,7 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
}
|
||||
|
||||
|
||||
- (void) setPosition:(Vector) posn
|
||||
- (void) setPosition:(Vector)posn
|
||||
{
|
||||
position = posn;
|
||||
if (atmosphere)
|
||||
@ -1228,7 +1241,14 @@ static GLfloat texture_uv_array[10400 * 2];
|
||||
}
|
||||
|
||||
|
||||
- (void) setModelName:(NSString *) modelName
|
||||
- (void) setOrientation:(Quaternion)inOrientation
|
||||
{
|
||||
rotationAxis = quaternion_rotate_vector(inOrientation, kBasisYVector);
|
||||
[super setOrientation:inOrientation];
|
||||
}
|
||||
|
||||
|
||||
- (void) setModelName:(NSString *)modelName
|
||||
{
|
||||
double old_collision_radius = collision_radius;
|
||||
[super setModelName:modelName];
|
||||
|
@ -217,7 +217,6 @@ typedef enum
|
||||
NSMutableDictionary *mission_variables;
|
||||
NSMutableDictionary *localVariables;
|
||||
int missionTextRow;
|
||||
ShipEntity *script_target;
|
||||
NSString *missionChoice;
|
||||
|
||||
NSString *specialCargo;
|
||||
@ -641,9 +640,6 @@ typedef enum
|
||||
|
||||
- (void) loopAfterburnerSound;
|
||||
- (void) stopAfterburnerSound;
|
||||
|
||||
- (void) setScriptTarget:(ShipEntity *)ship;
|
||||
- (ShipEntity*) script_target;
|
||||
|
||||
- (void) getFined;
|
||||
|
||||
|
@ -5850,18 +5850,6 @@ OOSound* burnersound;
|
||||
}
|
||||
|
||||
|
||||
- (void) setScriptTarget:(ShipEntity *)ship
|
||||
{
|
||||
script_target = ship;
|
||||
}
|
||||
|
||||
|
||||
- (ShipEntity*) script_target
|
||||
{
|
||||
return script_target;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) hasHostileTarget
|
||||
{
|
||||
return NO;
|
||||
|
@ -774,7 +774,7 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
|
||||
- (void) highlightSystemFromGuiContractsScreen
|
||||
{
|
||||
MyOpenGLView* gameView = (MyOpenGLView *)[UNIVERSE gameView];
|
||||
MyOpenGLView* gameView = [UNIVERSE gameView];
|
||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||
|
||||
NSMutableArray* passenger_market = [[UNIVERSE station] localPassengers];
|
||||
@ -1411,6 +1411,7 @@ static NSMutableDictionary* currentShipyard = nil;
|
||||
legalStatus = 0;
|
||||
|
||||
// get forward_weapon aft_weapon port_weapon starboard_weapon from ship_info
|
||||
// FIXME: allow buying of aft/port/starboard weapons? Bug #012363
|
||||
aft_weapon = WEAPON_NONE;
|
||||
port_weapon = WEAPON_NONE;
|
||||
starboard_weapon = WEAPON_NONE;
|
||||
|
@ -31,19 +31,7 @@ MA 02110-1301, USA.
|
||||
|
||||
- (void) initControls;
|
||||
|
||||
- (void) pollControls:(double) delta_t;
|
||||
- (void) pollApplicationControls;
|
||||
- (void) pollFlightControls:(double) delta_t;
|
||||
- (void) pollFlightArrowKeyControls:(double) delta_t;
|
||||
- (void) pollGuiArrowKeyControls:(double) delta_t;
|
||||
- (BOOL) handleGUIUpDownArrowKeys:(GuiDisplayGen *)gui
|
||||
:(MyOpenGLView *)gameView;
|
||||
- (void) switchToMainView;
|
||||
- (void) pollViewControls;
|
||||
- (void) pollGuiScreenControls;
|
||||
- (void) pollGameOverControls:(double) delta_t;
|
||||
- (void) pollAutopilotControls:(double) delta_t;
|
||||
- (void) pollDockedControls:(double) delta_t;
|
||||
- (void) pollDemoControls:(double) delta_t;
|
||||
- (void) pollControls:(double)delta_t;
|
||||
- (BOOL) handleGUIUpDownArrowKeys;
|
||||
|
||||
@end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,10 @@ MA 02110-1301, USA.
|
||||
|
||||
- (void) checkScript;
|
||||
|
||||
- (void) scriptActions:(NSArray*) some_actions forTarget:(ShipEntity*) a_target;
|
||||
- (void) setScriptTarget:(ShipEntity *)ship;
|
||||
- (ShipEntity*) scriptTarget;
|
||||
|
||||
- (void) scriptActions:(NSArray*) some_actions forTarget:(ShipEntity *)a_target;
|
||||
- (void)runScript:(NSArray*)scriptActions withName:(NSString *)scriptName forTarget:(ShipEntity *)target; // Hook for OOPListScript
|
||||
- (BOOL) checkCouplet:(NSDictionary *) couplet onEntity:(Entity *) entity;
|
||||
- (void) scriptAction:(NSString *) scriptAction onEntity:(Entity *) entity;
|
||||
|
@ -48,7 +48,19 @@ MA 02110-1301, USA.
|
||||
#define kOOLogUnconvertedNSLog @"unclassified.PlayerEntityLegacyScriptEngine"
|
||||
|
||||
|
||||
enum
|
||||
#define SUPPORT_TRACE_MESSAGES (!defined NDEBUG)
|
||||
|
||||
// Trace messages are very verbose debug messages in the script mechanism,
|
||||
// disabled in logcontrol.plist by default and disabled here in release builds
|
||||
// for performance reasons.
|
||||
#if SUPPORT_TRACE_MESSAGES
|
||||
#define TraceLog OOLog
|
||||
#else
|
||||
#define TraceLog(...) do {} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COMPARISON_NO,
|
||||
COMPARISON_EQUAL,
|
||||
@ -57,7 +69,7 @@ enum
|
||||
COMPARISON_GREATERTHAN,
|
||||
COMPARISON_ONEOF,
|
||||
COMPARISON_UNDEFINED
|
||||
};
|
||||
} OOComparisonType;
|
||||
|
||||
|
||||
static NSString * const kOOLogScriptAddShipsFailed = @"script.addShips.failed";
|
||||
@ -68,9 +80,6 @@ static NSString * const kOOLogDebug = @"script.debug";
|
||||
static NSString * const kOOLogDebugOnMetaClass = @"$scriptDebugOn";
|
||||
NSString * const kOOLogDebugMessage = @"script.debug.message";
|
||||
static NSString * const kOOLogDebugOnOff = @"script.debug.onOff";
|
||||
static NSString * const kOOLogDebugTestConditionCheckingVariable = @"script.debug.testCondition.checkingVariable";
|
||||
static NSString * const kOOLogDebugTestConditionValues = @"script.debug.testCondition.testValues";
|
||||
static NSString * const kOOLogDebugTestConditionOnOf = @"script.debug.testCondition.oneOf";
|
||||
static NSString * const kOOLogDebugAddPlanet = @"script.debug.addPlanet";
|
||||
static NSString * const kOOLogDebugReplaceVariablesInString = @"script.debug.replaceVariablesInString";
|
||||
static NSString * const kOOLogDebugProcessSceneStringAddScene = @"script.debug.processSceneString.addScene";
|
||||
@ -80,8 +89,12 @@ static NSString * const kOOLogDebugProcessSceneStringAddTargetPlanet = @"script.
|
||||
static NSString * const kOOLogDebugProcessSceneStringAddBillboard = @"script.debug.processSceneString.addBillboard";
|
||||
static NSString * const kOOLogDebugSetSunNovaIn = @"script.debug.setSunNovaIn";
|
||||
|
||||
static NSString * const kOOLogNoteScriptAction = @"script.debug.note.scriptAction";
|
||||
static NSString * const kOOLogNoteTestCondition = @"script.debug.note.testCondition";
|
||||
static NSString * const kOOLogTraceScriptAction = @"script.debug.trace.scriptAction";
|
||||
static NSString * const kOOLogTraceTestCondition = @"script.debug.trace.testCondition";
|
||||
static NSString * const kOOLogTraceTestConditionCheckingVariable = @"script.debug.trace.testCondition.checkingVariable";
|
||||
static NSString * const kOOLogTraceTestConditionValues = @"script.debug.trace.testCondition.testValues";
|
||||
static NSString * const kOOLogTraceTestConditionOneOf = @"script.debug.trace.testCondition.oneOf";
|
||||
|
||||
static NSString * const kOOLogNoteRemoveAllCargo = @"script.debug.note.removeAllCargo";
|
||||
static NSString * const kOOLogNoteUseSpecialCargo = @"script.debug.note.useSpecialCargo";
|
||||
NSString * const kOOLogNoteAddShips = @"script.debug.note.addShips";
|
||||
@ -95,6 +108,7 @@ static NSString * const kOOLogSyntaxBadConditional = @"script.debug.syntax.bad
|
||||
static NSString * const kOOLogSyntaxNoAction = @"script.debug.syntax.action.noneSpecified";
|
||||
static NSString * const kOOLogSyntaxBadAction = @"script.debug.syntax.action.badSelector";
|
||||
static NSString * const kOOLogSyntaxNoScriptCondition = @"script.debug.syntax.scriptCondition.noneSpecified";
|
||||
static NSString * const kOOLogSyntaxBadScriptCondition = @"script.debug.syntax.scriptCondition.badSelector";
|
||||
static NSString * const kOOLogSyntaxSetPlanetInfo = @"script.debug.syntax.setPlanetInfo";
|
||||
static NSString * const kOOLogSyntaxAwardCargo = @"script.debug.syntax.awardCargo";
|
||||
static NSString * const kOOLogSyntaxMessageShipAIs = @"script.debug.syntax.messageShipAIs";
|
||||
@ -105,14 +119,50 @@ static NSString * const kOOLogSyntaxIncrement = @"script.debug.syntax.increme
|
||||
static NSString * const kOOLogSyntaxDecrement = @"script.debug.syntax.decrement";
|
||||
static NSString * const kOOLogSyntaxAdd = @"script.debug.syntax.add";
|
||||
static NSString * const kOOLogSyntaxSubtract = @"script.debug.syntax.subtract";
|
||||
static NSString * const kOOLogInvalidComparison = @"script.debug.syntax.badComparison";
|
||||
|
||||
static NSString * const kOOLogRemoveAllCargoNotDocked = @"script.error.removeAllCargo.notDocked";
|
||||
|
||||
|
||||
@implementation PlayerEntity (Scripting)
|
||||
|
||||
static NSString * mission_string_value;
|
||||
static NSString * mission_key;
|
||||
static NSString *mission_string_value;
|
||||
static NSString *mission_key;
|
||||
static ShipEntity *scriptTarget;
|
||||
|
||||
|
||||
OOINLINE void PerformScriptActions(NSArray *actions, Entity *target)
|
||||
{
|
||||
unsigned i, count;
|
||||
id action = nil;
|
||||
PlayerEntity *player = [PlayerEntity sharedPlayer];
|
||||
|
||||
count = [actions count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
action = [actions objectAtIndex:i];
|
||||
if ([action isKindOfClass:[NSDictionary class]])
|
||||
{
|
||||
[player checkCouplet:action onEntity:target];
|
||||
}
|
||||
else if ([action isKindOfClass:[NSString class]])
|
||||
{
|
||||
[player scriptAction:action onEntity:target];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) setScriptTarget:(ShipEntity *)ship
|
||||
{
|
||||
scriptTarget = ship;
|
||||
}
|
||||
|
||||
|
||||
- (ShipEntity*) scriptTarget
|
||||
{
|
||||
return scriptTarget;
|
||||
}
|
||||
|
||||
|
||||
- (void) checkScript
|
||||
@ -139,91 +189,73 @@ static NSString * mission_key;
|
||||
[self setScriptTarget:target];
|
||||
mission_key = scriptName;
|
||||
[self scriptActions:scriptActions forTarget:target];
|
||||
mission_key = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void) scriptActions:(NSArray*) some_actions forTarget:(ShipEntity*) a_target
|
||||
- (void) scriptActions:(NSArray*) some_actions forTarget:(ShipEntity *)a_target
|
||||
{
|
||||
unsigned i;
|
||||
NSAutoreleasePool *pool = nil;
|
||||
|
||||
for (i = 0; i < [some_actions count]; i++)
|
||||
{
|
||||
id action = [some_actions objectAtIndex:i];
|
||||
if ([action isKindOfClass:[NSDictionary class]])
|
||||
[self checkCouplet:(NSDictionary *)action onEntity: a_target];
|
||||
if ([action isKindOfClass:[NSString class]])
|
||||
[self scriptAction:(NSString *)action onEntity: a_target];
|
||||
}
|
||||
PerformScriptActions(some_actions, a_target);
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) checkCouplet:(NSDictionary *) couplet onEntity:(Entity *) entity
|
||||
{
|
||||
NSAutoreleasePool *pool = nil;
|
||||
NSArray *conditions = [couplet objectForKey:@"conditions"]; // No CollectionsExtractors here, because we provide more detailed info below.
|
||||
NSArray *actions = [couplet objectForKey:@"do"];
|
||||
NSArray *else_actions = [couplet objectForKey:@"else"];
|
||||
BOOL success = YES;
|
||||
unsigned i;
|
||||
NSArray *conditions = nil;
|
||||
NSArray *actions = nil;
|
||||
BOOL conditionsPassed;
|
||||
unsigned i, count;
|
||||
NSString *actionsName = nil;
|
||||
|
||||
conditions = [couplet objectForKey:@"conditions"];
|
||||
if (conditions == nil)
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR no 'conditions' in %@ - returning YES.", [couplet description]);
|
||||
return success;
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR no 'conditions' in %@ - returning YES.", couplet);
|
||||
return YES;
|
||||
}
|
||||
if (![conditions isKindOfClass:[NSArray class]])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR \"conditions = %@\" is not an array - returning YES.", [conditions description]);
|
||||
return success;
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR \"conditions = %@\" is not an array - returning YES.", conditions);
|
||||
return YES;
|
||||
}
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NS_DURING
|
||||
for (i = 0; (i < [conditions count])&&(success); i++)
|
||||
success &= [self scriptTestCondition:(NSString *)[conditions objectAtIndex:i]];
|
||||
if ((success) && (actions))
|
||||
conditionsPassed = YES;
|
||||
count = [conditions count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (![self scriptTestCondition:[conditions objectAtIndex:i]])
|
||||
{
|
||||
conditionsPassed = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (conditionsPassed) actionsName = @"do";
|
||||
else actionsName = @"else";
|
||||
|
||||
actions = [couplet objectForKey:actionsName];
|
||||
if (actions != nil)
|
||||
{
|
||||
if (![actions isKindOfClass:[NSArray class]])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR \"actions = %@\" is not an array.", [actions description]);
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR \"%@\" actions = %@ is not an array.", actionsName, actions);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < [actions count]; i++)
|
||||
{
|
||||
if ([[actions objectAtIndex:i] isKindOfClass:[NSDictionary class]])
|
||||
[self checkCouplet:(NSDictionary *)[actions objectAtIndex:i] onEntity:entity];
|
||||
if ([[actions objectAtIndex:i] isKindOfClass:[NSString class]])
|
||||
[self scriptAction:(NSString *)[actions objectAtIndex:i] onEntity:entity];
|
||||
}
|
||||
}
|
||||
}
|
||||
// now check if there's an 'else' to do if the couplet is false
|
||||
if ((!success) && (else_actions))
|
||||
{
|
||||
if (![else_actions isKindOfClass:[NSArray class]])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadConditional, @"SCRIPT ERROR \"else_actions = %@\" is not an array.", [else_actions description]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < [else_actions count]; i++)
|
||||
{
|
||||
if ([[else_actions objectAtIndex:i] isKindOfClass:[NSDictionary class]])
|
||||
[self checkCouplet:(NSDictionary *)[else_actions objectAtIndex:i] onEntity:entity];
|
||||
if ([[else_actions objectAtIndex:i] isKindOfClass:[NSString class]])
|
||||
[self scriptAction:(NSString *)[else_actions objectAtIndex:i] onEntity:entity];
|
||||
}
|
||||
PerformScriptActions(actions, entity);
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
OOLog(kOOLogException, @"***** Exception %@ (%@) during plist script evaluation.", [localException name], [localException reason]);
|
||||
// Suppress
|
||||
NS_ENDHANDLER
|
||||
[pool release];
|
||||
|
||||
return success;
|
||||
return conditionsPassed;
|
||||
}
|
||||
|
||||
|
||||
@ -242,51 +274,57 @@ static NSString * mission_key;
|
||||
is used to set a mission variable to the given string_expression
|
||||
|
||||
*/
|
||||
NSMutableArray* tokens = ScanTokensFromString(scriptAction);
|
||||
NSMutableDictionary* locals = [self localVariablesForMission:mission_key];
|
||||
NSString* selectorString = nil;
|
||||
NSString* valueString = nil;
|
||||
SEL _selector;
|
||||
|
||||
OOLog(kOOLogNoteScriptAction, @"scriptAction: \"%@\"", scriptAction);
|
||||
|
||||
if ([tokens count] < 1)
|
||||
NSMutableArray *tokens = ScanTokensFromString(scriptAction);
|
||||
NSMutableDictionary *locals = [self localVariablesForMission:mission_key];
|
||||
NSString *selectorString = nil;
|
||||
NSString *valueString = nil;
|
||||
SEL _selector = NULL;
|
||||
unsigned tokenCount;
|
||||
BOOL takesParam;
|
||||
|
||||
TraceLog(kOOLogTraceScriptAction, @"scriptAction: \"%@\"", scriptAction);
|
||||
|
||||
tokenCount = [tokens count];
|
||||
if (tokenCount < 1)
|
||||
{
|
||||
OOLog(kOOLogSyntaxNoAction, @"***** No scriptAction '%@'",scriptAction);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
selectorString = [tokens objectAtIndex:0];
|
||||
|
||||
if ([tokens count] > 1)
|
||||
takesParam = [selectorString hasSuffix:@":"];
|
||||
|
||||
if (takesParam && tokenCount > 1)
|
||||
{
|
||||
[tokens removeObjectAtIndex:0];
|
||||
valueString = [[tokens componentsJoinedByString:@" "] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
valueString = ExpandDescriptionsWithLocalsForCurrentSystem(valueString, locals);
|
||||
OOLog(kOOLogNoteScriptAction, @"scriptAction after expansion: \"%@ %@\"", selectorString, valueString);
|
||||
}
|
||||
|
||||
_selector = NSSelectorFromString(selectorString);
|
||||
|
||||
if ((entity)&&([entity respondsToSelector:_selector]))
|
||||
{
|
||||
if ([selectorString hasSuffix:@":"])
|
||||
[entity performSelector:_selector withObject:valueString];
|
||||
if (tokenCount == 2) valueString = [tokens objectAtIndex:1];
|
||||
else
|
||||
[entity performSelector:_selector];
|
||||
return;
|
||||
{
|
||||
[tokens removeObjectAtIndex:0];
|
||||
valueString = [tokens componentsJoinedByString:@" "];
|
||||
}
|
||||
#ifdef POINTLESS
|
||||
// I believe this will never do anything useful, given the way ScanTokensFromString() works. -- Ahruman
|
||||
valueString = [valueString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
#endif
|
||||
valueString = ExpandDescriptionsWithLocalsForCurrentSystem(valueString, locals);
|
||||
|
||||
TraceLog(kOOLogTraceScriptAction, @"scriptAction after expansion: \"%@ %@\"", selectorString, valueString);
|
||||
}
|
||||
|
||||
if (![self respondsToSelector:_selector])
|
||||
|
||||
_selector = NSSelectorFromString(selectorString);
|
||||
|
||||
if (entity == nil || ![entity respondsToSelector:_selector])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadAction, @"***** PlayerEntity DOES NOT RESPOND TO scriptAction: \"%@\"", scriptAction);
|
||||
return;
|
||||
if (![self respondsToSelector:_selector])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadAction, @"***** PlayerEntity DOES NOT RESPOND TO scriptAction: \"%@\"", scriptAction);
|
||||
return;
|
||||
}
|
||||
entity = self;
|
||||
}
|
||||
|
||||
if ([selectorString hasSuffix:@":"])
|
||||
[self performSelector:_selector withObject:valueString];
|
||||
else
|
||||
[self performSelector:_selector];
|
||||
|
||||
if (takesParam) [entity performSelector:_selector withObject:valueString];
|
||||
else [entity performSelector:_selector];
|
||||
}
|
||||
|
||||
|
||||
@ -319,38 +357,44 @@ static NSString * mission_key;
|
||||
comma separated numeric constants (eg "planet_number oneof 1,5,9,12,14,234").
|
||||
|
||||
*/
|
||||
NSArray* tokens = ScanTokensFromString(scriptCondition);
|
||||
NSMutableDictionary* locals = [self localVariablesForMission:mission_key];
|
||||
NSString* selectorString = nil;
|
||||
NSString* comparisonString = nil;
|
||||
NSString* valueString = nil;
|
||||
SEL _selector;
|
||||
int comparator = COMPARISON_NO;
|
||||
|
||||
OOLog(kOOLogNoteTestCondition, @"scriptTestCondition: \"%@\"", scriptCondition);
|
||||
|
||||
if ([tokens count] < 1)
|
||||
NSArray *tokens = ScanTokensFromString(scriptCondition);
|
||||
NSMutableDictionary *locals = [self localVariablesForMission:mission_key];
|
||||
NSString *selectorString = nil;
|
||||
NSString *comparisonString = nil;
|
||||
NSString *valueString = nil;
|
||||
SEL _selector;
|
||||
OOComparisonType comparator = COMPARISON_NO;
|
||||
unsigned tokenCount;
|
||||
unsigned i, count;
|
||||
NSArray *valueStrings = nil;
|
||||
NSNumber *value = nil;
|
||||
|
||||
TraceLog(kOOLogTraceTestCondition, @"scriptTestCondition: \"%@\"", scriptCondition);
|
||||
|
||||
tokenCount = [tokens count];
|
||||
if (tokenCount < 1)
|
||||
{
|
||||
OOLog(kOOLogSyntaxNoScriptCondition, @"***** No scriptCondition '%@'",scriptCondition);
|
||||
return NO;
|
||||
}
|
||||
selectorString = (NSString *)[tokens objectAtIndex:0];
|
||||
selectorString = [tokens objectAtIndex:0];
|
||||
if ([selectorString hasPrefix:@"mission_"])
|
||||
{
|
||||
OOLog(kOOLogDebugTestConditionCheckingVariable, @"DEBUG ..... checking mission_variable '%@'",selectorString);
|
||||
mission_string_value = (NSString *)[mission_variables objectForKey:selectorString];
|
||||
TraceLog(kOOLogTraceTestConditionCheckingVariable, @"DEBUG ..... checking mission_variable '%@'",selectorString);
|
||||
mission_string_value = [mission_variables objectForKey:selectorString];
|
||||
selectorString = @"mission_string";
|
||||
}
|
||||
else if ([selectorString hasPrefix:@"local_"])
|
||||
{
|
||||
OOLog(kOOLogDebugTestConditionCheckingVariable, @"DEBUG ..... checking local variable '%@'",selectorString);
|
||||
mission_string_value = (NSString *)[locals objectForKey:selectorString];
|
||||
TraceLog(kOOLogTraceTestConditionCheckingVariable, @"DEBUG ..... checking local variable '%@'",selectorString);
|
||||
mission_string_value = [locals objectForKey:selectorString];
|
||||
selectorString = @"mission_string";
|
||||
}
|
||||
|
||||
if ([tokens count] > 1)
|
||||
if (tokenCount > 1)
|
||||
{
|
||||
comparisonString = (NSString *)[tokens objectAtIndex:1];
|
||||
comparisonString = [tokens objectAtIndex:1];
|
||||
|
||||
if ([comparisonString isEqual:@"equal"])
|
||||
comparator = COMPARISON_EQUAL;
|
||||
else if ([comparisonString isEqual:@"notequal"])
|
||||
@ -365,16 +409,20 @@ static NSString * mission_key;
|
||||
// -dajt: black ops
|
||||
else if ([comparisonString isEqual:@"undefined"])
|
||||
comparator = COMPARISON_UNDEFINED;
|
||||
else
|
||||
{
|
||||
OOLog(kOOLogInvalidComparison, @"SCRIPT ERROR unknown comparison operator \"%@\", returning NO.", comparisonString);
|
||||
}
|
||||
}
|
||||
|
||||
if ([tokens count] > 2)
|
||||
if (tokenCount > 2)
|
||||
{
|
||||
NSMutableString* allValues = [NSMutableString stringWithCapacity:256];
|
||||
NSMutableString *allValues = [NSMutableString stringWithCapacity:256];
|
||||
unsigned value_index = 2;
|
||||
while (value_index < [tokens count])
|
||||
while (value_index < tokenCount)
|
||||
{
|
||||
valueString = (NSString *)[tokens objectAtIndex:value_index++];
|
||||
if (([valueString hasSuffix:@"_number"])||([valueString hasSuffix:@"_bool"])||([valueString hasSuffix:@"_string"]))
|
||||
valueString = [tokens objectAtIndex:value_index++];
|
||||
if ([valueString hasSuffix:@"_number"] || [valueString hasSuffix:@"_bool"] || [valueString hasSuffix:@"_string"])
|
||||
{
|
||||
SEL value_selector = NSSelectorFromString(valueString);
|
||||
if ([self respondsToSelector:value_selector])
|
||||
@ -384,7 +432,7 @@ static NSString * mission_key;
|
||||
}
|
||||
}
|
||||
[allValues appendString:valueString];
|
||||
if (value_index < [tokens count])
|
||||
if (value_index < tokenCount)
|
||||
[allValues appendString:@" "];
|
||||
}
|
||||
valueString = allValues;
|
||||
@ -392,38 +440,45 @@ static NSString * mission_key;
|
||||
|
||||
_selector = NSSelectorFromString(selectorString);
|
||||
if (![self respondsToSelector:_selector])
|
||||
{
|
||||
OOLog(kOOLogSyntaxBadScriptCondition, @"SCRIPT ERROR unknown script condition method %@, returning NO.", selectorString);
|
||||
return NO;
|
||||
}
|
||||
|
||||
// test string values (method returns NSString*)
|
||||
if ([selectorString hasSuffix:@"_string"])
|
||||
{
|
||||
NSString *result = [self performSelector:_selector];
|
||||
OOLog(kOOLogDebugTestConditionValues, @"..... comparing \"%@\" (%@) to \"%@\" (%@)", result, [result class], valueString, [valueString class]);
|
||||
TraceLog(kOOLogTraceTestConditionValues, @"..... comparing \"%@\" (%@) to \"%@\" (%@)", result, [result class], valueString, [valueString class]);
|
||||
|
||||
switch (comparator)
|
||||
{
|
||||
case COMPARISON_UNDEFINED :
|
||||
return (result == nil);
|
||||
case COMPARISON_NO :
|
||||
case COMPARISON_UNDEFINED:
|
||||
return result == nil;
|
||||
case COMPARISON_NO:
|
||||
return NO;
|
||||
case COMPARISON_EQUAL :
|
||||
return ([result isEqual:valueString]);
|
||||
case COMPARISON_NOTEQUAL :
|
||||
return (![result isEqual:valueString]);
|
||||
case COMPARISON_LESSTHAN :
|
||||
return ([result floatValue] < [valueString floatValue]);
|
||||
case COMPARISON_GREATERTHAN :
|
||||
return ([result floatValue] > [valueString floatValue]);
|
||||
case COMPARISON_EQUAL:
|
||||
return [result isEqual:valueString];
|
||||
case COMPARISON_NOTEQUAL:
|
||||
return ![result isEqual:valueString];
|
||||
case COMPARISON_LESSTHAN:
|
||||
return [result floatValue] < [valueString floatValue];
|
||||
case COMPARISON_GREATERTHAN:
|
||||
return [result floatValue] > [valueString floatValue];
|
||||
case COMPARISON_ONEOF:
|
||||
{
|
||||
unsigned i;
|
||||
NSArray *valueStrings = [valueString componentsSeparatedByString:@","];
|
||||
OOLog(kOOLogDebugTestConditionOnOf, @"performing a ONEOF comparison: is %@ ONEOF %@ ?", result, valueStrings);
|
||||
valueStrings = [valueString componentsSeparatedByString:@","];
|
||||
|
||||
TraceLog(kOOLogTraceTestConditionOneOf, @"performing a ONEOF comparison: is %@ ONEOF %@ ?", result, valueStrings);
|
||||
|
||||
NSString* r1 = [result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
for (i = 0; i < [valueStrings count]; i++)
|
||||
count = [valueStrings count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if ([r1 isEqual:[(NSString*)[valueStrings objectAtIndex:i] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]])
|
||||
if ([r1 isEqualToString:[[valueStrings objectAtIndex:i] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]])
|
||||
{
|
||||
OOLog(kOOLogDebugTestConditionOnOf, @"found a match in ONEOF!");
|
||||
|
||||
TraceLog(kOOLogTraceTestConditionOneOf, @"found a match (%@) in ONEOF!", [valueStrings objectAtIndex:i]);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
@ -438,40 +493,44 @@ static NSString * mission_key;
|
||||
// +dajt: black ops
|
||||
if (comparator == COMPARISON_ONEOF)
|
||||
{
|
||||
NSArray *valueStrings = [valueString componentsSeparatedByString:@","];
|
||||
OOLog(kOOLogDebugTestConditionOnOf, @"performing a ONEOF comparison with %d elements: is %@ ONEOF %@", [valueStrings count], result, valueStrings);
|
||||
unsigned i;
|
||||
for (i = 0; i < [valueStrings count]; i++)
|
||||
valueStrings = [valueString componentsSeparatedByString:@","];
|
||||
OOLog(kOOLogTraceTestConditionOneOf, @"performing a ONEOF comparison with %d elements: is %@ ONEOF %@", [valueStrings count], result, valueStrings);
|
||||
count = [valueStrings count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSNumber *value = [NSNumber numberWithDouble:[[valueStrings objectAtIndex: i] doubleValue]];
|
||||
value = [NSNumber numberWithDouble:[[valueStrings objectAtIndex: i] doubleValue]];
|
||||
if ([result isEqual:value])
|
||||
{
|
||||
OOLog(kOOLogDebugTestConditionOnOf, @"found a match in ONEOF!");
|
||||
TraceLog(kOOLogTraceTestConditionOneOf, @"found a match (%@) in ONEOF!", value);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
OOLog(kOOLogDebugTestConditionOnOf, @"No match in ONEOF");
|
||||
TraceLog(kOOLogTraceTestConditionOneOf, @"No match in ONEOF");
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSNumber *value = [NSNumber numberWithDouble:[valueString doubleValue]];
|
||||
|
||||
OOLog(kOOLogDebugTestConditionValues, @"..... comparing \"%@\" (%@) to \"%@\" (%@)", result, [result class], value, [value class]);
|
||||
|
||||
value = [NSNumber numberWithDouble:[valueString doubleValue]];
|
||||
|
||||
TraceLog(kOOLogTraceTestConditionValues, @"..... comparing \"%@\" (%@) to \"%@\" (%@)", result, [result class], value, [value class]);
|
||||
|
||||
switch (comparator)
|
||||
{
|
||||
case COMPARISON_UNDEFINED :
|
||||
case COMPARISON_NO :
|
||||
case COMPARISON_UNDEFINED:
|
||||
case COMPARISON_NO:
|
||||
return NO;
|
||||
case COMPARISON_EQUAL:
|
||||
return [result isEqual:value];
|
||||
case COMPARISON_NOTEQUAL:
|
||||
return ![result isEqual:value];
|
||||
case COMPARISON_LESSTHAN:
|
||||
return [result isLessThan:value];
|
||||
case COMPARISON_GREATERTHAN:
|
||||
return [result isGreaterThan:value];
|
||||
|
||||
case COMPARISON_ONEOF:
|
||||
// can't happen
|
||||
return NO;
|
||||
case COMPARISON_EQUAL :
|
||||
return ([result isEqual:value]);
|
||||
case COMPARISON_NOTEQUAL :
|
||||
return (![result isEqual:value]);
|
||||
case COMPARISON_LESSTHAN :
|
||||
return ([result isLessThan:value]);
|
||||
case COMPARISON_GREATERTHAN :
|
||||
return ([result isGreaterThan:value]);
|
||||
}
|
||||
}
|
||||
// -dajt: black ops
|
||||
@ -479,7 +538,7 @@ static NSString * mission_key;
|
||||
// test boolean values (method returns @"YES" or @"NO")
|
||||
if ([selectorString hasSuffix:@"_bool"])
|
||||
{
|
||||
BOOL result = ([[self performSelector:_selector] isEqual:@"YES"]);
|
||||
BOOL result = [[self performSelector:_selector] isEqual:@"YES"];
|
||||
BOOL value = [valueString isEqual:@"YES"];
|
||||
switch (comparator)
|
||||
{
|
||||
@ -487,11 +546,14 @@ static NSString * mission_key;
|
||||
case COMPARISON_LESSTHAN:
|
||||
case COMPARISON_UNDEFINED:
|
||||
case COMPARISON_NO:
|
||||
case COMPARISON_ONEOF:
|
||||
OOLog(kOOLogInvalidComparison, @"SCRIPT ERROR comparison %@ is not valid for boolean expressions, returning NO.", comparisonString);
|
||||
return NO;
|
||||
|
||||
case COMPARISON_EQUAL:
|
||||
return (result == value);
|
||||
return result == value;
|
||||
case COMPARISON_NOTEQUAL:
|
||||
return (result != value);
|
||||
return result != value;
|
||||
}
|
||||
}
|
||||
// default!
|
||||
@ -905,7 +967,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) commsMessage:(NSString *)valueString
|
||||
{
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
Random_Seed very_random_seed;
|
||||
very_random_seed.a = rand() & 255;
|
||||
@ -964,7 +1026,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) awardCredits:(NSString *)valueString
|
||||
{
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
int award = 10 * [valueString intValue];
|
||||
if (award < 0 && credits < (unsigned)-award) credits = 0;
|
||||
@ -974,7 +1036,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) awardShipKills:(NSString *)valueString
|
||||
{
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
int value = [valueString intValue];
|
||||
if (0 < value) ship_kills += value;
|
||||
@ -983,25 +1045,23 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) awardEquipment:(NSString *)equipString //eg. EQ_NAVAL_ENERGY_UNIT
|
||||
{
|
||||
NSString* eq_type = equipString;
|
||||
|
||||
if (script_target != self) return;
|
||||
|
||||
if ([eq_type isEqual:@"EQ_FUEL"])
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
if ([equipString isEqual:@"EQ_FUEL"])
|
||||
{
|
||||
fuel = PLAYER_MAX_FUEL;
|
||||
return;
|
||||
}
|
||||
|
||||
if ([eq_type hasSuffix:@"MISSILE"]||[eq_type hasSuffix:@"MINE"])
|
||||
|
||||
if ([equipString hasSuffix:@"MISSILE"]||[equipString hasSuffix:@"MINE"])
|
||||
{
|
||||
[self mountMissile:[[UNIVERSE newShipWithRole:eq_type] autorelease]];
|
||||
[self mountMissile:[[UNIVERSE newShipWithRole:equipString] autorelease]];
|
||||
return;
|
||||
}
|
||||
|
||||
if (![self hasExtraEquipment:eq_type])
|
||||
|
||||
if (![self hasExtraEquipment:equipString])
|
||||
{
|
||||
[self addExtraEquipment:eq_type];
|
||||
[self addExtraEquipment:equipString];
|
||||
}
|
||||
|
||||
}
|
||||
@ -1011,7 +1071,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
{
|
||||
NSString* eq_type = equipString;
|
||||
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
if ([eq_type isEqual:@"EQ_FUEL"])
|
||||
{
|
||||
@ -1039,8 +1099,8 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
return;
|
||||
}
|
||||
|
||||
keyString = [(NSString*)[tokens objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
valueString = [(NSString*)[tokens objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
keyString = [[tokens objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
valueString = [[tokens objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
|
||||
[UNIVERSE setSystemDataKey:keyString value:valueString];
|
||||
|
||||
@ -1060,10 +1120,10 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
return;
|
||||
}
|
||||
|
||||
gnum = [(NSString*)[tokens objectAtIndex:0] intValue];
|
||||
pnum = [(NSString*)[tokens objectAtIndex:1] intValue];
|
||||
keyString = [(NSString*)[tokens objectAtIndex:2] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
valueString = [(NSString*)[tokens objectAtIndex:3] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
gnum = [tokens intAtIndex:0];
|
||||
pnum = [tokens intAtIndex:1];
|
||||
keyString = [[tokens objectAtIndex:2] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
valueString = [[tokens objectAtIndex:3] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
|
||||
[UNIVERSE setSystemDataForGalaxy:gnum planet:pnum key:keyString value:valueString];
|
||||
}
|
||||
@ -1071,7 +1131,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) awardCargo:(NSString *)amount_typeString
|
||||
{
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
NSArray *tokens = ScanTokensFromString(amount_typeString);
|
||||
NSString *typeString = nil;
|
||||
@ -1113,7 +1173,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
OOCargoType type;
|
||||
OOMassUnit unit;
|
||||
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
if (status != STATUS_DOCKED)
|
||||
{
|
||||
OOLog(kOOLogRemoveAllCargoNotDocked, @"***** Error: removeAllCargo only works when docked.");
|
||||
@ -1144,7 +1204,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) useSpecialCargo:(NSString *)descriptionString;
|
||||
{
|
||||
if (script_target != self) return;
|
||||
if (scriptTarget != self) return;
|
||||
|
||||
OOLog(kOOLogNoteUseSpecialCargo, @"Going to useSpecialCargo:'%@'", specialCargo);
|
||||
|
||||
@ -1162,13 +1222,13 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
- (void) awardFuel:(NSString *)valueString // add to fuel up to 7.0 LY
|
||||
{
|
||||
int delta = 10 * [valueString floatValue];
|
||||
OOFuelQuantity scriptTargetFuelBeforeAward = [script_target fuel];
|
||||
OOFuelQuantity scriptTargetFuelBeforeAward = [scriptTarget fuel];
|
||||
|
||||
if (delta < 0 && scriptTargetFuelBeforeAward < (unsigned)-delta) [script_target setFuel:0];
|
||||
if (delta < 0 && scriptTargetFuelBeforeAward < (unsigned)-delta) [scriptTarget setFuel:0];
|
||||
else
|
||||
{
|
||||
[script_target setFuel:(scriptTargetFuelBeforeAward + delta)];
|
||||
if ([script_target fuel] > PLAYER_MAX_FUEL) [script_target setFuel:PLAYER_MAX_FUEL];
|
||||
[scriptTarget setFuel:(scriptTargetFuelBeforeAward + delta)];
|
||||
if ([scriptTarget fuel] > PLAYER_MAX_FUEL) [scriptTarget setFuel:PLAYER_MAX_FUEL];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1196,10 +1256,10 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
- (void) ejectItem:(NSString *)item_key
|
||||
{
|
||||
ShipEntity* item = [UNIVERSE newShipWithName:item_key];
|
||||
if (script_target == nil)
|
||||
script_target = self;
|
||||
if (scriptTarget == nil)
|
||||
scriptTarget = self;
|
||||
if (item)
|
||||
[script_target dumpItem:item];
|
||||
[scriptTarget dumpItem:item];
|
||||
}
|
||||
|
||||
|
||||
@ -1830,9 +1890,9 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
- (void) setFuelLeak: (NSString *)value
|
||||
{
|
||||
if (script_target != self)
|
||||
if (scriptTarget != self)
|
||||
{
|
||||
[script_target setFuel:0];
|
||||
[scriptTarget setFuel:0];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1922,7 +1982,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
if (!UNIVERSE)
|
||||
return;
|
||||
NSDictionary* dict = (NSDictionary*)[[UNIVERSE planetinfo] objectForKey:planetKey];
|
||||
NSDictionary* dict = [[UNIVERSE planetinfo] dictionaryForKey:planetKey];
|
||||
if (!dict)
|
||||
{
|
||||
NSLog(@"ERROR - could not find an entry in planetinfo.plist for '%@'", planetKey);
|
||||
@ -1969,7 +2029,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
if (!UNIVERSE)
|
||||
return;
|
||||
NSDictionary* dict = (NSDictionary*)[[UNIVERSE planetinfo] objectForKey:moonKey];
|
||||
NSDictionary* dict = [[UNIVERSE planetinfo] dictionaryForKey:moonKey];
|
||||
if (!dict)
|
||||
{
|
||||
NSLog(@"ERROR - could not find an entry in planetinfo.plist for '%@'", moonKey);
|
||||
@ -2148,13 +2208,19 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
for (i = 0; i < [items count]; i++)
|
||||
{
|
||||
NSObject* item = [items objectAtIndex:i];
|
||||
id item = [items objectAtIndex:i];
|
||||
if ([item isKindOfClass:[NSString class]])
|
||||
[self processSceneString: (NSString*)item atOffset: off];
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
[self addScene: (NSArray*)item atOffset: off];
|
||||
if ([item isKindOfClass:[NSDictionary class]])
|
||||
[self processSceneDictionary: (NSDictionary*) item atOffset: off];
|
||||
{
|
||||
[self processSceneString:item atOffset: off];
|
||||
}
|
||||
else if ([item isKindOfClass:[NSArray class]])
|
||||
{
|
||||
[self addScene:item atOffset: off];
|
||||
}
|
||||
else if ([item isKindOfClass:[NSDictionary class]])
|
||||
{
|
||||
[self processSceneDictionary:item atOffset: off];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2185,7 +2251,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
|
||||
// check conditions..
|
||||
for (i = 0; (i < [conditions count])&&(success); i++)
|
||||
success &= [self scriptTestCondition:(NSString *)[conditions objectAtIndex:i]];
|
||||
success &= [self scriptTestCondition:[conditions stringAtIndex:i]];
|
||||
|
||||
// perform successful actions...
|
||||
if ((success) && (actions) && [actions count])
|
||||
|
@ -52,9 +52,9 @@ MA 02110-1301, USA.
|
||||
- (void) savePlayer;
|
||||
- (void) quicksavePlayer;
|
||||
|
||||
- (NSString *) commanderSelector:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView;
|
||||
- (void) saveCommanderInputHandler:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView;
|
||||
- (void) overwriteCommanderInputHandler:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView;
|
||||
- (NSString *) commanderSelector;
|
||||
- (void) saveCommanderInputHandler;
|
||||
- (void) overwriteCommanderInputHandler;
|
||||
|
||||
- (void) loadPlayerFromFile:(NSString *)fileToOpen;
|
||||
|
||||
|
@ -145,13 +145,15 @@
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)commanderSelector:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView
|
||||
- (NSString *)commanderSelector
|
||||
{
|
||||
NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
|
||||
if (!dir) dir = [[NSFileManager defaultManager] defaultCommanderPath];
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
|
||||
if (!dir) dir = [[NSFileManager defaultManager] defaultCommanderPath];
|
||||
|
||||
int idx;
|
||||
if([self handleGUIUpDownArrowKeys: gui :gameView])
|
||||
if([self handleGUIUpDownArrowKeys])
|
||||
{
|
||||
int guiSelectedRow=[gui selectedRow];
|
||||
idx=(guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
|
||||
@ -224,12 +226,14 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) saveCommanderInputHandler:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView
|
||||
- (void) saveCommanderInputHandler
|
||||
{
|
||||
NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
|
||||
if (!dir) dir = [[NSFileManager defaultManager] defaultCommanderPath];
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
|
||||
if (!dir) dir = [[NSFileManager defaultManager] defaultCommanderPath];
|
||||
|
||||
if ([self handleGUIUpDownArrowKeys: gui :gameView])
|
||||
if ([self handleGUIUpDownArrowKeys])
|
||||
{
|
||||
int guiSelectedRow=[gui selectedRow];
|
||||
int idx = (guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
|
||||
@ -310,9 +314,12 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) overwriteCommanderInputHandler:(GuiDisplayGen *)gui :(MyOpenGLView *)gameView
|
||||
- (void) overwriteCommanderInputHandler
|
||||
{
|
||||
[self handleGUIUpDownArrowKeys: gui :gameView];
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
|
||||
[self handleGUIUpDownArrowKeys];
|
||||
|
||||
if (([gameView isDown: 13] && ([gui selectedRow] == SAVE_OVERWRITE_YES_ROW))||[gameView isDown: 121]||[gameView isDown: 89])
|
||||
{
|
||||
|
@ -165,7 +165,8 @@ MA 02110-1301, USA.
|
||||
suppressExplosion: 1, // Avoid exploding on death (script hook)
|
||||
|
||||
// scripting
|
||||
haveExecutedSpawnAction: 1;
|
||||
haveExecutedSpawnAction: 1,
|
||||
noRocks: 1;
|
||||
|
||||
OOFuelQuantity fuel; // witch-space fuel
|
||||
GLfloat fuel_accumulator;
|
||||
@ -633,7 +634,6 @@ BOOL class_masslocks(int some_class);
|
||||
- (BOOL) markForFines;
|
||||
|
||||
- (BOOL) isMining;
|
||||
- (void) setNumberOfMinedRocks:(int) value;
|
||||
|
||||
- (void) spawn:(NSString *)roles_number;
|
||||
|
||||
|
@ -116,7 +116,6 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
|
||||
{
|
||||
NSDictionary *shipDict = dict;
|
||||
unsigned i;
|
||||
PlayerEntity *player = [PlayerEntity sharedPlayer];
|
||||
|
||||
// Does this positional stuff need setting up here?
|
||||
// Either way, having four representations of orientation is dumb. Needs fixing. --Ahruman
|
||||
@ -216,6 +215,7 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
|
||||
max_cargo = [shipDict unsignedIntForKey:@"max_cargo"];
|
||||
likely_cargo = [shipDict unsignedIntForKey:@"likely_cargo"];
|
||||
extra_cargo = [shipDict unsignedIntForKey:@"extra_cargo" defaultValue:15];
|
||||
if ([shipDict fuzzyBooleanForKey:@"no_boulders"]) noRocks = YES;
|
||||
|
||||
NSString *cargoString = [shipDict stringForKey:@"cargo_carried"];
|
||||
if (cargoString != nil)
|
||||
@ -418,34 +418,26 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
|
||||
properties:[NSDictionary dictionaryWithObject:self forKey:@"ship"]];
|
||||
if (script == nil)
|
||||
{
|
||||
NSArray *launchActions = nil,
|
||||
*scriptActions = nil,
|
||||
*deathActions = nil,
|
||||
*setUpActions = nil;
|
||||
NSMutableDictionary *scriptHandlers = nil;
|
||||
NSArray *actions = nil;
|
||||
NSMutableDictionary *properties = nil;
|
||||
|
||||
launchActions = [shipDict arrayForKey:@"launch_actions"];
|
||||
scriptActions = [shipDict arrayForKey:@"script_actions"];
|
||||
deathActions = [shipDict arrayForKey:@"death_actions"];
|
||||
if (launchActions != nil || scriptActions != nil || deathActions != nil)
|
||||
{
|
||||
scriptHandlers = [NSMutableDictionary dictionary];
|
||||
if (launchActions != nil) [scriptHandlers setObject:launchActions forKey:@"didSpawn"];
|
||||
if (deathActions != nil) [scriptHandlers setObject:deathActions forKey:@"didDie"];
|
||||
if (scriptActions != nil)
|
||||
{
|
||||
[scriptHandlers setObject:scriptActions forKey:@"wasScooped"];
|
||||
[scriptHandlers setObject:scriptActions forKey:@"playerDidDock"];
|
||||
}
|
||||
script = [OOScript scriptWithLegacyEventHandlers:scriptHandlers forOwner:self];
|
||||
}
|
||||
properties = [NSMutableDictionary dictionaryWithCapacity:5];
|
||||
[properties setObject:self forKey:@"ship"];
|
||||
|
||||
setUpActions = [shipDict arrayForKey:@"setup_actions"];
|
||||
if (setUpActions != nil)
|
||||
{
|
||||
[player setScriptTarget:self];
|
||||
[player scriptActions:setUpActions forTarget:self];
|
||||
}
|
||||
actions = [shipDict arrayForKey:@"launch_actions"];
|
||||
if (actions != nil) [properties setObject:actions forKey:@"legacy_launchActions"];
|
||||
|
||||
actions = [shipDict arrayForKey:@"script_actions"];
|
||||
if (actions != nil) [properties setObject:actions forKey:@"legacy_scriptActions"];
|
||||
|
||||
actions = [shipDict arrayForKey:@"death_actions"];
|
||||
if (actions != nil) [properties setObject:actions forKey:@"legacy_deathActions"];
|
||||
|
||||
actions = [shipDict arrayForKey:@"setup_actions"];
|
||||
if (actions != nil) [properties setObject:actions forKey:@"legacy_setupActions"];
|
||||
|
||||
script = [OOScript nonLegacyScriptFromFileNamed:@"oolite-default-ship-script.js"
|
||||
properties:properties];
|
||||
}
|
||||
[script retain];
|
||||
|
||||
@ -2872,22 +2864,6 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple
|
||||
return [roleSet roleSetWithAddedRoleIfNotSet:primaryRole probability:1.0];
|
||||
}
|
||||
|
||||
/*
|
||||
- (void) setRoles:(OORoleSet *)inRoles
|
||||
{
|
||||
if (inRoles != nil && ![inRoles isEqual:roles])
|
||||
{
|
||||
[roles release];
|
||||
roles = [inRoles copy];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) setRoleString:(NSString *)string
|
||||
{
|
||||
[self setRoles:[OORoleSet roleSetWithString:string]];
|
||||
}*/
|
||||
|
||||
|
||||
- (NSString *)primaryRole
|
||||
{
|
||||
@ -3733,10 +3709,10 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple
|
||||
//
|
||||
if ([self hasPrimaryRole:@"asteroid"])
|
||||
{
|
||||
if ((being_mined)||(randf() < 0.20))
|
||||
if (!noRocks && (being_mined || randf() < 0.20))
|
||||
{
|
||||
int n_rocks = likely_cargo;
|
||||
//
|
||||
int n_rocks = 2 + (Ranrot() % (likely_cargo + 1));
|
||||
|
||||
for (i = 0; i < n_rocks; i++)
|
||||
{
|
||||
ShipEntity* rock = [UNIVERSE newShipWithRole:@"boulder"]; // retain count = 1
|
||||
@ -7136,14 +7112,6 @@ int w_space_seed = 1234567;
|
||||
}
|
||||
|
||||
|
||||
- (void) setNumberOfMinedRocks:(int) value
|
||||
{
|
||||
if (![self hasPrimaryRole:@"asteroid"])
|
||||
return;
|
||||
likely_cargo = value;
|
||||
}
|
||||
|
||||
|
||||
- (void) interpretAIMessage:(NSString *)ms
|
||||
{
|
||||
if ([ms hasPrefix:AIMS_AGGRESSOR_SWITCHED_TARGET])
|
||||
|
@ -216,4 +216,8 @@ MA 02110-1301, USA.
|
||||
- (void) setRacepointsFromTarget;
|
||||
- (void) performFlyRacepoints;
|
||||
|
||||
/* Other methods documented for AI use (may not be exhaustive):
|
||||
setPrimaryRole:
|
||||
*/
|
||||
|
||||
@end
|
||||
|
@ -891,7 +891,6 @@ WormholeEntity* whole;
|
||||
|
||||
- (void) ejectCargo
|
||||
{
|
||||
SEL _dumpCargoSelector = @selector(dumpCargo);
|
||||
unsigned i;
|
||||
if ((cargo_flag == CARGO_FLAG_FULL_PLENTIFUL)||(cargo_flag == CARGO_FLAG_FULL_SCARCE))
|
||||
{
|
||||
@ -910,7 +909,7 @@ WormholeEntity* whole;
|
||||
[self dumpCargo];
|
||||
for (i = 1; i < [cargo count]; i++)
|
||||
{
|
||||
[self performSelector:_dumpCargoSelector withObject:nil afterDelay:0.75 * i]; // drop 3 canisters per 2 seconds
|
||||
[self performSelector:@selector(dumpCargo) withObject:nil afterDelay:0.75 * i]; // drop 3 canisters per 2 seconds
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1190,15 +1190,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
|
||||
if ((id_lock[i] == ship_id)||([UNIVERSE entityForUniversalID:id_lock[i]] == nil))
|
||||
id_lock[i] = NO_TARGET;
|
||||
|
||||
if (script != nil)
|
||||
{
|
||||
PlayerEntity *player = [PlayerEntity sharedPlayer];
|
||||
[player setScriptTarget:self];
|
||||
|
||||
// Two actions here. playerDidDock is equivalent to legacy script_actions. shipDidDock is more general.
|
||||
if (ship == player) [script doEvent:@"playerDidDock"];
|
||||
[script doEvent:@"shipDidDock" withArgument:ship];
|
||||
}
|
||||
[script doEvent:@"shipDidDock" withArgument:ship];
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +55,7 @@ SOFTWARE.
|
||||
#import "OOCPUInfo.h"
|
||||
#import <stdlib.h>
|
||||
#import "OOAsyncQueue.h"
|
||||
#import "NSThreadOOExtensions.h"
|
||||
|
||||
|
||||
static OOAsyncQueue *sLoadQueue,
|
||||
@ -81,7 +82,7 @@ enum
|
||||
|
||||
@interface OOTextureLoader (OOTextureLoadingThread)
|
||||
|
||||
+ (void)queueTask;
|
||||
+ (void)queueTask:(NSNumber *)threadNumber;
|
||||
- (void)performLoad;
|
||||
- (void)applySettings;
|
||||
- (void)getDesiredWidth:(uint32_t *)outDesiredWidth andHeight:(uint32_t *)outDesiredHeight;
|
||||
@ -231,7 +232,7 @@ enum
|
||||
|
||||
+ (void)setUp
|
||||
{
|
||||
int threadCount;
|
||||
int threadCount, threadNumber = 1;
|
||||
GLint maxSize;
|
||||
|
||||
sLoadQueue = [[OOAsyncQueue alloc] init];
|
||||
@ -246,7 +247,7 @@ enum
|
||||
threadCount = MIN(OOCPUCount() - 1, (unsigned)kMaxWorkThreads);
|
||||
do
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(queueTask) toTarget:self withObject:nil];
|
||||
[NSThread detachNewThreadSelector:@selector(queueTask:) toTarget:self withObject:[NSNumber numberWithInt:threadNumber++]];
|
||||
} while (--threadCount > 0);
|
||||
|
||||
// Load two maximum sizes - graphics hardware limit and user-specified limit.
|
||||
@ -268,7 +269,7 @@ enum
|
||||
|
||||
@implementation OOTextureLoader (OOTextureLoadingThread)
|
||||
|
||||
+ (void)queueTask
|
||||
+ (void)queueTask:(NSNumber *)threadNumber
|
||||
{
|
||||
NSAutoreleasePool *pool = nil;
|
||||
OOTextureLoader *loader = nil;
|
||||
@ -285,6 +286,9 @@ enum
|
||||
-- Ahruman
|
||||
*/
|
||||
[NSThread setThreadPriority:0.5];
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
[NSThread ooSetCurrentThreadName:[NSString stringWithFormat:@"OOTextureLoader loader thread %@", threadNumber]];
|
||||
[pool release];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -33,9 +33,9 @@ MA 02110-1301, USA.
|
||||
BOOL OK = YES;
|
||||
NSData *data = nil;
|
||||
const uint8_t *bytes = NULL;
|
||||
size_t length;
|
||||
size_t length = 0;
|
||||
const uint8_t *effectiveBytes = NULL;
|
||||
size_t effectiveLength;
|
||||
size_t effectiveLength = 0;
|
||||
|
||||
data = [[NSData alloc] initWithContentsOfFile:path];
|
||||
if (data == nil) OK = NO;
|
||||
|
61
src/Core/NSThreadOOExtensions.h
Normal file
61
src/Core/NSThreadOOExtensions.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
|
||||
NSThreadOOExtensions.h
|
||||
|
||||
Utility methods for NSThread.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright (C) 2004-2007 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.
|
||||
|
||||
|
||||
This file may also be distributed under the MIT/X11 license:
|
||||
|
||||
Copyright (C) 2007 Jens Ayton
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSThread (OOExtensions)
|
||||
|
||||
/* Set name of current thread for identification during debugging. Only works
|
||||
on Mac OS X 10.5 or later, does nothing on other platforms.
|
||||
*/
|
||||
+ (void)ooSetCurrentThreadName:(NSString *)name;
|
||||
|
||||
@end
|
67
src/Core/NSThreadOOExtensions.m
Normal file
67
src/Core/NSThreadOOExtensions.m
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
|
||||
NSThreadOOExtensions.h
|
||||
|
||||
Utility methods for NSThread.
|
||||
|
||||
|
||||
Oolite
|
||||
Copyright (C) 2004-2007 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.
|
||||
|
||||
|
||||
This file may also be distributed under the MIT/X11 license:
|
||||
|
||||
Copyright (C) 2007 Jens Ayton
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#import "NSThreadOOExtensions.h"
|
||||
|
||||
|
||||
@implementation NSThread (OOExtensions)
|
||||
|
||||
+ (void)ooSetCurrentThreadName:(NSString *)name
|
||||
{
|
||||
NSThread *thread = nil;
|
||||
|
||||
thread = [NSThread currentThread];
|
||||
if ([thread respondsToSelector:@selector(setName:)])
|
||||
{
|
||||
[(id)thread setName:name];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -481,7 +481,9 @@ static OOCacheManager *sSingleton = nil;
|
||||
if (errorString != nil)
|
||||
{
|
||||
OOLog(@"dataCache.badData", @"Could not read data cache: %@", errorString);
|
||||
[errorString release]; // Not autoreleased by NSPropertyListSerialization!
|
||||
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errorString release];
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
if (![contents isKindOfClass:[NSDictionary class]]) return nil;
|
||||
@ -502,6 +504,9 @@ static OOCacheManager *sSingleton = nil;
|
||||
plist = [NSPropertyListSerialization dataFromPropertyList:inDict format:CACHE_PLIST_FORMAT errorDescription:&errorDesc];
|
||||
if (plist == nil)
|
||||
{
|
||||
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errorDesc autorelease];
|
||||
#endif
|
||||
OOLog(kOOLogDataCacheSerializationError, @"Could not convert data cache to property list data: %@", errorDesc);
|
||||
return NO;
|
||||
}
|
||||
|
@ -30,14 +30,13 @@ MA );-);, USA.
|
||||
|
||||
|
||||
#define CASE(foo) case foo: return @#foo;
|
||||
#define REVERSE_CASE(foo) if ([string isEqual:@#foo]) return foo;
|
||||
#define REVERSE_CASE(foo) if ([string isEqualToString:@#foo]) return foo;
|
||||
|
||||
|
||||
NSString *EntityStatusToString(OOEntityStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
CASE(STATUS_EXPERIMENTAL);
|
||||
CASE(STATUS_EFFECT);
|
||||
CASE(STATUS_ACTIVE);
|
||||
CASE(STATUS_COCKPIT_DISPLAY);
|
||||
@ -65,7 +64,6 @@ NSString *EntityStatusToString(OOEntityStatus status)
|
||||
|
||||
OOEntityStatus StringToEntityStatus(NSString *string)
|
||||
{
|
||||
REVERSE_CASE(STATUS_EXPERIMENTAL);
|
||||
REVERSE_CASE(STATUS_EFFECT);
|
||||
REVERSE_CASE(STATUS_ACTIVE);
|
||||
REVERSE_CASE(STATUS_COCKPIT_DISPLAY);
|
||||
|
@ -81,7 +81,6 @@ id OOPropertyListFromData(NSData *data, NSString *whereFrom)
|
||||
id result = nil;
|
||||
NSString *error = nil;
|
||||
|
||||
|
||||
if (data != nil)
|
||||
{
|
||||
#ifndef NO_DYNAMIC_PLIST_DTD_CHANGE
|
||||
|
@ -30,7 +30,6 @@ MA 02110-1301, USA.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATUS_EXPERIMENTAL = 99,
|
||||
STATUS_EFFECT = 10,
|
||||
STATUS_ACTIVE = 5,
|
||||
STATUS_COCKPIT_DISPLAY = 2,
|
||||
|
@ -123,6 +123,14 @@ This code is hereby placed in the public domain.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// New fast forwarding mechanism introduced in Mac OS X 10.5.
|
||||
// Note that -forwardInvocation: is still called if _object is nil.
|
||||
- (id)forwardingTargetForSelector:(SEL)sel
|
||||
{
|
||||
return _object;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -39,6 +39,9 @@ MA 02110-1301, USA.
|
||||
{
|
||||
*outErrorDesc = [NSString stringWithFormat:@"could not convert property list to XML: %@", errorDesc];
|
||||
}
|
||||
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errorDesc release];
|
||||
#endif
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -281,11 +281,7 @@ static BOOL CheckNameConflict(NSString *lcName, NSDictionary *directoryCases, NS
|
||||
format:&format
|
||||
errorDescription:&errorString];
|
||||
|
||||
#if OOLITE_MAC_OS_X
|
||||
/* Documented wart: this is caller responsibility in Cocoa (but not GNUstep?)
|
||||
TODO: verify that it is correct to not do this in GNUstep.
|
||||
In the mean time, not doing it in GNUstep seems to be avoiding a crash.
|
||||
*/
|
||||
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
|
||||
[errorString autorelease];
|
||||
#endif
|
||||
|
||||
|
@ -31,6 +31,7 @@ MA 02110-1301, USA.
|
||||
#import "OOStringParsing.h"
|
||||
#import "EntityOOJavaScriptExtensions.h"
|
||||
#import "OORoleSet.h"
|
||||
#import "OOJSPlayer.h"
|
||||
|
||||
|
||||
static JSObject *sShipPrototype;
|
||||
@ -46,6 +47,7 @@ static JSBool ShipReactToAIMessage(JSContext *context, JSObject *this, uintN arg
|
||||
static JSBool ShipDeployEscorts(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipDockEscorts(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipHasRole(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipRunLegacyScriptActions(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
|
||||
|
||||
static JSExtendedClass sShipClass =
|
||||
@ -170,6 +172,7 @@ static JSFunctionSpec sShipMethods[] =
|
||||
{ "deployEscorts", ShipDeployEscorts, 0 },
|
||||
{ "dockEscorts", ShipDockEscorts, 0 },
|
||||
{ "hasRole", ShipHasRole, 1 },
|
||||
{ "runLegacyScriptActions", ShipRunLegacyScriptActions, 2 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -635,7 +638,7 @@ static JSBool ShipDockEscorts(JSContext *context, JSObject *this, uintN argc, js
|
||||
static JSBool ShipHasRole(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
ShipEntity *thisEnt = nil;
|
||||
NSString *role;
|
||||
NSString *role = nil;
|
||||
|
||||
if (!JSShipGetShipEntity(context, this, &thisEnt)) return YES; // stale reference, no-op.
|
||||
role = [NSString stringWithJavaScriptValue:*argv inContext:context];
|
||||
@ -643,3 +646,34 @@ static JSBool ShipHasRole(JSContext *context, JSObject *this, uintN argc, jsval
|
||||
*outResult = BOOLToJSVal([thisEnt hasRole:role]);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipRunLegacyScriptActions(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
ShipEntity *thisEnt = nil;
|
||||
PlayerEntity *player = nil;
|
||||
ShipEntity *target = nil;
|
||||
NSArray *actions = nil;
|
||||
|
||||
player = OOPlayerForScripting();
|
||||
if (!JSShipGetShipEntity(context, this, &thisEnt)) return YES; // stale reference, no-op.
|
||||
|
||||
target = JSValueToObject(context, argv[0]);
|
||||
if (![target isKindOfClass:[ShipEntity class]])
|
||||
{
|
||||
OOReportJavaScriptWarning(context, @"First argument of RunLegacyScriptActions must be a Ship.");
|
||||
return YES;
|
||||
}
|
||||
|
||||
actions = JSValueToObject(context, argv[1]);
|
||||
if (![actions isKindOfClass:[NSArray class]])
|
||||
{
|
||||
OOReportJavaScriptWarning(context, @"Second argument of RunLegacyScriptActions must be an Array.");
|
||||
return YES;
|
||||
}
|
||||
|
||||
[player setScriptTarget:thisEnt];
|
||||
[player scriptActions:actions forTarget:target];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -584,8 +584,9 @@ static JSBool SystemFilteredEntities(JSContext *context, JSObject *this, uintN a
|
||||
// Search for entities
|
||||
if (function != NULL)
|
||||
{
|
||||
JSFunctionPredicateParameter param = { context, function, jsThis };
|
||||
JSFunctionPredicateParameter param = { context, function, jsThis, NO };
|
||||
result = FindJSVisibleEntities(JSFunctionPredicate, ¶m, relativeTo, range);
|
||||
if (param.errorFlag) result = nil; // Exception in predicate
|
||||
}
|
||||
|
||||
if (result != nil) *outResult = [result javaScriptValueInContext:context];
|
||||
|
@ -188,6 +188,9 @@ typedef struct
|
||||
JSContext *context;
|
||||
JSFunction *function;
|
||||
JSObject *jsThis;
|
||||
BOOL errorFlag; // Set if a JS exception occurs. The
|
||||
// exception will have been reported.
|
||||
// This also supresses further filtering.
|
||||
} JSFunctionPredicateParameter;
|
||||
BOOL JSFunctionPredicate(Entity *entity, void *parameter);
|
||||
|
||||
|
@ -260,6 +260,7 @@ static void ReportJSError(JSContext *context, const char *message, JSErrorReport
|
||||
|
||||
context = [self acquireContext];
|
||||
result = JS_CallFunction(context, jsThis, function, argc, argv, outResult);
|
||||
JS_ReportPendingException(context);
|
||||
[self releaseContext:context];
|
||||
|
||||
return result;
|
||||
@ -1055,10 +1056,17 @@ BOOL JSFunctionPredicate(Entity *entity, void *parameter)
|
||||
jsval rval = JSVAL_VOID;
|
||||
JSBool result = NO;
|
||||
|
||||
if (param->errorFlag) return NO;
|
||||
|
||||
args[0] = [entity javaScriptValueInContext:param->context];
|
||||
if (JS_CallFunction(param->context, param->jsThis, param->function, 1, args, &rval))
|
||||
{
|
||||
if (!JS_ValueToBoolean(param->context, rval, &result)) result = NO;
|
||||
if (JS_IsExceptionPending(param->context))
|
||||
{
|
||||
JS_ReportPendingException(param->context);
|
||||
param->errorFlag = YES;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1728,7 +1728,6 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
|
||||
for (i = 0; i < clusterSize; i++)
|
||||
{
|
||||
ShipEntity* asteroid;
|
||||
int n_rocks = 2 + (Ranrot() % 5);
|
||||
launchPos.x = spawnPos.x + SCANNER_MAX_RANGE * (randf() - randf());
|
||||
launchPos.y = spawnPos.y + SCANNER_MAX_RANGE * (randf() - randf());
|
||||
launchPos.z = spawnPos.z + SCANNER_MAX_RANGE * (randf() - randf());
|
||||
@ -1740,7 +1739,6 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
|
||||
[asteroid setPosition:launchPos];
|
||||
[asteroid setVelocity:spawnVel];
|
||||
[asteroid setStatus:STATUS_IN_FLIGHT];
|
||||
[asteroid setNumberOfMinedRocks: n_rocks];
|
||||
[self addEntity:asteroid];
|
||||
[[asteroid getAI] setState:@"GLOBAL"];
|
||||
[asteroid release];
|
||||
|
Loading…
x
Reference in New Issue
Block a user