mirror of
https://git.code.sf.net/p/quake/prozac-qfcc
synced 2025-02-24 21:11:20 +00:00
mercury's building fix. you now *never* loose your buildings through walls when you build them. Yay!
This commit is contained in:
parent
20e9fe09ae
commit
be736a6e22
1 changed files with 54 additions and 75 deletions
129
engineer.qc
129
engineer.qc
|
@ -1,5 +1,3 @@
|
||||||
#include "defs.qh"
|
|
||||||
#include "menu.qh"
|
|
||||||
/*======================================================
|
/*======================================================
|
||||||
ENGINEER.QC Custom TeamFortress v3.1
|
ENGINEER.QC Custom TeamFortress v3.1
|
||||||
|
|
||||||
|
@ -9,6 +7,10 @@
|
||||||
========================================================
|
========================================================
|
||||||
Weapons and functions for the ENGINEER class and associated weaponry
|
Weapons and functions for the ENGINEER class and associated weaponry
|
||||||
=======================================================*/
|
=======================================================*/
|
||||||
|
|
||||||
|
#include "defs.qh"
|
||||||
|
#include "menu.qh"
|
||||||
|
|
||||||
float modelindex_tesla; //CH
|
float modelindex_tesla; //CH
|
||||||
// Weapon Functions
|
// Weapon Functions
|
||||||
void() LaserBolt_Touch;
|
void() LaserBolt_Touch;
|
||||||
|
@ -30,7 +32,6 @@ void(entity disp) Engineer_UseDispenser;
|
||||||
void(entity gun) Engineer_UseSentryGun;
|
void(entity gun) Engineer_UseSentryGun;
|
||||||
void(entity cam) Engineer_UseCamera;
|
void(entity cam) Engineer_UseCamera;
|
||||||
void() CheckDistance;
|
void() CheckDistance;
|
||||||
float(entity obj, entity builder) CheckArea;
|
|
||||||
//WK
|
//WK
|
||||||
void() Sentry_Touch;
|
void() Sentry_Touch;
|
||||||
float(float myteam) HasFlag;
|
float(float myteam) HasFlag;
|
||||||
|
@ -483,15 +484,14 @@ void() TeamFortress_EngineerBuild =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
float(entity obj, entity builder) CheckArea =
|
float(entity obj, entity builder) CheckArea =
|
||||||
{
|
{
|
||||||
local vector src, end;
|
local vector src, end;
|
||||||
local float pos;
|
local float pos;
|
||||||
|
|
||||||
// Check the origin
|
// Check the origin
|
||||||
pos = pointcontents(obj.origin);
|
pos = pointcontents(obj.origin);
|
||||||
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Check the surrounding area
|
// Check the surrounding area
|
||||||
|
@ -499,8 +499,8 @@ float(entity obj, entity builder) CheckArea =
|
||||||
src_y = obj.origin_y + obj.maxs_y + 16;
|
src_y = obj.origin_y + obj.maxs_y + 16;
|
||||||
src_z = obj.origin_z + obj.maxs_z + 16; // check upwards more
|
src_z = obj.origin_z + obj.maxs_z + 16; // check upwards more
|
||||||
|
|
||||||
pos = pointcontents(src);
|
pos = pointcontents(src);
|
||||||
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
end_x = obj.origin_x + obj.mins_x - 16;
|
end_x = obj.origin_x + obj.mins_x - 16;
|
||||||
|
@ -510,8 +510,8 @@ float(entity obj, entity builder) CheckArea =
|
||||||
if (trace_fraction != 1)
|
if (trace_fraction != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pos = pointcontents(end);
|
pos = pointcontents(end);
|
||||||
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// extend the size a little
|
// extend the size a little
|
||||||
|
@ -519,21 +519,21 @@ float(entity obj, entity builder) CheckArea =
|
||||||
src_y = obj.origin_y + obj.maxs_y + 16;
|
src_y = obj.origin_y + obj.maxs_y + 16;
|
||||||
src_z = obj.origin_z + obj.maxs_z + 16;
|
src_z = obj.origin_z + obj.maxs_z + 16;
|
||||||
|
|
||||||
pos = pointcontents(src);
|
pos = pointcontents(src);
|
||||||
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
end_x = obj.origin_x + obj.maxs_x + 16;
|
end_x = obj.origin_x + obj.maxs_x + 16;
|
||||||
end_y = obj.origin_y + obj.mins_y - 16;
|
end_y = obj.origin_y + obj.mins_y - 16;
|
||||||
end_z = obj.origin_z + obj.mins_z - 16; // check downwards less
|
end_z = obj.origin_z + obj.mins_z - 16; // check downwards less
|
||||||
|
|
||||||
traceline (src, end, TRUE, obj);
|
traceline (src, end, TRUE, obj);
|
||||||
|
|
||||||
if (trace_fraction != 1)
|
if (trace_fraction != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pos = pointcontents(end);
|
pos = pointcontents(end);
|
||||||
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Trace a line from the player to the object too
|
// Trace a line from the player to the object too
|
||||||
|
@ -547,12 +547,14 @@ float(entity obj, entity builder) CheckArea =
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// rehashed version of TF_Build
|
// rehashed version of TF_Build
|
||||||
void(float objtobuild) TeamFortress_Build =
|
void(float objtobuild) TeamFortress_Build =
|
||||||
{
|
{
|
||||||
local float btime;
|
local float btime;
|
||||||
local entity te;
|
local entity tmp;
|
||||||
local vector tmp1, tmp2;
|
local vector tmp1, tmp2;
|
||||||
|
|
||||||
newmis = spawn();
|
newmis = spawn();
|
||||||
|
@ -591,8 +593,8 @@ void(float objtobuild) TeamFortress_Build =
|
||||||
sprint(self, PRINT_HIGH, "You must buy the dispenser before you can build it.\n");
|
sprint(self, PRINT_HIGH, "You must buy the dispenser before you can build it.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmp1 = '-16 -16 0';
|
tmp1 = '-8 -8 0';
|
||||||
tmp2 = '16 16 48';
|
tmp2 = '8 8 24';
|
||||||
|
|
||||||
#ifdef no_new_dispenser
|
#ifdef no_new_dispenser
|
||||||
newmis.mdl = "progs/disp.mdl";
|
newmis.mdl = "progs/disp.mdl";
|
||||||
|
@ -638,14 +640,14 @@ void(float objtobuild) TeamFortress_Build =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//tmp1 = '-16 -16 0'; //- OfN commented by
|
// tmp1 = '-16 -16 0'; //- OfN commented by
|
||||||
tmp1 = '-16 -16 -25';
|
tmp1 = '-16 -16 -25';
|
||||||
//tmp2 = '16 16 48'; //WK 62 is better, but crashes?
|
// tmp2 = '16 16 48'; //WK 62 is better, but crashes?
|
||||||
tmp2 = '16 16 23';
|
tmp2 = '16 16 23';
|
||||||
//newmis.mdl = "progs/newtesla.mdl";
|
//newmis.mdl = "progs/newtesla.mdl";
|
||||||
newmis.mdl = "progs/coil.mdl";
|
newmis.mdl = "progs/coil.mdl";
|
||||||
newmis.netname = "tesla";
|
newmis.netname = "tesla";
|
||||||
newmis.origin = newmis.origin + '0 0 25';
|
// newmis.origin = newmis.origin + '0 0 25';
|
||||||
|
|
||||||
|
|
||||||
btime = time + BUILD_TIME_TESLA;
|
btime = time + BUILD_TIME_TESLA;
|
||||||
|
@ -707,14 +709,39 @@ void(float objtobuild) TeamFortress_Build =
|
||||||
|
|
||||||
if (objtobuild != BUILD_SECURITY_CAMERA)
|
if (objtobuild != BUILD_SECURITY_CAMERA)
|
||||||
{
|
{
|
||||||
// before we start building it, check it out
|
newmis.owner = self;
|
||||||
// check for validity of point
|
newmis.classname = "timer";
|
||||||
if (CheckArea(newmis, self) == FALSE)
|
newmis.netname = "build_timer";
|
||||||
|
newmis.nextthink = btime;
|
||||||
|
newmis.think = TeamFortress_FinishedBuilding;
|
||||||
|
newmis.colormap = self.colormap;
|
||||||
|
newmis.weapon = objtobuild;
|
||||||
|
newmis.angles_y = anglemod(self.angles_y + 180);
|
||||||
|
|
||||||
|
// newmis.velocity = '0 0 8';
|
||||||
|
newmis.movetype = MOVETYPE_TOSS;
|
||||||
|
|
||||||
|
newmis.solid = SOLID_BBOX;
|
||||||
|
setmodel (newmis, newmis.mdl);
|
||||||
|
setsize (newmis, tmp1, tmp2);
|
||||||
|
if (objtobuild==BUILD_TESLA)
|
||||||
{
|
{
|
||||||
|
newmis.skin = self.team_no;
|
||||||
|
if (self.team_no==3) newmis.skin=0;
|
||||||
|
else if (self.team_no==4) newmis.skin=3;
|
||||||
|
}
|
||||||
|
|
||||||
|
newmis.flags = newmis.flags | FL_ONGROUND;
|
||||||
|
setorigin (newmis, newmis.origin + '0 0 8');
|
||||||
|
tmp = self;
|
||||||
|
self = newmis;
|
||||||
|
if (droptofloor() == FALSE) {
|
||||||
|
self = tmp;
|
||||||
sprint(self, PRINT_HIGH, "Not enough room to build here\n");
|
sprint(self, PRINT_HIGH, "Not enough room to build here\n");
|
||||||
dremove(newmis);
|
dremove(newmis);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
self = tmp;
|
||||||
|
|
||||||
self.is_building = 1;
|
self.is_building = 1;
|
||||||
makeImmune(self,time + 2);
|
makeImmune(self,time + 2);
|
||||||
|
@ -732,32 +759,6 @@ void(float objtobuild) TeamFortress_Build =
|
||||||
#else
|
#else
|
||||||
self.pausetime = btime;
|
self.pausetime = btime;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
newmis.owner = self;
|
|
||||||
newmis.classname = "timer";
|
|
||||||
newmis.netname = "build_timer";
|
|
||||||
newmis.nextthink = btime;
|
|
||||||
newmis.think = TeamFortress_FinishedBuilding;
|
|
||||||
newmis.colormap = self.colormap;
|
|
||||||
newmis.weapon = objtobuild;
|
|
||||||
newmis.angles_y = anglemod(self.angles_y + 180);
|
|
||||||
|
|
||||||
newmis.velocity = '0 0 8';
|
|
||||||
newmis.movetype = MOVETYPE_TOSS;
|
|
||||||
|
|
||||||
newmis.solid = SOLID_BBOX;
|
|
||||||
setmodel (newmis, newmis.mdl);
|
|
||||||
setsize (newmis, tmp1, tmp2);
|
|
||||||
setorigin (newmis, newmis.origin);
|
|
||||||
|
|
||||||
if (objtobuild==BUILD_TESLA)
|
|
||||||
{
|
|
||||||
newmis.skin = self.team_no;
|
|
||||||
if (self.team_no==3) newmis.skin=0;
|
|
||||||
else if (self.team_no==4) newmis.skin=3;
|
|
||||||
}
|
|
||||||
|
|
||||||
newmis.flags = newmis.flags - (newmis.flags & FL_ONGROUND);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -796,6 +797,7 @@ void() DispenserThink =
|
||||||
|
|
||||||
void() TeamFortress_FinishedBuilding =
|
void() TeamFortress_FinishedBuilding =
|
||||||
{
|
{
|
||||||
|
local entity tmpself;
|
||||||
local entity oldself;
|
local entity oldself;
|
||||||
local float current_yaw;
|
local float current_yaw;
|
||||||
local vector source;
|
local vector source;
|
||||||
|
@ -852,9 +854,6 @@ void() TeamFortress_FinishedBuilding =
|
||||||
oldself.colormap = self.colormap; // Set the Color
|
oldself.colormap = self.colormap; // Set the Color
|
||||||
oldself.takedamage = DAMAGE_AIM;
|
oldself.takedamage = DAMAGE_AIM;
|
||||||
oldself.owner = world;
|
oldself.owner = world;
|
||||||
oldself.movetype = MOVETYPE_TOSS;
|
|
||||||
oldself.velocity = '0 0 8';
|
|
||||||
oldself.flags = oldself.flags - (oldself.flags & FL_ONGROUND);
|
|
||||||
|
|
||||||
// Put some ammo in the Dispenser
|
// Put some ammo in the Dispenser
|
||||||
oldself.ammo_shells = ceil(self.ammo_shells * 0.25);
|
oldself.ammo_shells = ceil(self.ammo_shells * 0.25);
|
||||||
|
@ -872,8 +871,6 @@ void() TeamFortress_FinishedBuilding =
|
||||||
|
|
||||||
oldself.solid = SOLID_BBOX;
|
oldself.solid = SOLID_BBOX;
|
||||||
setmodel(oldself, oldself.mdl);
|
setmodel(oldself, oldself.mdl);
|
||||||
setsize (oldself, '-8 -8 0', '8 8 24');
|
|
||||||
setorigin(oldself, oldself.origin + '0 0 16'); //CH disp does jump
|
|
||||||
}
|
}
|
||||||
else if (oldself.weapon == BUILD_SENTRYGUN)
|
else if (oldself.weapon == BUILD_SENTRYGUN)
|
||||||
{
|
{
|
||||||
|
@ -921,8 +918,6 @@ void() TeamFortress_FinishedBuilding =
|
||||||
|
|
||||||
newmis.takedamage = DAMAGE_AIM;
|
newmis.takedamage = DAMAGE_AIM;
|
||||||
newmis.velocity = '0 0 -8';
|
newmis.velocity = '0 0 -8';
|
||||||
newmis.flags = newmis.flags - (newmis.flags & FL_ONGROUND);
|
|
||||||
oldself.flags = oldself.flags - (oldself.flags & FL_ONGROUND);
|
|
||||||
|
|
||||||
newmis.frags = 0; //CH how many people has your sent killed?
|
newmis.frags = 0; //CH how many people has your sent killed?
|
||||||
|
|
||||||
|
@ -975,9 +970,6 @@ void() TeamFortress_FinishedBuilding =
|
||||||
oldself.health = BUILD_HEALTH_TESLA;
|
oldself.health = BUILD_HEALTH_TESLA;
|
||||||
oldself.movetype = MOVETYPE_TOSS;
|
oldself.movetype = MOVETYPE_TOSS;
|
||||||
oldself.colormap = self.colormap; // Set the Base Color
|
oldself.colormap = self.colormap; // Set the Base Color
|
||||||
oldself.velocity = '0 0 -8';
|
|
||||||
oldself.avelocity = '0 0 0';
|
|
||||||
oldself.flags = oldself.flags - (oldself.flags & FL_ONGROUND);
|
|
||||||
oldself.team_no = self.team_no;
|
oldself.team_no = self.team_no;
|
||||||
|
|
||||||
//- OfN -
|
//- OfN -
|
||||||
|
@ -1065,13 +1057,11 @@ void() TeamFortress_FinishedBuilding =
|
||||||
oldself.takedamage = DAMAGE_AIM;
|
oldself.takedamage = DAMAGE_AIM;
|
||||||
oldself.owner = world;
|
oldself.owner = world;
|
||||||
oldself.movetype = MOVETYPE_TOSS;
|
oldself.movetype = MOVETYPE_TOSS;
|
||||||
oldself.velocity = '0 0 8';
|
|
||||||
oldself.flags = oldself.flags - (oldself.flags & FL_ONGROUND);
|
|
||||||
|
|
||||||
oldself.solid = SOLID_BBOX;
|
oldself.solid = SOLID_BBOX;
|
||||||
setmodel(oldself, oldself.mdl);
|
setmodel(oldself, oldself.mdl);
|
||||||
setsize (oldself, '-16 -16 0', '16 16 4');
|
setsize (oldself, '-16 -16 0', '16 16 4');
|
||||||
setorigin(oldself, oldself.origin + '0 0 8'); //CH does jump
|
setorigin(oldself, oldself.origin); //CH does jump
|
||||||
|
|
||||||
oldself.heat = 4; //dont come on for 4 seconds
|
oldself.heat = 4; //dont come on for 4 seconds
|
||||||
oldself.think = Teleporter_heat_think;
|
oldself.think = Teleporter_heat_think;
|
||||||
|
@ -1112,22 +1102,12 @@ void() TeamFortress_FinishedBuilding =
|
||||||
oldself.takedamage = DAMAGE_AIM;
|
oldself.takedamage = DAMAGE_AIM;
|
||||||
oldself.owner = world;
|
oldself.owner = world;
|
||||||
oldself.movetype = MOVETYPE_TOSS;
|
oldself.movetype = MOVETYPE_TOSS;
|
||||||
oldself.velocity = '0 0 8';
|
|
||||||
oldself.flags = oldself.flags - (oldself.flags & FL_ONGROUND);
|
|
||||||
|
|
||||||
oldself.solid = SOLID_BBOX;
|
oldself.solid = SOLID_BBOX;
|
||||||
|
|
||||||
oldself.angles = '0 0 0';
|
oldself.angles = '0 0 0';
|
||||||
|
|
||||||
setmodel(oldself, oldself.mdl);
|
setmodel(oldself, oldself.mdl);
|
||||||
setsize (oldself, '-6 -6 0', '6 6 54');
|
|
||||||
setorigin(oldself, oldself.origin + '0 0 8'); //CH does jump
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//oldself.heat = 4; //dont come on for 4 seconds
|
|
||||||
/*oldself.think = Teleporter_heat_think;
|
|
||||||
oldself.nextthink = time + 1;*/
|
|
||||||
|
|
||||||
oldself.spawnflags = 4; //CH cause extensive checks for height
|
oldself.spawnflags = 4; //CH cause extensive checks for height
|
||||||
|
|
||||||
|
@ -1578,4 +1558,3 @@ void() CheckDistance =
|
||||||
|
|
||||||
self.nextthink = time + 0.3;
|
self.nextthink = time + 0.3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue