Page 1 of 8

49ers OXP - The Oolite Gold Rush (was: Ore processor)

Posted: Mon Dec 25, 2006 3:24 pm
by Dr. Nil
edit:

Download the Ore Processor v.1.03

It works. :D

Thanks to those who helped and tested.


-----

I've been thinking about an ore processor to make mining more profitable. Here are some of my latest ideas on the subject.

...\Oolite\AddOns\Ore_processor.oxp\Config\equipment.plist

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<array>
		<integer>11</integer>
		<integer>50000</integer>
		<string>Ore Processor</string>
		<string>EQ_ORE_PROCESSOR</string>
		<string>Connects to the fuel scoops for instant extraction of higher valued materials from mined ore.</string>
	</array>
</array>
</plist>
...\Oolite\AddOns\Ore_processor.oxp\Config\shipdata.plist

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>op_splinter</key>
	<dict>
		<key>conditions</key> 
		<array> 
			<string>***the player is equipped with the ore processor***</string> 
		</array>
		<key>ai_type</key>
		<string>dumbAI.plist</string>
		<key>bounty</key>
		<integer>1</integer>
		<key>cargo_type</key>
		<string>CARGO_MINERALS</string>
		<key>energy_recharge_rate</key>
		<real>0.0</real>
		<key>forward_weapon_type</key>
		<string>WEAPON_NONE</string>
		<key>has_ecm</key>
		<false/>
		<key>has_escape_pod</key>
		<false/>
		<key>has_scoop</key>
		<false/>
		<key>likely_cargo</key>
		<integer>0</integer>
		<key>max_cargo</key>
		<integer>0</integer>
		<key>max_energy</key>
		<real>5</real>
		<key>max_flight_pitch</key>
		<real>1</real>
		<key>max_flight_roll</key>
		<real>1</real>
		<key>max_flight_speed</key>
		<real>10</real>
		<key>missiles</key>
		<integer>0</integer>
		<key>model</key>
		<string>splinter.dat</string>
		<key>name</key>
		<string>Splinter</string>
		<key>roles</key>
		<string>baseforopsplinter</string>
		<key>smooth</key>
		<true/>
		<key>thrust</key>
		<real>0.0</real>
		<key>unpiloted</key>
		<true/>
		<key>weapon_energy</key>
		<real>0.0</real>
		<key>weapon_offset_x</key>
		<real>0.0</real>
	</dict>

	<key>op_splinter2</key>
	<dict>
		<key>conditions</key> 
		<array> 
			<string>***the player is equipped with the ore processor***</string>
		</array>
		<key>ai_type</key>
		<string>dumbAI.plist</string>
		<key>bounty</key>
		<integer>1</integer>
		<key>cargo_type</key>
		<string>CARGO_MINERALS</string>
		<key>energy_recharge_rate</key>
		<real>0.0</real>
		<key>forward_weapon_type</key>
		<string>WEAPON_NONE</string>
		<key>has_ecm</key>
		<false/>
		<key>has_escape_pod</key>
		<false/>
		<key>has_scoop</key>
		<false/>
		<key>likely_cargo</key>
		<integer>0</integer>
		<key>max_cargo</key>
		<integer>0</integer>
		<key>max_energy</key>
		<real>5</real>
		<key>max_flight_pitch</key>
		<real>1</real>
		<key>max_flight_roll</key>
		<real>1</real>
		<key>max_flight_speed</key>
		<real>10</real>
		<key>missiles</key>
		<integer>0</integer>
		<key>model</key>
		<string>splinter1.dat</string>
		<key>name</key>
		<string>Splinter</string>
		<key>roles</key>
		<string>baseforopsplinter2</string>
		<key>smooth</key>
		<true/>
		<key>thrust</key>
		<real>0.0</real>
		<key>unpiloted</key>
		<true/>
		<key>weapon_energy</key>
		<real>0.0</real>
		<key>weapon_offset_x</key>
		<real>0.0</real>
	</dict>

	<key>op_alloys</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter</string>
		<key>cargo_type</key>
		<string>CARGO_ALLOYS</string>
		<key>roles</key>
		<string>splinter(15.0)</string>
	</dict>

	<key>op_radioactives</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter</string>
		<key>cargo_type</key>
		<string>CARGO_RADIOACTIVES</string>
		<key>roles</key>
		<string>splinter(7.0)</string>
	</dict>

	<key>op_gold</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter</string>
		<key>cargo_type</key>
		<string>CARGO_GOLD</string>
		<key>roles</key>
		<string>splinter(4.0)</string>
	</dict>

	<key>op_platinum</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter</string>
		<key>cargo_type</key>
		<string>CARGO_PLATINUM</string>
		<key>roles</key>
		<string>splinter(3.3)</string>
	</dict>

	<key>op_gem-stones</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter</string>
		<key>cargo_type</key>
		<string>CARGO_GEM-STONES</string>
		<key>roles</key>
		<string>splinter(6.0)</string>
	</dict>

	<key>op_alloys2</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter2</string>
		<key>cargo_type</key>
		<string>CARGO_ALLOYS</string>
		<key>roles</key>
		<string>splinter(15.0)</string>
	</dict>

	<key>op_radioactives2</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter2</string>
		<key>cargo_type</key>
		<string>CARGO_RADIOACTIVES</string>
		<key>roles</key>
		<string>splinter(7.0)</string>
	</dict>

	<key>op_gold2</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter2</string>
		<key>cargo_type</key>
		<string>CARGO_GOLD</string>
		<key>roles</key>
		<string>splinter(4.0)</string>
	</dict>

	<key>op_platinum2</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter2</string>
		<key>cargo_type</key>
		<string>CARGO_PLATINUM</string>
		<key>roles</key>
		<string>splinter(3.3)</string>
	</dict>

	<key>op_gem-stones2</key>
	<dict>
		<key>like_ship</key>
		<string>baseforopsplinter2</string>
		<key>cargo_type</key>
		<string>CARGO_GEM-STONES</string>
		<key>roles</key>
		<string>splinter(6.0)</string>
	</dict>
