From 0bb88774a274827344299cbbd6eb7076fffbccbe Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 6 Mar 2024 19:11:37 -0800 Subject: [PATCH] Add new class: NSSpawnPoint. --- platform/base_scripts.pk3dir/def/spawns.def | 26 +++++++++++++++++ src/botlib/botinfo.h | 2 ++ src/shared/NSSpawnPoint.h | 26 +++++++++++++++++ src/shared/NSSpawnPoint.qc | 31 +++++++++++++++++++++ src/shared/defs.h | 2 ++ src/shared/include.src | 1 + 6 files changed, 88 insertions(+) create mode 100644 platform/base_scripts.pk3dir/def/spawns.def create mode 100644 src/shared/NSSpawnPoint.h create mode 100644 src/shared/NSSpawnPoint.qc diff --git a/platform/base_scripts.pk3dir/def/spawns.def b/platform/base_scripts.pk3dir/def/spawns.def new file mode 100644 index 00000000..50c9e671 --- /dev/null +++ b/platform/base_scripts.pk3dir/def/spawns.def @@ -0,0 +1,26 @@ +entityDef info_player_start +{ + editor_mins "-16 -16 -36" + editor_maxs "16 16 36" + editor_description "Singleplayer Spawn Point" + + spawnclass NSSpawnPoint +} + +entityDef info_player_deathmatch +{ + editor_mins "-16 -16 -36" + editor_maxs "16 16 36" + editor_description "Deathmatch Spawn Point" + + spawnclass NSSpawnPoint +} + +entityDef info_player_coop +{ + editor_mins "-16 -16 -36" + editor_maxs "16 16 36" + editor_description "Cooperative Spawn Point" + + spawnclass NSSpawnPoint +} \ No newline at end of file diff --git a/src/botlib/botinfo.h b/src/botlib/botinfo.h index 37f684fd..fbc2f19f 100644 --- a/src/botlib/botinfo.h +++ b/src/botlib/botinfo.h @@ -27,3 +27,5 @@ enum BOTINFO_TEAM_GOALCAPTURE, /* where to go when goal-item present */ BOTINFO_END /* end destination */ }; + +.float botinfo; \ No newline at end of file diff --git a/src/shared/NSSpawnPoint.h b/src/shared/NSSpawnPoint.h new file mode 100644 index 00000000..f3d74259 --- /dev/null +++ b/src/shared/NSSpawnPoint.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Vera Visions LLC. + * + * 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. +*/ + +/** This entity class represents spawnpoints. +*/ +class NSSpawnPoint:NSPointTrigger +{ +public: + void NSSpawnPoint(void); + + /* overrides */ + virtual void Respawn(void); +}; diff --git a/src/shared/NSSpawnPoint.qc b/src/shared/NSSpawnPoint.qc new file mode 100644 index 00000000..e44e9138 --- /dev/null +++ b/src/shared/NSSpawnPoint.qc @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Vera Visions LLC. + * + * 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. +*/ + +void +NSSpawnPoint::NSSpawnPoint(void) +{ +} + +void +NSSpawnPoint::Respawn(void) +{ + InitPointTrigger(); + setorigin_safe(this, GetSpawnOrigin()); + SetSize(VEC_HULL_MIN, VEC_HULL_MAX); + SetSolid(SOLID_NOT); + SetMovetype(MOVETYPE_NONE); + botinfo = BOTINFO_SPAWNPOINT; +} diff --git a/src/shared/defs.h b/src/shared/defs.h index 01d3cc7f..f8e0032e 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -78,6 +78,7 @@ string __fullspawndata; #include "../gs-entbase/server/defs.h" #endif +#include "../botlib/botinfo.h" #include "sentences.h" #include "NSIO.h" @@ -95,6 +96,7 @@ string __fullspawndata; #include "NSMonster.h" #include "NSSquadMonster.h" #include "NSTalkMonster.h" +#include "NSSpawnPoint.h" #include "NSProjectile.h" #include "NSItem.h" #include "NSSpraylogo.h" diff --git a/src/shared/include.src b/src/shared/include.src index 8d3f2d45..9d82ac00 100644 --- a/src/shared/include.src +++ b/src/shared/include.src @@ -17,6 +17,7 @@ NSMonster.qc NSSquadMonster.qc NSTalkMonster.qc NSProjectile.qc +NSSpawnPoint.qc NSItem.qc NSPortal.qc NSDebris.qc