mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
set rider to none if replacing driver
This commit is contained in:
parent
92ead1cf38
commit
e9978acf4c
@ -30,12 +30,13 @@ fn on_setup(ctx: EventCtx<SimulateNpcs, OnSetup>) {
|
||||
let data = &mut *ctx.state.data_mut();
|
||||
|
||||
// Add riders to vehicles
|
||||
for (npc_id, npc) in data.npcs.npcs.iter() {
|
||||
for (npc_id, npc) in data.npcs.npcs.iter_mut() {
|
||||
if let Some(ride) = &npc.riding {
|
||||
if let Some(vehicle) = data.npcs.vehicles.get_mut(ride.vehicle) {
|
||||
let actor = Actor::Npc(npc_id);
|
||||
if ride.steering && vehicle.driver.replace(actor).is_some() {
|
||||
error!("Replaced driver");
|
||||
npc.riding = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user