]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
also support virtual friendly fire
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 20 Dec 2010 14:01:12 +0000 (15:01 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 20 Dec 2010 14:01:12 +0000 (15:01 +0100)
defaultXonotic.cfg
qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c
qcsrc/server/g_damage.qc

index 27bf9ae2d8a2bba016cb6102ec6f4bbfd0f65265..e8934d10f1da8ef271d5eaaa90f99508aa1145dd 100644 (file)
@@ -641,6 +641,7 @@ seta teamplay_mode 4 "default teamplay setting in team games. 1 = no friendly fi
 seta g_mirrordamage 0.500000   "for teamplay 4: mirror damage factor"
 seta g_mirrordamage_virtual 1  "for teamplay 4: do not actually apply mirror damage, just show graphics effect for it"
 seta g_friendlyfire 0.100000   "for teamplay 4: fiendly fire factor"
+seta g_friendlyfire_virtual 1  "for teamplay 4: do not actually apply friendly fire, just show graphics effect for it"
 seta g_teamdamage_threshold 50 "for teamplay 4: threshold over which to apply mirror damage"
 seta g_teamdamage_resetspeed 30        "for teamplay 4: how fast player's teamdamage count decreases"
 
index 841b2bf490dc8bf5845ce01f263a24147037a3a9..87f82a43d16bc5d392148a4ec8688c3cd128dd4e 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticAdvancedDialog) EXTENDS(XonoticDialog)
        ATTRIB(XonoticAdvancedDialog, title, string, "Advanced server settings")
        ATTRIB(XonoticAdvancedDialog, color, vector, SKINCOLOR_DIALOG_ADVANCED)
        ATTRIB(XonoticAdvancedDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticAdvancedDialog, rows, float, 13)
+       ATTRIB(XonoticAdvancedDialog, rows, float, 14)
        ATTRIB(XonoticAdvancedDialog, columns, float, 3)
        ATTRIB(XonoticAdvancedDialog, refilterEntity, entity, NULL)
 ENDCLASS(XonoticAdvancedDialog)
@@ -42,6 +42,9 @@ void XonoticAdvancedDialog_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Friendly fire scale:"));
                me.TD(me, 1, 1.6, e = makeXonoticSlider(0, 1.0, 0.05, "g_friendlyfire"));
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "g_friendlyfire_virtual", "Virtual friendly fire (effect only)"));
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Friendly fire penalty:"));
index 9d7a4974070ce200c52ff4f2ad8328eb5ff766cd..e5e972bf6fb284420f7776d565a0f28bd591103a 100644 (file)
@@ -565,6 +565,28 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                        else
                                                                damage = autocvar_g_friendlyfire * damage;
                                                        // mirrordamage will be used LATER
+
+                                                       if(autocvar_g_mirrordamage_virtual)
+                                                       {
+                                                               vector v;
+                                                               v = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, mirrordamage);
+                                                               attacker.dmg_take += v_x;
+                                                               attacker.dmg_save += v_y;
+                                                               attacker.dmg_inflictor = inflictor;
+                                                               mirrordamage = 0;
+                                                               mirrorforce = 0;
+                                                       }
+
+                                                       if(autocvar_g_friendlyfire_virtual)
+                                                       {
+                                                               vector v;
+                                                               v = healtharmor_applydamage(targ.armorvalue, autocvar_g_balance_armor_blockpercent, damage);
+                                                               targ.dmg_take += v_x;
+                                                               targ.dmg_save += v_y;
+                                                               targ.dmg_inflictor = inflictor;
+                                                               damage = 0;
+                                                               force = '0 0 0';
+                                                       }
                                                }
                                                else
                                                        damage = 0;
@@ -606,12 +628,11 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        if (DEATH_ISWEAPON(deathtype, WEP_LASER))
                        {
                                damage = 0;
+                               mirrordamage = 0;
                                if (targ != attacker)
                                {
                                        if ((targ.health >= 1) && (targ.classname == "player"))
                                                centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, "Secondary fire inflicts no damage!"));
-                                       damage = 0;
-                                       mirrordamage = 0;
                                        force = '0 0 0';
                                        // keep mirrorforce
                                        attacker = targ;
@@ -841,31 +862,20 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        {
                attacker = attacker_save;
                if(g_minstagib)
-                       if(mirrordamage > 0)
+               if(mirrordamage > 0)
+               {
+                       // just lose extra LIVES, don't kill the player for mirror damage
+                       if(attacker.armorvalue > 0)
                        {
-                               // just lose extra LIVES, don't kill the player for mirror damage
-                               if(attacker.armorvalue > 0)
-                               {
-                                       attacker.armorvalue = attacker.armorvalue - 1;
-                                       centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, "^3Remaining extra lives: ",ftos(attacker.armorvalue)));
-                                       attacker.hitsound += 1;
-                               }
-                               mirrordamage = 0;
+                               attacker.armorvalue = attacker.armorvalue - 1;
+                               centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, "^3Remaining extra lives: ",ftos(attacker.armorvalue)));
+                               attacker.hitsound += 1;
                        }
-
-               if(autocvar_g_mirrordamage_virtual)
-               {
-                       vector v;
-                       v = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, mirrordamage);
-                       attacker.dmg_take += v_x;
-                       attacker.dmg_save += v_y;
-                       attacker.dmg_inflictor = inflictor;
-               }
-               else
-               {
-                       force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
-                       Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
+                       mirrordamage = 0;
                }
+
+               force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
+               Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
        }
 }