mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-25 21:31:28 +00:00
SERVER: Add proper support for Rocket/Missile weapons, assign to Panzer/Longinus
This commit is contained in:
parent
92b464b424
commit
2e9838682b
6 changed files with 164 additions and 30 deletions
|
@ -30,6 +30,7 @@
|
|||
../source/server/entities/machines.qc
|
||||
|
||||
../source/server/weapons/frames_core.qc
|
||||
../source/server/weapons/rocket_launcher.qc
|
||||
../source/server/weapons/ray_gun.qc
|
||||
../source/server/weapons/weapon_core.qc
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
../source/server/entities/machines.qc
|
||||
|
||||
../source/server/weapons/frames_core.qc
|
||||
../source/server/weapons/rocket_launcher.qc
|
||||
../source/server/weapons/ray_gun.qc
|
||||
../source/server/weapons/weapon_core.qc
|
||||
../source/server/entities/powerups.qc
|
||||
|
|
128
source/server/weapons/rocket_launcher.qc
Normal file
128
source/server/weapons/rocket_launcher.qc
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
server/weapons/rocket_launcher.qc
|
||||
|
||||
Core logic for Rocket Launcher/Missile weapons.
|
||||
|
||||
Copyright (C) 2021-2023 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
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// Rocket_Die()
|
||||
// Called to de-spawn the rocket, as it's probably
|
||||
// not going to go anywhere at this point.
|
||||
//
|
||||
void() Rocket_Die =
|
||||
{
|
||||
// Cleanup
|
||||
SUB_Remove ();
|
||||
}
|
||||
|
||||
//
|
||||
// Rocket_Impact()
|
||||
// When something touches the Missile, check it's validity for
|
||||
// being used to set up the explosion.
|
||||
//
|
||||
void() Rocket_Impact =
|
||||
{
|
||||
if (!other.solid || other.solid == SOLID_TRIGGER)
|
||||
if (other != world)
|
||||
return;
|
||||
|
||||
if (other == self.owner)
|
||||
return;
|
||||
|
||||
float rocket_damage_min;
|
||||
float rocket_damage_max;
|
||||
float rocket_damage_radius;
|
||||
|
||||
// Longinus is OP!!!!
|
||||
if (IsPapWeapon(self.weapon)) {
|
||||
rocket_damage_min = 75;
|
||||
rocket_damage_max = 1200;
|
||||
rocket_damage_radius = 400;
|
||||
} else {
|
||||
rocket_damage_min = 75;
|
||||
rocket_damage_max = 600;
|
||||
rocket_damage_radius = 256;
|
||||
}
|
||||
|
||||
// Apply the Damage.
|
||||
DamgageExplode(self, self.owner, rocket_damage_max,
|
||||
rocket_damage_min, rocket_damage_radius);
|
||||
|
||||
// Spawn Effects
|
||||
|
||||
#ifdef FTE
|
||||
|
||||
te_customflash(self.origin, rocket_damage_radius, 300, '1 1 1');
|
||||
|
||||
#endif // FTE
|
||||
|
||||
CallExplosion(self.origin);
|
||||
|
||||
// Clean up!
|
||||
SUB_Remove ();
|
||||
};
|
||||
|
||||
//
|
||||
// W_FireRocket()
|
||||
// Called by weapon_core for the Rocket firetype. Sets up the
|
||||
// missile and prepares it for impact, also sets up timeout.
|
||||
//
|
||||
void() W_FireRocket =
|
||||
{
|
||||
entity rocket = spawn();
|
||||
rocket.owner = self;
|
||||
rocket.movetype = MOVETYPE_FLY;
|
||||
|
||||
rocket.weapon = self.weapon;
|
||||
rocket.solid = SOLID_BBOX;
|
||||
|
||||
// Start initial velocity projection.
|
||||
makevectors(self.v_angle);
|
||||
rocket.velocity = v_forward*2000;
|
||||
rocket.avelocity = '0 0 0';
|
||||
|
||||
// Make sure our angle is always FORWARD
|
||||
rocket.angles = vectoangles(rocket.velocity);
|
||||
rocket.angles_z += (rocket.angles_z + 180 < 360)? 180 : -180;
|
||||
rocket.angles = vectoangles(v_forward);
|
||||
rocket.v_angle = '0 0 200';
|
||||
|
||||
// Prepare for Impact and initiate de-spawn timer.
|
||||
rocket.touch = Rocket_Impact;
|
||||
rocket.think = Rocket_Die;
|
||||
rocket.nextthink = time + 8;
|
||||
|
||||
// Set model.
|
||||
setmodel(rocket, "models/misc/shark.mdl");
|
||||
setsize(rocket, '0 0 0', '0 0 0');
|
||||
|
||||
// final setup!
|
||||
rocket.origin = self.origin + self.view_ofs;
|
||||
rocket.origin += v_forward * 0;
|
||||
setorigin(rocket, rocket.origin);
|
||||
|
||||
self.animend = ReturnWeaponModel;
|
||||
self.callfuncat = 0;
|
||||
}
|
|
@ -1497,6 +1497,9 @@ void(float side) W_Fire =
|
|||
}
|
||||
|
||||
switch(firetype) {
|
||||
case FIRETYPE_ROCKET:
|
||||
W_FireRocket();
|
||||
break;
|
||||
case FIRETYPE_GRENADE:
|
||||
W_FireGrenade(side);
|
||||
break;
|
||||
|
|
|
@ -63,6 +63,7 @@ const float EVENT_WEAPONRECOIL = 40;
|
|||
// Weapon Firetype definitions
|
||||
#define FIRETYPE_FULLAUTO 0
|
||||
#define FIRETYPE_SEMIAUTO 1
|
||||
#define FIRETYPE_ROCKET 2
|
||||
#define FIRETYPE_GRENADE 3
|
||||
#define FIRETYPE_RAYBEAM 4
|
||||
#define FIRETYPE_TESLA 5
|
||||
|
|
|
@ -213,84 +213,84 @@ float(float wep) GetFiretype =
|
|||
switch (wep)
|
||||
{
|
||||
case W_COLT:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_BIATCH:
|
||||
return 3;
|
||||
return FIRETYPE_GRENADE;
|
||||
case W_KAR:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_ARMAGEDDON:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_THOMPSON:
|
||||
case W_GIBS:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_357:
|
||||
case W_KILLU:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_BAR:
|
||||
case W_WIDOW:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_BROWNING:
|
||||
case W_ACCELERATOR:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_DB:
|
||||
case W_BORE:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_FG:
|
||||
case W_IMPELLER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_GEWEHR:
|
||||
case W_COMPRESSOR:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_KAR_SCOPE:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_HEADCRACKER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_M1:
|
||||
case W_M1000:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_M1A1:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_WIDDER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_M2:
|
||||
case W_FIW:
|
||||
return 6;
|
||||
return FIRETYPE_FLAME;
|
||||
case W_MP40:
|
||||
case W_AFTERBURNER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_MP5K:
|
||||
case W_KOLLIDER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_MG:
|
||||
case W_BARRACUDA:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_PANZER:
|
||||
case W_LONGINUS:
|
||||
return 3;
|
||||
return FIRETYPE_ROCKET;
|
||||
case W_PPSH:
|
||||
case W_REAPER:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_PTRS:
|
||||
case W_PENETRATOR:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_RAY:
|
||||
case W_PORTER:
|
||||
return 4;
|
||||
return FIRETYPE_RAYBEAM;
|
||||
case W_SAWNOFF:
|
||||
case W_SNUFF:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_STG:
|
||||
case W_SPATZ:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_TRENCH:
|
||||
case W_GUT:
|
||||
return 1;
|
||||
return FIRETYPE_SEMIAUTO;
|
||||
case W_TYPE:
|
||||
case W_SAMURAI:
|
||||
return 0;
|
||||
return FIRETYPE_FULLAUTO;
|
||||
case W_TESLA:
|
||||
case W_DG3:
|
||||
return 5;
|
||||
return FIRETYPE_TESLA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3310,7 +3310,7 @@ void(float weptype) precache_extra =
|
|||
precache_sound ("sounds/weapons/panzer/move.wav");
|
||||
precache_sound ("sounds/weapons/panzer/insert.wav");
|
||||
precache_sound ("sounds/weapons/panzer/shoot.wav");
|
||||
//precache_model ("progs/shark.mdl");
|
||||
precache_model ("models/misc/shark.mdl");
|
||||
break;
|
||||
case W_PPSH:
|
||||
case W_REAPER:
|
||||
|
|
Loading…
Reference in a new issue