mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Gated safe zone behind a server setting, removed unneeded function.
This commit is contained in:
parent
416fe5c2af
commit
c8d4c4ff84
@ -255,7 +255,3 @@ pub fn handle_create_waypoint(server: &mut Server, pos: Vec3<f32>) {
|
||||
)]))
|
||||
.build();
|
||||
}
|
||||
|
||||
pub fn handle_create_safezone(server: &mut Server, range: Option<f32>, pos: Pos) {
|
||||
server.state.create_safezone(range, pos).build();
|
||||
}
|
||||
|
@ -2,9 +2,8 @@ use crate::{state_ext::StateExt, Server};
|
||||
use common::event::{EventBus, ServerEvent};
|
||||
use common_base::span;
|
||||
use entity_creation::{
|
||||
handle_beam, handle_create_npc, handle_create_safezone, handle_create_ship,
|
||||
handle_create_waypoint, handle_initialize_character, handle_loaded_character_data,
|
||||
handle_shockwave, handle_shoot,
|
||||
handle_beam, handle_create_npc, handle_create_ship, handle_create_waypoint,
|
||||
handle_initialize_character, handle_loaded_character_data, handle_shockwave, handle_shoot,
|
||||
};
|
||||
use entity_manipulation::{
|
||||
handle_aura, handle_buff, handle_combo_change, handle_damage, handle_delete, handle_destroy,
|
||||
@ -20,7 +19,7 @@ use interaction::{
|
||||
use inventory_manip::handle_inventory;
|
||||
use invite::{handle_invite, handle_invite_response};
|
||||
use player::{handle_client_disconnect, handle_exit_ingame};
|
||||
use specs::{Entity as EcsEntity, WorldExt};
|
||||
use specs::{Builder, Entity as EcsEntity, WorldExt};
|
||||
use trade::{cancel_trade_for, handle_process_trade_action};
|
||||
|
||||
mod entity_creation;
|
||||
@ -214,7 +213,7 @@ impl Server {
|
||||
max_range,
|
||||
} => handle_teleport_to(&self, entity, target, max_range),
|
||||
ServerEvent::CreateSafezone { range, pos } => {
|
||||
handle_create_safezone(self, range, pos)
|
||||
self.state.create_safezone(range, pos).build();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ pub struct Settings {
|
||||
pub max_player_group_size: u32,
|
||||
pub client_timeout: Duration,
|
||||
pub spawn_town: Option<String>,
|
||||
pub safe_spawn: bool,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
@ -61,6 +62,7 @@ impl Default for Settings {
|
||||
max_player_group_size: 6,
|
||||
client_timeout: Duration::from_secs(40),
|
||||
spawn_town: None,
|
||||
safe_spawn: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,12 +325,10 @@ impl StateExt for State {
|
||||
use comp::{
|
||||
aura::{Aura, AuraKind, AuraTarget, Auras},
|
||||
buff::{BuffCategory, BuffData, BuffKind, BuffSource},
|
||||
object, Body,
|
||||
};
|
||||
self.ecs_mut()
|
||||
.create_entity_synced()
|
||||
.with(pos)
|
||||
.with(Body::Object(object::Body::BoltNature))
|
||||
.with(Auras::new(vec![Aura::new(
|
||||
AuraKind::Buff {
|
||||
kind: BuffKind::Invulnerability,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
chunk_generator::ChunkGenerator, client::Client, presence::Presence, rtsim::RtSim, SpawnPoint,
|
||||
Tick,
|
||||
chunk_generator::ChunkGenerator, client::Client, presence::Presence, rtsim::RtSim,
|
||||
settings::Settings, SpawnPoint, Tick,
|
||||
};
|
||||
use common::{
|
||||
comp::{
|
||||
@ -35,6 +35,7 @@ impl<'a> System<'a> for Sys {
|
||||
Read<'a, EventBus<ServerEvent>>,
|
||||
Read<'a, Tick>,
|
||||
Read<'a, SpawnPoint>,
|
||||
Read<'a, Settings>,
|
||||
WriteExpect<'a, ChunkGenerator>,
|
||||
WriteExpect<'a, TerrainGrid>,
|
||||
Write<'a, TerrainChanges>,
|
||||
@ -54,6 +55,7 @@ impl<'a> System<'a> for Sys {
|
||||
server_event_bus,
|
||||
tick,
|
||||
spawn_point,
|
||||
server_settings,
|
||||
mut chunk_generator,
|
||||
mut terrain,
|
||||
mut terrain_changes,
|
||||
@ -223,7 +225,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Insert a safezone if chunk contains the spawn position
|
||||
if is_spawn_chunk(key, *spawn_point, &terrain) {
|
||||
if server_settings.safe_spawn && is_spawn_chunk(key, *spawn_point, &terrain) {
|
||||
server_emitter.emit(ServerEvent::CreateSafezone {
|
||||
range: Some(100.0),
|
||||
pos: Pos(spawn_point.0),
|
||||
|
Loading…
Reference in New Issue
Block a user