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

NOTCONSUMABLE inventory flag #2563

Closed

Conversation

Blue-Shadow
Copy link
Contributor

An item with this flag isn't consumed upon a successful use.

In my mod, I have powerups which are meant to be used infinitely but require the player to have enough "energy" to be successfully used/activated. So I propose this flag.

@RicardoLuis0
Copy link
Collaborator

that can already be done with zscript, no need for new flags

@Blue-Shadow
Copy link
Contributor Author

The flag is more convenient than overriding UseInventory and adding an exception for an item or item class that I want to have this mechanic.

@MajorCooke
Copy link
Contributor

Agreed, I think it'd be better to have an actual flag. This prevents some special cases from breaking consumption otherwise that I have to perform for some inventory items.

@Boondorl
Copy link
Contributor

I think my big issue is that there's not really a use case for this in vanilla meaning you'll inherently have to be making your own class. If that's the case it's probably better to throw this behavior into either a base class or mixin in your mod rather than adding an engine-wide flag. Flags and properties are rare to add nowadays because ZScript allows working around the old issues DECORATE had by essentially letting you write your own engine-level code. The only time they tend to be added is when it's something that cannot be trivially done from a mod and requires some level of cooperation with the core ZScript and the engine (especially for the latter). For instance, this snippet would do the same thing in the item classes:

override bool Use(bool pickup)
{
    Super.Use(pickup);
    return false;
}

@Blue-Shadow
Copy link
Contributor Author

That code snippet tells the engine the use has failed, even if didn't in reality, which means no use sound is played. I know, you're gonna tell me next to manually play the use sound in Use, but that's jumping through hoops just to get the behavior I want.

@RicardoLuis0
Copy link
Collaborator

That code snippet tells the engine the use has failed, even if didn't in reality, which means no use sound is played. I know, you're gonna tell me next to manually play the use sound in Use, but that's jumping through hoops just to get the behavior I want.

you can just override UseInventory to return true instead of Use, it's a virtual as well

@Blue-Shadow Blue-Shadow deleted the notconsumable_inventory_flag branch October 13, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants