mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-24 12:51:39 +00:00
Server: Electro-Shock Parity
This commit is contained in:
parent
b7d643be2f
commit
2b07dd561c
15 changed files with 483 additions and 227 deletions
|
@ -17,6 +17,7 @@
|
|||
../source/server/entities/sounds.qc
|
||||
../source/server/entities/triggers.qc
|
||||
../source/server/entities/map_entities.qc
|
||||
../source/server/entities/traps.qc
|
||||
../source/server/entities/lights.qc
|
||||
../source/server/entities/doors.qc
|
||||
../source/server/entities/window.qc
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
../source/server/entities/sounds.qc
|
||||
../source/server/entities/triggers.qc
|
||||
../source/server/entities/map_entities.qc
|
||||
../source/server/entities/traps.qc
|
||||
../source/server/entities/lights.qc
|
||||
../source/server/entities/doors.qc
|
||||
../source/server/entities/window.qc
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
../source/server/entities/sounds.qc
|
||||
../source/server/entities/triggers.qc
|
||||
../source/server/entities/map_entities.qc
|
||||
../source/server/entities/traps.qc
|
||||
../source/server/entities/lights.qc
|
||||
../source/server/entities/doors.qc
|
||||
../source/server/entities/window.qc
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
../source/server/entities/sounds.qc
|
||||
../source/server/entities/triggers.qc
|
||||
../source/server/entities/map_entities.qc
|
||||
../source/server/entities/traps.qc
|
||||
../source/server/entities/lights.qc
|
||||
../source/server/entities/doors.qc
|
||||
../source/server/entities/window.qc
|
||||
|
|
|
@ -154,7 +154,7 @@ void() Dog_Death =
|
|||
self.movetype = MOVETYPE_NONE;
|
||||
self.takedamage = DAMAGE_NO;
|
||||
|
||||
sound(self,CHAN_WEAPON,"sounds/null.wav",1,ATTN_NORM);
|
||||
sound(self,CHAN_VOICE,"sounds/null.wav",1,ATTN_NORM);
|
||||
|
||||
self.usedent = world;
|
||||
|
||||
|
@ -179,10 +179,10 @@ void() Dog_Death =
|
|||
float r = random();
|
||||
|
||||
// explode chance
|
||||
if (r < 0.75) {
|
||||
if (r < 0.75 || self.electro_targeted == true) {
|
||||
self.frame = 0;
|
||||
setmodel (self, "models/sprites/explosion.spr");
|
||||
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM);
|
||||
sound (self, CHAN_VOICE, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM);
|
||||
dog_explodeanim();
|
||||
} else {
|
||||
dog_deathanim();
|
||||
|
@ -247,6 +247,8 @@ void(entity where) spawn_a_dogB =
|
|||
sdog.th_idle = dog_idleanim;
|
||||
sdog.th_diewunder = die_dog_wunder1;
|
||||
|
||||
sdog.electro_targeted = 0;
|
||||
|
||||
SetZombieWalk(sdog);
|
||||
sdog.walktype = 5;
|
||||
|
||||
|
|
|
@ -195,6 +195,10 @@ void(float what) play_sound_z =
|
|||
sound(self,CHAN_VOICE,"sounds/zombie/t4.wav",1,ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
if (what == 5) // Electric Zap
|
||||
{
|
||||
sound(self, CHAN_VOICE, "sounds/machines/elec_shock.wav", 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -410,6 +414,10 @@ void() Zombie_Think = //called every frame for zombies
|
|||
}
|
||||
}
|
||||
|
||||
if (self.death_timer < time && self.death_timer_activated == true) {
|
||||
self.th_die();
|
||||
}
|
||||
|
||||
if (self.classname == "wunder") {
|
||||
self.th_diewunder();
|
||||
return;
|
||||
|
@ -867,7 +875,7 @@ void() zombie_attack =
|
|||
{
|
||||
self.velocity = '0 0 0';
|
||||
|
||||
if (self.classname == "wunder")
|
||||
if (self.classname == "wunder" || self.electro_targeted == true)
|
||||
return;
|
||||
|
||||
if(self.outside == TRUE)
|
||||
|
@ -1105,7 +1113,12 @@ void() Zombie_Death =
|
|||
self.health = 0;
|
||||
Remaining_Zombies = Remaining_Zombies - 1;
|
||||
|
||||
play_sound_z(3);
|
||||
// Death Noises
|
||||
if (self.electro_targeted == false)
|
||||
play_sound_z(3);
|
||||
else
|
||||
play_sound_z(5);
|
||||
|
||||
//Gotta' make sure we set it back down instead of glitching it up, yo'
|
||||
if(self.s_time > 0 && sounds_playing > 0)
|
||||
{
|
||||
|
@ -1148,6 +1161,75 @@ void() Zombie_Death =
|
|||
}
|
||||
};
|
||||
|
||||
//
|
||||
// --------------------
|
||||
// Electric Damage
|
||||
// --------------------
|
||||
//
|
||||
void() Zombie_Tesla_Light;
|
||||
|
||||
//
|
||||
// Z_ElectroShock
|
||||
// Mark Zombie to die by non-Waffe Electricity.
|
||||
//
|
||||
void() Z_ElectroShock =
|
||||
{
|
||||
// Mark the Zombie as to-be-dead
|
||||
self.electro_targeted = true;
|
||||
|
||||
// Determine a time for the Zombie to die. (0.1-1.25s)
|
||||
self.death_timer = (rint((random() * 11.5) + 1)/10) + time;
|
||||
self.death_timer_activated = true;
|
||||
|
||||
// Spawn a Sparkle
|
||||
Zombie_Tesla_Light();
|
||||
|
||||
// Decide what to Gib
|
||||
float r = random();
|
||||
|
||||
// Head?
|
||||
if (r < 0.20 && self.head.deadflag) {
|
||||
self.head.frame = 0;
|
||||
self.head.health = 0;
|
||||
self.head.deadflag = false;
|
||||
self.head.solid = SOLID_NOT;
|
||||
setmodel(self.head, "");
|
||||
makevectors(self.angles);
|
||||
spawn_gibs(self.origin + (self.head.view_ofs_x * v_right)
|
||||
+ (self.head.view_ofs_y * v_forward) + (self.head.view_ofs_z * v_up));
|
||||
SpawnBlood(self.origin, self.origin, 50);
|
||||
}
|
||||
// Right Arm?
|
||||
r = random();
|
||||
if (r < 0.20 && self.rarm.deadflag) {
|
||||
self.rarm.frame = 0;
|
||||
self.rarm.health = 0;
|
||||
self.rarm.deadflag = false;
|
||||
self.rarm.solid = SOLID_NOT;
|
||||
setmodel(self.rarm, "");
|
||||
makevectors(self.angles);
|
||||
spawn_gibs(self.origin + (self.rarm.view_ofs_x * v_right)
|
||||
+ (self.rarm.view_ofs_y * v_forward) + (self.rarm.view_ofs_z * v_up));
|
||||
SpawnBlood(self.origin, self.origin, 50);
|
||||
}
|
||||
// Left Arm?
|
||||
r = random();
|
||||
if (r < 0.20 && self.larm.deadflag) {
|
||||
self.larm.frame = 0;
|
||||
self.larm.health = 0;
|
||||
self.larm.deadflag = false;
|
||||
self.larm.solid = SOLID_NOT;
|
||||
setmodel(self.larm, "");
|
||||
makevectors(self.angles);
|
||||
spawn_gibs(self.origin + (self.larm.view_ofs_x * v_right)
|
||||
+ (self.larm.view_ofs_y * v_forward) + (self.larm.view_ofs_z * v_up));
|
||||
SpawnBlood(self.origin, self.origin, 50);
|
||||
}
|
||||
|
||||
// Play the first Electro-Sound
|
||||
play_sound_z(5);
|
||||
}
|
||||
|
||||
/////////////////////ZOMBIE WAFFE STUFF/////////////////////
|
||||
|
||||
void() Zombie_Lightning_Think =
|
||||
|
@ -1617,6 +1699,9 @@ void(entity where) spawn_a_zombieB =
|
|||
szombie.ideal_yaw = szombie.angles_y;
|
||||
szombie.yaw_speed = 20;
|
||||
szombie.iszomb = 1;
|
||||
szombie.death_timer = 0;
|
||||
szombie.death_timer_activated = false;
|
||||
szombie.electro_targeted = false;
|
||||
|
||||
// We used to set different limb health, too, but we now handle any limb damage differences in weapon stats.
|
||||
szombie.health = szombie.head.health = szombie.larm.health = szombie.rarm.health = z_health;
|
||||
|
|
|
@ -435,8 +435,11 @@ void(entity victim,entity attacker, float damage, float d_style) DamageHandler =
|
|||
victim.punchangle_x = distance_x;
|
||||
victim.punchangle_y = distance_y;
|
||||
|
||||
// play hurt sound
|
||||
sound (self, CHAN_AUTO, "sounds/player/pain4.wav", 1, ATTN_NORM);
|
||||
// Play pain noise if this isn't done by an electric barrier.
|
||||
if (d_style != S_ZAPPER)
|
||||
sound (self, CHAN_AUTO, "sounds/player/pain4.wav", 1, ATTN_NORM);
|
||||
else
|
||||
sound (self, CHAN_AUTO, "sounds/machines/elec_shock.wav", 1, ATTN_NORM);
|
||||
|
||||
if (victim.health <= 20)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
put custom server-only globals and fields here
|
||||
|
||||
Copyright (C) 2021 NZ:P Team
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -31,19 +31,21 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define FL_JUMPRELEASED 4096
|
||||
#define FL_JUMPRELEASED 4096
|
||||
|
||||
#define STR_NOTENOUGHPOINTS "Not Enough Points\n" // To help aid consistency with these..
|
||||
|
||||
// achievement tracking
|
||||
.float ach_tracker_npnp;
|
||||
.float ach_tracker_abst;
|
||||
float ach_tracker_spin;
|
||||
float ach_tracker_luck;
|
||||
.float ach_tracker_coll;
|
||||
float ach_tracker_col2;
|
||||
float ach_tracker_barr;
|
||||
float ach_tracker_spin;
|
||||
float ach_tracker_luck;
|
||||
|
||||
float framecount;
|
||||
float deathmatch;
|
||||
|
@ -94,6 +96,11 @@ entity activator;
|
|||
.float zoom;
|
||||
#endif
|
||||
|
||||
.float damage_timer; // Used for time-based damage infliction such as Traps.
|
||||
.float speed_penalty; // A multiplier for limiting player speed. Also
|
||||
// prohibits sprinting.
|
||||
.float speed_penalty_time; // A timer for how long speed_penalty is applied for.
|
||||
|
||||
float sprint_max_time = 4.0;
|
||||
.float sprinting;
|
||||
.float weaponskin;
|
||||
|
@ -110,7 +117,6 @@ void() W_SprintStop;
|
|||
.float into_sprint;
|
||||
.float dive;
|
||||
.float dive_delay;
|
||||
.float damagetimer;
|
||||
.vector movement;
|
||||
|
||||
//Weaponsystem defines
|
||||
|
@ -216,10 +222,17 @@ void() SUB_Null2 = {};
|
|||
|
||||
vector trace_plane_normal;
|
||||
|
||||
|
||||
//
|
||||
// AI definitions
|
||||
//Used for global one-zombie-at-a-time type ai
|
||||
// Used for global one-zombie-at-a-time type ai
|
||||
//
|
||||
void Do_Zombie_AI();
|
||||
void Z_ElectroShock();
|
||||
|
||||
.float electro_targeted; // Marks Zombie as waiting to die via Electro-Shock
|
||||
.float death_timer; // A timer that will kill a Zombie when it expires.
|
||||
.float death_timer_activated; // To prevent Zombies just dying because of this..
|
||||
|
||||
.string aistatus;
|
||||
entity lastzombie;
|
||||
float zombie_spawn_delay; // time before spawning, in seconds.
|
||||
|
@ -253,7 +266,10 @@ float crawler_num;
|
|||
.float chase_time;
|
||||
.float enemy_timeout;
|
||||
//.float pathing;
|
||||
.float calc_time; //used as a delay thing (so zombie ai doesn't run 100% of the time
|
||||
.float calc_time; // used as a delay thing (so zombie ai doesn't run
|
||||
// 100% of the time
|
||||
.string zappername; // An identifier similar to targetname used to link
|
||||
// Electric Trap components.
|
||||
.string target2;
|
||||
.string target3;
|
||||
.string target4;
|
||||
|
@ -262,12 +278,12 @@ float crawler_num;
|
|||
.string target7;
|
||||
.string target8;
|
||||
.string wayTarget;
|
||||
.entity active_door;//Set in waypoint mode
|
||||
.string targetname;//the name of an entitys
|
||||
entity lastspawn;//last spawn point used by spawning code
|
||||
.entity goaldummy; //Used to store the origin of the zombies target
|
||||
.float goalway; //Used to store the origin of the zombies target
|
||||
.float walktype;//decides animations and moving speeds for zombies
|
||||
.entity active_door; // Set in waypoint mode
|
||||
.string targetname; // the name of an entitys
|
||||
entity lastspawn; // last spawn point used by spawning code
|
||||
.entity goaldummy; // Used to store the origin of the zombies target
|
||||
.float goalway; // Used to store the origin of the zombies target
|
||||
.float walktype; // decides animations and moving speeds for zombies
|
||||
.void() th_walk;
|
||||
//.void() th_run;
|
||||
.void() th_die;
|
||||
|
|
|
@ -295,7 +295,7 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
|
|||
{
|
||||
if(other.classname == "player" && !other.downed)
|
||||
{
|
||||
centerprint (other, "You do not have enough points\n");
|
||||
centerprint (other, STR_NOTENOUGHPOINTS);
|
||||
other.semiuse = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
mbox, perks, pap
|
||||
|
||||
Copyright (C) 2021 NZ:P Team
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -435,7 +435,7 @@ void() touch_perk =
|
|||
}
|
||||
} else if (other.button7) {
|
||||
// We tried to use, but we don't have the cash..
|
||||
centerprint(other, "Not enough points\n");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1526,7 +1526,7 @@ void() mystery_touch =
|
|||
self.spins++;
|
||||
}
|
||||
else {
|
||||
centerprint (other, "Not enough points\n");
|
||||
centerprint (other, STR_NOTENOUGHPOINTS);
|
||||
}
|
||||
}
|
||||
if (self.boxstatus == 2)
|
||||
|
@ -1859,7 +1859,7 @@ void touch_pap() {
|
|||
|
||||
}
|
||||
else if (other.button7 && other.weapon) {
|
||||
centerprint (other, "Not enough points\n");
|
||||
centerprint (other, STR_NOTENOUGHPOINTS);
|
||||
}
|
||||
} else if (self.papState == 2) {
|
||||
float startframe;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
misc map entity spawn and logic
|
||||
|
||||
Copyright (C) 2021 NZ:P Team
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -125,7 +125,7 @@ void() button_touch =
|
|||
}
|
||||
else
|
||||
{
|
||||
centerprint(other,"You do not have enough points\n");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void () buy_weapon_touch =
|
|||
|
||||
other.semiuse = true;
|
||||
if ((other.points < self.cost2 && !IsPapWeapon(other.weapon)) || (other.points < 4500 && IsPapWeapon(other.weapon))) {
|
||||
centerprint(other, "You do not have enough points\n");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ void () buy_weapon_touch =
|
|||
return;
|
||||
if (other.points < self.cost2)
|
||||
{
|
||||
centerprint(other, "You do not have enough points\n");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
sound(other, 0,"sounds/misc/denybuy.wav", 1, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void () buy_weapon_touch =
|
|||
return;
|
||||
if (other.points < self.cost)
|
||||
{
|
||||
centerprint(other, "You do not have enough points\n");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
sound(other, 0,"sounds/misc/denybuy.wav", 1, 1);
|
||||
|
||||
return;
|
||||
|
@ -399,7 +399,7 @@ void () buy_weapon_touch =
|
|||
|
||||
other.semiuse = 1;
|
||||
if (other.points < self.cost) {
|
||||
centerprint (other, "Not enough points\n");
|
||||
centerprint (other, STR_NOTENOUGHPOINTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -619,194 +619,6 @@ void() item_radio =
|
|||
self.th_die = radio_hit;
|
||||
};
|
||||
|
||||
.string zappername;
|
||||
void() turnswitch1 =[ 1, turnswitch2 ] {self.frame = 0;};
|
||||
void() turnswitch2 =[ 2, turnswitch3 ] {self.frame = 1;};
|
||||
void() turnswitch3 =[ 3, turnswitch4 ] {self.frame = 2;};
|
||||
void() turnswitch4 =[ 4, SUB_Null ] {self.frame = 2;};
|
||||
|
||||
void() offswitch2 =[ 2, offswitch3 ] {self.frame = 2;};
|
||||
void() offswitch3 =[ 3, offswitch4 ] {self.frame = 1;};
|
||||
void() offswitch4 =[ 4, SUB_Null ] {self.frame = 0;};
|
||||
|
||||
|
||||
void zap_zombie () {
|
||||
entity tempe;
|
||||
|
||||
if (other.classname == "ai_zombie") {
|
||||
tempe = self;
|
||||
self = other;
|
||||
self.th_die();
|
||||
self = tempe;
|
||||
} else if (other.classname == "player") {
|
||||
if (other.damagetimer < time) {
|
||||
DamageHandler (other, self, 50, S_ZAPPER);
|
||||
other.damagetimer = time + 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void zapper_play () {
|
||||
entity zents = find(world, targetname, self.target);
|
||||
local vector org = self.origin;
|
||||
local vector targetorg = zents.origin;
|
||||
|
||||
if (zents) {
|
||||
#ifdef PC
|
||||
te_lightning2(self, self.origin, zents.origin);
|
||||
#endif
|
||||
#ifdef PSP
|
||||
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
|
||||
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
|
||||
WriteEntity (MSG_BROADCAST, self);
|
||||
WriteCoord (MSG_BROADCAST, org_x);
|
||||
WriteCoord (MSG_BROADCAST, org_y);
|
||||
WriteCoord (MSG_BROADCAST, org_z);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_x);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_y);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_z);
|
||||
#endif
|
||||
}
|
||||
|
||||
zents.touch = zap_zombie;
|
||||
|
||||
self.think = zapper_play;
|
||||
self.nextthink = time + (0.5*random());
|
||||
}
|
||||
|
||||
void() zapper_touch;
|
||||
void() zapper_cooldown =
|
||||
{
|
||||
offswitch2();
|
||||
self.touch = zapper_touch;
|
||||
}
|
||||
|
||||
void zapper_stop() {
|
||||
entity zents;
|
||||
entity tempe;
|
||||
|
||||
zents = find(world, zappername, self.zappername);
|
||||
while (zents)
|
||||
{
|
||||
if (zents.classname == "zapper_light") {
|
||||
zents.skin = 0;
|
||||
} else if (zents.classname == "zapper_switch") {
|
||||
tempe = self;
|
||||
self = zents;
|
||||
self.state = 0;
|
||||
self.think = zapper_cooldown;
|
||||
self.nextthink = time + 30;
|
||||
self = tempe;
|
||||
} else if (zents.classname == "zapper_node" && zents.target) {
|
||||
zents.think = SUB_Null;
|
||||
zents.nextthink = 0;
|
||||
}
|
||||
zents.touch = SUB_Null;
|
||||
zents = find(zents, zappername, self.zappername);
|
||||
}
|
||||
|
||||
remove(self);
|
||||
}
|
||||
|
||||
void zapper_start(string zapper) {
|
||||
entity zents;
|
||||
entity tempe;
|
||||
|
||||
zents = find(world, zappername, zapper);
|
||||
while (zents)
|
||||
{
|
||||
if (zents.classname == "zapper_light") {
|
||||
zents.skin = 1;
|
||||
} else if (zents.classname == "zapper_switch") {
|
||||
tempe = self;
|
||||
self = zents;
|
||||
self.state = 1;
|
||||
turnswitch1();
|
||||
self = tempe;
|
||||
} else if (zents.classname == "zapper_node" && zents.target) {
|
||||
zents.think = zapper_play;
|
||||
zents.nextthink = time + 0.1;
|
||||
}
|
||||
zents = find(zents, zappername, zapper);
|
||||
}
|
||||
|
||||
tempe = spawn();
|
||||
tempe.think = zapper_stop;
|
||||
tempe.nextthink = time + 30;
|
||||
tempe.zappername = zapper;
|
||||
}
|
||||
|
||||
void zapper_touch () {
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.requirespower == true && !isPowerOn) {
|
||||
useprint (other, 8, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.state == 0) {
|
||||
useprint (other, 11, self.cost, self.weapon);
|
||||
|
||||
if (!other.button7) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.points < self.cost) {
|
||||
centerprint(other, "You do not have enough points\n");
|
||||
return;
|
||||
}
|
||||
|
||||
zapper_start(self.zappername);
|
||||
addmoney(other, -1*self.cost, false);
|
||||
}
|
||||
}
|
||||
|
||||
void() zapper_switch =
|
||||
{
|
||||
precache_model ("models/machines/zapper/z_switch.mdl");
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.solid = SOLID_TRIGGER;
|
||||
self.classname = "zapper_switch";
|
||||
setmodel(self, "models/machines/zapper/z_switch.mdl");
|
||||
setsize (self, '-4 -4 -4', '4 4 4');
|
||||
|
||||
self.state = 0;
|
||||
self.touch = zapper_touch;
|
||||
};
|
||||
|
||||
void() zapper_node =
|
||||
{
|
||||
precache_model ("models/machines/zapper/z_zap.mdl");
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.solid = SOLID_TRIGGER;
|
||||
self.classname = "zapper_node";
|
||||
setmodel(self, "models/machines/zapper/z_zap.mdl");
|
||||
setsize (self, '-4 -4 -4', '4 4 4');
|
||||
};
|
||||
|
||||
void() zapper_light =
|
||||
{
|
||||
precache_model ("models/machines/zapper/z_light.mdl");
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.solid = SOLID_TRIGGER;
|
||||
//self.touch = switch_touch;
|
||||
self.classname = "zapper_light";
|
||||
setmodel(self, "models/machines/zapper/z_light.mdl");
|
||||
setsize (self, '-4 -4 -4', '4 4 4');
|
||||
};
|
||||
|
||||
|
||||
void() trigger_electro =
|
||||
{
|
||||
self.classname = "zapper_field";
|
||||
InitTrigger ();
|
||||
//self.touch = electro_touch;
|
||||
self.solid = SOLID_TRIGGER;
|
||||
};
|
||||
|
||||
/* ================
|
||||
Custom Teddy Code
|
||||
================*/
|
||||
|
@ -1017,7 +829,7 @@ void() teleport_touch =
|
|||
if (other.button7) {
|
||||
|
||||
if (other.points < self.cost) {
|
||||
centerprint(other, "Not enough points");
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
314
source/server/entities/traps.qc
Normal file
314
source/server/entities/traps.qc
Normal file
|
@ -0,0 +1,314 @@
|
|||
/*
|
||||
server/entities/map_entities.qc
|
||||
|
||||
logic and entities pertaining to in-game traps
|
||||
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// --------------------
|
||||
// Electric Trap
|
||||
// --------------------
|
||||
//
|
||||
|
||||
#define ELECTRICTRAP_MODE_TIMER 0 // Der Riese style; trap cools down after X seconds.
|
||||
#define ELECTRICTRAP_MODE_ROUND 1 // SNN/Verruckt style; trap cools down at end of Round.
|
||||
|
||||
//
|
||||
// Electric Switch On Animation
|
||||
//
|
||||
void() A_ElecSwitchOn1 = [ 1, A_ElecSwitchOn2 ] {self.frame = 0;};
|
||||
void() A_ElecSwitchOn2 = [ 2, A_ElecSwitchOn3 ] {self.frame = 1;};
|
||||
void() A_ElecSwitchOn3 = [ 3, A_ElecSwitchOn4 ] {self.frame = 2;};
|
||||
void() A_ElecSwitchOn4 = [ 4, SUB_Null ] {self.frame = 2;};
|
||||
|
||||
//
|
||||
// Electric Swich Off Animation
|
||||
//
|
||||
void() A_ElecSwitchOff1 = [ 1, A_ElecSwitchOff2 ] {self.frame = 2;};
|
||||
void() A_ElecSwitchOff2 = [ 2, A_ElecSwitchOff3 ] {self.frame = 1;};
|
||||
void() A_ElecSwitchOff3 = [ 3, SUB_Null ] {self.frame = 0;};
|
||||
|
||||
//
|
||||
// zapper_do_damage
|
||||
// Called when entities touch the Electric barrier.
|
||||
//
|
||||
void() zapper_do_damage
|
||||
{
|
||||
entity tempe;
|
||||
|
||||
// Player Logic:
|
||||
// - Trap instantly kills player on contact without Jugg,
|
||||
// having Jugg/Toughness reduces damage to only 50.
|
||||
// - 1.25s delay before damage can be dealt again.
|
||||
// - Player is slowed down by 50% for 2.5 seconds. (Stop sprinting)
|
||||
if (other.classname == "player")
|
||||
{
|
||||
// Inflict Damage
|
||||
if (other.damage_timer < time) {
|
||||
if (other.perks & P_JUG)
|
||||
DamageHandler(other, self, 50, S_ZAPPER);
|
||||
else
|
||||
DamageHandler(other, self, other.health, S_ZAPPER);
|
||||
other.damage_timer = time + 1.25;
|
||||
}
|
||||
// Inflict Speed Penalty
|
||||
if (other.speed_penalty_time < time) {
|
||||
other.speed_penalty = 0.5;
|
||||
other.speed_penalty_time = time + 2.5;
|
||||
|
||||
// Make sure we can't sprint
|
||||
if (other.sprinting) {
|
||||
tempe = self;
|
||||
self = other;
|
||||
W_SprintStop();
|
||||
self = tempe;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Zombie Logic:
|
||||
// - Zombie can take up to 1.25 seconds to die after contact,
|
||||
// cannot damage in this state.
|
||||
// - Has a chance to gib.
|
||||
// - No normal death sound, play elec sound on contact, then
|
||||
// again on death.
|
||||
if (other.classname == "ai_zombie" && !other.electro_targeted) {
|
||||
tempe = self;
|
||||
self = other;
|
||||
Z_ElectroShock();
|
||||
self = tempe;
|
||||
}
|
||||
// Dog Logic:
|
||||
// - Dogs should always explode on contact, instantly.
|
||||
// - Trap plays Electro-Shock sound, dog plays explosion.
|
||||
else if (other.classname == "ai_dog") {
|
||||
sound(self, CHAN_WEAPON, "sounds/machines/elec_shock.wav", 1, ATTN_NORM);
|
||||
|
||||
tempe = self;
|
||||
self = other;
|
||||
self.electro_targeted = true;
|
||||
self.th_die();
|
||||
self = tempe;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void zapper_play () {
|
||||
entity zents = find(world, targetname, self.target);
|
||||
local vector org = self.origin;
|
||||
local vector targetorg = zents.origin;
|
||||
|
||||
if (zents) {
|
||||
#ifdef PC
|
||||
te_lightning2(self, self.origin, zents.origin);
|
||||
#endif
|
||||
#ifdef PSP
|
||||
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
|
||||
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
|
||||
WriteEntity (MSG_BROADCAST, self);
|
||||
WriteCoord (MSG_BROADCAST, org_x);
|
||||
WriteCoord (MSG_BROADCAST, org_y);
|
||||
WriteCoord (MSG_BROADCAST, org_z);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_x);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_y);
|
||||
WriteCoord (MSG_BROADCAST, targetorg_z);
|
||||
#endif
|
||||
}
|
||||
|
||||
zents.touch = zapper_do_damage;
|
||||
|
||||
self.think = zapper_play;
|
||||
self.nextthink = time + (0.5*random());
|
||||
}
|
||||
|
||||
void() zapper_touch;
|
||||
void() zapper_cooldown =
|
||||
{
|
||||
A_ElecSwitchOff1();
|
||||
self.touch = zapper_touch;
|
||||
}
|
||||
|
||||
void zapper_stop() {
|
||||
entity zents;
|
||||
entity tempe;
|
||||
|
||||
zents = find(world, zappername, self.zappername);
|
||||
while (zents)
|
||||
{
|
||||
if (zents.classname == "zapper_light") {
|
||||
zents.skin = 0;
|
||||
} else if (zents.classname == "zapper_switch") {
|
||||
tempe = self;
|
||||
self = zents;
|
||||
self.state = 0;
|
||||
|
||||
if (self.mode == ELECTRICTRAP_MODE_TIMER) {
|
||||
self.think = zapper_cooldown;
|
||||
self.nextthink = time + self.cooldown;
|
||||
}
|
||||
|
||||
self = tempe;
|
||||
} else if (zents.classname == "zapper_node" && zents.target) {
|
||||
zents.think = SUB_Null;
|
||||
zents.nextthink = 0;
|
||||
}
|
||||
zents.touch = SUB_Null;
|
||||
zents = find(zents, zappername, self.zappername);
|
||||
}
|
||||
|
||||
remove(self);
|
||||
}
|
||||
|
||||
void zapper_start(string zapper) {
|
||||
entity zents;
|
||||
entity tempe;
|
||||
|
||||
zents = find(world, zappername, zapper);
|
||||
while (zents)
|
||||
{
|
||||
if (zents.classname == "zapper_light") {
|
||||
zents.skin = 1;
|
||||
} else if (zents.classname == "zapper_switch") {
|
||||
tempe = self;
|
||||
self = zents;
|
||||
self.state = 1;
|
||||
A_ElecSwitchOn1();
|
||||
self = tempe;
|
||||
} else if (zents.classname == "zapper_node" && zents.target) {
|
||||
zents.think = zapper_play;
|
||||
zents.nextthink = time + 0.1;
|
||||
}
|
||||
zents = find(zents, zappername, zapper);
|
||||
}
|
||||
|
||||
tempe = spawn();
|
||||
tempe.think = zapper_stop;
|
||||
tempe.nextthink = time + self.calc_time;
|
||||
tempe.zappername = zapper;
|
||||
}
|
||||
|
||||
void zapper_touch () {
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.requirespower == true && !isPowerOn) {
|
||||
useprint (other, 8, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.state == 0) {
|
||||
useprint (other, 11, self.cost, self.weapon);
|
||||
|
||||
if (!other.button7) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.points < self.cost) {
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
return;
|
||||
}
|
||||
|
||||
zapper_start(self.zappername);
|
||||
addmoney(other, -1*self.cost, false);
|
||||
}
|
||||
}
|
||||
|
||||
void() zapper_switch =
|
||||
{
|
||||
//
|
||||
// Set Default Stats for Compatibility
|
||||
//
|
||||
|
||||
// Model
|
||||
if (!self.model)
|
||||
self.model = "models/machines/zapper/z_switch.mdl";
|
||||
|
||||
// Cost
|
||||
if (!self.cost)
|
||||
self.cost = 1000;
|
||||
|
||||
// Cooldown Time
|
||||
if (!self.cooldown)
|
||||
self.cooldown = 30;
|
||||
|
||||
// Lasting Time
|
||||
if (!self.calc_time)
|
||||
self.calc_time = 60;
|
||||
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
precache_sound("sounds/machines/elec_shock.wav");
|
||||
setorigin(self, self.origin);
|
||||
setmodel(self, self.model);
|
||||
setsize(self, '-4 -4 -4', '4 4 4');
|
||||
self.state = 0;
|
||||
self.touch = zapper_touch;
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.classname = "zapper_switch";
|
||||
};
|
||||
|
||||
void() zapper_node =
|
||||
{
|
||||
//
|
||||
// Set Default Stats for Compatibility
|
||||
//
|
||||
|
||||
// Model
|
||||
if (!self.model)
|
||||
self.model = "models/machines/zapper/z_zap.mdl";
|
||||
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
setorigin(self, self.origin);
|
||||
setmodel(self, self.model);
|
||||
setsize (self, '-4 -4 -4', '4 4 4');
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.classname = "zapper_node";
|
||||
};
|
||||
|
||||
void() zapper_light =
|
||||
{
|
||||
//
|
||||
// Set Default Stats for Compatibility
|
||||
//
|
||||
|
||||
// Model
|
||||
if (!self.model)
|
||||
self.model = "models/machines/zapper/z_light.mdl";
|
||||
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
setorigin(self, self.origin);
|
||||
setmodel(self, self.model);
|
||||
setsize(self, '-4 -4 -4', '4 4 4');
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.classname = "zapper_light";
|
||||
};
|
||||
|
||||
void() trigger_electro =
|
||||
{
|
||||
self.classname = "zapper_field";
|
||||
InitTrigger ();
|
||||
self.solid = SOLID_TRIGGER;
|
||||
};
|
|
@ -242,8 +242,14 @@ void() PlayerPreThink =
|
|||
#endif
|
||||
} else if (self.zoom != 3) {
|
||||
self.maxspeed *= 0.5;
|
||||
} if (self.damagetimer > time) {
|
||||
self.maxspeed *= 0.5;
|
||||
}
|
||||
|
||||
// Speed Penalty
|
||||
if (self.speed_penalty_time > time)
|
||||
{
|
||||
self.maxspeed *= self.speed_penalty;
|
||||
} else {
|
||||
self.speed_penalty = 1;
|
||||
}
|
||||
|
||||
switch(self.stance) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
wave logic
|
||||
|
||||
Copyright (C) 2021 NZ:P Team
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
float() spawn_a_dogA;
|
||||
void() zapper_cooldown;
|
||||
|
||||
void() Spawn_Enemy =
|
||||
{
|
||||
|
@ -275,6 +276,16 @@ void() NewRound =
|
|||
if (rounds >= 10 && ach_tracker_spin == 0) {
|
||||
GiveAchievement(10);
|
||||
}
|
||||
|
||||
// Refresh Electric Traps
|
||||
entity zaps = find(world, classname, "zapper_switch");
|
||||
while(zaps != world) {
|
||||
if (zaps.mode == 1) {
|
||||
zaps.think = zapper_cooldown;
|
||||
zaps.nextthink = time + 0.1;
|
||||
}
|
||||
zaps = find(zaps, classname, "zapper_switch");
|
||||
}
|
||||
}
|
||||
void() Round_Core =
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ void() W_SprintStop =
|
|||
float endframe = GetFrame(self.weapon,SPRINT_OUT_END);
|
||||
string modelname = GetWeaponModel(self.weapon, 0);
|
||||
|
||||
if (self.isBuying || self.damagetimer > time || !self.sprinting)
|
||||
if (self.isBuying || !self.sprinting)
|
||||
return;
|
||||
|
||||
//TEMPORARY
|
||||
|
@ -134,6 +134,9 @@ void() W_SprintStop =
|
|||
|
||||
|
||||
void W_SprintStart () {
|
||||
if (self.speed_penalty_time > time)
|
||||
return;
|
||||
|
||||
self.sprint_start_time = time;
|
||||
|
||||
if (self.sprint_rest_time > sprint_max_time)
|
||||
|
|
Loading…
Reference in a new issue