Skip to content

Commit

Permalink
v1.10.1 cleanup
Browse files Browse the repository at this point in the history
no longer track extensions folder
remove unused include files to reduce repo size
update build process
use new sourcemod syntax
  • Loading branch information
CrimsonTautology committed Mar 13, 2021
1 parent 95e6e13 commit f7801b8
Show file tree
Hide file tree
Showing 28 changed files with 235 additions and 7,562 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
version: ${{ matrix.sm-version }}

- name: Compile SourceMod plugins
run: make SPCOMP=spcomp SPFLAGS=-E
run: make clean compile test SPCOMP=spcomp SPFLAGS=-E
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ SHELL=/bin/bash
# directories
override scripting_dir=addons/sourcemod/scripting
override include_dir=addons/sourcemod/scripting/include
override testing_dir=addons/sourcemod/scripting/testsuite
override plugins_dir=addons/sourcemod/plugins
override testsuite_dir=addons/sourcemod/plugins/testsuite
override configs_dir=addons/sourcemod/configs
override extensions_dir=addons/sourcemod/extensions
override gamedata_dir=addons/sourcemod/gamedata
Expand All @@ -26,10 +28,14 @@ ZIP=zip
# files
override sourcefiles=$(wildcard $(scripting_dir)/*.sp)
override includefiles=$(shell find $(include_dir) -name '*.inc' 2>/dev/null)
override testfiles=$(wildcard $(testing_dir)/test_*.sp)

override plugins=\
$(patsubst $(scripting_dir)/%.sp, $(plugins_dir)/%.smx, $(sourcefiles))

override testsuite=\
$(patsubst $(testing_dir)/%.sp, $(testsuite_dir)/%.smx, $(testfiles))

override configs=\
$(shell find $(configs_dir) -name '*' -type f 2>/dev/null)

Expand All @@ -50,6 +56,7 @@ override disabled=$(addprefix $(plugins_dir)/,\
$(notdir $(wildcard $(SRCDS)/$(plugins_dir)/disabled/*.smx)))

vpath %.sp $(scripting_dir)
vpath %.sp $(testing_dir)

ifeq ($(DEBUG), 1)
SPFLAGS+=DEBUG=1
Expand All @@ -70,7 +77,7 @@ $(plugins_dir):
mkdir -p $@

clean:
$(RM) $(plugins_dir)/*.smx $(plugins_dir)/*.asm $(plugins_dir)/*.lst
$(RM) -r $(plugins_dir)

compile: $(plugins)

Expand All @@ -89,6 +96,10 @@ list:
@printf '%s\n' $(sourcefiles)
@printf '\ninclude files:\n'
@printf '%s\n' $(includefiles)
@printf '\ntestsuite:\n'
@printf '%s\n' $(testsuite)
@printf '\ntest files:\n'
@printf '%s\n' $(testfiles)
@printf '\nconfigs:\n'
@printf '%s\n' $(configs)
@printf '\ngamedata:\n'
Expand All @@ -102,7 +113,6 @@ install:
@# install only plugins that are not in the 'disabled' folder
@$(foreach file, $(filter-out $(disabled), $(plugins)),\
cp --parents $(file) -t $(SRCDS);)
@if [ -n "$(plugins)" ]; then cp -n --parents $(plugins) -t $(SRCDS); fi
@if [ -n "$(configs)" ]; then cp -n --parents $(configs) -t $(SRCDS); fi
@if [ -n "$(extensions)" ]; then cp -n --parents $(extensions) -t $(SRCDS); fi
@if [ -n "$(gamedata)" ]; then cp --parents $(gamedata) -t $(SRCDS); fi
Expand All @@ -117,10 +127,25 @@ uninstall:
$(addprefix $(SRCDS)/, $(translations))
@echo "uninstall $(notdir $(plugins)) from $(SRCDS)"

$(testsuite_dir)/%.smx: %.sp | $(testsuite_dir)
$(SPCOMP) $^ -o$@ $(INC) $(SPFLAGS)

$(testsuite_dir):
mkdir -p $@

test: $(testsuite)

test-install: test
cp --parents $(testsuite) -t $(SRCDS)

test-uninstall:
$(RM) $(addprefix $(SRCDS)/, $(testsuite))

release.tar.gz: compile
tar cvzf $@ $(release_files) --ignore-failed-read

release.zip: compile
$(ZIP) -r $@ $(release_files)

.PHONY: all clean compile tags dos2unix list install uninstall
.PHONY: all clean compile tags dos2unix list install uninstall test\
test-install test-uninstall
Empty file.
26 changes: 13 additions & 13 deletions addons/sourcemod/scripting/include/particle.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ enum ParticleAttachmentType
** type (0 = not attached, 1 = normal attachment, 2 = head attachment). Allows
** offsets from the entity's position.
** ------------------------------------------------------------------------- */
stock CreateParticle(const String:particleType[], Float:time=5.0, entity=0,
ParticleAttachmentType:attach=Attach,
const String:attachToBone[]="head",
const Float:offsetPos[3]=NULL_VECTOR,
const Float:offsetAng[3]=NULL_VECTOR,
&Handle:timerHandle=INVALID_HANDLE)
stock int CreateParticle(const char[] particleType, float time=5.0, int entity=0,
ParticleAttachmentType attach=Attach,
const char[] attachToBone="head",
const float offsetPos[3]=NULL_VECTOR,
const float offsetAng[3]=NULL_VECTOR,
Handle& timerHandle=null)
{
new particle = CreateEntityByName("info_particle_system");
int particle = CreateEntityByName("info_particle_system");
if (particle > 0 && IsValidEdict(particle))
{
decl Float:pos[3], Float:ang[3];
float pos[3], ang[3];
if (entity > 0)
{
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
Expand All @@ -51,7 +51,7 @@ stock CreateParticle(const String:particleType[], Float:time=5.0, entity=0,

TeleportEntity(particle, pos, ang, NULL_VECTOR);

decl String:tName[32];
char tName[32];
Format(tName, sizeof(tName), "target%i", entity);
DispatchKeyValue(entity, "targetname", tName);

Expand Down Expand Up @@ -90,12 +90,12 @@ stock CreateParticle(const String:particleType[], Float:time=5.0, entity=0,
return particle;
}

stock DeleteParticle(particleRef)
stock void DeleteParticle(int particleRef)
{
new particle = EntRefToEntIndex(particleRef);
int particle = EntRefToEntIndex(particleRef);
if (particle > 0 && IsValidEntity(particle))
{
new String:classname[32];
char classname[32];
GetEdictClassname(particle, classname, sizeof(classname));
if (StrEqual(classname, "info_particle_system", false))
{
Expand All @@ -104,7 +104,7 @@ stock DeleteParticle(particleRef)
}
}

public Action:DeleteParticles(Handle:timer, any:particleRef)
public Action DeleteParticles(Handle timer, int particleRef)
{
DeleteParticle(particleRef);
return Plugin_Stop;
Expand Down
32 changes: 0 additions & 32 deletions addons/sourcemod/scripting/include/smlib.inc

This file was deleted.

157 changes: 0 additions & 157 deletions addons/sourcemod/scripting/include/smlib/arrays.inc

This file was deleted.

Loading

0 comments on commit f7801b8

Please sign in to comment.