-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: SourcePawn CI | ||
on: [push] | ||
|
||
jobs: | ||
ci: | ||
name: SourcePawn CI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install SourceMod | ||
uses: KatsuteTF/Workflows/actions/setup-sourcepawn@main | ||
|
||
- name: Install RRM | ||
uses: KatsuteTF/Workflows/actions/curl@main | ||
with: | ||
url: https://raw.githubusercontent.com/KatsuteTF/RRM/main/addons/sourcemod/include/rrm.inc | ||
file: rrm.inc | ||
|
||
- name: Compile Plugin | ||
run: | | ||
spcomp -i ./ rrm_bleed.sp | ||
spcomp -i ./ rrm_explode.sp | ||
spcomp -i ./ rrm_fire.sp | ||
spcomp -i ./ rrm_jarate.sp | ||
spcomp -i ./ rrm_marked.sp | ||
spcomp -i ./ rrm_medieval.sp | ||
spcomp -i ./ rrm_milked.sp | ||
spcomp -i ./ rrm_stun.sp | ||
spcomp -i ./ rrm_taunt.sp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
name: Release Plugin | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install SourceMod | ||
uses: KatsuteTF/Workflows/actions/setup-sourcepawn@main | ||
|
||
- name: Install RRM | ||
uses: KatsuteTF/Workflows/actions/curl@main | ||
with: | ||
url: https://raw.githubusercontent.com/KatsuteTF/RRM/main/addons/sourcemod/include/rrm.inc | ||
file: rrm.inc | ||
|
||
- name: Compile Plugin | ||
run: | | ||
spcomp -i ./ rrm_bleed.sp | ||
spcomp -i ./ rrm_explode.sp | ||
spcomp -i ./ rrm_fire.sp | ||
spcomp -i ./ rrm_jarate.sp | ||
spcomp -i ./ rrm_marked.sp | ||
spcomp -i ./ rrm_medieval.sp | ||
spcomp -i ./ rrm_milked.sp | ||
spcomp -i ./ rrm_stun.sp | ||
spcomp -i ./ rrm_taunt.sp | ||
- name: Deploy to GitHub Releases | ||
uses: AButler/upload-release-assets@v2.0.2 | ||
with: | ||
files: "*.smx" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0 | ||
|
||
#pragma semicolon 1 | ||
|
||
#define RRM_VERSION "1.0" | ||
|
||
#include <sourcemod> | ||
#include <sdkhooks> | ||
#include <tf2attributes> | ||
#include <tf2> | ||
#include <tf2_stocks> | ||
#include <rrm> | ||
|
||
#pragma newdecls required | ||
|
||
int gEnabled = 0; | ||
float gChance = 0.0; | ||
ConVar cMin = null, cMax = null, cDuration = null; | ||
float gMin = 0.0, gMax = 0.0, gDuration = 0.0; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[RRM] Bleed Modifier", | ||
author = "Katsute", | ||
description = "Modifier that grants chance of bleed.", | ||
version = "1.0" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
cMin = CreateConVar("rrm_bleed_min", "0.1", "Minimum value for the random number generator."); | ||
cMax = CreateConVar("rrm_bleed_max", "1.0", "Maximum value for the random number generator."); | ||
cDuration = CreateConVar("rrm_bleed_duration", "3.0", "Duration for bleed to last on affected players."); | ||
|
||
cMin.AddChangeHook(OnConvarChanged); | ||
cMax.AddChangeHook(OnConvarChanged); | ||
cDuration.AddChangeHook(OnConvarChanged); | ||
|
||
gMin = cMin.FloatValue; | ||
gMax = cMax.FloatValue; | ||
gDuration = cDuration.FloatValue; | ||
|
||
for (int i = 1; i < MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
SDKHook(i, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
if(RRM_IsRegOpen()) | ||
RegisterModifiers(); | ||
|
||
AutoExecConfig(true, "rrm_bleed", "rrm"); | ||
} | ||
|
||
public int RRM_OnRegOpen() | ||
{ | ||
RegisterModifiers(); | ||
} | ||
|
||
void RegisterModifiers() | ||
{ | ||
RRM_Register("Bleed", gMin, gMax, false, RRM_Callback_Bleed); | ||
} | ||
|
||
public void OnConvarChanged(Handle convar, char[] oldValue, char[] newValue) | ||
{ | ||
if (StrEqual(oldValue, newValue, true)) | ||
return; | ||
|
||
float fNewValue = StringToFloat(newValue); | ||
|
||
if(convar == cMin) | ||
gMin = fNewValue; | ||
else if(convar == cMax) | ||
gMax = fNewValue; | ||
else if(convar == cDuration) | ||
gDuration = fNewValue; | ||
} | ||
|
||
public void OnClientPostAdminCheck(int client) | ||
{ | ||
SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
public int RRM_Callback_Bleed(bool enable, float value) | ||
{ | ||
gEnabled = enable; | ||
if(gEnabled) | ||
gChance = value; | ||
return gEnabled; | ||
} | ||
|
||
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, | ||
float damageForce[3], float damagePosition[3], int damagecustom) | ||
{ | ||
if(!gEnabled) | ||
return Plugin_Continue; | ||
|
||
if(gChance > RandomFloat(RandomFloat(0.0, 1.0))) | ||
{ | ||
if(!(1 <= victim <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(victim)) | ||
return Plugin_Continue; | ||
if(!(1 <= attacker <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(attacker)) | ||
return Plugin_Continue; | ||
if(!IsPlayerAlive(victim)) | ||
return Plugin_Continue; | ||
if(!TF2_IsPlayerInCondition(victim, TFCond_Bleeding)) | ||
TF2_MakeBleed(victim, attacker, gDuration); | ||
} | ||
return Plugin_Continue; | ||
} | ||
|
||
float RandomFloat(const float min = 0.0, const float max = 1.0){ | ||
return min + GetURandomFloat() * (max - min); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0 | ||
|
||
#pragma semicolon 1 | ||
|
||
#define RRM_VERSION "1.0" | ||
|
||
#include <sourcemod> | ||
#include <sdkhooks> | ||
#include <tf2attributes> | ||
#include <tf2> | ||
#include <tf2_stocks> | ||
#include <rrm> | ||
|
||
#pragma newdecls required | ||
|
||
int gEnabled = 0; | ||
float gChance = 0.0; | ||
ConVar cMin = null, cMax = null; | ||
float gMin = 0.0, gMax = 0.0; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[RRM] Explode Modifier", | ||
author = "Katsute", | ||
description = "Modifier that grants chance of exploding.", | ||
version = "1.0" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
cMin = CreateConVar("rrm_explode_min", "0.1", "Minimum value for the random number generator."); | ||
cMax = CreateConVar("rrm_explode_max", "1.0", "Maximum value for the random number generator."); | ||
|
||
cMin.AddChangeHook(OnConvarChanged); | ||
cMax.AddChangeHook(OnConvarChanged); | ||
|
||
gMin = cMin.FloatValue; | ||
gMax = cMax.FloatValue; | ||
|
||
for (int i = 1; i < MaxClients; i++) | ||
{ | ||
if(!IsClientInGame(i)) | ||
continue; | ||
SDKHook(i, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
if(RRM_IsRegOpen()) | ||
RegisterModifiers(); | ||
|
||
AutoExecConfig(true, "rrm_explode", "rrm"); | ||
} | ||
|
||
public int RRM_OnRegOpen() | ||
{ | ||
RegisterModifiers(); | ||
} | ||
|
||
void RegisterModifiers() | ||
{ | ||
RRM_Register("Explode", gMin, gMax, false, RRM_Callback_Explode); | ||
} | ||
|
||
public void OnConvarChanged(Handle convar, char[] oldValue, char[] newValue) | ||
{ | ||
if (StrEqual(oldValue, newValue, true)) | ||
return; | ||
|
||
float fNewValue = StringToFloat(newValue); | ||
|
||
if(convar == cMin) | ||
gMin = fNewValue; | ||
else if(convar == cMax) | ||
gMax = fNewValue; | ||
else if(convar == cDuration) | ||
gDuration = fNewValue; | ||
} | ||
|
||
public void OnClientPostAdminCheck(int client) | ||
{ | ||
SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage); | ||
} | ||
|
||
public int RRM_Callback_Explode(bool enable, float value) | ||
{ | ||
gEnabled = enable; | ||
if(gEnabled) | ||
gChance = value; | ||
return gEnabled; | ||
} | ||
|
||
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, | ||
float damageForce[3], float damagePosition[3], int damagecustom) | ||
{ | ||
if(!gEnabled) | ||
return Plugin_Continue; | ||
|
||
if(gChance > RandomFloat(RandomFloat(0.0, 1.0))) | ||
{ | ||
if(!(1 <= victim <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(victim)) | ||
return Plugin_Continue; | ||
if(!(1 <= attacker <= MaxClients)) | ||
return Plugin_Continue; | ||
if(!IsClientInGame(attacker)) | ||
return Plugin_Continue; | ||
if(!IsPlayerAlive(victim)) | ||
return Plugin_Continue; | ||
FakeClientCommand(victim, "explode"); | ||
} | ||
return Plugin_Continue; | ||
} | ||
|
||
float RandomFloat(const float min = 0.0, const float max = 1.0){ | ||
return min + GetURandomFloat() * (max - min); | ||
} |
Oops, something went wrong.