Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Did you ever wish for just a little more space in your hold?

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

Kaks wrote:
Ok, unless there are any objections, I'm going to make the following changes to add / remove equipment:

Adding the large cargo bay via script will add extra space, and removing it via script will remove the extra cargo space, as defined by the ships extra cargo space overrides. Same thing will happen with passengers berths added / removed via script.

However, if the present cargo can't fit inside the changed cargo bay space, no changes will be made, add / remove equipment will return false, and a message will be added to the log.

What do you guys think?
I'm all for this.
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Ok, unless there are any objections, I'm going to make the following changes to add / remove equipment:

...However, if the present cargo can't fit inside the changed cargo bay space, no changes will be made, add / remove equipment will return false, and a message will be added to the log.
Sounds good to me. Alternatively one could eject the surplus of barrels or let the surplus evaporate together with the bay.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

I thought about it, but... if we have different types of cargo on board, how do we decide about which surplus to eject / evaporate?

We could decide it randomly, but it might not be too clever an idea...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
We could decide it randomly, but it might not be too clever an idea...
When you press Dump cargo it is also a random item. (Unless you have scooped items on board)

Looking at your code it suggest you don't correct inside addEquipment. I would do it there as all ways of removing items end there and you won't miss an exception. But the problem was more in removing as in adding as addEquipent already corrects things correctly as far as I know.
Last edited by Eric Walch on Fri Oct 09, 2009 12:59 pm, edited 1 time in total.
pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

Eric Walch wrote:
When you press Dump cargo it is also a random item. (Unless you have scooped items on board)
I thought that Dump cargo dumped the last thing that was added, that that before dumping you can cycle through your cargo to select what will get dumped.
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16080
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Post by Cody »

Kaks wrote:
I thought about it, but... if we have different types of cargo on board, how do we decide about which surplus to eject / evaporate?

We could decide it randomly, but it might not be too clever an idea...

A very non-expert comment: surely you should only be able to change cargo space when said cargo space is empty.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

pmw57 wrote:
Eric Walch wrote:
When you press Dump cargo it is also a random item. (Unless you have scooped items on board)
I thought that Dump cargo dumped the last thing that was added, that that before dumping you can cycle through your cargo to select what will get dumped.
Therefor my addition: (Unless you have scooped items on board)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Hmmm, doing changes to the cargo space only if there's no cargo in the way does sound like the simplest way to implement this...

We already have award / remove equipment fail silently and just return false if not successful, so as long as the OXP script checks that the equipment change is successful, we should be ok...
Last edited by Kaks on Fri Oct 09, 2009 1:13 pm, edited 1 time in total.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

Kaks wrote:
Hmmm, doing changes to the cargo space only if there's no cargo in the way does sound like the simplest way to implement this...
If the size of the cargo bay is greater than or equal to the space available on the ship, then go right ahead.

There doesn't seem to be any ways that that could go wrong.
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
We already have award / remove equipment fail silently and just return false if not successful, so as long as the OXP script checks that the equipment change is successful, we should be ok...
And in case of a selEquipment.oxp we have a requires cargo space. When setting that at 15 or 20 tons, the removal item will not be offered. It still needs the script check as the extra bay is 15 tons by default but could have an other value when explicit specified for that ship. (None of the native ships use this customised bay size, but there could be some around)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Ok, the following is now in trunk:

award/remove passenger berths & cargo space via script now do change the available cargo space.
If there's cargo (or passengers!) in the way of the refit, no change is made, and the functions return false.

The extra cargo space is allocated / removed in accordance to the extra_cargo ship key.

In addition to that, the passenger berth modification is recognised inside .hasEquipment too. Before it was left in a sort of limbo.

Once we have a 1.74 release (or 1.73.5, if we must!) Commander McLane's OXP will once more allow captains everywhere to sell cargo bay extensions, this time without falling prey to (ok, taking undue advange of) quantum bay phenomena... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post by Lestradae »

Kaks wrote:
Ok, the following is now in trunk:

award/remove passenger berths & cargo space via script now do change the available cargo space.
Does that mean that additionally extended cargo bay options could be scripted via that?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

extra_cargo is a key inside the shipdata that tells oolite by how much is the cargo bay going to be expanded, if the player has got the Large Cargo Bay as equipment.

It's been there since before 1.70, but so far no-one has set it higher than the standard 15 tons...

Beyond that, I'm really not sure what you mean by additionally extended cargo bay options...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

I see, I'm already using the extra cargo bay option for specific ships.

My question was if this made it possible to script specific cargo bay extensions in addition to the Large Cargo Bay. I.e. "Subspace Compression Cargo Bay" that adds another (second) extra cargo unit to the first (the standard LCB).

Your answer translates to me as "no", and I assume that my idea that this could become possible is also open to discussion if that would even be desirable.

Cheers

L
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

All this makes possible is to give / remove a cargo bay and passenger berth without the player having to click anything.

Before this change you could try, but the cargo bay size wouldn't be modified at all, and in the case of passenger berths, no change whatsoever would happen at all.

This opens up a few more scripted ship changes, as in "we're refitting your ship as a luxury cruiser for our ambassador to travel with you to planet xyz..." or "we took the liberty to remove your extra cargo bay, our lads needed the extra space. Don't worry about not having any space for your cargo, we took that as well, for no extra charge..."
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply