add Zone_Speedmod for oblivious

This commit is contained in:
rtldg 2022-05-10 01:50:50 +00:00
parent ab73e36a15
commit acf47a11b1
4 changed files with 161 additions and 68 deletions

View File

@ -16,11 +16,11 @@
"Start"
{
"visible" "1"
"red" "67"
"green" "210"
"blue" "230"
"alpha" "255"
"width" "0.5"
@ -30,11 +30,11 @@
"End"
{
"visible" "1"
"red" "165"
"green" "19"
"blue" "194"
"alpha" "255"
"width" "0.5"
}
@ -42,11 +42,11 @@
"Glitch_Respawn"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.5"
}
@ -54,11 +54,11 @@
"Glitch_Stop"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.5"
}
@ -66,11 +66,11 @@
"Glitch_Slay"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.5"
}
@ -78,11 +78,11 @@
"Freestyle"
{
"visible" "1"
"red" "25"
"green" "25"
"blue" "255"
"alpha" "195"
"width" "0.5"
}
@ -90,11 +90,11 @@
"Custom Speed Limit"
{
"visible" "1"
"red" "247"
"green" "3"
"blue" "255"
"alpha" "50"
"width" "0.5"
}
@ -102,11 +102,11 @@
"Teleport"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "4.0"
}
@ -114,11 +114,11 @@
"Easybhop"
{
"visible" "1"
"red" "57"
"green" "196"
"blue" "92"
"alpha" "175"
"width" "2.5"
}
@ -126,11 +126,11 @@
"Slide"
{
"visible" "1"
"red" "244"
"green" "66"
"blue" "92"
"alpha" "255"
"width" "1.5"
}
@ -138,11 +138,11 @@
"Airaccelerate"
{
"visible" "1"
"red" "118"
"green" "102"
"blue" "173"
"alpha" "255"
"width" "1.5"
}
@ -150,11 +150,11 @@
"Stage"
{
"visible" "1"
"red" "255"
"green" "153"
"blue" "0"
"alpha" "255"
"width" "0.5"
}
@ -162,11 +162,11 @@
"No Timer Gravity"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}
@ -174,11 +174,23 @@
"Gravity"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}
"Speedmod"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}
@ -186,11 +198,11 @@
"Bonus 1 Start"
{
"visible" "1"
"red" "255"
"green" "255"
"blue" "255"
"alpha" "255"
"width" "0.1"
}
@ -198,11 +210,11 @@
"Bonus 1 End"
{
"visible" "1"
"red" "123"
"green" "20"
"blue" "250"
"alpha" "255"
"width" "0.1"
}
@ -210,11 +222,11 @@
"Bonus 1 Glitch_Respawn"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.1"
}
@ -222,11 +234,11 @@
"Bonus 1 Glitch_Stop"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.1"
}
@ -234,11 +246,11 @@
"Bonus 1 Glitch_Slay"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "0.1"
}
@ -246,11 +258,11 @@
"Bonus 1 Freestyle"
{
"visible" "1"
"red" "25"
"green" "25"
"blue" "255"
"alpha" "195"
"width" "0.1"
}
@ -258,11 +270,11 @@
"Bonus 1 Custom Speed Limit"
{
"visible" "1"
"red" "247"
"green" "3"
"blue" "255"
"alpha" "50"
"width" "0.1"
}
@ -270,11 +282,11 @@
"Bonus 1 Teleport"
{
"visible" "0"
"red" "255"
"green" "200"
"blue" "0"
"alpha" "255"
"width" "2.0"
}
@ -282,11 +294,11 @@
"Bonus 1 Easybhop"
{
"visible" "1"
"red" "57"
"green" "196"
"blue" "92"
"alpha" "175"
"width" "1.75"
}
@ -294,11 +306,11 @@
"Bonus 1 Slide"
{
"visible" "1"
"red" "244"
"green" "66"
"blue" "92"
"alpha" "255"
"width" "1.0"
}
@ -306,23 +318,23 @@
"Bonus 1 Airaccelerate"
{
"visible" "1"
"red" "118"
"green" "102"
"blue" "173"
"alpha" "255"
"width" "1.0"
}
"Bonus 1 Stage"
{
"visible" "1"
"red" "204"
"green" "153"
"blue" "255"
"alpha" "255"
"width" "0.5"
}
@ -330,11 +342,11 @@
"Bonus 1 No Timer Gravity"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}
@ -342,11 +354,23 @@
"Bonus 1 Gravity"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}
"Bonus 1 Speedmod"
{
"visible" "1"
"red" "255"
"green" "0"
"blue" "255"
"alpha" "255"
"width" "1.0"
}

