From: LegendaryGuard Date: Wed, 5 Jan 2022 17:15:01 +0000 (+0100) Subject: Several spamming CSQC error fixes, fix dark blinking effect when player is dead or... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=77419efcdfdbb659553470a464de6c3ec52afcf6;p=xonotic%2Fxonotic-data.pk3dir.git Several spamming CSQC error fixes, fix dark blinking effect when player is dead or match is over. Disabled turret feature, no longer works to assign owner and team to stop attacking no sense --- diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index be726d669..2ef7be708 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -606,7 +606,7 @@ void nade_entrap_touch(entity this, entity toucher) #endif } - if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) ) + if ( IS_REAL_CLIENT(toucher) && !IS_VEHICLE(toucher) ) { entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; STAT(ENTRAP_ORB, show_tint) = time + 0.1; @@ -662,10 +662,10 @@ void nade_heal_touch(entity this, entity toucher) } - if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) ) + if ( IS_REAL_CLIENT(toucher) && !IS_VEHICLE(toucher) ) { entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; - STAT(HEALING_ORB, show_red) = time+0.1; + STAT(HEALING_ORB, show_red) = time + 0.1; STAT(HEALING_ORB_ALPHA, show_red) = 0.75 * (this.ltime - time) / this.orb_lifetime; } } @@ -691,7 +691,7 @@ void nade_monster_boom(entity this) void nade_veil_touch(entity this, entity toucher) { - if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) ) + if ( IS_REAL_CLIENT(toucher) && !IS_VEHICLE(toucher) ) { entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; @@ -805,11 +805,12 @@ void nade_emerald_randomvehicles(entity e, vector org) //LegendGuard adds turret spawn option for emerald nade 22-06-2021 //EXPERIMENTAL //TODO: turrets must be spawned by owner team, cannot be spawned to attack owner team or both +/* void nade_emerald_SpawnTurret(entity ent, vector org, entity tur) { //FOREACH_CLIENT(IS_PLAYER(it), //{ - if (ent.turspawncount < autocvar_g_nades_emerald_turretspawnlimit) + if (turspawncount < autocvar_g_nades_emerald_turretspawnlimit) { //ent = spawn(); //ent.owner = it.owner; @@ -828,8 +829,8 @@ void nade_emerald_SpawnTurret(entity ent, vector org, entity tur) //bool turret_initialize(entity this, Turret tur) //turret_validate_target(ent.realowner, ent.enemy, ent.target_validate_flags); turret_initialize(ent, tur); - //it.turspawncount++; - //PrintToChatAll(sprintf("^1AFTER^7 it.turspawncount: ^3%f", it.turspawncount)); + //turspawncount++; + //PrintToChatAll(sprintf("^1AFTER^7 turspawncount: ^3%f", turspawncount)); //if (!IS_ONGROUND(ent)) // ent.gravity = 1; setorigin(ent, org); } @@ -848,13 +849,8 @@ void nade_emerald_SpawnTurret(entity ent, vector org, entity tur) //EXPERIMENTAL void nade_emerald_randomturrets(entity e, vector org) { - /*//taken from: qcsrc/common/turrets/turret.qh - const int TSF_SUSPENDED = 1; - const int TSF_TERRAINBASE = 2; // currently unused - const int TSF_NO_AMMO_REGEN = 4; // disable builtin ammo regeneration - const int TSF_NO_PATHBREAK = 8; // don't break path to chase enemies, will still fire at them if possible - const int TSL_NO_RESPAWN = 16; // don't re-spawn - const int TSL_ROAM = 32; // roam while idle*/ + //in: qcsrc/common/turrets/turret.qh , look constants + RandomSelection_Init(); FOREACH(Turrets, it != TUR_Null && (!((it.spawnflags & TSF_SUSPENDED))), { @@ -866,7 +862,7 @@ void nade_emerald_randomturrets(entity e, vector org) RandomSelection_AddEnt(it, chancetur, 1); }); nade_emerald_SpawnTurret(e, org, RandomSelection_chosen_ent); -} +}*/ void nade_emerald_randomitem(entity e, vector org) { @@ -1080,12 +1076,12 @@ void nade_emerald_boom(entity this) { FOREACH_CLIENT(IS_PLAYER(it), { - if (it.vehspawncount < autocvar_g_nades_emerald_vehiclespawnlimit) + if (vehspawncount < autocvar_g_nades_emerald_vehiclespawnlimit) { spawnlimited = false; - //PrintToChatAll(sprintf("^2BEFORE^7 it.vehspawncount: ^3%f", it.vehspawncount)); - it.vehspawncount++; - //PrintToChatAll(sprintf("^1AFTER^7 it.vehspawncount: ^3%f", it.vehspawncount)); + //PrintToChatAll(sprintf("^2BEFORE^7 vehspawncount: ^3%f", vehspawncount)); + vehspawncount++; + //PrintToChatAll(sprintf("^1AFTER^7 vehspawncount: ^3%f", vehspawncount)); } else spawnlimited = true; @@ -1097,7 +1093,11 @@ void nade_emerald_boom(entity this) return; } - case 2: nade_emerald_randomturrets(e, this.origin); return; //EXPERIMENTAL + /*case 2: + { + nade_emerald_randomturrets(e, this.origin); + return; //EXPERIMENTAL + }*/ default: { for (int c = 0; c < autocvar_g_nades_emerald_ball_count; c++) @@ -1205,7 +1205,7 @@ void nade_ammo_touch(entity this, entity toucher) } } - if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) ) + if ( IS_REAL_CLIENT(toucher) && !IS_VEHICLE(toucher) ) { entity show_brown = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; STAT(AMMUNITIONING_ORB, show_brown) = time+0.1; @@ -1284,7 +1284,7 @@ void DarkBlinking(entity e); //copy of the special.qc function contents for DarkBlinking void nade_dark_touch(entity this, entity toucher) { - if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) ) + if ( IS_REAL_CLIENT(toucher) && !IS_VEHICLE(toucher) ) { entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index 7daa62415..eba6f2aa0 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -75,7 +75,7 @@ float autocvar_g_nades_emerald_fountain_lifetime = 1; //if much time, fountain w bool autocvar_g_nades_emerald_powerupjetpack_randomdrop = 0; int autocvar_g_nades_emerald_dropitemselect = 0; //admin/user selects which item wants to drop in-game, if not will be random int autocvar_g_nades_emerald_vehiclespawnlimit = 6; //LegendGuard adds new nade cvar of vehicle spawn count limit for the server 26-06-2021 -int autocvar_g_nades_emerald_turretspawnlimit = 4; // EXPERIMENTAL 26-06-2021 +//int autocvar_g_nades_emerald_turretspawnlimit = 4; // EXPERIMENTAL 26-06-2021 float autocvar_g_nades_ammo_time = 5; //LegendGuard adds new nade cvars 13-02-2021 float autocvar_g_nades_ammo_rate = 30; float autocvar_g_nades_ammo_friend = 1; @@ -171,8 +171,8 @@ Nade Nade_FromProjectile(int proj) .float nade_show_particles; .float nade_veil_prevalpha; .float nade_dark_prevalpha; //LegendGuard adds new nade .variable 08-02-2021 -.int vehspawncount; //LegendGuard adds new .variable 22-06-2021 -.int turspawncount; //EXPERIMENTAL 26-06-2021 +int vehspawncount; //LegendGuard adds new .variable 22-06-2021 +//int turspawncount; //EXPERIMENTAL 26-06-2021 bool orb_send(entity this, entity to, int sf); @@ -207,7 +207,6 @@ float cvar_cl_nade_type; string cvar_cl_pokenade_type; float cvar_cl_tandemnade_type; //LegendGuard adds new cl variable for emerald nade 01-07-2021 //LegendGuard sets variables for dark nade 09-02-2021 -float autocvar_hud_panel_darkradar_maximised_zoom_scale = 1; float dark_appeartime; float dark_fadetime; /***************************************************************/ @@ -245,70 +244,9 @@ void DarkBlinking(entity e) #endif #ifdef CSQC -const int MAX_QUADRATIC2 = 25; -vector quadratic2_slots[MAX_QUADRATIC2]; -vector quadratic2_dirs[MAX_QUADRATIC2]; -const float QUADRATIC2_SPEED = 150; -const float QUADRATIC2_TURNSPEED = 0.35; -const float QUADRATIC2_SIZE = 24; -const float QUADRATIC2_CHANCE = 0.35; -float quadratic2_spawntime, quadratic2_fadetime; -bool quadratic2; -void HUD_Quadratic2() -{ - for(int j = MAX_QUADRATIC2 - 1; j >= 0; --j) - { - vector slot = quadratic2_slots[j]; - vector dirs = quadratic2_dirs[j]; - float oldz = slot.z; - if(slot) - slot += quadratic2_dirs[j] * QUADRATIC2_SPEED * frametime; - slot.z = oldz; - //if(slot.z) - //slot.z = sin(QUADRATIC2_TURNSPEED * M_PI * time); - if(slot.y > vid_conheight || slot.x > vid_conwidth) - slot = '0 0 0'; - - if(slot == '0 0 0') - { - if(time > quadratic2_spawntime && random() <= QUADRATIC2_CHANCE) // low chance to spawn! - { - slot.x = bound(0, (random() * vid_conwidth + 1), vid_conwidth); - slot.y = bound(0, (random() * vid_conheight + 1), vid_conheight); - slot.z = 0; - dirs = vec2(randomvec()); - quadratic2_spawntime = time + bound(0.05, random() * 0.5, 0.4); // prevent spawning another one for this amount of time! - } - } - else - { - vector splash_size = vec2(QUADRATIC2_SIZE, QUADRATIC2_SIZE); - if(time > dirs.z) - { - if(random() <= 0.05) - slot.z = -1; - else - slot.z = floor(random() * 9) + 1; - dirs.z = time + QUADRATIC2_TURNSPEED; - } - string chosen_number = ((slot.z == -1) ? "NOOB" : ftos(rint(slot.z))); - draw_beginBoldFont(); - drawcolorcodedstring(vec2(slot), chosen_number, splash_size, 0.95, DRAWFLAG_NORMAL); - draw_endBoldFont(); - } - - quadratic2_slots[j] = slot; - quadratic2_dirs[j] = dirs; - } -} bool darkblink; -STATIC_INIT_LATE(cl_darkblink_override) -{ - localcmd("\nalias solve_quadratic2 \"cl_cmd solve_quadratic2 ${* ?}\"\n"); -} - REGISTER_MUTATOR(cl_darkblink, true); MUTATOR_HOOKFUNCTION(cl_darkblink, DrawScoreboard) @@ -318,10 +256,16 @@ MUTATOR_HOOKFUNCTION(cl_darkblink, DrawScoreboard) MUTATOR_HOOKFUNCTION(cl_darkblink, HUD_Draw_overlay) { - if(!darkblink && !quadratic2) + if(!darkblink) return false; + + if (g_stat_HEALTH < 0) + darkblink = false; + + if(!STAT(GAME_STOPPED) && !warmup_stage) + darkblink = false; - if(time <= dark_fadetime && autocvar_hud_panel_darkradar_maximised_zoom_scale == 1) + if(time <= dark_fadetime) { HUD_DarkBlinking(); return false; @@ -329,33 +273,9 @@ MUTATOR_HOOKFUNCTION(cl_darkblink, HUD_Draw_overlay) else darkblink = false; - if(time <= quadratic2_fadetime) - { - HUD_Quadratic2(); - // don't return true, we want regular HUD effects! - } - else - quadratic2 = false; - return false; } -MUTATOR_HOOKFUNCTION(cl_darkblink, CSQC_ConsoleCommand) -{ - if(MUTATOR_RETURNVALUE) // command was already handled? - return; - - string cmd_name = M_ARGV(0, string); - //int cmd_argc = M_ARGV(2, int); - - if(cmd_name == "solve_quadratic2") - { - quadratic2 = true; - quadratic2_fadetime = time + 5; - return true; - } -} - NET_HANDLE(TE_CSQC_DARKBLINKING, bool isNew) { return = true; @@ -366,7 +286,7 @@ NET_HANDLE(TE_CSQC_DARKBLINKING, bool isNew) localcmd("play2 sound/misc/blind\n"); darkblink = true; dark_appeartime = time; - dark_fadetime = time + 9; + dark_fadetime = time + 7; } #endif /***************************************************************/