aliens

Author Topic: [DONE][Suggestion] cantBeBuiltWith property for xcom base facilities  (Read 6303 times)

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #15 on: March 21, 2020, 07:31:37 pm »
Is my solution bad? It is really tiny and has no such limitations. It is not making for just XCF, one-day modder will come asking to free him from that. Also, modder will be free from functionality stuff that is also used widely for research and manufacture - and in complex mega mods that can do additional mess

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #16 on: March 21, 2020, 07:36:01 pm »
Because do not solve core of problem. If you add forbidden and required functionality to your buildings then it will easy break and you will end up in same situation as now.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #17 on: March 21, 2020, 07:53:36 pm »
I paste here a simplest test case I can think of:

1. you can build a small radar from scratch
2. you can build a large radar from scratch
3. you can upgrade a small radar to large radar
4. you cannot build 2 small radars
5. you cannot build 2 large radars
6. you cannot build small and large radar together

I hope this is a complete example and can be used for testing, regardless of chosen implementation.

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #18 on: March 21, 2020, 08:11:40 pm »
I paste here a simplest test case I can think of:

1. you can build a small radar from scratch
2. you can build a large radar from scratch
3. you can upgrade a small radar to large radar
4. you cannot build 2 small radars
5. you cannot build 2 large radars
6. you cannot build small and large radar together

I hope this is a complete example and can be used for testing, regardless of chosen implementation.

I think all that doable with current OXCE with `maxAllowedPerBase` and functionalities. I'd like to add:
7. you can upgrade small radar to large radar, but there is no possible way to have them both at the same time.
for that, it split these cases, but they must be all true with the same ruleset
7.1 you can place large radar on small radar (currently possible with `buildOverFacilities`)
7.2 you cant build large radar as a separate building if you already have small radar, thus having 2 of them at the same time (solved with `isUpgrade: true`, so you can replace the facility. if it has `maxAllowedPerBase: 1` case solved)
7.3 you cant build small radar if you already have large radar, thus again having 2 of them at the same time (solved with `cantBeBuiltWith`)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #19 on: March 21, 2020, 08:20:55 pm »
7. you can upgrade small radar to large radar, but there is no possible way to have them both at the same time.

I'm sorry, maybe I'm really stupid, but how is that different from my point 6?

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #20 on: March 21, 2020, 08:31:22 pm »
because if you really cant build them together, you cant upgrade one to another, it goes to `_disabledFacilities.push_back(rule)`. I would, actually, keep it separate, for you would not be able to build, say Psi gates on your base if you already have, I don't know, Arcana gates. And I like it goes to the disabled list because it does not pass `cantBeBuiltWith`

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #21 on: March 21, 2020, 08:49:12 pm »
because if you really cant build them together, you cant upgrade one to another

I said very explicitly:
3. you can upgrade a small radar to large radar
6. you cannot build small and large radar together

I.e. you can upgrade one to another and you can't build them together.

I really don't know what else to say.

it goes to `_disabledFacilities.push_back(rule)`. I would, actually, keep it separate, for you would not be able to build, say Psi gates on your base if you already have, I don't know, Arcana gates. And I like it goes to the disabled list because it does not pass `cantBeBuiltWith`

I am not saying anything about current or future implementation details, just what the expected result should be.

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #22 on: March 21, 2020, 09:01:26 pm »
ok, I'm just saying I think it would be good to have separate ruleset design options to restrict having 2 buildings together (no matter they are upgrades or not) and another option to make upgradable unique building

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #23 on: March 28, 2020, 07:31:53 pm »
I'm now finishing my version of implementation.
One design decision was that to enable this functionality you need define `buildOverFacilities`, with this given facility will ignore forbidden functionalities when displayed on available build list. All checks will be done at moment when you try build it on other building.

Game will check if in base after removing old facilities and adding this new, all constrains still holds, aka all buildings have other build that provide its needed fucntion and there is no two buildings that forbids each other functionality.

This mean you can build over building that normally prevent building that new facility.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #24 on: May 17, 2020, 07:32:11 pm »
I paste here a simplest test case I can think of:

1. you can build a small radar from scratch
2. you can build a large radar from scratch
3. you can upgrade a small radar to large radar
4. you cannot build 2 small radars
5. you cannot build 2 large radars
6. you cannot build small and large radar together

I hope this is a complete example and can be used for testing, regardless of chosen implementation.

Here is the ruleset for a bit more complicated example (with 3 types of radar).

Code: [Select]
facilities:
  - type: STR_SMALL_RADAR_SYSTEM
    provideBaseFunc: [ RADAR ]
    forbiddenBaseFunc: [ RADAR ]
  - type: STR_LARGE_RADAR_SYSTEM
    provideBaseFunc: [ RADAR ]
    forbiddenBaseFunc: [ RADAR ]
    buildOverFacilities: [ STR_SMALL_RADAR_SYSTEM ]
  - type: STR_HYPER_WAVE_DECODER
    provideBaseFunc: [ RADAR ]
    forbiddenBaseFunc: [ RADAR ]
    buildOverFacilities: [ STR_SMALL_RADAR_SYSTEM, STR_LARGE_RADAR_SYSTEM ]

You can only have 1 radar in the base.
Each radar can be built from scratch.
Or following the upgrade path: Small radar -> Large radar -> Hyper radar.

This is available since OXCE v6.5.

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: [DONE][Suggestion] cantBeBuiltWith property for xcom base facilities
« Reply #25 on: May 19, 2020, 01:03:41 am »
Thank you! It is very welcome by many mods!