Oolite Bulletins

For information and discussion about Oolite.
It is currently Mon Dec 11, 2017 1:07 pm

All times are UTC




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Apr 05, 2016 11:39 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1832
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
I've been playing around with a mission pack that utilitises the Black Box from cim's/spara's Rescue Stations. I've created my own custom shipdata entry for it, and can now happily spawn blackboxes to my hearts content. Here's the shipdata code for reference purposes:
Code:
	"gcm-blackbox-template" = {
		is_template = "yes";
		ai_type = "nullAI.plist";
		energy_recharge_rate = 1;
		forward_weapon_type = "WEAPON_NONE";
		heat_insulation = 0.3;
		max_energy = 10;
		max_flight_pitch = 0.5;
		max_flight_roll = 0.5;
		max_flight_speed = 0;
		missiles = 0;
		model = "gcm_blackbox.dat";
		materials = {
			"gcm_blackbox.png" = {
				"diffuse_map" = "gcm_blackbox.png";
				"emission_map" = "gcm_blackbox_emission.png";
				"specular_map" = "gcm_blackbox_specular.png";
				"normal_map" = "gcm_blackbox_normal.png";
				"shininess" = "128";
			};
		};		
		name = "Black Box";
		scan_class = "CLASS_CARGO";
		thrust = 0;
		weapon_energy = "0";
		script_info = {
			no_sc_config = 1;
		};
		subentities = (
			{
				type = "flasher";
				color = { hue = 200; };
				frequency = 0.1;
				size = 7.5;
			}
		);		
	};
	"gcm-blackbox" = {
		like_ship = "gcm-blackbox-template";
		cargo_type = "CARGO_CARRIED";
		cargo_carried = "1 machinery";
		roles = "gcm_blackbox";
		unpiloted = "yes";
	};
I didn't realise that Oolite keeps a track of the data key of scooped objects, because I discovered if I scoop my black box, and then eject it again, the original model is respawned, not a standard cargo container. That's really cool!

But here's the thing: there is no "shipSpawned" event in this case. I've just spent the last two hours trying to work out why my code for detecting when the player ejects cargo (using the "shipSpawned" event) wasn't working, and the reason was, the event wasn't being called at all. This is in 1.82.

I took my code to 1.83, added the new "shipDumpedCargo" event and now I could see my blackbox being spawned. But still the "shipSpawned" event didn't fire.

So I think this is a bug, but I'd appreciate any pointers if I've messed something up somewhere.

_________________
My OXP's


Last edited by phkb on Wed Apr 06, 2016 2:26 am, edited 1 time in total.

Top
   
PostPosted: Wed Apr 06, 2016 2:25 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1832
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Nevermind, I think I worked this out after looking through the source. Scooped objects, and indeed all scooped objects in the hold, are still entities in the system. Therefore, when they are ejected they are not re-spawned, but just reappear. That's why the ship knew what type of object I'd scooped, and was able to eject the same item.

Sorry for the diversion. We will now return you to your normal programming.

Edit: Found out I should have been using the shipWasDumped event. Just for future reference.

_________________
My OXP's


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited