Author Topic: New optionnal feature: storage in hangars  (Read 11480 times)

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
New optionnal feature: storage in hangars
« on: August 26, 2013, 10:17:51 pm »
Hi,

Being used with the original game, taking in account items on Skyrangers in the base storage capacity somewhat hurt me. I believe to compensate, we should add some storage in the hangar, at least as an optional feature. A value such as 10 would be nice, because 20 soldiers each with a riffle, a rifle clip, an electro-flare and a grenade would need this storage. It sounds to me logical some equipment can be stored in the hangar, or some Stingray or Avalanche missiles.

But I'm not sure what is the better way to do that. I have tried to modify the RuleBaseFacility::load() function adding the following:
Code: [Select]
_storage += _crafts * Options::getInt("storageInHangar");

This seems to work perfectly, but am I doing it the good way?

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: New optionnal feature: storage in hangars
« Reply #1 on: August 26, 2013, 11:02:39 pm »
Much easier to just change it with ruleset editing.
Code: [Select]
facilities:
  - type: STR_HANGAR
    spriteShape: 9
    spriteFacility: 9
    size: 2
    buildCost: 200000
    buildTime: 25
    monthlyCost: 25000
    crafts: 1
    mapName: XBASE_16
    storage: 10

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #2 on: August 26, 2013, 11:08:52 pm »
Much easier to just change it with ruleset editing.

I understand, but this way it will never be an option the user could change in the UI.

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #3 on: August 26, 2013, 11:18:20 pm »
I have thought of another way to do this which seem more logical to me, modifying Base::getAvailableStores() function:

Code: [Select]
total += (*i)->getRules()->getStorage() + Options::getInt("storageInHangar") * (*i)->getRules()->getCrafts();

Offline Amunak

  • Colonel
  • ****
  • Posts: 101
    • View Profile
    • My homepage (czech only)
Re: New optionnal feature: storage in hangars
« Reply #4 on: August 27, 2013, 08:23:49 pm »
Oh, and I thought that you want to be able to have hangar as a huge storage when there's no aircraft assigned. That'd be a good idea too I think.

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: New optionnal feature: storage in hangars
« Reply #5 on: August 27, 2013, 08:38:06 pm »
I understand, but this way it will never be an option the user could change in the UI.
Ah, as one of the Advanced options?

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #6 on: August 27, 2013, 08:54:56 pm »
Oh, and I thought that you want to be able to have hangar as a huge storage when there's no aircraft assigned. That'd be a good idea too I think.

This would be also a good idea, but way more complex to implement. And if you go this way you could tell any unused building could be used for storage, and implementing that would be really painful.

Anyway, a hangar is a sort of big square, right, and none of the ships can occupy the whole place, so even an occupied hangar should be able to store some boxes with various supplies, such as missiles for interceptors or laser weapons in case a skyranger has to take off in an emergency.

Ah, as one of the Advanced options?

Voila, this is exactly what I want to do.

I'm going to try to make a pool request with this very simple development, this will be a good exercise for me since as I have never used Git.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2161
    • View Profile
Re: New optionnal feature: storage in hangars
« Reply #7 on: August 27, 2013, 10:22:35 pm »
Feel free to use it as an exercise, but don't expect to see it merged, we really don't need more one-man options, specially if it can be done much more simply with a ruleset.

Offline Amunak

  • Colonel
  • ****
  • Posts: 101
    • View Profile
    • My homepage (czech only)
Re: New optionnal feature: storage in hangars
« Reply #8 on: August 27, 2013, 10:50:18 pm »
This would be also a good idea, but way more complex to implement. And if you go this way you could tell any unused building could be used for storage, and implementing that would be really painful.
Well...But hangar is, just as you said, an empty space. Labs, prison, workshop, soldier's quarters... Those aren't really empty. Also there are often times when you build a hangar and then don't have enough money for a craft (or you lose one). All other places are usually occupied, and even if they aren't that's just for few days.

Anyway, a hangar is a sort of big square, right, and none of the ships can occupy the whole place, so even an occupied hangar should be able to store some boxes with various supplies, such as missiles for interceptors or laser weapons in case a skyranger has to take off in an emergency.
That's very true. Maybe by the same logic there could be like 5 storage unit in every other building (you know workshops, labs, ... contain their items near) and like 10 for living quarters. I think it'd unbalance the game too much, it'd be just some extra realism.

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #9 on: August 28, 2013, 12:39:38 am »
@SupSuperMaster

I have tried to send a pull request, I am not sure I have done it the good way.
I have also created a serial patch, please tell me if I have done it the good way.



Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #10 on: August 28, 2013, 07:36:06 pm »
I don't see my push request in the list, I'm pretty sure I was not able to create it correctly...

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2161
    • View Profile
Re: New optionnal feature: storage in hangars
« Reply #11 on: August 30, 2013, 02:31:04 am »
Seems to be working now.
Anyways, rulesets will eventually get a GUI, I didn't hide them in the "options.cfg" out of spite, they're just an incomplete implementation that the community ran away with. :P

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New optionnal feature: storage in hangars
« Reply #12 on: September 01, 2013, 05:17:33 pm »
Anyways, rulesets will eventually get a GUI, I didn't hide them in the "options.cfg" out of spite, they're just an incomplete implementation that the community ran away with. :P

If you do this, I hope the rulesets will be duplicated in user directory. Data in the installation directory should not be writable for lambda users. I hope you agree with me.