Closed Xpyder closed 3 years ago
I can't test or verify that this is correct, but it looks like maybe you want map::veh_at and optional_vpartposition::[avail]part_with_feature using the flags in veh_type.h to construct something like
here.veh_at( target->pos() ).part_with_feature( VPFLAG_SEATBELT , true ); // or
here.veh_at( target->pos() ).avail_part_with_feature( VPFLAG_SEATBELT ); // maybe?
in mattack::ranged_pull with an if statement and whatever other logic, obviously
Ty, I'll review that and if it does what I need I'll close this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
Is your feature request related to a problem? Please describe.
Stuck on my fix for #22764
I can't figure out how to get a list of
vehicle_part
from a grid location.Describe the solution you'd like
I'm happy to build a function that will do this for other people, if I have some way to get a list of everything (or a partial list of some things) at a grid location.
I found how to get a list of vehicles, but that's going to give me all parts in that vehicle, not all parts on the specific grid space
Describe alternatives you've considered
if the vehicle object will let me query a given part from either a tripoint or an local offset that I can derive from said tripoint+[some property listing vehicle's origin for the offset] I could probably make that work
Additional context
22764 has more cogent examples and lists some of the actual code pages
vehicle_part
appears to be the actual type for vehicle parts, it's found insrc/vehicle_part.cpp
a list of vehicles can be gathered using this:VehicleList vehicles = get_vehicles(position,position)
found insrc/map.cpp