Author Topic: Item list  (Read 4376 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Item list
« on: March 01, 2015, 02:13:22 am »
My suggestion is mostly relevant to modding, but again, which one isn't nowadays?

Basically, I would like to see a new ruleset option: container list. This list contains a number of entries, like items or research objects, and represents all of them.

For example, in the FMP, every alien engineer has the following entry:

Code: [Select]
    getOneFree:
      - STR_SMALL_SCOUT
      - STR_MEDIUM_SCOUT
      - STR_LARGE_SCOUT
      - STR_HARVESTER
      - STR_ABDUCTOR
      - STR_TERROR_SHIP
      - STR_BATTLESHIP
      - STR_SUPPLY_SHIP
      - STR_SENTRY_SHIP
      - STR_FIGHTER_SHIP
      - STR_LAB_SHIP
      - STR_EXCAVATOR
      - STR_RAIDER_SHIP
      - STR_PARTICLE_MICROACCELERATION
      - STR_ANTIMATTER_CONTAINMENT
      - STR_FUSION_EXPLOSIVES
      - STR_ALIEN_GRAVITY_GENERATOR
      - STR_TRACTOR_BEAM_GENERATOR
      - STR_ADVANCED_PLASMA_PHYSICS
      - STR_ALIEN_ELECTRONICS
      - STR_DELTA_RADIATION
      - STR_SECTOPOD
      - STR_CYBERDISC
      - STR_SECTOPOD_CORPSE
      - STR_CYBERDISC_CORPSE

This means I have to repeat this chunk of text under every single engineer, which bloats the ruleset and is prone to errors. Which sufficient number of entries, data management becomes a hassle due to the sheer amount of data and scrolling.

I would rather see a new ruleset section:

Code: [Select]
lists:
  - type: LIST_ALIEN_ENGINEER_GET_ONE_FREE
    section: research
    items:
      - STR_SMALL_SCOUT
      - STR_MEDIUM_SCOUT
      - STR_LARGE_SCOUT
      - STR_HARVESTER
      - STR_ABDUCTOR
      - STR_TERROR_SHIP
      - STR_BATTLESHIP
      - STR_SUPPLY_SHIP
      - STR_SENTRY_SHIP
      - STR_FIGHTER_SHIP
      - STR_LAB_SHIP
      - STR_EXCAVATOR
      - STR_RAIDER_SHIP
      - STR_PARTICLE_MICROACCELERATION
      - STR_ANTIMATTER_CONTAINMENT
      - STR_FUSION_EXPLOSIVES
      - STR_ALIEN_GRAVITY_GENERATOR
      - STR_TRACTOR_BEAM_GENERATOR
      - STR_ADVANCED_PLASMA_PHYSICS
      - STR_ALIEN_ELECTRONICS
      - STR_DELTA_RADIATION
      - STR_SECTOPOD
      - STR_CYBERDISC
      - STR_SECTOPOD_CORPSE
      - STR_CYBERDISC_CORPSE

Then, each engineer entry would only have:
Code: [Select]
    getOneFree:
      - LIST_ALIEN_ENGINEER_GET_ONE_FREE

Looks nice, doesn't it?

Then, you could combine lists. For example, in the FMP, leaders give one discovery either from the abovementioned engineer list or the medic list, which contains live alien research and other biology-related stuff. So you could have

Code: [Select]
    getOneFree:
      - LIST_ALIEN_ENGINEER_GET_ONE_FREE
      - LIST_ALIEN_MEDIC_GET_ONE_FREE

as long as you make the LIST_ALIEN_MEDIC_GET_ONE_FREE list.

Furthermore, this feature is not limited to research topics. For example, we could have random "treasure stashes", (particularly useful for the Piratez mod). For example, you make a list:

Code: [Select]
lists:
  - type: LIST_FREIGHTER_CHEST_BOOTY
    section: items
    items:
      - STR_BEER
      - STR_VODKA
      - STR_LIGHT_CRYSTAL
      - STR_SCRAP_METAL
      - STR_CHEMICALS
      - STR_PARTS_GAUSS_COIL
      - STR_CREDIT_CHIP_M

And then you simply add this list to the relevant map block like any item, and they'll all spawn there.
Or even better, we could have an additional parameter in the list:

Code: [Select]
lists:
  - type: LIST_FREIGHTER_CHEST_BOOTY
    section: items
    pickrandom: true
    items:
      - STR_BEER
      - STR_VODKA
      - STR_LIGHT_CRYSTAL
      - STR_SCRAP_METAL
      - STR_CHEMICALS
      - STR_PARTS_GAUSS_COIL
      - STR_CREDIT_CHIP_M

And only one random item will spawn.

As I said, the main objective of this feature is modding, but it would also be useful for medic and engineer entries in the vanilla game.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Item list
« Reply #1 on: March 01, 2015, 02:50:45 am »
If you repeat something in yaml you should use:

Code: [Select]
somthing: &nameRef
  - A
  - B
somethingElse: *nameRef #now equal [A, B]
But this can only "copy" whole node and you can't  merge two.
This would need support form game, one simple solution would be allow nested values:
Code: [Select]
something:
  - [A, B]
  - [C, D]
#this is equal for game:
something:
  - A
  - B
  - C
  - D
#in consequence this will allow:
something:
  - *someRef1
  - *someRef2
  - NewValue

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Item list
« Reply #2 on: March 01, 2015, 08:43:16 am »
That's interesting Yankes, but it doesn't really solve any problems, except maybe the file size. I don't think it could be used practically for modding, and it certainly isn't easy to use.

Offline NoelBuddy

  • Colonel
  • ****
  • Posts: 142
    • View Profile
Re: Item list
« Reply #3 on: March 01, 2015, 08:50:23 pm »
Seconded! There's certainly a balance to be struck when making things easier for creating different races between ease of implementation and limiting flexibility of new creations. I would say doing something like this to make adding these repetitive lists would be very nice.

If it helps any here's what I've posted on a now dead thread about a similar idea.

7)  This is manipulable depending on how they are discovered, I've done a lot of discovering different ways to make things not work as intended on the subject, along with getting it to tell you all the research options that have just been unlocked in the splash screen(like after Laser Weapons it tells you Laser Pistol is unlocked) they always show up in the list but I had to work thru several iterations where it wouldn't tell you you've unlocked topic X.

