diff --git a/codemp/game/bg_damage.cpp b/codemp/game/bg_damage.cpp index 47be09c6b2..d69087bd5d 100644 --- a/codemp/game/bg_damage.cpp +++ b/codemp/game/bg_damage.cpp @@ -90,14 +90,20 @@ static void JKG_ParseSingleMeansOfDamage(const char* name, cJSON* json) { mod.modifiers.droid = 1.0f; mod.modifiers.organic = 1.0f; mod.modifiers.shield = 1.0f; + + mod.modifiers.ignoreArmor = qfalse; + mod.modifiers.ignoreShield = qfalse; + mod.modifiers.shieldBlocks = qfalse; + mod.modifiers.dodgeable = qfalse; + mod.modifiers.isEMP = qfalse; } jsonNode = cJSON_GetObjectItem(json, "dismemberment"); if (jsonNode) { - child = cJSON_GetObjectItem(json, "canDismember"); + child = cJSON_GetObjectItem(jsonNode, "canDismember"); mod.dismemberment.canDismember = cJSON_ToBooleanOpt(child, qfalse); - child = cJSON_GetObjectItem(json, "blowChunks"); + child = cJSON_GetObjectItem(jsonNode, "blowChunks"); mod.dismemberment.blowChunks = cJSON_ToBooleanOpt(child, qfalse); } diff --git a/codemp/game/g_combat.cpp b/codemp/game/g_combat.cpp index dcf417ca8d..080bbd03db 100644 --- a/codemp/game/g_combat.cpp +++ b/codemp/game/g_combat.cpp @@ -5194,6 +5194,23 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, trap->SendServerCommand(attacker - g_entities, va("notify 1 \"Head blow!\"")); } } + + //check for dismemberment for players --futuza: todo, check wtf is going on with armor when dismemberment happens + if (targ->s.eType == ET_PLAYER || targ->s.eType == ET_BODY) + { + if ((means->dismemberment.canDismember || means->dismemberment.blowChunks) + && take > 2 && !(dflags & DAMAGE_NO_DISMEMBER)) + { + if (means->dismemberment.canDismember) + { + G_CheckForDismemberment(targ, attacker, targ->pos1, take, targ->client->ps.torsoAnim, qtrue); + } + if (means->dismemberment.blowChunks) + { + G_CheckForBlowingUp(targ, attacker, targ->pos1, take, targ->client->ps.torsoAnim, qtrue); + } + } + } } else if (targ->s.eType == ET_NPC) { //g2animent @@ -5229,6 +5246,8 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } } + + targ->enemy = attacker; targ->die (targ, inflictor, attacker, take, mod); G_ActivateBehavior( targ, BSET_DEATH );