SERVER: Bring changes necessary for '1room' Beta compatibility

This commit is contained in:
cypress 2024-01-01 16:53:29 -05:00
parent c8bc829a83
commit 69d86ed722
3 changed files with 83 additions and 26 deletions

View file

@ -238,32 +238,6 @@ void() trigger_activator =
self.touch = trigger_activator_touch;
}
#define SPAWNFLAG_TRIGGERCMD_NOPLAYER 1
#define SPAWNFLAG_TRIGGERCMD_NOSPEC 2
void() trigger_stuffcmd_touch =
{
// First, lets make sure this is a client
if (other.classname != "player" && other.classname != "spectator")
return;
// Don't interact with players
if ((self.spawnflags & SPAWNFLAG_TRIGGERCMD_NOPLAYER) && other.classname == "player")
return;
// Don't interact with spectators
if ((self.spawnflags & SPAWNFLAG_TRIGGERCMD_NOSPEC) && other.classname == "spectator")
return;
// Run the command.
stuffcmd(other, strcat(self.message, "\n"));
}
void() trigger_stuffcmd =
{
InitTrigger();
self.touch = trigger_stuffcmd_touch;
}
void() trigger_interact_touch =
{
if (other.classname != "player" || other.downed || other.isBuying == true || !PlayerIsLooking(other, self))

View file

@ -740,6 +740,18 @@ string(string asset) convert_old_asset_path =
case "progs/g_m1a1.mdl":
ret = "models/weapons/m1carbine/g_m1a1.mdl";
break;
case "progs/g_ray.mdl":
ret = "models/weapons/ray/g_ray.mdl";
break;
case "progs/g_tesla.mdl":
ret = "models/weapons/tesla/g_tesla.mdl";
break;
case "progs/g_mg.mdl":
ret = "models/weapons/mg/g_mg.mdl";
break;
case "progs/g_browning.mdl":
ret = "models/weapons/browning/g_browning.mdl";
break;
case "progs/gmodels/g_m1.mdl":
ret = "models/weapons/garand/g_m1.mdl";
break;

View file

@ -393,6 +393,77 @@ void() item_douple = {map_compatibility_mode = MAP_COMPAT_BETA; Compat_RelocateB
void() item_staminup = {map_compatibility_mode = MAP_COMPAT_BETA; Compat_RelocateBetaPerkMachine(COMPAT_RELOCAT_NORM); perk_staminup();};
void() item_pap = {map_compatibility_mode = MAP_COMPAT_BETA; Compat_RelocateBetaPerkMachine(COMPAT_RELOCAT_PAP); perk_pap();};
//
// NZ:P Beta Triggers
//
#ifdef FTE
//
// Compat_TriggerCommandIsSafe()
// Pass a trigger_command .message to this,
// it's a whitelist that determines whether
// or not we should let the map use this.
//
float(string msg) Compat_TriggerCommandIsSafe =
{
// First check: Don't allow multiple commands, at all. So
// fail if there's a ';' anywhere.
for(float i = 0; i < strlen(msg) - 1; i++) {
if (substring(msg, i, i + 1) == ";")
return false;
}
// Allow playing audio and whatnot.
if (substring(msg, 0, 4) != "play")
return false;
return true;
}
void() touch_command =
{
if (other.classname != "player" || self.electro_targeted)
return;
self.electro_targeted = true;
// Follow up with cl_insta because whoever wrote this way back
// forgot to perform a line break..
stuffcmd(other, strcat(self.message, "cl_insta\n"));
}
#endif // FTE
//
// trigger_command
// Whoever was behind this was nasty...
// on contact, this trigger runs a stuffcmd()
// to the touching client. Obviously, this can't
// fly.
//
void() trigger_command =
{
map_compatibility_mode = MAP_COMPAT_BETA;
#ifdef FTE
// If there's no message, or the message
// is invalid, remove this garbage.
if (!self.message || !Compat_TriggerCommandIsSafe(self.message)) {
return;
}
InitTrigger();
self.touch = touch_command;
#else
remove(self);
#endif // FTE
}
//
// Compat_Init()