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

Refactor and consolidate wield #79719

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

marilynias
Copy link
Contributor

@marilynias marilynias commented Feb 18, 2025

Summary

Infrastructure "Refactor wield"

Purpose of change

wield() would clear the old item if it was in you inventory, but not if it came from the world.
Additionally there are a couple different wield() functions:

void game::wield( item_location loc )

void game::wield()

bool avatar::wield( item &target, const int obtain_cost )

bool npc::wield( item &it )

I want to unify them.
some context: discord and #79716

Describe the solution

create npc::wield( item_location loc ) that takes the location, so I can remove the old location and wield_new( item it ) since sometimes you want to wield a newly created item without a location.

There are some subtle differences between the current wield function, which have to be implemented .
use item_location where available, for newly created items make wield_new method

Describe alternatives you've considered

Testing

compiles
all [w]ield functions work
trading npc resulting in wield works
wielding from reloading works
dropping into vehicle from [w]ield works without old game::wield logic
Some wield-times seem to complain.

Additional context

Things WILL break.

@marilynias marilynias marked this pull request as draft February 18, 2025 14:05
@github-actions github-actions bot requested a review from KorGgenT February 18, 2025 14:05
@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Missions Quests and missions Bionics CBM (Compact Bionic Modules) Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Melee Melee weapons, tactics, techniques, reach attack Character / World Generation Issues and enhancements concerning stages of creating a character or a world Items: Containers Things that hold other things Mechanics: Enchantments / Spells Enchantments and spells EOC: Effects On Condition Anything concerning Effects On Condition Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Feb 18, 2025
@github-actions github-actions bot added the Code: Build Issues regarding different builds and build environments label Feb 20, 2025
@marilynias marilynias marked this pull request as ready for review February 20, 2025 13:42
@marilynias marilynias changed the title Refactor wield Refactor and consolidate wield Feb 20, 2025
@marilynias
Copy link
Contributor Author

marilynias commented Feb 20, 2025

should be ready for first looks

@marilynias marilynias marked this pull request as draft February 21, 2025 11:40
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 Bionics CBM (Compact Bionic Modules) [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Code: Build Issues regarding different builds and build environments Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling EOC: Effects On Condition Anything concerning Effects On Condition Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Items: Containers Things that hold other things json-styled JSON lint passed, label assigned by github actions Mechanics: Enchantments / Spells Enchantments and spells Melee Melee weapons, tactics, techniques, reach attack Missions Quests and missions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant