-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: no_autopickup | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/no_autopickup.yaml' | ||
- 'resources/no_autopickup.json' | ||
- 'scripts/mikk/*' | ||
- 'scripts/plugins/no_autopickup.*' | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
|
||
env: | ||
APP_NAME: no_autopickup | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Installing Python | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Repack resources | ||
run: python3 build.py ${{ env.APP_NAME }} | ||
|
||
- name: Create Release | ||
uses: xresloader/upload-to-github-release@v1.5.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
file: "assets.zip" | ||
default_release_body_path: CHANGELOG.md | ||
overwrite: true | ||
tags: true | ||
draft: false | ||
prerelease: false | ||
tag_name: ${{ env.APP_NAME }} | ||
branches: main | ||
default_release_name: ${{ env.APP_NAME }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
target_owner: Mikk155 | ||
target_repo: Sven-Co-op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Include": | ||
[ | ||
"shared" | ||
], | ||
"Resources": | ||
[ | ||
"scripts/plugins/mikk/no_autopickup.as", | ||
"scripts/plugins/mikk/no_autopickup.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//==========================================================================================================================================\\ | ||
// \\ | ||
// Creative Commons Attribution-NonCommercial 4.0 International \\ | ||
// https://creativecommons.org/licenses/by-nc/4.0/ \\ | ||
// \\ | ||
// * You are free to: \\ | ||
// * Copy and redistribute the material in any medium or format. \\ | ||
// * Remix, transform, and build upon the material. \\ | ||
// \\ | ||
// * Under the following terms: \\ | ||
// * You must give appropriate credit, provide a link to the license, and indicate if changes were made. \\ | ||
// * You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. \\ | ||
// * You may not use the material for commercial purposes. \\ | ||
// * You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. \\ | ||
// \\ | ||
//==========================================================================================================================================\\ | ||
|
||
#include '../../mikk/shared' | ||
|
||
void PluginInit() | ||
{ | ||
g_Module.ScriptInfo.SetAuthor( "Gaftherman" ); | ||
g_Module.ScriptInfo.SetContactInfo( Mikk.GetContactInfo() ); | ||
|
||
g_Hooks.RegisterHook( Hooks::PickupObject::CanCollect, @CanCollect ); | ||
|
||
pJson.load( 'plugins/mikk/no_autopickup.json' ); | ||
pItems = pJson[ 'ItemList', {} ]; | ||
} | ||
|
||
json pItems; | ||
json pJson; | ||
|
||
HookReturnCode CanCollect( CBaseEntity@ pPickup, CBaseEntity@ pOther, bool& out bResult ) | ||
{ | ||
if( pPickup !is null && pOther !is null && pOther.IsPlayer() ) | ||
{ | ||
for( uint ui = 0; ui < pItems.length(); ui++ ) | ||
{ | ||
if( pPickup.GetClassname() == pItems[ui,''] || pItems[ui,''].EndsWith( '*' ) | ||
&& pPickup.GetClassname().StartsWith( pItems[ui, ''].SubString( 0, pItems[ui, ''].Length() - 1 ) ) ) { | ||
|
||
if( pJson[ 'MessagePlayer', false ] ) | ||
{ | ||
string name = String::EMPTY_STRING; | ||
|
||
array<string> str = pPickup.GetClassname().Split( '_' ); | ||
|
||
if( str.length() > 2 ) | ||
{ | ||
for( uint u = 1; u < str.length(); u++ ) | ||
{ | ||
name += ( u == 1 ? '' : '_' ) + str[u]; | ||
} | ||
} | ||
else if( str.length() == 2 ) | ||
{ | ||
name = str[1]; | ||
} | ||
|
||
Mikk.Language.Print( cast<CBasePlayer@>( pOther ), pJson[ 'PickMeMessage', {} ], MKLANG::BIND, { { 'item', name } } ); | ||
} | ||
|
||
bResult = ( ( pOther.pev.button & IN_USE ) != 0 ); | ||
} | ||
} | ||
} | ||
return HOOK_CONTINUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// true = tell players to press E | ||
// false = don't tell ( use less resources ) | ||
"MessagePlayer": true, | ||
|
||
// List of items this plugin supports. supports ending wildcard as asterisk (*) | ||
"ItemList": | ||
[ | ||
"weapon_*", | ||
"item_healthkit", | ||
"item_battery", | ||
"weaponbox", | ||
"ammo_*" | ||
], | ||
|
||
"PickMeMessage": | ||
{ | ||
"english": "+use pickup $item$", | ||
"spanish": "+use recoger $item$" | ||
} | ||
} |