-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat: flag for items NPCs will use in combat. #1704
base: main
Are you sure you want to change the base?
Conversation
I'm trying to think of further things to develop here and coming up blank. None of the things I'd like are strictly a part of this PR and would be better served with follow up PRs (like the chainsaw and Bionic UPS/Interface) |
data/json/flags.json
Outdated
"id": "NPC_COMBAT_ITEM", | ||
"type": "json_flag", | ||
"context": [ ], | ||
"info": "A <good>follower</good> will attempt to <info>use</info> this item in combat." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it needs an info block like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume info block would make more sense if that were to more clearly imply activating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I can change it. Due to the way the flags are this is being slowly rolled out, so marking items that NPC's will activate and will not activate is important in my view
data/json/items/melee/bludgeons.json
Outdated
@@ -116,7 +116,7 @@ | |||
"symbol": "/", | |||
"material": [ "aluminum" ], | |||
"techniques": [ "WBLOCK_1", "RAPID" ], | |||
"flags": [ "DURABLE_MELEE", "BELT_CLIP" ], | |||
"flags": [ "DURABLE_MELEE", "BELT_CLIP", "NPC_COMBAT_ITEM" ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how it's on both active and inactive variants. If I give a NPC an extended baton, I want them to use an extended baton. In fact, it may be hard to get the NPC to equip a collapsed one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So a problem with making them check for the active variant is that the iuse can_use
for transforms doesn't cover all requirements, so for some requirements like need_charges
the NPC will not know it can't be used until they actually use them, and if an NPC fails it's silent because of the way the messages are printed.
My NPC started flipping the baton on and off during the fight when given the extended variant. |
src/npc.h
Outdated
/* | ||
* Perform any cleanup upon no more present danger, such as disabling combat CBMs or items. | ||
*/ | ||
void cleanup_on_no_danger(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the whole block above is full of methods, but they'd be better off as separate functions.
Consider a distant future when a player can let the AI control the character. If all the functionality is in npc methods, it will be harder and more hacky, but if it's all separate functions, it could be as easy as changing the npc
argument to player
(or even Character
) one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what protocol is for this, would I need to move the functions or shift them around in npc.h?
Gah, of course, I forgot it only counts active. If I want to make the baton work I'll need two flags, one to activate and one to deactivate. |
Or to compare their stats rather than using flags. |
31b0994
to
f15b4f8
Compare
Here is the point I'm restarting it from scratch, old version just doesn't work for what I need it to do. |
Move all iuse_transform can use checks into iuse_transform::can_use
28d530d
to
f04718f
Compare
Summary
SUMMARY: Features "Adds flag for items that NPCs will activate in combat."
Purpose of change
As a follow up #1505, make power armour and similar items usable by NPCs during combat.
Describe the solution
Modifies 52259 to function for most simple iuse actions, mainlytransform
andset_transform
. The inclusion of chainsaws and chainsaw lajatangs will need a follow up PR that converts theiriuse
intoiuse_actors
for ease of use.Canning the port, it's not going to do what I need it to do. New plan follows:
iuse_transform::can_use
actually account for all pre-requisites, if it returns true, then it can be used, no ifs, no buts, no niche requirements or bullshit.Describe alternatives you've considered
Not the worst idea, but this current system suffices. In the future we will need somewhat more intelligent usage of items by NPCs so that NPC enemies will be more threatening with equipment. (Optically cloaked bandits anyone?)
Testing
Additional context
Unactivated Power Armour is encumbering, very heavy, and very warm, fortunately, NPCs do not suffer from stamina issues, heat issues, and encumbrance disappears when it's activated in combat.
I will need to make 2 follow up PRs to this.