Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedgefog committed May 9, 2022
0 parents commit 2e9b2b0
Show file tree
Hide file tree
Showing 60 changed files with 16,505 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .amxxpack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compiler": {
"version": "1.9.0-git5294",
"dev": true,
"addons": ["cstrike"]
},
"include": [
"./.compiler/include",
"./.thirdparty/reapi/addons/amxmodx/scripting/include"
],
"thirdparty": {
"dependencies": [
{
"name": "reapi",
"url": "https://github.com/s1lentq/reapi/releases/download/5.21.0.252/reapi-bin-5.21.0.252.zip"
}
]
},
"input": {
"scripts": "./src/scripts",
"include": "./src/include",
"assets": "./assets"
},
"output": {
"plugins": "./dist/reapi/addons/amxmodx/plugins",
"scripts": "./dist/reapi/addons/amxmodx/scripting",
"include": "./dist/reapi/addons/amxmodx/scripting/include",
"assets": "./dist/reapi"
},
"rules": {
"flatCompilation": true
}
}
87 changes: 87 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This is a basic workflow to help you get started with Actions

name: CI

on:
push:
branches: [ release ]
workflow_dispatch:
branches: [ release ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Setup Build Variables
id: buildvars
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`);
['name', 'version', 'description', 'author']
.forEach(k => core.setOutput(k, package[k]));
const tagVersion = package.version.replace(/\./g, '');
core.setOutput('tagversion', tagVersion);
core.setOutput('tagname', `${package.name}-${tagVersion}`);
core.setOutput('releasename', `${package.description} Release v${package.version}`);
} catch (err) {
core.setFailed(err.message);
}
- name: Install Dependencies
run: npm install
- name: Build project
run: npm run build
- name: Pack bundles
run: npm run pack
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.buildvars.outputs.tagname }}
release_name: ${{ steps.buildvars.outputs.releasename }}
draft: false
prerelease: false
- name: Upload Release Addons Src
id: upload-release-addons-src
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/bundles/snowwars-${{ steps.buildvars.outputs.tagversion }}-addons-src.zip
asset_name: snowwars-${{ steps.buildvars.outputs.tagversion }}-addons-src.zip
asset_content_type: application/zip
- name: Upload Release Build
id: upload-release-addons-reapi
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/bundles/snowwars-${{ steps.buildvars.outputs.tagversion }}-addons-build.zip
asset_name: snowwars-${{ steps.buildvars.outputs.tagversion }}-addons-build.zip
asset_content_type: application/zip
- name: Upload Release Resources
id: upload-release-resources
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/bundles/snowwars-${{ steps.buildvars.outputs.tagversion }}-resources.zip
asset_name: snowwars-${{ steps.buildvars.outputs.tagversion }}-resources.zip
asset_content_type: application/zip
- name: Cleanup
run: |
rm -rf ./.compiler
rm -rf ./.thirdparty
rm -rf ./dist
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
.compiler/
.thirdparty/
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"klippy.amxxpawn-language",
"exodiusstudios.comment-anchors"
]
}
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "amxxpawn",
"request": "launch",
"name": "Run remote debugger",
"program": "${workspaceFolder}/src"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"amxxpawn.compiler.executablePath": "${workspaceRoot}/compiler/amxxpc.exe",
"amxxpawn.compiler.includePaths": [
"${workspaceRoot}/src/include",
"${workspaceRoot}/.compiler/include",
"${workspaceRoot}/.thirdparty/reapi/addons/amxmodx/scripting/include"
]
}
Empty file added CREDITS.md
Empty file.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
### ❄ Snow Wars mod for Counter-Strike 1.6
__Version:__ 0.9.0 (Alpha)

### 📄 About

Snow Wars is a Counter-Strike mod based on snowballs fights with original Counter-Strike modes.

#### Weapons and Artifacts

- Snowball - deals 50 damage on hit
- Slightshot - allows you to shoot snowballs with extra controlled power
- Lemon Juice - adds radius damage to your snowballs. It's yellow for a reason and enemies find it humiliating.
- Down Jacket - reduces taken damage
- Surprise Box - SURPRISE, but in the box.

### 🔽 Download latest:
- [Releases](../../releases)

### 🔄 Requirements
- Amx Mod X 1.9.0+
- RegameDLL + ReAPI
- Metamod-R or Metamod-P (for windows)

## 🔧 Deployment
- Clone repository.
- Install dependencies `npm i`

#### Customize builder
Use `.amxxpack.json` configuration file

#### Build project

```bash
npm run build
```

#### Watch project

```bash
npm run watch
```

#### Create bundle

```bash
npm run pack
```
27 changes: 27 additions & 0 deletions assets/addons/amxmodx/configs/plugins-snowwars.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; API
api_custom_entities.amxx
api_custom_weapons.amxx

; Core
snowwars.amxx debug
sw_gamemode.amxx debug
sw_player_attributes.amxx debug
sw_player_artifacts.amxx debug
sw_shop.amxx debug
sw_bomb.amxx debug
sw_player.amxx debug

; Entities
sw_entity_snowball.amxx debug
sw_entity_item_artifact.amxx debug
sw_entity_fireworkrocket.amxx debug
sw_entity_fireworksbox.amxx debug

; Weapons
sw_weapon_snowball.amxx debug
sw_weapon_slingshot.amxx debug
sw_weapon_fireworksbox.amxx debug

; Artifacts
sw_artifact_downjacket.amxx debug
sw_artifact_lemonjuice.amxx debug
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/sound/snowwars/v090/christmas_jingle.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/push.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/pw_shield.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/rocket1.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/sbhit.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/snowhit_human1.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/snowhit_human2.wav
Binary file not shown.
Binary file added assets/sound/snowwars/v090/snowthrow1.wav
Binary file not shown.
11 changes: 11 additions & 0 deletions assets/sprites/snowwars/v090/weapon_fireworksbox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10
weapon 320 320hud2 0 40 80 20
weapon_s 320 320hud5 0 40 80 20
ammo 320 640hud7 168 232 24 24
crosshair 320 crosshairs 24 0 24 24
autoaim 320 crosshairs 0 72 24 24
weapon 640 640hud2 0 90 170 45
weapon_s 640 640hud5 0 90 170 45
ammo 640 640hud7 168 232 24 24
crosshair 640 crosshairs 24 0 24 24
autoaim 640 crosshairs 0 72 24 24
11 changes: 11 additions & 0 deletions assets/sprites/snowwars/v090/weapon_slingshot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10
weapon 320 320hud2 0 40 80 20
weapon_s 320 320hud5 0 40 80 20
ammo 320 640hud7 168 232 24 24
crosshair 320 crosshairs 24 0 24 24
autoaim 320 crosshairs 0 72 24 24
weapon 640 640hud2 0 90 170 45
weapon_s 640 640hud5 0 90 170 45
ammo 640 640hud7 168 232 24 24
crosshair 640 crosshairs 24 0 24 24
autoaim 640 crosshairs 0 72 24 24
11 changes: 11 additions & 0 deletions assets/sprites/snowwars/v090/weapon_snowball.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10
weapon 320 320hud2 0 40 80 20
weapon_s 320 320hud5 0 40 80 20
ammo 320 640hud7 168 232 24 24
crosshair 320 crosshairs 24 0 24 24
autoaim 320 crosshairs 0 72 24 24
weapon 640 640hud2 0 90 170 45
weapon_s 640 640hud5 0 90 170 45
ammo 640 640hud7 168 232 24 24
crosshair 640 crosshairs 24 0 24 24
autoaim 640 crosshairs 0 72 24 24
64 changes: 64 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const path = require('path');
const fs = require('fs');
const gulp = require('gulp');
const zip = require('gulp-zip');
const file = require('gulp-file');
const merge2 = require('merge2');

const package = require('./package.json');
const generateReadme = require('./helpers/bundle-readme.generator');

const WORK_DIR = process.cwd();
const DIST_DIR = path.join(WORK_DIR, './dist');
const BUILD_DIR = path.join(DIST_DIR, 'bundles');
const REAPI_DIST_DIR = path.join(DIST_DIR, 'reapi');

if (!fs.existsSync(REAPI_DIST_DIR)) {
throw new Error('Build ReAPI project before packing');
}

const resolveArchiveName = (sufix) => `${package.name}-${package.version.replace(/\./g, '')}-${sufix}.zip`;

const FILES = {
bundleArchive: resolveArchiveName('bundle'),
srcArchive: resolveArchiveName('addons-src'),
addonsArchive: resolveArchiveName('addons-build'),
resourcesArchive: resolveArchiveName('resources'),
readme: 'README.TXT'
};

const BUNDLE_FILES = [
{ name: FILES.addonsArchive, description: 'compiled plugins and source code' },
{ name: FILES.resourcesArchive, description: 'mod resources' }
];

console.log(BUNDLE_FILES);

gulp.task('pack:bundles', () => {
const dirPatterns = {
all: REAPI_DIST_DIR + '/**',
addons: REAPI_DIST_DIR + '/addons{,/**}',
plugins: REAPI_DIST_DIR + '/addons/amxmodx/plugins{,/**}',
modules: REAPI_DIST_DIR + '/addons/amxmodx/modules{,/**}'
};

return merge2([
gulp.src([dirPatterns.addons, '!' + dirPatterns.plugins, '!' + dirPatterns.modules])
.pipe(zip(FILES.srcArchive)),
gulp.src([dirPatterns.addons])
.pipe(zip(FILES.addonsArchive)),
gulp.src([dirPatterns.all, '!' + dirPatterns.addons])
.pipe(zip(FILES.resourcesArchive)),
file(FILES.readme, generateReadme(BUNDLE_FILES), {src: true})
]).pipe(gulp.dest(BUILD_DIR));
});

gulp.task('pack:full', () => {
const bundleFiles = BUNDLE_FILES.map(file => path.join(BUILD_DIR, file.name));

return gulp.src(bundleFiles)
.pipe(zip(FILES.bundleArchive))
.pipe(gulp.dest(BUILD_DIR))
})

gulp.task('default', gulp.series('pack:bundles', 'pack:full'));
26 changes: 26 additions & 0 deletions helpers/bundle-readme.generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const ARCHIVE_NAME_MAXLEN = 32;
const JOIN_STR = '\r\n';
const INDENT = ' ';
const INSTALLATION_TEXT = 'Extract addons and resources to cstrike folder';

function getFilesList(prefix, files) {
return Object.keys(files).map(key => {
const { name, description } = files[key];

if (!description) {
return;
}

const spaces = ' '.repeat(ARCHIVE_NAME_MAXLEN - name.length);

return `${prefix}${name}${spaces} - ${description}`
}).filter(str => !!str).join(JOIN_STR);
}

module.exports = (files) => [
'[INSTALLATION]',
`${INDENT}${INSTALLATION_TEXT}`,
'',
'[FILES]',
getFilesList(INDENT, files)
].join(JOIN_STR);
Loading

0 comments on commit 2e9b2b0

Please sign in to comment.