Skip to content

Commit

Permalink
Release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dronelektron committed Jul 2, 2022
2 parents ce1dbd4 + 45e1bd0 commit e8398d5
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
11 changes: 10 additions & 1 deletion scripting/include/ru/entity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@

#define ENTITY_NOT_FOUND -1

#define COLLISION_GROUP_IN_VEHICLE 10
#define COLLISION_GROUP "m_CollisionGroup"
#define COLLISION_GROUP_IN_VEHICLE 10

#define SOLID_TYPE "m_nSolidType"
#define SOLID_TYPE_VPHYSICS 6

#define VECTOR_MINS "m_vecMins"

#define X 0
#define Y 1
#define Z 2
24 changes: 24 additions & 0 deletions scripting/modules/console-variable.sp
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
static ConVar g_wallsEnabled = null;
static ConVar g_cratesEnabled = null;
static ConVar g_notificationsEnabled = null;
static ConVar g_crateColorRed = null;
static ConVar g_crateColorGreen = null;
static ConVar g_crateColorBlue = null;
static ConVar g_crateColorAlpha = null;

void Variable_Create() {
g_wallsEnabled = CreateConVar("sm_respawnunlocker_walls", "1", "Enable (1) or disable (0) walls removing");
g_cratesEnabled = CreateConVar("sm_respawnunlocker_crates", "1", "Enable (1) or disable (0) crates adding");
g_notificationsEnabled = CreateConVar("sm_respawnunlocker_notifications", "1", "Enable (1) or disable (0) notifications");
g_crateColorRed = CreateConVar("sm_respawnunlocker_crate_color_red", "0", "Crate color (red channel)");
g_crateColorGreen = CreateConVar("sm_respawnunlocker_crate_color_green", "255", "Crate color (green channel)");
g_crateColorBlue = CreateConVar("sm_respawnunlocker_crate_color_blue", "255", "Crate color (blue channel)");
g_crateColorAlpha = CreateConVar("sm_respawnunlocker_crate_color_alpha", "255", "Crate color (alpha channel)");
}

bool Variable_IsWallsEnabled() {
Expand All @@ -19,3 +27,19 @@ bool Variable_IsCratesEnabled() {
bool Variable_IsNotificationsEnabled() {
return g_notificationsEnabled.IntValue == 1;
}

int Variable_GetCrateColorRed() {
return g_crateColorRed.IntValue;
}

int Variable_GetCrateColorGreen() {
return g_crateColorGreen.IntValue;
}

int Variable_GetCrateColorBlue() {
return g_crateColorBlue.IntValue;
}

int Variable_GetCrateColorAlpha() {
return g_crateColorAlpha.IntValue;
}
4 changes: 2 additions & 2 deletions scripting/modules/crate-editor.sp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void CrateEditor_TracePosition(int client, float position[VECTOR_SIZE]) {
}

int CrateEditor_TraceCrate(int client) {
float eyesPosition[3];
float eyesAngles[3];
float eyesPosition[VECTOR_SIZE];
float eyesAngles[VECTOR_SIZE];

GetClientEyePosition(client, eyesPosition);
GetClientEyeAngles(client, eyesAngles);
Expand Down
21 changes: 15 additions & 6 deletions scripting/modules/entity.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ int Entity_SpawnCrate(float position[VECTOR_SIZE]) {

DispatchKeyValue(crate, "model", "models/props_junk/wood_crate001a.mdl");
DispatchKeyValue(crate, "disableshadows", "1");
DispatchKeyValue(crate, "solid", "6");
DispatchSpawn(crate);

SetEntityRenderColor(crate, 255, 255, 255, 190);
SetEntProp(crate, Prop_Send, SOLID_TYPE, SOLID_TYPE_VPHYSICS);
SetEntityRenderMode(crate, RENDER_TRANSCOLOR);
Entity_SetColorFromVariable(crate);

float minBounds[VECTOR_SIZE];
float newPosition[VECTOR_SIZE];

GetEntPropVector(crate, Prop_Send, "m_vecMins", minBounds);
GetEntPropVector(crate, Prop_Send, VECTOR_MINS, minBounds);

newPosition[0] = position[0];
newPosition[1] = position[1];
newPosition[2] = position[2] - minBounds[2];
newPosition[X] = position[X];
newPosition[Y] = position[Y];
newPosition[Z] = position[Z] - minBounds[Z];

TeleportEntity(crate, newPosition, NULL_VECTOR, NULL_VECTOR);

Expand All @@ -30,3 +30,12 @@ int Entity_GetCollisionGroup(int entity) {
void Entity_SetCollisionGroup(int entity, int group) {
SetEntProp(entity, Prop_Send, COLLISION_GROUP, group);
}

void Entity_SetColorFromVariable(int entity) {
int red = Variable_GetCrateColorRed();
int green = Variable_GetCrateColorGreen();
int blue = Variable_GetCrateColorBlue();
int alpha = Variable_GetCrateColorAlpha();

SetEntityRenderColor(entity, red, green, blue, alpha);
}
2 changes: 1 addition & 1 deletion scripting/respawn-unlocker.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Plugin myinfo = {
name = "Respawn unlocker",
author = "Dron-elektron",
description = "Allows you to unlock respawn at the end of the round",
version = "1.4.0",
version = "1.5.0",
url = "https://github.com/dronelektron/respawn-unlocker"
};

Expand Down

0 comments on commit e8398d5

Please sign in to comment.