Fix ecs changes
This commit is contained in:
parent
aa367514d6
commit
adda066782
2 changed files with 18 additions and 24 deletions
|
@ -326,8 +326,8 @@ impl Map {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn disable_spawns(&self, world: &mut World) -> Result<()> {
|
||||
self.data.write().unwrap().disable_spawns(world)
|
||||
pub fn disable_spawns(&self, world: &mut World) {
|
||||
self.data.write().unwrap().disable_spawns(world);
|
||||
}
|
||||
|
||||
pub fn set_leave_location(
|
||||
|
@ -996,37 +996,35 @@ impl Map {
|
|||
Ok(self.data.read().unwrap().leave_markers())
|
||||
}
|
||||
|
||||
pub fn disable(&self, world: &mut World) -> Result<()> {
|
||||
pub fn disable(&self, world: &mut World) {
|
||||
let data = self.data.read().unwrap();
|
||||
|
||||
// clear tiles
|
||||
for chunk in data.chunk_handles.values() {
|
||||
world.remove_entity(*chunk)?;
|
||||
world.remove_entity(*chunk);
|
||||
}
|
||||
|
||||
// clear entities
|
||||
for entity in data.entities.values() {
|
||||
world.remove_entity(*entity)?;
|
||||
world.remove_entity(*entity);
|
||||
}
|
||||
|
||||
// clear spawns
|
||||
for (spawn, _) in data.spawn_locations.values() {
|
||||
world.remove_entity(*spawn)?;
|
||||
world.remove_entity(*spawn);
|
||||
}
|
||||
|
||||
// clear exits
|
||||
for leave in data.leave_locations.values() {
|
||||
world.remove_entity(*leave)?;
|
||||
world.remove_entity(*leave);
|
||||
}
|
||||
|
||||
// clear npc spawns
|
||||
for (_, marker) in data.npc_spawn_areas.iter() {
|
||||
if let Some(marker) = marker {
|
||||
marker.remove(world)?;
|
||||
marker.remove(world);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,11 +193,9 @@ impl AlterEntities for HashMap<Coordinate, (Entity, Vector3<f32>)> {
|
|||
}
|
||||
|
||||
impl SpawnMarker {
|
||||
pub fn remove(&self, world: &mut World) -> Result<()> {
|
||||
world.remove_entity(self.flag)?;
|
||||
world.remove_entity(self.area)?;
|
||||
|
||||
Ok(())
|
||||
pub fn remove(&self, world: &mut World) {
|
||||
world.remove_entity(self.flag);
|
||||
world.remove_entity(self.area);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,16 +588,14 @@ impl MapData {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn disable_spawns(&mut self, world: &mut World) -> Result<()> {
|
||||
pub fn disable_spawns(&mut self, world: &mut World) {
|
||||
if self.show_spawn_locations {
|
||||
self.show_spawn_locations = false;
|
||||
|
||||
for (spawn_entity, _) in self.spawn_locations.values() {
|
||||
world.remove_entity(*spawn_entity)?;
|
||||
world.remove_entity(*spawn_entity);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn spawn_locations(&self) -> Vec<Vector3<f32>> {
|
||||
|
@ -673,7 +669,7 @@ impl MapData {
|
|||
if self.show_npc_spawns {
|
||||
// marker.add(scene)?;
|
||||
} else {
|
||||
marker.remove(world)?;
|
||||
marker.remove(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +707,7 @@ impl MapData {
|
|||
if self.show_npc_spawns {
|
||||
// marker.add(scene)?;
|
||||
} else {
|
||||
world.remove_entity(marker)?;
|
||||
world.remove_entity(marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -789,7 +785,7 @@ impl MapData {
|
|||
async_db.add(move |sql| sql.remove_npc_spawn((coordinate.x, coordinate.y)))?;
|
||||
|
||||
if let Some(marker) = marker {
|
||||
marker.remove(world)?;
|
||||
marker.remove(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -858,7 +854,7 @@ impl MapData {
|
|||
async_db.add(move |sql| sql.remove_boss_spawn((coordinate.x, coordinate.y)))?;
|
||||
|
||||
if let Some(marker) = marker {
|
||||
world.remove_entity(marker)?;
|
||||
world.remove_entity(marker);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -929,7 +925,7 @@ impl MapData {
|
|||
sql.remove_entity(table_name, (coordinate.x, coordinate.y))
|
||||
})?;
|
||||
|
||||
world.remove_entity(entity)?;
|
||||
world.remove_entity(entity);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue