Skip to content

Commit

Permalink
Merge pull request #55 from Hedgefog/master
Browse files Browse the repository at this point in the history
Update 6.3.0
  • Loading branch information
Hedgefog authored Oct 29, 2021
2 parents 71a44f9 + 5d50d29 commit 579fbfe
Show file tree
Hide file tree
Showing 69 changed files with 2,780 additions and 1,796 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

jobs:
build:
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,39 @@ __Version:__ 6.2.0
### What is Halloween Mod?
Halloween mod is a powerful Halloween-themed core for your server with completely new game modes, NPCs, bosses, spells, cosmetics, and more.

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

### Documentation
- [Index](./doc/pages/index.md)

### Special Thanks:
- [Credits](./CREDITS.md)

### Deployment
- Clone repository.
- Extract compiler executable and includes to _"compiler"_ folder of project.
- Extract RoundControl module to _"thirdparty/round-control"_ folder of project (example: _"thirdparty/round-control/addons"_).
- Extract ReAPI module to _"thirdparty/reapi"_ folder of project (example: _"thirdparty/reapi/addons"_).
- Install dependencies `npm i`

#### Customize builder
Use `config.user.js` file (Generated automatically on dependencies install)

#### Build project

```bash
npm i
npm run build
```

#### Watch project

```bash
npm i
npm run watch
```

#### Create bundle

```bash
npm i
npm run pack
```

#### Documentation
- [Index](./doc/pages/index.md)

#### Special Thanks:
- [Credits](./CREDITS.md)
5 changes: 5 additions & 0 deletions assets/addons/amxmodx/configs/hwn.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ hwn_bucket_health 300
hwn_pumpkin_pickup_flash 1

// [Custom Entity] Hwn Item Spellbook
hwn_spellbook_max_rare_spell_count 1
hwn_spellbook_max_spell_count 3

// [Custom Entity] Hwn NPC HHH
Expand Down Expand Up @@ -88,3 +89,7 @@ hwn_boss_healthbar 1
// [Hwn] HUD
hwn_hud_collector_hide_money 1
hwn_hud_collector_hide_timer 0

// [Hwn] Menu Player Cosmetic
hwn_pcosmetic_menu_preview 1
hwn_pcosmetic_menu_preview_light 1
5 changes: 4 additions & 1 deletion assets/addons/amxmodx/configs/plugins-hwn.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ api_player_burn.amxx
api_player_cosmetic.amxx
api_player_inventory.amxx
api_particles.amxx
api_player_preview.amxx
api_rounds.amxx

astar.amxx

entity_ce_spawner.amxx
particle_magic_glow.amxx
menu_player_cosmetic.amxx

; Entities

Expand Down Expand Up @@ -45,6 +46,7 @@ entity_hwn_pumpkin_dispenser.amxx

hwn.amxx
hwn_gamemode.amxx
hwn_event_points.amxx

hwn_bosses.amxx

Expand Down Expand Up @@ -86,6 +88,7 @@ hwn_pcosmetics_2017.amxx

hwn_hud.amxx
hwn_menu.amxx
hwn_menu_player_cosmetic.amxx
hwn_gamename.amxx
hwn_boss_healthbar.amxx

Expand Down
Binary file added assets/sound/hwn/spells/spell_pickup_rare.wav
Binary file not shown.
5 changes: 3 additions & 2 deletions builder/config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const path = require('path');
const os = require('os');

const userConfig = false;
const compilerExecutable = os.platform() === 'win32' ? 'amxxpc.exe' : 'amxxpc';

