2020-09-04 12:28:06 -07:00
|
|
|
/*
|
2022-07-07 09:10:14 -07:00
|
|
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
2020-09-04 12:28:06 -07:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2022-07-07 09:10:14 -07:00
|
|
|
*/
|
2020-09-04 12:28:06 -07:00
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
/*!QUAKED func_tankcontrols (0 .5 .8) ?
|
|
|
|
# OVERVIEW
|
2021-07-14 02:49:30 -07:00
|
|
|
Brush that marks the usable region of a func_tankmortar, in order
|
|
|
|
to gain control.
|
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
# KEYS
|
|
|
|
- "targetname" : Name
|
2020-10-25 04:38:41 -07:00
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
# TRIVIA
|
2020-10-25 04:38:41 -07:00
|
|
|
This entity was introduced in Half-Life (1998).
|
2020-09-04 12:28:06 -07:00
|
|
|
*/
|
2022-08-10 14:24:06 -07:00
|
|
|
class
|
|
|
|
func_tankcontrols:NSBrushTrigger
|
2020-09-04 12:28:06 -07:00
|
|
|
{
|
2022-12-06 15:04:07 -08:00
|
|
|
public:
|
|
|
|
void func_tankcontrols(void);
|
|
|
|
|
|
|
|
virtual void OnPlayerUse(void);
|
|
|
|
virtual void Respawn(void);
|
2020-09-04 12:28:06 -07:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-08-10 14:24:06 -07:00
|
|
|
void
|
|
|
|
func_tankcontrols::func_tankcontrols(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
func_tankcontrols::Respawn(void)
|
|
|
|
{
|
|
|
|
InitBrushTrigger();
|
|
|
|
solid = SOLID_BBOX;
|
|
|
|
SetOrigin(GetSpawnOrigin());
|
|
|
|
PlayerUse = OnPlayerUse;
|
|
|
|
}
|
|
|
|
|
2020-09-04 12:28:06 -07:00
|
|
|
void
|
2020-11-25 01:32:42 -08:00
|
|
|
func_tankcontrols::OnPlayerUse(void)
|
2020-09-04 12:28:06 -07:00
|
|
|
{
|
|
|
|
entity f;
|
2021-10-19 16:18:36 -07:00
|
|
|
NSVehicle tank;
|
2020-09-04 12:28:06 -07:00
|
|
|
|
2020-09-08 23:05:34 -07:00
|
|
|
tank = __NULL__;
|
|
|
|
|
2020-09-04 12:28:06 -07:00
|
|
|
if (!(eActivator.flags & FL_CLIENT)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-08 13:49:35 -07:00
|
|
|
for (f = world; (f = find(f, ::targetname, target));) {
|
2020-09-04 12:28:06 -07:00
|
|
|
/* we found the right entity */
|
|
|
|
if (f.classname == "func_tank" || f.classname == "func_tankmortar") {
|
2021-10-19 16:18:36 -07:00
|
|
|
tank = (NSVehicle)f;
|
2020-09-04 12:28:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tank) {
|
|
|
|
if (!tank.m_eDriver)
|
2022-05-11 12:49:04 -07:00
|
|
|
tank.PlayerEnter((NSClientPlayer)eActivator);
|
2020-09-04 12:28:06 -07:00
|
|
|
else if (tank.m_eDriver == eActivator)
|
2022-05-11 12:49:04 -07:00
|
|
|
tank.PlayerLeave((NSClientPlayer)eActivator);
|
2020-09-04 12:28:06 -07:00
|
|
|
}
|
|
|
|
}
|