Create dockerized version

Create dockerized version which will automatically build this.
This commit is contained in:
Ari Timonen 2018-04-18 10:09:48 -04:00
parent 09e076ff51
commit 3ab6b1badf
8 changed files with 421 additions and 4 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/*

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
FROM ubuntu
# Need to install GCC-MULTILIB to be able to run amxxpc
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget git vim curl ca-certificates gcc-multilib hashalot
RUN useradd -m amxx && mkdir -p /var/build && chown -R amxx:amxx /var/build
USER amxx
WORKDIR /home/amxx
RUN wget -q -O amxx.tgz "https://www.amxmodx.org/release/amxmodx-1.8.2-base-linux.tar.gz" && \
wget -q -O amxx_ns.tgz "https://www.amxmodx.org/release/amxmodx-1.8.2-ns-linux.tar.gz"
COPY files/amxmodx.sha /home/amxx
RUN sha256sum -c amxmodx.sha
RUN tar -zxf amxx.tgz && tar -zxf amxx_ns.tgz
WORKDIR /home/amxx/addons/amxmodx/scripting
COPY src/*.* /home/amxx/addons/amxmodx/scripting/
COPY src/include/* /home/amxx/addons/amxmodx/scripting/include
# RUN ./amxxpc ENSL.sma && cp ENSL.sma /var/build
USER root
ENTRYPOINT ["/home/amxx/addons/amxmodx/scripting/compile.sh", "ENSL.sma"]

34
Makefile Normal file
View file

@ -0,0 +1,34 @@
REGISTRY ?= ensl
PROJECT ?= ensl-plugin
TAG ?= latest
ifdef REGISTRY
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)
else
IMAGE=$(PROJECT):$(TAG)
endif
all:
@echo "Available targets:"
@echo " * build - build a Docker image for $(IMAGE)"
@echo " * pull - pull $(IMAGE)"
@echo " * push - push $(IMAGE)"
@echo " * test - build and test $(IMAGE)"
build: Dockerfile
docker build -t $(IMAGE) .
run: build
docker run -v $(shell pwd)/build/:/var/build -ti $(IMAGE)
pull:
docker pull $(IMAGE) || true
push:
docker push $(IMAGE)
clean:
rm -f $(shell pwd)/build/*
test: build
@echo "TODO"

View file

@ -1,13 +1,22 @@
ENSL Plugin
===========
This is the source code of ENSL Plugin. It was used on [European NS League](http://www.ensl.org) for many years.
This is the source code of ENSL Plugin. It was used on European NS League for many years.
Originally based on CAL Plugin, but later completely remade by Ari "jiriki" Timonen. Rest of the credits below:
## How to compile
Use the provided Dockerfile to install libs, amxmodx and compile it.
1. Run `make build` to build docker image
1. Run `make run` to compile and find it in **build** directory.
## Credits
Originally based on CAL Plugin, but later completely remade by jiriki. Rest of the credits below:
+ DarkSnow's socket example
+ CAL Features by CAL-ns|Austin (xHomicide) and Jim "JazzX" Olson
+ Asmodee for waypoint fixes & weaponfix & other fixes
+ Asmodee for waypoint fixes, weaponfix and other fixes
+ Multivac's Jetpack fix
+ sawce's icons plugin
+ www.nsmod.org

1
files/amxmodx.sha Normal file
View file

@ -0,0 +1 @@
43d9e13a462609626bbf6ef68f568973fd43fb8e0789ba4261c9b44f0ff380fc amxx.tgz

4
src/compile.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
./amxxpc $1
cp $1 /var/build

341
src/include/nsteam.inc Normal file
View file

@ -0,0 +1,341 @@
/*
* AMX mod X team functions for "Natural-Selection 3.2"
* by Mev-Rael (Tyrael@inbox.lv ; Tyrael_Greefien @ skype; Mevrael @ steam)
*
* 28.04.2010
*
* http://ns.boxg.lv - Baltic Natural-Selection Community
*
* Those functions provides a simple manipulation with NS (MvA) teams:
* 1) Check if player is in team
* 2) Change player team
* 3) Count players in team
* 4) Get players ID and count in team
*/
#if !defined NS_INC
#include <ns>
#endif
/*
* Check if player is in team
* return true or false
*/
// Check if player is in readyroom
stock nst_is_readyroom(id)
{
new team[4]
ns_get_user_team(id, team, 3)
if (equal(team, "und") && is_user_connected(id))
{
return true
}
return false
}
// Check if player is in spectatorteam
stock nst_is_spectate(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] == 's')
{
return true
}
return false
}
// Check if player is in marine team
stock nst_is_marine(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] == 'm')
{
return true
}
return false
}
// Check if player is in alien team
stock nst_is_alien(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] == 'a'))
{
return true
}
return false
}
/*
* Change player team
*/
// Send a player to readyroom
stock nst_readyroom(id)
{
new team[4]
ns_get_user_team(id, team, 3)
if (!equal(team, "und") && is_user_connected(id))
{
client_cmd(id, "readyroom; readyroom")
}
}
// Readyroom all
stock nst_readyroomall()
{
new players[32], num, i
get_players(players, num)
for (i=0; i<num; i++)
{
nst_readyroom(players[i])
}
}
// Send a player to spectatorteam
stock nst_spectate(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] != 's' && is_user_connected(id))
{
nst_readyroom(id)
client_cmd(id, "spectate")
}
}
// Send a player to marines
stock nst_marine(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] != 'm' && is_user_connected(id))
{
if (team[0] != 's')
{
nst_readyroom(id)
}
client_cmd(id, "jointeamone")
}
}
// Send a player to aliens
stock nst_alien(id)
{
new team[2]
ns_get_user_team(id, team, 1)
if (team[0] != 'a' && is_user_connected(id))
{
if (team[0] != 's')
{
nst_readyroom(id)
}
client_cmd(id, "jointeamtwo")
}
}
/*
* Count members in team
* Return a number
*/
// Count players in readyroom
stock nst_readyroom_count()
{
new count = 0
new players[32], num, i
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_readyroom(players[i]))
{
count++
}
}
return count
}
// Count players in spectatorteam
stock nst_spectate_count()
{
new count = 0
new players[32], num, i
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_spectate(players[i]))
{
count++
}
}
return count
}
// Count players in marine team
stock nst_marine_count()
{
new count = 0
new players[32], num, i
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_marine(players[i]))
{
count++
}
}
return count
}
// Count players in alien team
stock nst_alien_count()
{
new count = 0
new players[32], num, i
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_alien(players[i]))
{
count++
}
}
return count
}
/*
* Get players ID and count in team.
* Return an array with 33 elements. 1-32 are player indexes and 0 is players count
* Example: client_print to all marines
*
* new marines[33]
* marines = nst_get_marine()
* for (new i=1; i<=marines[0]; i++) {
* client_print(marines[i], print_chat, "You are marine!")
* }
*/
// Get readyroom players
stock nst_get_readyroom()
{
new teamplayers[33]
new players[32], num, i
new k=0
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_readyroom(players[i]))
{
k++
teamplayers[k]=players[i]
}
teamplayers[0] = k
}
return teamplayers
}
// Get spectatorteam players
stock nst_get_spectate()
{
new teamplayers[33]
new players[32], num, i
new k=0
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_spectate(players[i]))
{
k++
teamplayers[k]=players[i]
}
teamplayers[0] = k
}
return teamplayers
}
// Get marine players
stock nst_get_marine()
{
new teamplayers[33]
new players[32], num, i
new k=0
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_marine(players[i]))
{
k++
teamplayers[k]=players[i]
}
teamplayers[0] = k
}
return teamplayers
}
// Get alien players
stock nst_get_alien()
{
new teamplayers[33]
new players[32], num, i
new k=0
get_players(players, num)
for (i=0; i<num; i++)
{
if (nst_is_alien(players[i]))
{
k++
teamplayers[k]=players[i]
}
teamplayers[0] = k
}
return teamplayers
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/