Skip to content

Commit 04ad339

Browse files
committed
Add handling for func_rot_button zones
1 parent 94ebb97 commit 04ad339

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

addons/sourcemod/scripting/include/shavit/zones.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum
5353
enum
5454
{
5555
ZF_ForceRender = (1 << 0),
56-
ZF_Hammerid = (1 << 1), // used by ZoneForm_{trigger_{multiple, teleport}, func_button} sometimes
56+
ZF_Hammerid = (1 << 1), // used by ZoneForm_{trigger_{multiple, teleport}, func_[rot_]button} sometimes
5757
ZF_Solid = (1 << 2), // forces the zone to physically block people...
5858
ZF_Origin = (1 << 4), // sTarget is the entity's origin formatted as "%X %X %X"
5959
};

addons/sourcemod/scripting/shavit-zones-json.sp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ JSONObject FillYourMom(zone_cache_t cache)
503503
public Action Command_DumpZones(int client, int args)
504504
{
505505
int count = Shavit_GetZoneCount();
506-
506+
507507
if (!count)
508508
{
509509
ReplyToCommand(client, "Map doesn't have any zones...");
@@ -582,7 +582,7 @@ int MenuHandler_MapInfo(Menu menu, MenuAction action, int param1, int param2)
582582
++empties;
583583
continue;
584584
}
585-
585+
586586
for (; empties; --empties)
587587
arr.Push(empty);
588588
arr.Push(obj);

addons/sourcemod/scripting/shavit-zones.sp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n
618618
}
619619

620620
if (convar.BoolValue) add_prebuilts_to_cache("func_button", true);
621+
if (convar.BoolValue) add_prebuilts_to_cache("func_rot_button", true);
621622
}
622623
}
623624

@@ -1219,6 +1220,7 @@ public void Shavit_LoadZonesHere()
12191220
if (gCV_ClimbButtons.BoolValue)
12201221
{
12211222
add_prebuilts_to_cache("func_button", true);
1223+
add_prebuilts_to_cache("func_rot_button", true);
12221224
}
12231225
}
12241226

@@ -1329,6 +1331,7 @@ public void OnGameFrame()
13291331
if (search_func_button)
13301332
{
13311333
FindEntitiesToHook("func_button", ZoneForm_func_button);
1334+
FindEntitiesToHook("func_rot_button", ZoneForm_func_button);
13321335
}
13331336
}
13341337

@@ -3017,6 +3020,23 @@ void OpenHookMenu_List(int client, int form, int pos = 0)
30173020
list.PushArray(thing);
30183021
}
30193022

3023+
// copy & paste for func_rot_button because it's shrimple and I can't think of how to do it cleanly otherwise right now
3024+
if (form == ZoneForm_func_button)
3025+
{
3026+
while ((ent = FindEntityByClassname(ent, "func_rot_button")) != -1)
3027+
{
3028+
if (gI_EntityZone[ent] > -1) continue;
3029+
3030+
float ent_origin[3];
3031+
GetEntPropVector(ent, Prop_Send, "m_vecOrigin", ent_origin);
3032+
3033+
ent_list_thing thing;
3034+
thing.dist = GetVectorDistance(player_origin, ent_origin);
3035+
thing.ent = ent;
3036+
list.PushArray(thing);
3037+
}
3038+
}
3039+
30203040
if (!list.Length)
30213041
{
30223042
Shavit_PrintToChat(client, "No unhooked entities found");
@@ -3067,7 +3087,7 @@ bool TeleportFilter(int entity)
30673087
char classname[20];
30683088
GetEntityClassname(entity, classname, sizeof(classname));
30693089

3070-
if (StrEqual(classname, "trigger_teleport") || StrEqual(classname, "trigger_multiple") || StrEqual(classname, "func_button"))
3090+
if (StrEqual(classname, "trigger_teleport") || StrEqual(classname, "trigger_multiple") || StrEqual(classname, "func_button") || StrEqual("func_rot_button"))
30713091
{
30723092
//TR_ClipCurrentRayToEntity(MASK_ALL, entity);
30733093
gI_CurrentTraceEntity = entity;
@@ -3116,7 +3136,7 @@ public int MenuHandle_HookZone_Form(Menu menu, MenuAction action, int param1, in
31163136
char classname[32];
31173137
GetEntityClassname(ent, classname, sizeof(classname));
31183138

3119-
if (StrEqual(classname, "func_button"))
3139+
if (StrEqual(classname, "func_button") || StrEqual(classname, "func_rot_button"))
31203140
{
31213141
form = ZoneForm_func_button;
31223142
}

0 commit comments

Comments
 (0)