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

jsonize toolweapon actions #70791

Merged
merged 26 commits into from
Jan 25, 2024
Merged

Conversation

nornagon
Copy link
Contributor

@nornagon nornagon commented Jan 9, 2024

Summary

Infrastructure "Added transform_item and turn_cost EOC effects, and has_ammo condition"

Purpose of change

Expands the capabilities of item EOCs enough to JSONize all the
toolweapon effects (trimmer, carver, chainsaw, masonrysaw etc.).

Describe the solution

  • Replaced the toolweapon use_actions and tick_actions by EOCs.
  • Added new has_ammo conditional to allow the EOC to fail if the chainsaw is
    out of ammo. This calls ammo_sufficient under the hood.
  • Added new transform_item effect which calls convert.
  • Added new turn_cost effect to add a move cost to an activation EOC. Counts
    in turns instead of moves because this way I could reuse the duration_var
    infrastructure, so you can specify this in seconds in a string if you want.

The only thing I haven't ported over is the chainsaw idle / theme ambient sounds. I'll add an EOC effect to control ambient sounds once #70898 lands.

Describe alternatives you've considered

Maybe this is better off staying in C++? I feel like the JSON is more flexible
and moddable, and it seems weird to me for chainsaws to be "blessed" in this
way. But the new JSON is quite a bit more verbose than the old JSON. It would
be nice if there were a less-verbose way to say "invoke this EOC with these
variables".

Testing

  • Activate a charged combat chainsaw, then checked:
    • Move cost was applied
    • Message was printed (NB this is a bugfix! In current experimental, no
      message is printed when you successfully start a chainsaw.)
    • The item was converted to it's _on variant
    • The running sounds messages are printed every now and then
  • Manually deactivate a charged combat chainsaw (on)
    • The deactivate message is printed
    • The item is transformed to _off
  • Activate a charged combat chainsaw while underwater
    • The failure message is printed
    • The item is not transformed
  • Activate a combat chainsaw with no fuel
    • The failure message is printed
    • The item is not transformed
  • Activate a charged combat chainsaw, then move underwater
    • The drown message is printed
    • The item is reverted to _off

Additional context

@github-actions github-actions bot added Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership Translation I18n [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs [Python] Code made in Python EOC: Effects On Condition Anything concerning Effects On Condition labels Jan 9, 2024
@GuardianDll
Copy link
Member

Isn't there only a chance to start a saw when you activate it? Or it's only for generic chainsaw?

@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jan 9, 2024
@nornagon
Copy link
Contributor Author

nornagon commented Jan 9, 2024

Isn't there only a chance to start a saw when you activate it? Or it's only for generic chainsaw?

Yeah, that's only for the generic chainsaw, the combat saws are guaranteed-start. Though with this change it'd be possible to tweak that in JSON :)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 9, 2024
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Jan 10, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jan 10, 2024
@nornagon nornagon changed the title jsonize combatsaw actions jsonize combatsaw and carver actions Jan 12, 2024
@nornagon
Copy link
Contributor Author

Also jsonized carver_off here. It had a "works underwater" flag set in the C++, but the JSON for that object has the "WATER_BREAK_ACTIVE" flag, which makes more sense.

nornagon and others added 4 commits January 13, 2024 11:30
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nornagon nornagon changed the title jsonize combatsaw and carver actions jsonize toolweapon actions Jan 13, 2024
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Jan 13, 2024
Copy link
Contributor

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • With a roar, the polesaw screams to life!

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions and removed json-styled JSON lint passed, label assigned by github actions labels Jan 13, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 23, 2024
@Maleclypse
Copy link
Member

I'm going to let you handle the conflict on this one.

@GuardianDll
Copy link
Member

May i ask to document new effects that was added in this PR? specifically turn_cost, has_ammo and transform_item in EFFECT_ON_CONDITION.md, and damage_level in NPCs.md (unless i miss some more changes)

@Maleclypse Maleclypse merged commit 950ea96 into CleverRaven:master Jan 25, 2024
21 of 28 checks passed
@nornagon nornagon deleted the eoc_chainsaws branch January 25, 2024 09:50
@nornagon
Copy link
Contributor Author

@GuardianDll will do in a followup now that this has been merged.

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` 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 [Python] Code made in Python Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants