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<()> {
|
pub fn disable_spawns(&self, world: &mut World) {
|
||||||
self.data.write().unwrap().disable_spawns(world)
|
self.data.write().unwrap().disable_spawns(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_leave_location(
|
pub fn set_leave_location(
|
||||||
|
@ -996,37 +996,35 @@ impl Map {
|
||||||
Ok(self.data.read().unwrap().leave_markers())
|
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();
|
let data = self.data.read().unwrap();
|
||||||
|
|
||||||
// clear tiles
|
// clear tiles
|
||||||
for chunk in data.chunk_handles.values() {
|
for chunk in data.chunk_handles.values() {
|
||||||
world.remove_entity(*chunk)?;
|
world.remove_entity(*chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear entities
|
// clear entities
|
||||||
for entity in data.entities.values() {
|
for entity in data.entities.values() {
|
||||||
world.remove_entity(*entity)?;
|
world.remove_entity(*entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear spawns
|
// clear spawns
|
||||||
for (spawn, _) in data.spawn_locations.values() {
|
for (spawn, _) in data.spawn_locations.values() {
|
||||||
world.remove_entity(*spawn)?;
|
world.remove_entity(*spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear exits
|
// clear exits
|
||||||
for leave in data.leave_locations.values() {
|
for leave in data.leave_locations.values() {
|
||||||
world.remove_entity(*leave)?;
|
world.remove_entity(*leave);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear npc spawns
|
// clear npc spawns
|
||||||
for (_, marker) in data.npc_spawn_areas.iter() {
|
for (_, marker) in data.npc_spawn_areas.iter() {
|
||||||
if let Some(marker) = marker {
|
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 {
|
impl SpawnMarker {
|
||||||
pub fn remove(&self, world: &mut World) -> Result<()> {
|
pub fn remove(&self, world: &mut World) {
|
||||||
world.remove_entity(self.flag)?;
|
world.remove_entity(self.flag);
|
||||||
world.remove_entity(self.area)?;
|
world.remove_entity(self.area);
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,16 +588,14 @@ impl MapData {
|
||||||
Ok(())
|
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 {
|
if self.show_spawn_locations {
|
||||||
self.show_spawn_locations = false;
|
self.show_spawn_locations = false;
|
||||||
|
|
||||||
for (spawn_entity, _) in self.spawn_locations.values() {
|
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>> {
|
pub fn spawn_locations(&self) -> Vec<Vector3<f32>> {
|
||||||
|
@ -673,7 +669,7 @@ impl MapData {
|
||||||
if self.show_npc_spawns {
|
if self.show_npc_spawns {
|
||||||
// marker.add(scene)?;
|
// marker.add(scene)?;
|
||||||
} else {
|
} else {
|
||||||
marker.remove(world)?;
|
marker.remove(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -711,7 +707,7 @@ impl MapData {
|
||||||
if self.show_npc_spawns {
|
if self.show_npc_spawns {
|
||||||
// marker.add(scene)?;
|
// marker.add(scene)?;
|
||||||
} else {
|
} 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)))?;
|
async_db.add(move |sql| sql.remove_npc_spawn((coordinate.x, coordinate.y)))?;
|
||||||
|
|
||||||
if let Some(marker) = marker {
|
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)))?;
|
async_db.add(move |sql| sql.remove_boss_spawn((coordinate.x, coordinate.y)))?;
|
||||||
|
|
||||||
if let Some(marker) = marker {
|
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))
|
sql.remove_entity(table_name, (coordinate.x, coordinate.y))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
world.remove_entity(entity)?;
|
world.remove_entity(entity);
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue