aliens

Author Topic: [DONE] [Suggestion] Random manufacturing  (Read 17205 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Random manufacturing
« Reply #15 on: January 29, 2019, 07:49:38 pm »
It's probably naive, but:
Would it be possible to add extra indentation to the items? Seeing them just lined up with the weights is really confusing... Like the 40 or 60 was another item to choose.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #16 on: January 29, 2019, 08:01:55 pm »
You can do whatever YAML syntax allows, assuming:
- randomProducedItems is a list
- each list item contains a pair (a sub-list with exactly 2 items)
- first item in the pair is an integer
- second item in the pair is a dictionary (items in dictionary are string on the left and integer on the right)

https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html

This would for example work too:
Code: [Select]
    randomProducedItems:
      -
        - 60
        -   STR_MOTION_SCANNER: 4
            STR_MEDI_KIT: 3
            STR_PSI_AMP: 2
      -
        - 40
        -   STR_MOTION_SCANNER: 40
            STR_MEDI_KIT: 30
« Last Edit: January 29, 2019, 08:05:53 pm by Meridian »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Random manufacturing
« Reply #17 on: January 29, 2019, 08:24:40 pm »
Yes, that looks much cleaner. Thank you! :)

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #18 on: January 29, 2019, 10:36:48 pm »
Just out of curiosity, is there something that prevents the weights to be part of the first level of indentation?
e.g.
Code: [Select]
randomProducedItems:
  - 60
    - STR_A: 4
    - STR_B: 5
  - 40
    - STR_C: 6

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #19 on: January 29, 2019, 10:41:21 pm »
Just out of curiosity, is there something that prevents the weights to be part of the first level of indentation?

YAML syntax, as far as I know.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #20 on: January 29, 2019, 10:57:10 pm »
Fair enough.

Thanks for the quick answer.

Offline Roxis231

  • Colonel
  • ****
  • Posts: 484
  • Catching the feral kitten hiding in my rubish bin
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #21 on: January 30, 2019, 12:17:02 am »
Has this been added to Extended yet? or are you still working on it?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #22 on: January 30, 2019, 12:29:41 am »
I have asked how should it work a few hours and few posts ago... what do you think?

Offline Roxis231

  • Colonel
  • ****
  • Posts: 484
  • Catching the feral kitten hiding in my rubish bin
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #23 on: January 30, 2019, 03:25:24 am »
Ok.  Will be keeping an eye on this now - I can see a LOT of uses for this when its up and running.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #24 on: January 30, 2019, 11:06:45 am »
Ok.  Will be keeping an eye on this now - I can see a LOT of uses for this when its up and running.

If you plan on using it, then I'm interested in your opinion/feedback on the question stated above too...

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion] Random manufacturing
« Reply #25 on: January 30, 2019, 01:25:07 pm »
Question: How would you like to inform the user what will he get from the project? (on the attached screen)

Hoping for answer/feedback like:
1/ don't show anything to the player
2/ tell player it's gonna be random, but not any details
3/ tell player all the details/possibilities
4/ make a popup each time something is produced about what was actually done
5/ something even more crazy :)
6/ etc.
I am voting for [2]. But maybe with a string , informing user about resulting items type. Like "Spare parts", "Donor organs", e.t.c.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [DONE] [Suggestion] Random manufacturing
« Reply #26 on: January 31, 2019, 06:13:49 pm »
Since you were the only vote, you win :)

Attached how would it look like:
- just a simple message "Random production!" ...instead of "Units Produced" + list of items
- the string informing about resulting item types should just be the manufacturing project name I guess...

OXCE Download: https://lxnt.wtf/oxem/builds//Extended/Extended-5.2-b5dcebc3c-2019-01-31-win32.7z

One more example... for those, who don't know how to turn off the default production of an item named after the project (just override "producedItems"):

Code: [Select]
manufacture:
  - name: STR_RANDOM_JUNK1
    category: STR_JUNK
    requiredItems:
      STR_ALIEN_ALLOYS: 2
      STR_ELERIUM_115: 1
    producedItems:               # empty
      {}
    randomProducedItems:
      -
        - 70
        -   STR_PSI_AMP: 1
            STR_MEDI_KIT: 2
      -
        - 30
        -   STR_MOTION_SCANNER: 3
            STR_MEDI_KIT: 4
    space: 0
    time: 20
    cost: 1000

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: [DONE] [Suggestion] Random manufacturing
« Reply #27 on: January 31, 2019, 09:25:42 pm »
A sensible decision.

Looking at your example script i have one question though (although i suspect you've already thought of it).

What happens if the modder accidentally leave entries in the "producedItems" slot?
Are they discarded (possibly with a warning in the log), do they show up besides the random items, or is it undefined behavior?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [DONE] [Suggestion] Random manufacturing
« Reply #28 on: January 31, 2019, 11:20:48 pm »
A sensible decision.

Looking at your example script i have one question though (although i suspect you've already thought of it).

What happens if the modder accidentally leave entries in the "producedItems" slot?
Are they discarded (possibly with a warning in the log), do they show up besides the random items, or is it undefined behavior?

The "producedItems" will be produced normally and then additionally random items will be produced too.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Random manufacturing
« Reply #29 on: February 01, 2019, 02:52:47 am »
To be sure, how will look empty production variant? Like this?
 
Code: [Select]
  randomProducedItems:
      -
        - 70
        -   [] #bad luck
      -
        - 30
        -   STR_MOTION_SCANNER: 3