WEAPON_CROSSBOW: Don't allow explosive bolts in singleplayer.

This commit is contained in:
Marco Cawthorne 2022-05-01 16:47:59 -07:00
parent 39471c1fb7
commit 3077b70734
Signed by: eukara
GPG Key ID: C196CD8BA993248A
5 changed files with 27 additions and 2 deletions

View File

@ -24,6 +24,8 @@ class HLGameRules:CGameRules
virtual void(base_player) LevelDecodeParms;
virtual void(base_player) LevelChangeParms;
virtual void(void) LevelNewParms;
virtual bool(void) IsMultiplayer;
};
class HLSingleplayerRules:HLGameRules
@ -31,6 +33,7 @@ class HLSingleplayerRules:HLGameRules
/* client */
virtual void(base_player) PlayerSpawn;
virtual void(base_player) PlayerDeath;
virtual bool(void) IsMultiplayer;
};
class HLMultiplayerRules:HLGameRules
@ -48,5 +51,5 @@ class HLMultiplayerRules:HLGameRules
virtual void(base_player) PlayerSpawn;
virtual void(base_player) PlayerDeath;
virtual float(base_player, string) ConsoleCommand;
virtual bool(void) IsMultiplayer;
};

View File

@ -14,6 +14,12 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
bool
HLGameRules::IsMultiplayer(void)
{
return false;
}
void
HLGameRules::LevelDecodeParms(base_player pp)
{

View File

@ -14,6 +14,12 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
bool
HLMultiplayerRules::IsMultiplayer(void)
{
return true;
}
void
HLMultiplayerRules::FrameStart(void)
{

View File

@ -14,6 +14,12 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
bool
HLSingleplayerRules::IsMultiplayer(void)
{
return false;
}
void
HLSingleplayerRules::PlayerDeath(base_player pl)
{

View File

@ -168,6 +168,7 @@ w_crossbow_primary(player pl)
pl.crossbow_mag--;
#ifndef CLIENT
HLGameRules rules = (HLGameRules) g_grMode;
Weapons_MakeVectors(pl);
entity bolt = spawn();
setmodel(bolt, "models/crossbow_bolt.mdl");
@ -181,7 +182,10 @@ w_crossbow_primary(player pl)
bolt.angles = vectoangles(bolt.velocity);
bolt.avelocity[2] = 10;
bolt.touch = Crossbolt_Touch;
bolt.weapon = pl.viewzoom == 1.0 ? 1 : 0;
if (rules.IsMultiplayer() == true)
bolt.weapon = pl.viewzoom == 1.0 ? 1 : 0;
setsize(bolt, [0,0,0], [0,0,0]);
if (pl.crossbow_mag > 0) {