Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create talker item, paving way for greater item json interactions. #49950

Merged
merged 3 commits into from
Jul 31, 2021

Conversation

Ramza13
Copy link
Contributor

@Ramza13 Ramza13 commented Jul 15, 2021

Summary

Infrastructure "Create talker item, add consumption_eocs"

Purpose of change

Allow item EOC's to run functions on the item. At present location functions and allowing setting and accessing variables are the only supported functions.
Add consumption_eocs, effect on conditions run after consuming an item.

Describe the solution

talker_item has been a to-do for a number of projects and here is a basic version. This is a step towards having a conversation with an item.
Also part of my goal of creating migo bio technology. I want each piece to use a random function that once assigned doesn't change or does so in a controlled manner. So they all have the same name and you don't know what you are getting.

There has been discord talk of creating books with random quotes that don't change, this is a piece of that or even the whole thing if you are a masochist.

Also added consumption eoc's. These are for #35882. They are just effect_on_conditions run after consuming something. They are the second commit and could be seperate but are small and use talker_item.

Describe alternatives you've considered

Testing

Played around with this json

{
    "type": "effect_on_condition",
    "id": "EOC_1",
    "condition":{ "not":{"npc_has_var": "npc_foodperson_impressed", "type": "dialogue", "context": "foodperson", "value": "yes" }},
    "effect": [ { "message": "You feel very testy" }, { "npc_add_var": "npc_foodperson_impressed", "type": "dialogue", "context": "foodperson", "value": "yes" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_2",
    "condition":{ "npc_has_var": "npc_foodperson_impressed", "type": "dialogue", "context": "foodperson", "value": "yes" },
    "effect": [ { "message": "You score!" } ]
  },
  {
    "id": "test",
    "type": "TOOL",
    "name": { "str_sp": "test" },
    "description": "A test.",
    "weight": "1 g",
    "volume": "250 ml",
    "price": 3000,
    "price_postapoc": 10000,
    "symbol": "!",
    "color": "light_red",
    "use_action": {
      "type": "effect_on_conditions",
      "description": "Test.",
      "effect_on_conditions": [ "EOC_1", "EOC_2" ]
    }
  },

For consumption eocs just add the line: "consumption_effect_on_conditions":["EOC_SLEEP"],
to a food. I did protein_bar_evac since thats where this is planning to be used.

Additional context

@actual-nh actual-nh added <Enhancement / Feature> New features, or enhancements on existing Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Items / Item Actions / Item Qualities Items and how they work and interact [C++] Changes (can be) made in C++. Previously named `Code` labels Jul 15, 2021
@Ramza13 Ramza13 force-pushed the talker_item branch 2 times, most recently from aefa6d4 to 3b13bea Compare July 23, 2021 19:00
@kevingranade kevingranade merged commit a217565 into CleverRaven:master Jul 31, 2021
@Ramza13 Ramza13 deleted the talker_item branch July 31, 2021 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Enhancement / Feature> New features, or enhancements on existing Items / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants