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

move volume and weight vals to math #76968

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

GuardianDll
Copy link
Member

@GuardianDll GuardianDll commented Oct 11, 2024

Summary

None

Purpose of change

Since #76892 allow to use math evaluation on items, that means we can just add math function that allow us to directly check whatever we need, in all possible ways

Describe the solution

This PR replaces old u_val('weight') and u_val('volume') with math syntax, that allow to be used on items. For volume it also adds abiltiy to read character volume

Testing

test json
  {
    "type": "effect_on_condition",
    "id": "AAAAAAAA",
    "effect": [
      {
        "u_run_inv_eocs": "manual_mult",
        "true_eocs": [
          {
            "id": "EOC_WHATEVER_0",
            "effect": [
              { "math": [ "_u", "=", "u_weight()" ] },
              { "math": [ "_n", "=", "n_weight()" ] },
              {
                "u_message": "alpha: <u_name>, weight <context_val:u> mg, beta: <npc_name>, weight <context_val:n> mg"
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "BBBBBBBB",
    "effect": [
      {
        "u_run_inv_eocs": "manual_mult",
        "true_eocs": [
          {
            "id": "EOC_WHATEVER_1",
            "effect": [
              { "math": [ "_u", "=", "u_volume()" ] },
              { "math": [ "_n", "=", "n_volume()" ] },
              {
                "u_message": "alpha: <u_name>, volume <context_val:u> ml, beta: <npc_name>, volume <context_val:n> ml"
              }
            ]
          }
        ]
      }
    ]
  },

image

Additional context

i would really like to also add the field similar to time() funciton, but #70996 uses some magic i am not familiar with

@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 Mods Issues related to mods or modding [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs EOC: Effects On Condition Anything concerning Effects On Condition Mods: Mind Over Matter astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Oct 11, 2024
@GuardianDll GuardianDll force-pushed the math_volume_and_weight branch from c2a35a8 to c2a171d Compare October 11, 2024 14:01
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 13, 2024
@Maleclypse Maleclypse merged commit 1380795 into CleverRaven:master Oct 14, 2024
27 of 28 checks passed
@Maleclypse Maleclypse deleted the math_volume_and_weight branch October 14, 2024 04:34
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 [C++] Changes (can be) made in C++. Previously named `Code` <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 Mods: Mind Over Matter Mods Issues related to mods or modding NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants