Update scripts / binaries

This commit is contained in:
Jackzie 2024-10-06 23:17:21 -05:00
parent b42d0ecb46
commit 807dbfd805
16 changed files with 196 additions and 30 deletions

23
scripting/include/.gitignore vendored Normal file
View file

@ -0,0 +1,23 @@
*.*
!.gitignore
!epi/**
!feedthetrolls/**
!gamemodes/**
!guesswho/**
!hats/**
!hideandseek/**
!randomizer/**
!editor/**
!editor/**
!ftt.inc
!hats_editor.inc
!jutils.inc
!l4d_anti_rush.inc
!l4d2_perms.inc
!l4d2_detections.inc
!l4d_survivor_identity_fix.inc
!l4d2_usermsg.inc
!overlay.inc
!player_notes.inc
!tkstopper.inc
!anymap.inc

View file

@ -444,6 +444,7 @@ int SpawnCategoryHandler(Menu menu, MenuAction action, int client, int param2) {
ShowSpawnRoot(client);
}
} else {
PrintToServer("SpawnCategoryHandler: calling ClearItemBuffer, Menu cancelled");
g_PropData[client].CleanupBuffers();
}
} else if (action == MenuAction_End)
@ -470,7 +471,6 @@ int SpawnItemHandler(Menu menu, MenuAction action, int client, int param2) {
// Use same item menu again:
ShowItemMenu(client);
} else if(action == MenuAction_Cancel) {
g_PropData[client].ClearItemBuffer();
if(param2 == MenuCancel_ExitBack) {
CategoryData category;
if(g_PropData[client].PopCategory(category)) {
@ -480,7 +480,8 @@ int SpawnItemHandler(Menu menu, MenuAction action, int client, int param2) {
// If there is no categories, it means we are in a temp menu (search / recents / favorites)
ShowSpawnRoot(client);
}
} else {
} else if(param2 != MenuCancel_Interrupted) {
PrintToServer("SpawnItemHandler: calling ClearItemBuffer, Menu cancelled. param2=%d", param2);
g_PropData[client].CleanupBuffers();
}
} else if (action == MenuAction_End) {

View file

@ -426,6 +426,9 @@ ArrayList SearchItems(const char[] query) {
ArrayList items = new ArrayList(sizeof(ItemData));
ItemData item;
SearchData data;
if(results.Length > MAX_SEARCH_RESULTS) {
results.Resize(MAX_SEARCH_RESULTS);
}
for(int i = 0; i < results.Length; i++) {
results.GetArray(i, data);
item.FromSearchData(data);
@ -471,7 +474,6 @@ bool _searchItems(ArrayList results, ArrayList items, const char[] query) {
search.FromItemData(item);
search.index = searchIndex;
results.PushArray(search);
if(results.Length > MAX_SEARCH_RESULTS) return false;
}
}
return true;

View file

@ -5,8 +5,8 @@
#define DIRECTOR_WITCH_CHECK_TIME 30.0 // How often to check if a witch should be spawned
#define DIRECTOR_WITCH_MAX_WITCHES 5 // The maximum amount of extra witches to spawn
#define DIRECTOR_WITCH_ROLLS 3 // The number of dice rolls, increase if you want to increase freq
#define DIRECTOR_MIN_SPAWN_TIME 13.0 // Possibly randomized, per-special
#define DIRECTOR_SPAWN_CHANCE 0.038 // The raw chance of a spawn
#define DIRECTOR_MIN_SPAWN_TIME 13.0 // Possibly randomized, per-special, in seconds
ConVar directorSpawnChance; // Base chance of a special spawning, changed by player stress
#define DIRECTOR_CHANGE_LIMIT_CHANCE 0.05 // The chance that the maximum amount per-special is changed
#define DIRECTOR_SPECIAL_TANK_CHANCE 0.05 // The chance that specials can spawn when a tank is active
#define DIRECTOR_STRESS_CUTOFF 0.75 // The minimum chance a random cut off stress value is chosen [this, 1.0]
@ -41,7 +41,8 @@ enum specialType {
enum directorState {
DState_Normal,
DState_NoPlayersOrNotCoop,
DState_PendingMinFlowOrDisabled,
DState_PendingMinFlow,
DState_Disabled,
DState_MaxSpecialTime,
DState_PlayerChance,
DState_Resting,
@ -49,10 +50,11 @@ enum directorState {
DState_HighStress,
DState_MaxDirectorSpecials,
}
char DIRECTOR_STATE[9][] = {
char DIRECTOR_STATE[10][] = {
"normal",
"no players / not coop",
"pending minflow OR disabled",
"pending minflow",
"disabled",
"max special in window",
"player scaled chance",
"rest period",
@ -388,7 +390,8 @@ directorState Director_Think() {
// C. Special spawning is enabled
gd_maxSpecials = L4D2_GetScriptValueInt("MaxSpecials", 0);
if(gd_maxSpecials <= 0) return DState_MaxDirectorSpecials;
if( ~cvEPISpecialSpawning.IntValue & 1 || !L4D_HasAnySurvivorLeftSafeArea() || g_highestFlowAchieved < g_minFlowSpawn) return DState_PendingMinFlowOrDisabled;
if(~cvEPISpecialSpawning.IntValue & 1 ) return DState_Disabled;
if(!L4D_HasAnySurvivorLeftSafeArea() || g_highestFlowAchieved < g_minFlowSpawn) return DState_PendingMinFlow;
// Check if a rest period is given
if(Director_ShouldRest()) {
@ -423,7 +426,7 @@ directorState Director_Think() {
return DState_HighStress;
}
// Scale the chance where stress = 0.0, the chance is 50% more, and stress = 1.0, the chance is 50% less
float spawnChance = DIRECTOR_SPAWN_CHANCE + ((0.5 - curAvgStress) / 10.0);
float spawnChance = directorSpawnChance.FloatValue + ((0.5 - curAvgStress) / 10.0);
for(int i = 0; i < NUM_SPECIALS; i++) {
specialType special = view_as<specialType>(i);
// Skip if we hit our limit, or too soon:

View file

@ -173,6 +173,7 @@ stock int StartPropCreate(const char[] entClass, const char[] model, const float
stock int CreateProp(const char[] entClass, const char[] model, const float pos[3], const float ang[3] = NULL_VECTOR, const float vel[3] = NULL_VECTOR) {
int entity = StartPropCreate(entClass, model, pos, ang, vel);
if(entity == -1) return -1;
if(DispatchSpawn(entity)) {
#if defined DEBUG_LOG_MAPSTART
PrintToServer("spawn prop %.1f %.1f %.1f model %s", pos[0], pos[1], pos[2], model[7]);
@ -281,17 +282,24 @@ stock int CreateParticle(const char[] sParticle, const float vPos[3], const floa
return 0;
}
stock void CreateDecal(const char[] texture, const float vPos[3]) {
int index = PrecacheDecal("decals/checkpointarrow01_black.vmt");
stock void CreateDecal(const char[] texture, const float origin[3]) {
int index = PrecacheDecal(texture);
if(index <= 0) {
LogError("CreateDecal: bad decal \"%s\", precache failed.", texture);
return;
}
PrintToServer("CreateDecal: %s -> %d", texture, index);
TE_Start("World Decal");
TE_WriteVector("m_vecOrigin", vPos);
TE_WriteVector("m_vecOrigin", origin);
// TE_WriteNum("m_nEntity", -1);
TE_WriteNum("m_nIndex", index);
TE_SendToAll();
TE_Start("BSP Decal");
TE_WriteVector("m_vecOrigin", vPos);
TE_WriteNum("m_nIndex", index);
TE_SendToAll();
// TE_Start("World Decal");
// TE_WriteVector("m_vecOrigin", origin);
// TE_WriteNum("m_nIndex", index);
// TE_SendToAll();
// int entity = CreateEntityByName("infodecal");
// if( entity != -1 ) {
// DispatchKeyValue(entity, "texture", "decals/checkpointarrow01_black.vmt");
@ -299,6 +307,7 @@ stock void CreateDecal(const char[] texture, const float vPos[3]) {
// TeleportEntity(entity, vPos, NULL_VECTOR, NULL_VECTOR);
// DispatchSpawn(entity);
// ActivateEntity(entity);
// AcceptEntityInput(entity, "Activate");
// }
}

View file

@ -12,7 +12,7 @@ int SpawnCar(VariantEntityData entity) {
}
char glassModel[64];
strcopy(glassModel, sizeof(glassModel), entity.type);
strcopy(glassModel, sizeof(glassModel), entity.model);
ReplaceString(glassModel, sizeof(glassModel), ".mdl", "_glass.mdl");
if(StrEqual(entity.type, "_car_physics")) {
vehicle = CreateProp("prop_physics", entity.model, entity.origin, entity.angles);
@ -20,9 +20,11 @@ int SpawnCar(VariantEntityData entity) {
vehicle = CreateProp("prop_dynamic", entity.model, entity.origin, entity.angles);
}
if(PrecacheModel(glassModel)) {
int glass = CreateProp(glassModel, entity.model, entity.origin, entity.angles);
SetVariantString("!activator");
AcceptEntityInput(glass, "SetParent", vehicle);
int glass = CreateProp("prop_dynamic", glassModel, entity.origin, entity.angles);
if(glass != -1) {
SetVariantString("!activator");
AcceptEntityInput(glass, "SetParent", vehicle);
}
}
SetEntityRenderColor(vehicle, GetRandomInt(0, 255), GetRandomInt(0, 255), GetRandomInt(0, 255));
return vehicle;

View file

@ -43,7 +43,7 @@ void OpenVariantsMenu(int client) {
JSONArray entities;
for(int i = 0; i < variants.Length; i++) {
varObj = view_as<JSONObject>(variants.Get(i));
entities = view_as<JSONArray>(varObj.Get("entities"));
entities = varObj.HasKey("entities") ? view_as<JSONArray>(varObj.Get("entities")) : new JSONArray();
if(i == g_builder.selectedVariantIndex) {
Format(display, sizeof(display), "#%d - %d entities (✔)", i, entities.Length);
} else {