</dict>
</plist>
Do I have to make a script which tests for the presence of the equipment and then passes the result to the condition check in the shipdata, or can this be done without a script?

Any suggestions on the shipdata or a script? I might have overlooked something, which prevents this idea from working.

Does anybody know, if it's possible to have equipment take up space, like the passenger cabins do?

Posted: Mon Dec 25, 2006 3:29 pm
by LittleBear
Perhaps define the asteroid that breaks up to give valuable splinters with the role special_asteroid in shipdata, then script to only add special_asteroids to the system if it gets an equipment found boule yes and a dice roll chance is met. Might also be possible to do it with a script_action in shipdata or even make it a Character (like with the Constrictor piolt) but suspect scripting would be easier. :wink: Could maybe change the <name> of the special asteroid to "High metalic asteroid" or somthing to give a clue.

Posted: Mon Dec 25, 2006 4:21 pm
by Dr. Nil
Thanks for the suggestion. I think I might have found a solution.

Ore Processor v0.01

It uses this script

Code: Select all

{ "ore_processor_test" = (

{ conditions = ("status_string equal STATUS_IN_FLIGHT" );
do = (  "testForEquipment: EQ_ORE_PROCESSOR",

{ conditions = ( "foundEquipment_bool equal YES" );
do = ( set: mission_ore_processor_present 1 );
else =  ( set: mission_ore_processor_present 0 );

 }
); } );}
and has the conditions in the shipdata above changed to

Code: Select all

		<key>conditions</key> 
		<array> 
			<string>mission_ore_processor_present equal 1</string>
		</array>
Disclaimer: I have not tested this yet and have absolutely no idea if it works or not

Posted: Mon Dec 25, 2006 4:39 pm
by Dr. Nil
No problems so far - except that the script doesn't work (probably just something with brackets or commas) and that the equipment isn't there for purchase. :lol:

Posted: Mon Dec 25, 2006 4:51 pm
by LittleBear
equipment.plist I'm not too familer with, but the not comming up in shipyard is an rquipment.plist problem.

The Mark Transonder Scanner in Assassins doesn't do anything in code itself (other than a flag to say the player has it) and come up on the F5 screen, as all the things it does I did in shipdata or script.

