2020-09-20 01:43:13 -07:00
|
|
|
/*
|
2022-07-07 09:10:14 -07:00
|
|
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
2020-09-20 01:43:13 -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-20 01:43:13 -07:00
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
/* NSTrigger class is responsible for the legacy trigger architecture.
|
|
|
|
In the future, NSEntity can be configured so that legacy
|
|
|
|
triggers can be disabled. That's why this class is separate from NSIO.
|
2020-09-20 01:43:13 -07:00
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
This is a very low-level class. You're never meant to use this.
|
|
|
|
Use NSEntity as a basis for your classes.
|
|
|
|
*/
|
2020-09-20 01:43:13 -07:00
|
|
|
|
2022-01-10 23:48:14 -08:00
|
|
|
#define CENVGLOBAL_CVAR "env_global_data"
|
|
|
|
|
2022-08-10 14:24:06 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GLOBAL_OFF,
|
|
|
|
GLOBAL_ON,
|
|
|
|
GLOBAL_DEAD
|
|
|
|
} globalstate_t;
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
class NSTrigger:NSIO
|
2020-09-20 01:43:13 -07:00
|
|
|
{
|
2021-10-19 16:18:36 -07:00
|
|
|
void(void) NSTrigger;
|
|
|
|
|
2022-08-31 15:18:06 -07:00
|
|
|
/* not needed to be saved right now */
|
|
|
|
float m_flTouchTime;
|
|
|
|
bool m_beingTouched;
|
|
|
|
entity m_eTouchLast;
|
|
|
|
|
|
|
|
/* touch/blocked */
|
|
|
|
virtual void(entity) Blocked;
|
|
|
|
virtual void(entity) StartTouch;
|
|
|
|
virtual void(entity) Touch;
|
|
|
|
virtual void(entity) EndTouch;
|
|
|
|
nonvirtual void(void) _TouchHandler;
|
|
|
|
nonvirtual void(void) _BlockedHandler;
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
#ifdef SERVER
|
|
|
|
string m_oldstrTarget; /* needed due to trigger_changetarget */
|
|
|
|
|
2022-08-10 14:24:06 -07:00
|
|
|
string m_strGlobalState;
|
2020-09-20 01:43:13 -07:00
|
|
|
string m_strKillTarget;
|
|
|
|
string m_strMessage;
|
|
|
|
string m_strMaster;
|
|
|
|
int m_iUseType;
|
|
|
|
int m_iValue;
|
|
|
|
|
|
|
|
/* legacy trigger architecture */
|
|
|
|
float m_flDelay;
|
|
|
|
virtual void(entity, int) Trigger;
|
2022-08-31 13:24:18 -07:00
|
|
|
nonvirtual void(entity, int, float) UseTargets;
|
|
|
|
nonvirtual void(string) SetTriggerTarget;
|
2020-09-20 01:43:13 -07:00
|
|
|
|
|
|
|
/* master feature */
|
2022-08-24 15:11:04 -07:00
|
|
|
nonvirtual int(void) GetValue;
|
|
|
|
nonvirtual int(void) GetMaster;
|
|
|
|
nonvirtual globalstate_t(string) GetGlobalValue;
|
2022-08-26 15:39:00 -07:00
|
|
|
nonvirtual string(void) GetTriggerTarget;
|
|
|
|
nonvirtual bool(void) HasTriggerTarget;
|
|
|
|
nonvirtual bool(void) HasTargetname;
|
2020-09-20 01:43:13 -07:00
|
|
|
|
2022-08-31 15:18:06 -07:00
|
|
|
/* team */
|
|
|
|
nonvirtual void(float) SetTeam;
|
|
|
|
nonvirtual float(void) GetTeam;
|
|
|
|
|
2021-10-22 11:51:51 -07:00
|
|
|
/* overrides */
|
|
|
|
virtual void(float) Save;
|
|
|
|
virtual void(string,string) Restore;
|
2022-03-26 23:26:28 -07:00
|
|
|
virtual void(entity, string, string) Input;
|
2022-08-31 15:18:06 -07:00
|
|
|
#else
|
|
|
|
float team;
|
2021-10-19 16:18:36 -07:00
|
|
|
#endif
|
2021-10-23 03:40:35 -07:00
|
|
|
virtual void(string, string) SpawnKey;
|
2021-10-19 16:18:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
USE_TOGGLE,
|
|
|
|
USE_CONTINOUS
|
2020-09-20 01:43:13 -07:00
|
|
|
};
|
2021-10-19 16:18:36 -07:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TRIG_OFF,
|
|
|
|
TRIG_ON,
|
|
|
|
TRIG_TOGGLE
|
2022-07-07 09:10:14 -07:00
|
|
|
};
|