-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RDY] Stop NPCs from stealing from your vehicles #22144
Conversation
"Locking" a shopping cart? Let's just drop the NPC pickup from vehicles if it's such a problem. Alternatively, allow "claiming" a remembered vehicle. A number of claimed vehicles could be limited per overmap (remembered vehicles are visible from overmap level at the code side). |
It would be rather easy to stop NPCs from looting cars. It would be a simple solution but may be too broad. Would it mess up any kind of quest or something? |
This is too broad, if you're going to lock vehicle tiles, there needs to be
a mechanism to do so such as a locked trunk or door, or with a shopping
cart a lid.
In other words, add a LOCKING_CARGO flag to appropriate vehicle parts and
use that to disallow NPC access.
From a UI point of view, just disallow NPC access if the flag is present,
no need to manually lock and unlock.
|
I was thinking that the COVERED flag could also make the cargo inaccessible to NPCs. If it is able to block all light then it can make it so NPCs can't see or take these items |
No... NPCs are people and they're just as capable of opening containers as the player is, COVERED doesn't cut it. |
… floor trunk, stow board, all hatches, trunk, box, wooden box, folding wooden box, and cargo space
Build is failing, you didn't clean up all the manual lock/unlock changes and that's breaking compilation. Also this needs to be surfaced to the player somehow, that can stay as a TODO for the moment since some players clearly expect NPCs to be unable to take things anyway, but we need to communicate to the player that some cargo locations are safe from NPCs and others aren't. |
Where would I add the TODO comment? |
…om stow boards, boxes, and cargo spaces. Added new boxes that have CARGO_LOCKING.
npcmove.cpp is on the astyle-blacklist so do I need to worry that it failed it's astyle check? I only changed a few lines. Also I have no idea why this monster-test.cpp failed. I didn't touch it |
Npcmove.cpp is no longer on the a style blacklist in the main branch. Don't worry about it too much though, I can easily fix it when merging. |
data/json/vehicle_parts.json
Outdated
"location" : "center", | ||
"flags" : ["CARGO", "CARGO_LOCKING", "TOOL_SCREWDRIVER", "BOARDABLE", "COVERED"], | ||
"breaks_into": "ig_vp_frame" | ||
},{ |
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.
Vehicle parts support "copy-from". Don't specify everything from scratch.
Check out data/json/vehicleparts/battery.json
for an example.
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.
Good point. I will do this
Resolved merge conflicts in npcmove.cpp by accepting the master code
Could someone re-run the travis test please? |
Realized something else about this, we're having a lock (and key, but I'm less concerned about that) appear out of nowhere when you craft a frame into a trunk or hatch. Hinges and a latch were already pushing it a bit, but now it's starting to get a bit silly. In the end, this is mostly a bookkeeping issue since most frames are harvested from vehicles anyway, so presumably we're getting a stock of hinges, latches, handles, and locks from tearing down other vehicles, so we can call it "abstracted" for now, but this is something to track in the future that can expand vehicle crafting. |
I like this idea. It would be an interesting addition to vehicles |
Now that I think about it, having to detach and reattach every vehicle part just to make it lockable sounds very tedious. |
I like this. It would also solve the "worry" @kevingranade had about abstracting too much. |
I could make a vehicle lock part and make the parts with the "CARGO_LOCKING" flag have a "LOCKABLE_CARGO" flag. |
…re the lock can be installed.
I'm having an issue with my location flag. I have it coded like |
Added documentation to CARGO_LOCKING and LOCKABLE_CARGO flags
I fixed the location error. I needed to add a condition to the vehicle::can_mount() method since location isn't flexible like I thought. |
Jenkins, rebuild. |
I have added the ability to lock all cargo parts through the interact menu. Each cargo part can be individually locked. Intentionally made it part specific to make it harder to abuse the system.
This has been a long standing bug and I decided that it was worth trying to tackle. NPCs will no longer steal from your shopping cart so long as it is locked.
Let me know if anything should be change.