From b93cbd106f22fb72a46dcf54b5d631af118430b1 Mon Sep 17 00:00:00 2001 From: "Dr. Jaska" Date: Sun, 7 Apr 2024 23:47:10 +0000 Subject: [PATCH] server side option for both (old) or individually silent or particleless (re)spawning --- qcsrc/client/main.qc | 7 +++++-- qcsrc/server/spawnpoints.qc | 1 + qcsrc/server/spawnpoints.qh | 2 +- xonotic-client.cfg | 4 ++-- xonotic-server.cfg | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 90917341a..8a8e3f39d 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -875,11 +875,13 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) { this.origin = ReadVector(); + int particlesAndOrSound = ReadByte(); + if(is_new) { float teamnum = entcs_GetTeam(entnum - 1); - if(autocvar_cl_spawn_event_particles) + if(autocvar_cl_spawn_event_particles && (particlesAndOrSound & BIT(0))) { switch(teamnum) { @@ -890,7 +892,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) default: pointparticles(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1); break; } } - if(autocvar_cl_spawn_event_sound) + + if(autocvar_cl_spawn_event_sound && (particlesAndOrSound & BIT(1))) { sound(this, CH_TRIGGER, SND_SPAWN, VOL_BASE, ATTEN_NORM); } diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index ab0d2bea4..0a4ee0c2b 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -39,6 +39,7 @@ bool SpawnEvent_Send(entity this, entity to, int sf) { WriteByte(MSG_ENTITY, etof(this.owner)); WriteVector(MSG_ENTITY, this.owner.origin); + WriteByte(MSG_ENTITY, autocvar_g_spawn_alloweffects); send = true; } else if((to == this.owner) || (IS_SPEC(to) && (to.enemy == this.owner)) ) diff --git a/qcsrc/server/spawnpoints.qh b/qcsrc/server/spawnpoints.qh index d9707a167..09cf511d5 100644 --- a/qcsrc/server/spawnpoints.qh +++ b/qcsrc/server/spawnpoints.qh @@ -1,6 +1,6 @@ #pragma once -bool autocvar_g_spawn_alloweffects; +int autocvar_g_spawn_alloweffects; float autocvar_g_spawn_furthest; bool autocvar_g_spawn_useallspawns; bool autocvar_g_spawnpoints_auto_move_out_of_solid; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 9dee8744c..60cc2fe2f 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -69,8 +69,8 @@ seta cl_unpress_attack_on_weapon_switch 0 "automatically unpress fire and fire1 seta cl_weapon_switch_reload 1 "When trying to switch to the currently held weapon, reload it" seta cl_weapon_switch_fallback_to_impulse 1 "When trying to switch to a weapon that is not available, switch to an alternative from the same impulse" -seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns" -seta cl_spawn_event_sound 1 "sound effect whenever a player spawns" +seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns (if allowed by the server)" +seta cl_spawn_event_sound 1 "sound effect whenever a player spawns (if allowed by the server)" //seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files seta cl_spawn_point_dist_max 1200 "maximum distance from which spawnpoint particles will be visible" diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 063425b26..f4644e048 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -249,7 +249,8 @@ set g_player_damageplayercenter 1 "0: always calculate knockback force direction set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps" set g_botclip_collisions 1 "0 = disable collision testing against botclips, might be useful on some defrag maps" -set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info" +set g_spawn_alloweffects 3 "allow clients to enable spawn point and event effects such as particles and sounds (1 for particles only, 2 for sound only, 3 for both), see cl_spawn_ cvars for more info" + set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players" set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay" // respawn delay -- 2.39.2