take = damage;
}
+ frag_inflictor = inflictor;
+ frag_attacker = attacker;
+ frag_target = self;
+ damage_take = take;
+ damage_save = save;
+ damage_force = force;
+ MUTATOR_CALLHOOK(PlayerDamage);
+ take = bound(0, damage_take, self.health);
+ save = bound(0, damage_save, self.armorvalue);
+
if(sound_allowed(MSG_BROADCAST, attacker))
{
if (save > 10)
float ctf_score_value(string parameter);
float g_dm, g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_ca, g_lms, g_runematch, g_race, g_nexball, g_cts;
-float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_vampire, g_minstagib_invis_alpha, g_bloodloss;
+float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_minstagib_invis_alpha, g_bloodloss;
float g_warmup_limit;
float g_warmup_allguns;
float g_warmup_allow_timeout;
if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
{
- // Savage: vampire mode
- if (g_vampire)
- if (!g_minstagib)
- if (time >= self.spawnshieldtime)
- {
- attacker.health += damage;
- }
if(g_runematch)
{
if (attacker.runes & RUNE_VAMPIRE)
if(cvar_string("g_weaponarena") != "0")
s = strcat(s, ":", cvar_string("g_weaponarena"), " arena");
- // TODO to mutator system
- if(cvar("g_vampire"))
- s = strcat(s, ":vampire");
-
// TODO to mutator system
if(cvar("g_norecoil"))
s = strcat(s, ":norecoil");
// TODO to mutator system
if(cvar("g_minstagib"))
s = strcat(s, ":minstagib");
+
GameLogEcho(s);
GameLogEcho(":gameinfo:end");
}
MUTATOR_ADD(mutator_dodging);
if(cvar("g_rocket_flying"))
MUTATOR_ADD(mutator_rocketflying);
+ if(cvar("g_vampire"))
+ MUTATOR_ADD(mutator_vampire);
serverflags = 0;
if(cvar("sv_allow_fullbright"))
g_midair = cvar("g_midair");
g_minstagib = cvar("g_minstagib");
g_norecoil = cvar("g_norecoil");
- g_vampire = cvar("g_vampire");
g_bloodloss = cvar("g_bloodloss");
sv_maxidle = cvar("sv_maxidle");
sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
// INPUT:
entity self;
entity other;
+
+MUTATOR_HOOKABLE(PlayerDamage);
+ // called when a player gets damaged to e.g. remove stuff he was carrying.
+ // INPUT:
+ entity frag_inflictor;
+ entity frag_attacker;
+ entity frag_target; // same as self
+ vector damage_force; // NOTE: this force already HAS been applied (create and use a Damage hook to change that one)
+ // INPUT, OUTPUT:
+ float damage_take;
+ float damage_save;
--- /dev/null
+MUTATOR_HOOKFUNCTION(vampire_PlayerDamage)
+{
+ if(time < self.spawnshieldtime)
+ return 0;
+ if(g_minstagib)
+ {
+ // minstagib: each hit means +1 ammo
+ frag_attacker.ammo_cells += 1;
+ }
+ else
+ {
+ // otherwise: each hit gets damage back
+ frag_attacker.health += damage_take;
+ }
+ return 0;
+}
+
+MUTATOR_HOOKFUNCTION(vampire_BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":Vampire");
+ return 0;
+}
+
+MUTATOR_HOOKFUNCTION(vampire_BuildMutatorsPrettyString)
+{
+ ret_string = strcat(ret_string, ", Vampire");
+ return 0;
+}
+
+MUTATOR_DEFINITION(mutator_vampire)
+{
+ MUTATOR_HOOK(PlayerDamage, vampire_PlayerDamage, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, vampire_BuildMutatorsString, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsPrettyString, vampire_BuildMutatorsPrettyString, CBC_ORDER_ANY);
+
+ return 0;
+}
MUTATOR_DECLARATION(mutator_nix);
MUTATOR_DECLARATION(mutator_dodging);
MUTATOR_DECLARATION(mutator_rocketflying);
+MUTATOR_DECLARATION(mutator_vampire);
mutators/mutator_nix.qc
mutators/mutator_dodging.qc
mutators/mutator_rocketflying.qc
+mutators/mutator_vampire.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc
modifications = strcat(modifications, ", Hook");
if(g_midair)
modifications = strcat(modifications, ", Midair");
- if(g_vampire)
- modifications = strcat(modifications, ", Vampire");
if(g_pinata)
modifications = strcat(modifications, ", Pinata");
if(g_weapon_stay)