module.exports = {
version: '1.0.0',
compiler: {
dir: path.resolve('./compiler'),
executable: path.resolve('./compiler/amxxpc')
executable: path.resolve('./compiler/', compilerExecutable)
},
project: {
includeDir: path.resolve('./src/include'),
Expand Down
110 changes: 41 additions & 69 deletions doc/pages/api/spell.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,24 @@
# Methods

### Hwn_Spell_Register
> Register new spell.
| Param | Description |
|----------------|------------------------------------------------------------------------------------------------|
| szName | Name of the spell |
| szCastCallback | Callback. Will be executed when player cast spell. Player id will be passed at first argument. |

### Hwn_Spell_GetCount
> Get count of registered spells.
### Hwn_Spell_GetName
> Get name of spell by spell handler.
| Param | Description |
|--------|---------------------------|
| spell | Spell handler. |
| szName | Output array. |
| maxlen | Max len of output string. |


---

# UTILS

### UTIL_HwnSpawnPlayerSpellball
> Create spellball entity with predefined velocity, modelindex and render color.
| Param | Description | Type | Default Value |
|------------|-----------------------------------------------------------------------------------|-------------------|---------------|
| owner | Spawn origin to will be read from the owner position. | Integer | |
| modelindex | Max len of output string. | Integer | |
| color | Color of spellball | Integer Array [3] | |
| speed | Start speed of spell ball. Direction will be generated from the owner aim vector. | Integer | 512 |
| scale | Scale of spellball sprite. | Float | 0.25 |

---

### UTIL_HwnSpellDetonateEffect
> Create detonation effect.
| Param | Description | Type | Default Value |
|------------|----------------|-------------------|---------------|
| modelindex | Effect sprite. | Integer | |
| vOrigin | Effect origin. | Float Array [3] | |
| color | Effect color. | Integer Array [3] | |
| fRadius | Effect radius. | Float | |


# Create your spell using spellball entity.

At first you should register your spell and save returned handler to the global variable
At first you should register your spell and save returned handler to the global variable, use precache forward to register spell.

```SourcePawn
#include <amxmodx>
#include <hwn>
#include <hwn_utils>
#include <hwn_spell_utils>
new g_hSpell;
public plugin_init()
{
register_plugin(PLUGIN, HWN_VERSION, AUTHOR);
g_hSpell = Hwn_Spell_Register("Boo Spell", "OnCast");
}
public plugin_precache()
{
g_hSpell = Hwn_Spell_Register("Boo Spell", Hwn_SpellFlag_Throwable | Hwn_SpellFlag_Rare, "OnCast");
}
public OnCast(id) {}
Expand All @@ -74,46 +28,64 @@ public OnCast(id) {}
Precache resources for spell effects.

```SourcePawn
new g_sprSpellball;
new g_szSpellballSprite[] = "sprites/rjet1.spr";
new g_sprSpellballTrace;
public plugin_precache()
{
g_sprSpellball = precache_model("sprites/rjet1.spr");
precache_model(g_szSpellballSprite);
g_sprSpellballTrace = precache_model("sprites/xbeam4.spr");
g_hSpell = Hwn_Spell_Register("Boo Spell", Hwn_SpellFlag_Throwable | Hwn_SpellFlag_Rare, "OnCast");
}
```

Implement cast handler
#### Implement cast handler

You can use hwn_spell_utils to spawn spellball entity.

```SourcePawn
new ent = UTIL_HwnSpawnPlayerSpellball(id, g_sprSpellball, {255, 0, 0});
public OnCast(id)
{
new Float:spellballSpeed = 512.0;
new Float:spellballRenderAmt = 255.0;
new Float:spellballScale = 0.75;
new Float:spellballFramerate = 10.0;
if (!ent) {
return PLUGIN_HANDLED; // discard cast
}
new ent = UTIL_HwnSpawnPlayerSpellball(id, {255, 0, 0}, spellballSpeed, g_szSpellballSprite, spellballRenderAmt, spellballScale, spellballFramerate);
if (!ent) {
return PLUGIN_HANDLED; // discard cast
}
// create task to kill spellball after 5 seconds and pass entity index as task id.
set_task(5.0, "TaskKillSpellball", ent);
// create task to kill spellball after 5 seconds and pass entity index as task id.
set_task(5.0, "TaskKillSpellball", ent);
return PLUGIN_CONTINUE; // allow cast
return PLUGIN_CONTINUE; // allow cast
}
```

Now implement task to kill spellball using hwn_spell_utils include to make detonation effect.
Now implement task to kill spellball using hwn_utils include to make detonation effect.

Spellball entity is a custom entity created using Custom Entities API, so you should use CE_Kill to kill this entity.

```SourcePawn
public TaskKillSpellball(ent)
{
static Float:vOrigin[3];
pev(ent, pev_origin, vOrigin);
UTIL_HwnSpellDetonateEffect(
.modelindex = g_sprSpellballTrace,
.vOrigin = vOrigin,
.fRadius = 128.0,
.color = {255, 0, 0}
UTIL_Message_BeamCylinder(
vOrigin,
fRadius,
.modelIndex = g_sprSpellballTrace,
.lifeTime = 10,
.width = 32,
.noise = 0,
.color = {255, 0, 0},
.brightness = 100
);
CE_Kill(ent);
}
```
3 changes: 3 additions & 0 deletions doc/pages/cvars/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
| hwn_collector_npc_drop_chance_spell | Chance that NPC drop spellbook on death | 10.0 |
| hwn_collector_teampoints_to_boss_spawn | Total team points to spawn boss (0 - to disable) | 20 |
| hwn_spellbook_max_spell_count | Max count of spells that are given for spellbook pickup | 3 |
| hwn_spellbook_max_rare_spell_count | Max count of rare spells that are given for spellbook pickup | 1 |
| hwn_pumpkin_mutate_chance | Chance mutation pumpkin in a spooky pumpkin | 20.0 |
| hwn_pumpkin_pickup_flash | Enable/Disable flash effect on filling the bucket | 1 |
| hwn_spells_give %spell% | Give spell by index (Admin Access) | |
Expand All @@ -58,5 +59,7 @@
| hwn_crits_toggle %playerId% | Toggle crits for player (Admin Acces) | caller |
| hwn_hud_collector_hide_timer | Enable/Disable hide timer hud in collector gamemode | 1 |
| hwn_hud_collector_hide_money | Enable/Disable hide money hud in collector gamemode | 1 |
| hwn_pcosmetic_menu_preview | Enable/Disable player cosmetic preview | 1 |
| hwn_pcosmetic_menu_preview_light | Enable/Disable light source in player cosmetic preview | 1 |
| hwn_bots_spells | Enable/Disable spells for bots | 1 |
| hwn_bots_cosmetics | Number of cosmetic items for bots | 2 |
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 579fbfe

Please sign in to comment.