Feel free to copy and paste it in to yours , just changing the names and tech-level (I just copied and pasted this from Giles's equipment.plist and moded it). It works to put the item in the Ship-yard and come up on the F5 screen and set a player has it flag. I set the tech-level to 99 (as the item is given as a reward rather than being bought), but when I was developing I'd set the tech-level at a buyable level and it came up in ship data. The interger for price is in 1/10 of credits for some reason.

Posted: Mon Dec 25, 2006 5:03 pm
by Dr. Nil
LittleBear wrote:
equipment.plist I'm not too familer with, but the not comming up in shipyard is an rquipment.plist problem.

The Mark Transonder Scanner in Assassins doesn't do anything in code itself (other than a flag to say the player has it) and come up on the F5 screen, as all the things it does I did in shipdata or script.

Feel free to copy and paste it in to yours , just changing the names and tech-level (I just copied and pasted this from Giles's equipment.plist and moded it). It works to put the item in the Ship-yard and come up on the F5 screen and set a player has it flag. I set the tech-level to 99 (as the item is given as a reward rather than being bought), but when I was developing I'd set the tech-level at a buyable level and it came up in ship data. The interger for price is in 1/10 of credits for some reason.
I'll take a look at the Mark Transponder to try to spot what I might have done wrong. Thanks.

I set the techlevel to 2(1) and the price to 50(500) when I just tested it, compared to the 12(11) and 5000(50000) I planned for the finished product. It still might all just be due to a missing comma in the script.

Posted: Mon Dec 25, 2006 5:44 pm
by Dr. Nil
0.02 It just might work now
Ore processor v0.02

Posted: Tue Dec 26, 2006 10:29 am
by DaddyHoggy
@Doc - Da Link - it no work :cry:

Got to admire ya Doc - 'tis amazing how quickly you change an idea into a functioning expansion* to Oolite and one that genuinely adds a significant new dimension to the game.

*Once the link works and I have enough spare money to buy one

PS - Does it also extract gold/plat/gems as I accidently envisioned or are you sticking with alloys?

Posted: Tue Dec 26, 2006 1:19 pm
by Dr. Nil
DaddyHoggy wrote:
@Doc - Da Link - it no work :cry:

Got to admire ya Doc - 'tis amazing how quickly you change an idea into a functioning expansion* to Oolite and one that genuinely adds a significant new dimension to the game.

*Once the link works and I have enough spare money to buy one

PS - Does it also extract gold/plat/gems as I accidently envisioned or are you sticking with alloys?
:oops:

This link should work - Ore Processor

I used your idea since it really enhanced the concept a lot (and added radioactives). Most asteroid splinters will yield alloys and a few will still only give you minerals - If it works like it's supposed to.

I haven't had time to test it yet myself. But hope to get some time to look at it later today. I'd like to hear some reports, but please remember to make an extra save before purchase until it's tested, so you don't spend your Cr in vain. Is 5000 too small a price?

Posted: Tue Dec 26, 2006 3:47 pm
by Dr. Nil
v0.03

Don't know if it works, since the game keeps crashing, when I try it out ;)

Ore Processor v0.03

At least the script should be ok (the problem was simply some missing quotation marks).

Code: Select all

{ "ore_processor_test" = (

{ conditions = ("status_string equal STATUS_IN_FLIGHT" );
do = ( "testForEquipment: EQ_ORE_PROCESSOR",

{ conditions = ( "foundEquipment_bool equal YES" );
do = ( "set: mission_ore_processor_present 1" );
else =  ( "set: mission_ore_processor_present 0" );

} ); } );}
Instead the game just shuts down with the message "Fatal signal: Floating Point Exception (SDL Parachute Deployed)". It seems to happen when splinters are created.

Posted: Tue Dec 26, 2006 4:57 pm
by Cmdr Wyvern
Version 0.03 os still crashing Oolite-PC, with 'Fatal signal: Floating Point Exception (SDL Parachute Deployed)' recorded in stderr.txt.

Posted: Tue Dec 26, 2006 7:00 pm
by Griff
Hi Doc
I'm sad to report that oolite is crashing for me here too at the moment that splinters are being created.
I wonder if it's the conditions key in the shipdata.plist that is causing the crash? i think conditions have to 'do' something, eg:-

Code: Select all

<string>testForEquipment: EQ_FUEL_SCOOPS</string>
			<dict>
				<key>conditions</key>
				<array>
					<string>foundEquipment_bool equal YES</string>
				</array>
				<key>do</key>
				<array>
					<string>awardCargo: 2 Food </string>
				</array>
			</dict>
i don't think you can just leave it at

Code: Select all

<key>conditions</key> 
		<array> 
			<string>mission_ore_processor_present equal 1</string> 
		</array>
in the shipdata.plist, oolite must be expecting a 'do' command, not finding one and crashing.

I wonder if the easiest way to do this would be to 'addship' some custom asteroids & boulders that once mined break apart into a custom splinter element? for each custom splinter element, set their cargo type to scripted item and add this script_actions section into their shipdata.plist entry, eg:-

Code: Select all

<key>cargo_type</key>
<string>CARGO_SCRIPTED_ITEM</string>
<key>script_actions</key>
		<array>
			<string>debugOn</string>
			<string>testForEquipment: EQ_ORE_PROCESSOR</string>
			<dict>
				<key>conditions</key>
				<array>
					<string>foundEquipment_bool equal YES</string>
				</array>
				<key>do</key>
				<array>
					<string>awardCargo: 2 Gold</string>
				</array>
               <key>else</key>
               <array>
               <string>awardCargo: 1 Minerals</string>
               </array>
			</dict>
			<string>debugOff</string>
		</array>
This isn't as cool a solution as the one you're working on though.
I wonder if it's possible to randomise the 'awardCargo' bit? because in my example you're always going to get 2 Kg of gold whenever you scoop that splinter if you have the ore processor or 1 ton of minerals if you don't.

Posted: Tue Dec 26, 2006 7:08 pm
by LittleBear
Perhaps if you had a special asteroid do a spawn : special_splinters 6 (or whatever) with death_action, then have multipulte enturies with the same role for the special_splinters to get the variery.

Posted: Wed Dec 27, 2006 11:37 am
by Dr. Nil
Griff wrote:
i don't think you can just leave it at

Code: Select all

<key>conditions</key> 
		<array> 
			<string>mission_ore_processor_present equal 1</string> 
		</array>
in the shipdata.plist, oolite must be expecting a 'do' command, not finding one and crashing.

I wonder if the easiest way to do this would be to 'addship' some custom asteroids & boulders that once mined break apart into a custom splinter element? for each custom splinter element, set their cargo type to scripted item and add this script_actions section into their shipdata.plist entry, eg:-

Code: Select all

<key>cargo_type</key>
<string>CARGO_SCRIPTED_ITEM</string>
<key>script_actions</key>
		<array>
			<string>debugOn</string>
			<string>testForEquipment: EQ_ORE_PROCESSOR</string>
			<dict>
				<key>conditions</key>
				<array>
					<string>foundEquipment_bool equal YES</string>
				</array>
				<key>do</key>
				<array>
					<string>awardCargo: 2 Gold</string>
				</array>
               <key>else</key>
               <array>
               <string>awardCargo: 1 Minerals</string>
               </array>
			</dict>
			<string>debugOff</string>
		</array>
This isn't as cool a solution as the one you're working on though.
I wonder if it's possible to randomise the 'awardCargo' bit? because in my example you're always going to get 2 Kg of gold whenever you scoop that splinter if you have the ore processor or 1 ton of minerals if you don't.
Hi.

Thank you all for helping and testing.

(@Cmdr Wyvern: What's that ship on your profile?)

@Griff: Some conditions are available as a condition for the entire shipdata entity they appear in. I guess you could look at it as "do"ing the roles entry only when the conditions are met. It works fine for systemGovernment_number like in this example from Commies

Code: Select all

	<key>workcom_0</key>
	<dict>
		<key>conditions</key> 
		<array> 
			<string>systemGovernment_number equal 4</string> 
		</array>
		<key>like_ship</key>
		<string>workcom</string>
		<key>model</key>
		<string>workcom_0.dat</string>
		<key>name</key>
		<string>Worker's Commuter</string>
		<key>roles</key>
		<string>trader(0.5) sunskim-trader(0.25) shuttle(0.5) workcom(0.125)</string>
		<key>smooth</key>
		<true/>
		<key>thrust</key>
		<real>8</real>
	</dict>
I think I came across the option on the BB, since it's not documented in the Wiki. But it could be, that this is not yet implemented for mission variables.

@Griff & LB: I'd rather not take this a way, which leaves the standard asteroids as unprofitable as they are now. Perhaps it's the only way to go atm, and others are of course welcome to take it in that direction. :)

I'll try to dream up another idea on how to make this work on standard asteroids. But please keep the ideas for either way coming.

Posted: Wed Dec 27, 2006 12:49 pm
by LittleBear
This is a bit of a workaround, but should work:-

Give the special_asteroid an AI that includes a scanforshipwithrole : asteroid, Target found = scriptactionontarget: landonPlanet.

That way, if special asteroids are added, they become the only asteroids in the game, as they remove the normal asteroids! So they player without the special scoop attachment encounters the normal non-profitable rocks, but the player with the scoop attachment only meets profitable rocks.