Would also like a way to separate the medics/engineers/navigators getOnefree list from the specific aliens.  For example:
Code: [Select]
  - name: STR_SECTOID_MEDIC

    unlocks:      - STR_MEDIC_LIST #Unlocks STR_MEDIC_LIST, but even if you give the STR a cost: 0 or
don't give it a cost you need to spend one scientist day to trigger the get one free, it doesn't go away after you research it#

    getOneFree:       - STR_MEDIC_LIST #Gives you STR_MEDIC_LIST as a completed topic but doesn't trigger the getOnefree and only works once#

 - name: STR_MEDIC_LIST
   dependencies: STR_ALIEN_MEDIC #Making some secondary trigger dependency solves the cost: problem of unlocks: it but it only works once.#
   getOnefree:
      - STR_SNAKEMAN etc...

This would make adding entries for new aliens/UFOs/missions easier as you would only have to add it to one place, that way a sectoid medic will know all the same species as a Gazer medic will know all the same species as a medic from what ever new monstrosity people can come up with, with only one line in each ruleset, rather than having to make sure to have entries adding the new entry to every single appropriate alien.

Offline DoxaLogos (JG)

  • Colonel
  • ****
  • Posts: 358
  • Squaddie cautiously peering through the breach
    • View Profile
Re: Item list
« Reply #4 on: March 10, 2015, 07:15:56 am »
I found this about YAML merging from https://github.com/darvid/trine/wiki/YAML-Primer:

Quote
Merging Mappings

_FreeItemProps: &FREE
    SellPrice: 1
    BuyPrice: 0

item:
  - method: UPDATE
    where: {name: !include "itemlists/pve_weapons.yml"}
    <<: *FREE
Merge keys (<<) allow you to merge all keys and values from one or more mappings (multiple mappings can be referenced in a sequence, like [*FREE_TO_BUY, *FREE_TO_SELL]) into the current mapping.

Don't know for sure if this accomplishes what you want, since I'm not well versed in the use of YAML.  But, your request to create lists, so you can reference them elsewhere seems reasonable.