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

Allow EOCs to check and modify battery charge in items #74748

Merged
merged 9 commits into from
Jun 28, 2024

Conversation

zachary-kaelan
Copy link
Contributor

Summary

Infrastructure "Allow EOCs to check and modify battery charge in items"

Purpose of change

Fixes #74657

Describe the solution

Override the power_cur, power_max, and set_power_cur functions for talker_item, to make those functions work intuitively with items.

Describe alternatives you've considered

Make completely new functions.

Testing

[
  {
    "type": "effect_on_condition",
    "id": "eoc_print_inv_power",
    "effect": [
      {
        "u_run_inv_eocs": "all",
        "search_data": [ { "flags": [ "RECHARGE" ] }, { "flags": [ "ELECTRONIC" ] } ],
        "true_eocs": [ "eoc_print_item_charge" ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "eoc_charge_inv_power",
    "effect": [
      {
        "u_run_inv_eocs": "all",
        "search_data": [ { "flags": [ "RECHARGE" ] }, { "flags": [ "ELECTRONIC" ] } ],
        "true_eocs": [ "eoc_charge_item" ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "eoc_charge_item",
    "condition": { "math": [ "n_val('power')", "<", "n_val('power_max')" ] },
    "effect": [ { "math": [ "n_val('power')", "++" ] } ]
  }
]

image
image
image
image

Additional context

None.

@zachary-kaelan zachary-kaelan changed the title Battery eocs Allow EOCs to check and modify battery charge in items Jun 24, 2024
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs EOC: Effects On Condition Anything concerning Effects On Condition <Bugfix> This is a fix for a bug (or closes open issue) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jun 24, 2024
@GuardianDll
Copy link
Member

You can.. stack multiple search_data objects of the same type? Holy mother of god i didn't even knew about it. Can you please document it somewhere with this examples?

@zachary-kaelan
Copy link
Contributor Author

You can.. stack multiple search_data objects of the same type? Holy mother of god i didn't even knew about it. Can you please document it somewhere with this examples?

It's an array, but the description used the singular condition and the examples didn't give any indicator that multiple conditions could be stacked. I think I only noticed it was an array because of errors when I didn't use an array.

I added some clarification to the documentation.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 25, 2024
@Maleclypse Maleclypse merged commit e2af6e2 into CleverRaven:master Jun 28, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add way for EoCs to interact with item battery power
3 participants