Bug fixes

This commit is contained in:
Jackzie 2024-07-21 10:49:44 -05:00
parent cfa976cd95
commit 848fa7e76e
9 changed files with 1102 additions and 1050 deletions

View file

@ -30,8 +30,9 @@ enum {
Edit_None,
Edit_Copy = 1,
Edit_Preview = 2,
Edit_WallCreator = 4,
Edit_Manager = 8
Edit_WallCreator = 4,
Edit_Manager = 8, // Edit started via manager
Edit_Grab = 16 // Edit started via +editor grab command
}
enum buildType {
@ -141,7 +142,6 @@ enum struct EditorData {
this.angles[0] = RoundToNearestInterval(this.angles[0], this.snapAngle);
this.angles[1] = RoundToNearestInterval(this.angles[1], this.snapAngle);
this.angles[2] = RoundToNearestInterval(this.angles[2], this.snapAngle);
}
TeleportEntity(this.entity, this.origin, this.angles, NULL_VECTOR);
}
@ -342,7 +342,7 @@ enum struct EditorData {
// Is edit, do nothing, just reset
PrintHintText(this.client, "Edit Complete");
this.Reset();
entity = 0;
this.entity = 0;
type = Complete_EditSuccess;
}
@ -921,6 +921,35 @@ Action Command_Editor(int client, int args) {
return Plugin_Handled;
}
Action Cmd_EditorGrab(int client, int args) {
int entity = GetLookingEntity(client, Filter_ValidHats);
if(entity > 0) {
int parent = GetEntPropEnt(entity, Prop_Data, "m_hParent");
if(parent > 0) {
entity = parent;
}
if(!CheckBlacklist(entity)) {
return Plugin_Handled;
}
Editor[client].ImportEntity(entity, view_as<int>(Edit_Grab), MOVE_ORIGIN);
char classname[64];
char targetname[32];
GetEntityClassname(entity, classname, sizeof(classname));
GetEntPropString(entity, Prop_Data, "m_target", targetname, sizeof(targetname));
PrintToChat(client, "\x04[Editor]\x01 Editing entity \x05%d (%s) [%s]\x01. End with \x05/edit done\x01", entity, classname, targetname);
}
return Plugin_Handled;
}
Action Cmd_EditorRelease(int client, int args) {
if(Editor[client].IsActive() && Editor[client].flags & Edit_Grab) {
int entity;
Editor[client].Done(entity);
}
return Plugin_Handled;
}
int GetWallId(int client, const char[] arg) {
int id;
if(StringToIntEx(arg, id) > 0 && id > 0 && id <= createdWalls.Length) {

View file

@ -415,7 +415,7 @@ int GetSpawnedIndex(int client, int index) {
}
return -1;
}
#define MAX_SEARCH_RESULTS 10
#define MAX_SEARCH_RESULTS 30
ArrayList SearchItems(const char[] query) {
// We have to put it into SearchData enum struct, then convert it back to ItemResult
LoadCategories();