View File

@ -43,6 +43,7 @@ enum
Zone_Stage, // shows time when entering zone
Zone_NoTimerGravity, // prevents the timer from setting gravity while inside this zone
Zone_Gravity, // lets you set a specific gravity while inside this zone
Zone_Speedmod, // creates a player_speedmod
ZONETYPES_SIZE
};
@ -133,7 +134,8 @@ stock void GetZoneName(int client, int zoneType, char[] output, int size)
"Zone_Airaccelerate",
"Zone_Stage",
"Zone_NoTimerGravity",
"Zone_Gravity"
"Zone_Gravity",
"Zone_Speedmod"
};
if (zoneType >= ZONETYPES_SIZE)

View File

@ -803,6 +803,7 @@ bool JumpToZoneType(KeyValues kv, int type, int track)
{"Stage", ""},
{"No Timer Gravity", ""},
{"Gravity", ""},
{"Speedmod", ""},
};
char key[4][50];
@ -2301,6 +2302,10 @@ Action OpenTpToZoneMenu(int client, int pagepos=0)
{
FormatEx(sDisplay, 64, "#%d - %s %d (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else if (gA_ZoneCache[i].iZoneType == Zone_Gravity || gA_ZoneCache[i].iZoneType == Zone_Speedmod)
{
FormatEx(sDisplay, 64, "#%d - %s %.2f (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else
{
FormatEx(sDisplay, 64, "#%d - %s (%s)%s", (i + 1), sZoneName, sTrack, sPrebuilt);
@ -2401,6 +2406,10 @@ Action OpenEditMenu(int client, int pos = 0)
{
FormatEx(sDisplay, 64, "#%d - %s %d (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else if (gA_ZoneCache[i].iZoneType == Zone_Gravity || gA_ZoneCache[i].iZoneType == Zone_Speedmod)
{
FormatEx(sDisplay, 64, "#%d - %s %.2f (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else
{
FormatEx(sDisplay, 64, "#%d - %s (%s)%s", (i + 1), sZoneName, sTrack, sPrebuilt);
@ -2725,6 +2734,10 @@ Action OpenDeleteMenu(int client, int pos = 0)
{
FormatEx(sDisplay, 64, "#%d - %s %d (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else if (gA_ZoneCache[i].iZoneType == Zone_Gravity || gA_ZoneCache[i].iZoneType == Zone_Speedmod)
{
FormatEx(sDisplay, 64, "#%d - %s %.2f (%s)%s", (i + 1), sZoneName, gA_ZoneCache[i].iZoneData, sTrack, sPrebuilt);
}
else
{
FormatEx(sDisplay, 64, "#%d - %s (%s)%s", (i + 1), sZoneName, sTrack, sPrebuilt);
@ -2917,7 +2930,7 @@ public int MenuHandler_SelectZoneType(Menu menu, MenuAction action, int param1,
gI_ZoneType[param1] = StringToInt(info);
if (gI_ZoneType[param1] == Zone_Gravity)
if (gI_ZoneType[param1] == Zone_Gravity || gI_ZoneType[param1] == Zone_Speedmod)
{
gI_ZoneData[param1] = view_as<int>(1.0);
}
@ -3383,7 +3396,7 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
{
if(gB_WaitingForChatInput[client] && gI_MapStep[client] == 3)
{
if (gI_ZoneType[client] == Zone_Gravity)
if (gI_ZoneType[client] == Zone_Gravity || gI_ZoneType[client] == Zone_Speedmod)
{
gI_ZoneData[client] = view_as<int>(StringToFloat(sArgs));
}
@ -3516,9 +3529,15 @@ void CreateEditMenu(int client)
FormatEx(sMenuItem, sizeof(sMenuItem), "%T", "ZoneSetGravity", client, g);
menu.AddItem("datafromchat", sMenuItem);
}
else if (gI_ZoneType[client] == Zone_Speedmod)
{
float speed = view_as<float>(gI_ZoneData[client]);
FormatEx(sMenuItem, sizeof(sMenuItem), "%T", "ZoneSetSpeedmod", client, speed);
menu.AddItem("datafromchat", sMenuItem);
}
menu.ExitButton = true;
menu.Display(client, 600);
menu.Display(client, MENU_TIME_FOREVER);
}
void CreateAdjustMenu(int client, int page)
@ -4291,21 +4310,28 @@ public void CreateZoneEntities(bool only_create_dead_entities)
continue;
}
int entity = CreateEntityByName("trigger_multiple");
bool speedmod = (gA_ZoneCache[i].iZoneType == Zone_Speedmod);
char classname[32]; classname = speedmod ? "player_speedmod" : "trigger_multiple";
int entity = CreateEntityByName(classname);
if(entity == -1)
{
LogError("\"trigger_multiple\" creation failed, map %s.", gS_Map);
LogError("\"%s\" creation failed, map %s.", classname, gS_Map);
continue;
}
DispatchKeyValue(entity, "wait", "0");
DispatchKeyValue(entity, "spawnflags", "4097");
// TODO: look into storing the SF_SPEED_MOD_SUPPRESS_* in iZoneFlags
if (!speedmod)
{
DispatchKeyValue(entity, "wait", "0");
DispatchKeyValue(entity, "spawnflags", "4097");
}
if(!DispatchSpawn(entity))
{
LogError("\"trigger_multiple\" spawning failed, map %s.", gS_Map);
LogError("\"%s\" spawning failed, map %s.", classname, gS_Map);
continue;
}
@ -4349,6 +4375,14 @@ public void CreateZoneEntities(bool only_create_dead_entities)
SetEntPropVector(entity, Prop_Send, "m_vecMins", min);
SetEntPropVector(entity, Prop_Send, "m_vecMaxs", max);
if (speedmod)
{
int FSOLID_NOT_SOLID = 4;
int FSOLID_TRIGGER = 8;
SetEntProp(entity, Prop_Send, "m_usSolidFlags", FSOLID_TRIGGER|FSOLID_NOT_SOLID);
SDKHook(entity, SDKHook_StartTouch, SameTrack_StartTouch_er);
}
SetEntProp(entity, Prop_Send, "m_nSolidType", 2);
SDKHook(entity, SDKHook_StartTouchPost, StartTouchPost);
@ -4461,6 +4495,14 @@ public void StartTouchPost(int entity, int other)
}
}
}
case Zone_Speedmod:
{
char s[16];
FloatToString(view_as<float>(gA_ZoneCache[gI_EntityZone[entity]].iZoneData), s, sizeof(s));
SetVariantString(s);
AcceptEntityInput(entity, "ModifySpeed", other, entity, 0);
}
}
gB_InsideZone[other][gA_ZoneCache[gI_EntityZone[entity]].iZoneType][gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack] = true;
@ -4476,6 +4518,16 @@ public void StartTouchPost(int entity, int other)
Call_Finish();
}
public Action SameTrack_StartTouch_er(int entity, int other)
{
if (other < 1 || other > MaxClients || gI_EntityZone[entity] == -1 || !gA_ZoneCache[gI_EntityZone[entity]].bZoneInitialized || IsFakeClient(other) || gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack != Shavit_GetClientTrack(other))
{
return Plugin_Stop;
}
return Plugin_Continue;
}
public void EndTouchPost(int entity, int other)
{
if(other < 1 || other > MaxClients || gI_EntityZone[entity] == -1 || IsFakeClient(other))
@ -4495,6 +4547,12 @@ public void EndTouchPost(int entity, int other)
gB_InsideZone[other][type][track] = false;
gB_InsideZoneID[other][entityzone] = false;
if (type == Zone_Speedmod)
{
SetVariantString("1.0"); // surely nothing can go wrong with this
AcceptEntityInput(entity, "ModifySpeed", other, entity, 0);
}
Call_StartForward(gH_Forwards_LeaveZone);
Call_PushCell(other);
Call_PushCell(type);

View File

@ -239,6 +239,11 @@
"#format" "{1:f}"
"en" "Gravity scale: {1}"
}
"ZoneSetSpeedmod"
{
"#format" "{1:f}"
"en" "Speedmod: {1}"
}
"ZoneEnterDataChat"
{
"en" "Input your desired data in chat."
@ -328,7 +333,7 @@
{
"en" "Default"
}
"CustomZone_DisplayType_None"
{
"en" "None"
@ -341,7 +346,7 @@
{
"en" "Flat"
}
"CustomZone_Color_White"
{
"en" "White"
@ -471,6 +476,10 @@
{
"en" "Gravity Zone"
}
"Zone_Speedmod"
{
"en" "Speedmod Zone"
}
"Zone_Unknown"
{
"en" "UNKNOWN ZONE"