Skip to content

Commit

Permalink
Add fall speed multiplier & travis
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexer10 committed Jul 19, 2018
1 parent 3c15399 commit c6bed1a
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
addons:
apt:
packages:
- lib32z1
- lib32stdc++6
language: c
sudo: false
script:
- if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then bash ci/test.sh; fi
- if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then bash ci/build.sh $TRAVIS_TAG; fi

notifications:
email: false


deploy:
provider: releases
api_key:
secure: r0Jac+0NWOAg56HOUF1t6PPPTTWXBvAHVwdMjXgaoPNnkDo53f94IzXMFzao/51PkpM58jrCBr5YNAfZlNtrOiDB2BolJL9m7rd7zyjbETvpBVk3yT3ts56UJBk/uW0t1tLQDSwNgY17KFxx4zfW3a4LjJbYIIXFXFo81jRbNbUqAm08h6Z9nG/Cne8qZ/dnD93LAW79MU7RvVFvhw7jBwrj63Bd8CYgYnKiaJujyiut6wfgnlsmFpMxjRpeqPdS8C5faWnSXPwKPTPYq9zFnkD8p27vEt616VTjmPQrkVKlMUsyNdGEukP+1wcDFDpwLxF8OWUCcE7HTERis6A9ZBSDRB3mvFhh6aiszLOKfUWyAiwFqHYKn+xe6s3TFQEA1qzDmDjnc9saLWYVwtl64izTnJi0K+gv4jEKXO3y+U3ykxoLcRt7qqGZdmfyfs9U+UqQyIBGVUE708Xok8H5f84aTghJ+9/tt7L6EW2BZ4UAkqmtWbXYG4FJlEQ5MOhEe2t1Brm70NaZ8l8SGxFGntq/Q8PA84ggWs+Kf3hqOqoBCXvhfs0pGjQf0wneqUyHoFW13wOB5f78P0YW8QUZACj2JA5NRxOiOORbJddeO21gYhYGpcAqMCE+zQiyDLvezerDtMuQcCjbJj0K2Ja/0xsL6znYnuj0JEjnggrlouY=
file: airdrop.zip
skip_cleanup: true
on:
repo: Hexer10/AirDrop-Core
37 changes: 37 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -ev

TAG=$1

echo "Download und extract sourcemod"
wget "http://www.sourcemod.net/latest.php?version=1.9&os=linux" -O sourcemod.tar.gz
tar -xzf sourcemod.tar.gz

echo "Give compiler rights for compile"
chmod +x addons/sourcemod/scripting/spcomp

echo "Set plugins version"
sed -i "s/<TAG>/$TAG/g" addons/sourcemod/scripting/AirDropCore.sp

addons/sourcemod/scripting/compile.sh AirDropCore.sp

echo "Remove plugins folder if exists"
if [ -d "addons/sourcemod/plugins" ]; then
rm -r addons/sourcemod/plugins
fi

echo "Create clean plugins folder"
mkdir -p build/addons/sourcemod/scripting/include
mkdir build/addons/sourcemod/plugins

echo "Move plugins files to their folder"
mv addons/sourcemod/scripting/include/airdrop.inc build/addons/sourcemod/scripting/include
mv addons/sourcemod/scripting/AirDropCore.sp build/addons/sourcemod/scripting
mv addons/sourcemod/scripting/compiled/AirDropCore.smx build/addons/sourcemod/plugins


echo "Compress the plugin"
mv LICENSE build/
cd build/ && zip -9rq airdrop.zip addons/ LICENSE && mv airdrop.zip ../

echo "Build done"
12 changes: 12 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ev

echo "Download und extract sourcemod"
wget "http://www.sourcemod.net/latest.php?version=1.9&os=linux" -O sourcemod.tar.gz
tar -xzf sourcemod.tar.gz

echo "Give compiler rights for compile"
chmod +x addons/sourcemod/scripting/spcomp

addons/sourcemod/scripting/compile.sh AirDropCore.sp
addons/sourcemod/scripting/compile.sh Examples/AirDropCaller_Decoy.sp
108 changes: 108 additions & 0 deletions scripting/Addons/AirDrop_SpawnPoints.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <n_arms_fix>
//#include <multicolors>
//#include <hexstocks>

#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"

#pragma newdecls required
#pragma semicolon 1

KeyValues kv;

Menu pointsMenu;

public Plugin myinfo =
{
name = "AirDrop Spawn points",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = "github.com/Hexer10/AirDrop-Core"
};

public void OnPluginStart()
{
RegConsoleCmd("sm_airdrops", Cmd_SetSpawn);


//Cache points menu.
pointsMenu = new Menu(Handler_MainMenu);
pointsMenu.SetTitle("Choose you action");
pointsMenu.AddItem("new", "Add new point");
pointsMenu.AddItem("delete", "Remove existing point");
pointsMenu.AddItem("list", "List current");
}

public Action Cmd_SetSpawn(int client, int args)
{
if (!client)
{
ReplyToCommand(client, "[SM] In game only commmand!");
return Plugin_Handled;
}

pointsMenu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}

public void OnMapStart()
{
PreparePropKv();
}

void PreparePropKv()
{
char sPropPath[PLATFORM_MAX_PATH];
char sMap[64];
GetCurrentMap(sMap, sizeof(sMap));

BuildPath(Path_SM, sPropPath, sizeof(sPropPath), "configs/%s.airdrops.txt", sMap); //Get the right "map" file

if (kv != null)
delete kv;

kv = new KeyValues("AirDropPoints");

if (!FileExists(sPropPath)) //Try to create kv file.
if (!kv.ExportToFile(sPropPath))
SetFailState(" - AirDrops Points - Unable to create file: %s", sPropPath);

if (!kv.ImportFromFile(sPropPath)) //Import the kv file
SetFailState("- AirDrops Points - Unable to import: %s", sPropPath);
}

//Menu Handlers
public int Handler_Main(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Select)
{
char info[64];
menu.GetItem(param2, info, sizeof(info));

if (StrEqual(info, "new"))
{
Menu newPointMenu = new Menu(Handler_NewPoint);
newPointMenu.AddItem("Set to current position");
newPointMenu.ExitBackButton = true;
newPointMenu.Display(param1, MENU_TIME_FOREVER);
}
else if(StrEqual(info, "delete"))
{

}
else if(StrEqual(info, "edit"))
{

}
}
else if (action == MenuAction_End)
{
delete menu;
}
return 1;
}
Binary file added scripting/AirDropCore.smx
Binary file not shown.
11 changes: 7 additions & 4 deletions scripting/AirDropCore.sp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ConVar cv_fMaxDistance;
ConVar cv_fLandDistance;
ConVar cv_sLandBeam;
ConVar cv_bCheckSolid;
ConVar cv_fSpeedMult;

ArrayList Array_BoxEnt;
ArrayList Array_BoxRunningEnt;
Expand All @@ -31,15 +32,15 @@ char sLandBeam[64];


#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"
#define PLUGIN_VERSION "<TAG>"

public Plugin myinfo =
{
name = "AirDropCore",
author = PLUGIN_AUTHOR,
description = "API For developers to call AirDrops",
version = PLUGIN_VERSION,
url = "csitajb.it"
url = "github.com/Hexer10/AirDrop-Core"
};

/*************************** STARTUP **********************************/
Expand All @@ -63,6 +64,7 @@ public void OnPluginStart()
cv_fLandDistance = CreateConVar("sm_airdrop_landing_zone", "75.0", "N - Prevent player going into the Box Landing Zone to avoid them to compenetrait when the box. 0 - Disable", _, true, 0.0);
cv_sLandBeam = CreateConVar("sm_airdrop_landing_beam", "1", "1 - Make a random colored beam in the landind zone. 0 - Disabled. R,G,B - Colors (Es: 255, 0, 255)");
cv_bCheckSolid = CreateConVar("sm_airdrop_check_solid", "1", "1 - If a box is going to compenerate with the floor stop it. 0 - Allow the box to go thru the floor");
cv_fSpeedMult = CreateConVar("sm_airdrop_speed_mul", "1", "AirDrop fall speed multiplier");

//Get CvarString Values
cv_sBoxPath.GetString(sBoxPath, sizeof(sBoxPath));
Expand Down Expand Up @@ -146,6 +148,7 @@ public int CallAirDrop(float vBoxOrigin[3], bool bCallForward)

vBoxOrigin[2] += 3000.0;

//This needs to be check it's useless atm
while (TR_PointOutsideWorld(vBoxOrigin))
{
vBoxOrigin[2] -= 5.0;
Expand Down Expand Up @@ -290,9 +293,9 @@ public void OnReqFrame(ArrayList DataArray)
return;
}

vPos[2] -= 0.5;
vPos[2] -= 0.5 * cv_fSpeedMult.FloatValue;
TeleportEntity(iBoxEnt, vPos, NULL_VECTOR, NULL_VECTOR);
vPos[2] -= 30.0;
vPos[2] -= 30.0 * cv_fSpeedMult.FloatValue;
TeleportEntity(iParaEnt, vPos, NULL_VECTOR, NULL_VECTOR);

RequestFrame(OnReqFrame, DataArray);
Expand Down

0 comments on commit c6bed1a

Please sign in to comment.