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

Arithmetic is dead. And compare_int. And compare_num. Kinda. Long live the math! #70936

Merged
merged 27 commits into from
Jan 16, 2024

Conversation

GuardianDll
Copy link
Member

@GuardianDll GuardianDll commented Jan 14, 2024

Summary

None

Purpose of change

Replace almost all instances of arithmetic, compare_int and compare_num in favor of math

Describe the solution

Search all places this three fields are met in the json, and replace them with math, where possible
Fields that are not changed:
hour, { "time": "3 days" }, time_since_cataclysm, time_since_var - anything that touches time
{ "u_val": "spell_level", "school": "test_trait" } - u_spell_level can't use school syntax yet u_school_level() exists, apparently
moon - same as time

Testing

TBD

Additional context

I hope i ported all variables to math properly, but i would ask to doublecheck it
u_adjust_var would be the next one methinks
@TGWeaver you probably want to port this changes into your out of repo version of mod, so you won't accidentally overwrite it

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON Missions Quests and missions Bionics CBM (Compact Bionic Modules) Map / Mapgen Overmap, Mapgen, Map extras, Map display Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [Markdown] Markdown issues and PRs Melee Melee weapons, tactics, techniques, reach attack Mechanics: Weather Rain, snow, portal storms and non-temperature environment Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Aftershock Anything to do with the Aftershock mod Mechanics: Enchantments / Spells Enchantments and spells Limbs Limbs, mutable limbs, and code related to them. EOC: Effects On Condition Anything concerning Effects On Condition labels Jan 14, 2024
Copy link
Contributor

@andrei8l andrei8l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for doing this!

{ "u_val": "spell_level", "school": "test_trait" } - u_spell_level can't use school syntax yet

There's u_school_level(). It was split from u_spell_level() on purpose.

I lost track half way through, so I focused on the test errors. I'll take another look later.

data/json/effects_on_condition/addictions_eocs.json Outdated Show resolved Hide resolved
data/json/effects_on_condition/addictions_eocs.json Outdated Show resolved Hide resolved
data/json/monster_special_attacks/spells.json Outdated Show resolved Hide resolved
data/json/monster_special_attacks/spells.json Outdated Show resolved Hide resolved
data/json/npcs/exodii/exodii_merchant_missions.json Outdated Show resolved Hide resolved
data/mods/TEST_DATA/widgets.json Outdated Show resolved Hide resolved
data/mods/TEST_DATA/widgets.json Outdated Show resolved Hide resolved
data/mods/TEST_DATA/widgets.json Outdated Show resolved Hide resolved
data/json/effects_on_condition/bionic_eocs.json Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the json-styled JSON lint passed, label assigned by github actions label Jan 16, 2024
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 16, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 16, 2024
@Maleclypse Maleclypse merged commit 6fa0b0e into CleverRaven:master Jan 16, 2024
21 of 26 checks passed
@GuardianDll GuardianDll deleted the mathmathmath branch January 16, 2024 18:01
{ "compare_int": [ { "faction_like": "old_guard" }, "<", { "const": -45 } ] },
{ "compare_num": [ { "u_val": "var", "var_name": "government_assassins_sent" }, "<=", { "const": 6 } ] },
{ "math": [ "u_val('faction_like: old_guard')", "<", "-45" ] },
{ "math": [ "government_assassins_sent", "<=", "6" ] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ "math": [ "government_assassins_sent", "<=", "6" ] },
{ "math": [ "u_government_assassins_sent", "<=", "6" ] },

@@ -375,7 +375,7 @@
"spawn_message": "A professional-looking individual steps out of hiding and begins rapidly approaching you.",
"spawn_message_plural": "Professional-looking individuals step out of hiding and begin rapidly approaching you."
},
{ "arithmetic": [ { "u_val": "var", "var_name": "government_assassins_sent" }, "+=", { "const": 2 } ] }
{ "math": [ "government_assassins_sent", "+=", "2" ] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ "math": [ "government_assassins_sent", "+=", "2" ] }
{ "math": [ "u_government_assassins_sent", "+=", "2" ] }

@@ -391,7 +391,7 @@
"spawn_message": "A professional-looking individual steps out of hiding and begins rapidly approaching you.",
"spawn_message_plural": "Professional-looking individuals step out of hiding and begin rapidly approaching you."
},
{ "arithmetic": [ { "u_val": "var", "var_name": "government_assassins_sent" }, "+=", { "const": 2 } ] }
{ "math": [ "government_assassins_sent", "+=", "2" ] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ "math": [ "government_assassins_sent", "+=", "2" ] }
{ "math": [ "u_government_assassins_sent", "+=", "2" ] }

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 Bionics CBM (Compact Bionic Modules) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Limbs Limbs, mutable limbs, and code related to them. Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs Mechanics: Enchantments / Spells Enchantments and spells Mechanics: Weather Rain, snow, portal storms and non-temperature environment Melee Melee weapons, tactics, techniques, reach attack Missions Quests and missions Mods: Aftershock Anything to do with the Aftershock mod Mods: Bombastic Perks Mods: Desert Region Anything relating to the Desert Region mod Mods: Innawood 🌲 Anything to do with Innawood mod Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Mind Over Matter Mods: Sky Island Anything about the Sky Island mod Mods: Xedra Evolved Anything to do with Xedra Evolved Monsters Monsters both friendly and unfriendly. Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants