Skip to content

Commit

Permalink
Release 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dronelektron committed Jul 5, 2022
2 parents a3789b9 + f9f31f7 commit def283f
Show file tree
Hide file tree
Showing 24 changed files with 814 additions and 183 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Allows you to unlock respawn at the end of the round:

* Remove invisible walls
* Add crates
* Remove triggers

### Supported Games

Expand All @@ -18,6 +19,7 @@ Allows you to unlock respawn at the end of the round:

* sm_respawnunlocker_walls - Enable (1) or disable (0) walls removing [default: "1"]
* sm_respawnunlocker_crates - Enable (1) or disable (0) crates adding [default: "1"]
* sm_respawnunlocker_triggers - Enable (1) or disable (0) triggers removing [default: "1"]
* sm_respawnunlocker_notifications - Enable (1) or disable (0) notifications [default: "1"]
* sm_respawnunlocker_crate_color_red - Crate color (red channel) [default: "0"]
* sm_respawnunlocker_crate_color_green - Crate color (green channel) [default: "255"]
Expand All @@ -26,51 +28,60 @@ Allows you to unlock respawn at the end of the round:

### Console Commands

* sm_respawnunlocker_crates_load - Load crates from file
* sm_respawnunlocker_crates_save - Save crates to file
* sm_respawnunlocker_crates_load - Load crates from the file
* sm_respawnunlocker_crates_save - Save crates to the file
* sm_respawnunlocker_editor_enable - Enable crates editor (will spawn crates)
* sm_respawnunlocker_editor_disable - Disable crates editor (will destroy crates)
* sm_respawnunlocker_editor_crate_add - Add a crate where you are looking
* sm_respawnunlocker_editor_crate_remove - Remove a crate where you are looking
* sm_respawnunlocker_editor_crate_add - Add a crate
* sm_respawnunlocker_editor_crate_remove - Remove a crate
* sm_respawnunlocker_trigger_add - Add a trigger to the list
* sm_respawnunlocker_trigger_remove - Remove a trigger from the list
* sm_respawnunlocker_triggers_load - Load triggers from the file
* sm_respawnunlocker_triggers_save - Save triggers to the file

### Crates Storage

The crates config file should be created in the following location:
Each map has its own configuration file:

```
addons/sourcemod/configs/respawn-unlocker.txt
addons/sourcemod/configs/respawn-unlocker/{map_name}.txt
```

This file will have the following structure:

```
"Crates"
"Entities"
{
// Map name
"dod_gan_games"
"Crates"
{
// Crate's number
"1"
{
// X, Y - position of the center, Z - position of the bottom
"position" "320.000000 -128.000000 64.000000"
"position" "-157.499695 1407.957275 -255.968750"
}
"2"
{
"position" "320.000000 -108.000000 104.000000"
"position" "224.163727 1086.800537 -255.968750"
}
"3"
{
"position" "2300.000000 -128.000000 64.000000"
"position" "205.046783 1086.626831 -216.018341"
}
"4"
}
"Triggers"
{
"1"
{
"entity" "140"
}
"2"
{
"position" "2300.000000 -108.000000 104.000000"
"entity" "233"
}
}
}
```

This is how crates "3" and "4" will look like in the game:
What the crates will look at the end of the round:

![dod_gan_games](https://i.imgur.com/uxp9rcY.png)
![dod_gan_games](https://i.imgur.com/ZNyOoSg.jpeg)
6 changes: 0 additions & 6 deletions scripting/include/ru/crate-editor.inc

This file was deleted.

17 changes: 0 additions & 17 deletions scripting/include/ru/crate-storage.inc

This file was deleted.

8 changes: 3 additions & 5 deletions scripting/include/ru/entity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#define SOLID_TYPE "m_nSolidType"
#define SOLID_TYPE_VPHYSICS 6

#define VECTOR_MINS "m_vecMins"

#define X 0
#define Y 1
#define Z 2
#define VECTOR_ORIGIN "m_vecOrigin"
#define VECTOR_BOUNDS_MIN "m_vecMins"
#define VECTOR_BOUNDS_MAX "m_vecMaxs"
21 changes: 21 additions & 0 deletions scripting/include/ru/math.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if defined _ru_math_included
#endinput
#endif
#define _ru_math_included

#define X 0
#define Y 1
#define Z 2

#define VECTOR_SIZE 3

#define LEFT_FRONT_BOTTOM 0
#define LEFT_FRONT_TOP 1
#define LEFT_REAR_BOTTOM 2
#define LEFT_REAR_TOP 3
#define RIGHT_FRONT_BOTTOM 4
#define RIGHT_FRONT_TOP 5
#define RIGHT_REAR_BOTTOM 6
#define RIGHT_REAR_TOP 7

#define VERTICES_COUNT 8
10 changes: 10 additions & 0 deletions scripting/include/ru/menu.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#endif
#define _ru_menu_included

#define TEXT_BUFFER_MAX_SIZE (256 * 4)
#define MENU_ITEM_INFO_MAX_SIZE 32

#define RESPAWN_UNLOCKER "Respawn unlocker"
#define CRATES_MANAGEMENT "Crates management"
#define TRIGGERS_MANAGEMENT "Triggers management"

#define ITEM_EDITOR_ENABLE "Enable editor"
#define ITEM_EDITOR_DISABLE "Disable editor"
Expand All @@ -12,4 +17,9 @@
#define ITEM_CRATES_LOAD "Load crates"
#define ITEM_CRATES_SAVE "Save crates"

#define ITEM_TRIGGER_ADD "Add trigger to list"
#define ITEM_TRIGGER_REMOVE "Remove trigger from list"
#define ITEM_TRIGGERS_LOAD "Load triggers"
#define ITEM_TRIGGERS_SAVE "Save triggers"

#define ADMIN_MENU "adminmenu"
20 changes: 20 additions & 0 deletions scripting/include/ru/storage.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#if defined _ru_storage_included
#endinput
#endif
#define _ru_storage_included

#define PERMISSIONS_USER (FPERM_U_READ | FPERM_U_WRITE | FPERM_U_EXEC)
#define PERMISSIONS_GROUP (FPERM_G_READ | FPERM_G_WRITE | FPERM_G_EXEC)
#define PERMISSIONS_OTHER (FPERM_O_READ | FPERM_O_EXEC)
#define PERMISSIONS (PERMISSIONS_USER | PERMISSIONS_GROUP | PERMISSIONS_OTHER)

#define KEY_ROOT "Entities"
#define KEY_CRATES "Crates"
#define KEY_CRATE_POSITION "position"
#define KEY_TRIGGERS "Triggers"
#define KEY_TRIGGER_ENTITY "entity"

#define ID_MAX_LENGTH 12
#define CREATE_YES true

typedef KeyValuesCallback = function void (KeyValues kv);
17 changes: 17 additions & 0 deletions scripting/include/ru/visualizer.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#if defined _ru_visualizer_included
#endinput
#endif
#define _ru_visualizer_included

#define BEAM_START_FRAME 0
#define BEAM_FRAME_RATE 0
#define BEAM_LIFE_TIME 3.0
#define BEAM_WIDTH 2.0
#define BEAM_END_WIDTH BEAM_WIDTH
#define BEAM_FADE_LENGTH 0
#define BEAM_AMPLITUDE 0.0
#define BEAM_SPEED 0
#define BEAM_COLOR_RED 255
#define BEAM_COLOR_GREEN 255
#define BEAM_COLOR_BLUE 0
#define BEAM_COLOR_ALPHA 255
28 changes: 28 additions & 0 deletions scripting/modules/console-command.sp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ void Command_Create() {
RegAdminCmd("sm_respawnunlocker_editor_disable", Command_DisableEditor, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_editor_crate_add", Command_AddCrate, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_editor_crate_remove", Command_RemoveCrate, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_trigger_add", Command_AddTriggerToList, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_trigger_remove", Command_RemoveTriggerFromList, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_triggers_load", Command_LoadTriggers, ADMFLAG_GENERIC);
RegAdminCmd("sm_respawnunlocker_triggers_save", Command_SaveTriggers, ADMFLAG_GENERIC);
}

public Action Command_LoadCrates(int client, int args) {
Expand Down Expand Up @@ -42,3 +46,27 @@ public Action Command_RemoveCrate(int client, int args) {

return Plugin_Handled;
}

public Action Command_AddTriggerToList(int client, int args) {
UseCase_AddTriggerToList(client);

return Plugin_Handled;
}

public Action Command_RemoveTriggerFromList(int client, int args) {
UseCase_RemoveTriggerFromList(client);

return Plugin_Handled;
}

public Action Command_LoadTriggers(int client, int args) {
UseCase_LoadTriggers(client);

return Plugin_Handled;
}

public Action Command_SaveTriggers(int client, int args) {
UseCase_SaveTriggers(client);

return Plugin_Handled;
}
6 changes: 6 additions & 0 deletions scripting/modules/console-variable.sp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
static ConVar g_wallsEnabled = null;
static ConVar g_cratesEnabled = null;
static ConVar g_triggersEnabled = null;
static ConVar g_notificationsEnabled = null;
static ConVar g_crateColorRed = null;
static ConVar g_crateColorGreen = null;
Expand All @@ -9,6 +10,7 @@ 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_triggersEnabled = CreateConVar("sm_respawnunlocker_triggers", "1", "Enable (1) or disable (0) triggers removing");
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)");
Expand All @@ -24,6 +26,10 @@ bool Variable_IsCratesEnabled() {
return g_cratesEnabled.IntValue == 1;
}

bool Variable_IsTriggersEnabled() {
return g_triggersEnabled.IntValue == 1;
}

bool Variable_IsNotificationsEnabled() {
return g_notificationsEnabled.IntValue == 1;
}
Expand Down
2 changes: 1 addition & 1 deletion scripting/modules/crate-editor.sp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool CrateEditor_RemoveCrate(int client) {
int crate = CrateEditor_TraceCrate(client);
int crateIndex = g_editorCrateEntities.FindValue(crate);

if (crateIndex == CRATE_NOT_FOUND) {
if (crateIndex == ENTITY_NOT_FOUND) {
MessageReply_CrateNotFound(client);

return false;
Expand Down
69 changes: 0 additions & 69 deletions scripting/modules/crate-storage.sp

This file was deleted.

20 changes: 12 additions & 8 deletions scripting/modules/entity.sp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int Entity_SpawnCrate(float position[VECTOR_SIZE]) {
float minBounds[VECTOR_SIZE];
float newPosition[VECTOR_SIZE];

GetEntPropVector(crate, Prop_Send, VECTOR_MINS, minBounds);
GetEntPropVector(crate, Prop_Send, VECTOR_BOUNDS_MIN, minBounds);

newPosition[X] = position[X];
newPosition[Y] = position[Y];
Expand All @@ -23,6 +23,15 @@ int Entity_SpawnCrate(float position[VECTOR_SIZE]) {
return crate;
}

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);
}

int Entity_GetCollisionGroup(int entity) {
return GetEntProp(entity, Prop_Send, COLLISION_GROUP);
}
Expand All @@ -31,11 +40,6 @@ 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);
void Entity_Disable(int entity) {
AcceptEntityInput(entity, "Disable");
}
Loading

0 comments on commit def283f

Please sign in to comment.