[Mod] Gunslinger (WIP) [gunslinger]

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

[Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Sat Dec 29, 2018 08:31

Gunslinger (v0.9 | Pre-release 10)



Gunslinger is one of the most advanced guns mods for Minetest. It's heaven on earth for those gunslingers out there who play MT... at least when it is functional in the near future. However, this mod requires 5.0.0-dev+ as it uses Raycast.

Features

Gunslinger provides a very simple API to register custom guns, and almost every aspect of the gun can be customized, including but not restricted to (includes currently non-functional features):

  • Types: Types are essentially blueprints that allow mods to register a set of valid gun registration fields, which can then be "inherited" by individual guns.
    • Using Types is a great way to add multiple similar guns without having to define the same fields for each of them.
    • Guns can inherit the type by simply adding type=<name of valid registered type> to the gun-def, which will import all fields from the type-def to the gun-def.
    • Fields inherited from types can be overridden per-gun if needed, by just re-defining them in the gun-def.
  • Firing modes. Available choices:
    • manual: One round per-click. Requires manual loading after each round.
    • semi-automatic: One round per-click.
    • burst: Multiple rounds per-click. Can be set by defining burst field in gun registration table. Defaults to 3.
    • automatic: Keeps firing rounds. Time between two consecutive rounds is based on fire-rate.
    • hybrid: Same as automatic, but switches to burst when player is aiming down sights.
    • splash: (TODO) Shotgun-style splash damage. Fires random number of pellets in the direction of player's look dir, but each pellet will have a slight random deviation from the exact look dir vector.
  • Support for scopes and sights. Toggled using RMB.
  • (TODO) Recoil; customizable per-gun.
  • (TODO) Support for custom effects when projectile finds its target a.k.a weapon perks.
  • (TODO) Scopes with custom zoom (per-gun). Will work only after 5.1.0.
  • (TODO) Add-ons for guns like specialized scopes, suppressors, extended magazines, etc.

Settings
  • gunslinger.lite: If set to true, the more laggy features (incl. automatic and hybrid guns) are disabled.
  • gunslinger.disable_builtin: If set to true, the builtin guns are disabled. Useful in situations where mods/games register their custom guns, and/or when the builtin guns don't adhere to the mod's/game's theme.

License
Code: MIT
Media: CC0

ContentDB: https://content.minetest.net/packages/ANAND/gunslinger
Browse code: https://github.com/ClobberXD/gunslinger
Download: https://github.com/ClobberXD/gunslinger ... master.zip
Last edited by ANAND on Tue Jan 15, 2019 08:13, edited 8 times in total.
 

User avatar
Lone_Wolf
Member
 
Posts: 2026
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Sat Jan 05, 2019 01:09

As the mod is now somewhat functional, I've created a pre-release for easy testing. https://content.minetest.net/packages/A ... /download/
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1

Re: [Mod] Gunslinger (WIP) [gunslinger]

by StarNinjas » Sun Jan 06, 2019 04:43

Join and this is what I get:

Code: Select all
2019-01-05 21:40:11: ERROR[Main]: ModError: Failed to load and run script from C:\MT-0.5-master\bin\..\mods\gunslinger-master\init.lua:
2019-01-05 21:40:11: ERROR[Main]: C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:250: gunslinger.register_gun: Attempt to register gun of disabled type 'semi-automatic'
2019-01-05 21:40:11: ERROR[Main]: stack traceback:
2019-01-05 21:40:11: ERROR[Main]:    [C]: in function 'error'
2019-01-05 21:40:11: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:250: in function 'register_gun'
2019-01-05 21:40:11: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master/guns.lua:1: in main chunk
2019-01-05 21:40:11: ERROR[Main]:    [C]: in function 'dofile'
2019-01-05 21:40:11: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master\init.lua:7: in main chunk
2019-01-05 21:40:11: ERROR[Main]: Check debug.txt for details.
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Sun Jan 06, 2019 06:15

Thanks for reporting, this has been fixed. Please get the updated version from the GitHub repo or the CDB.
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1

Re: [Mod] Gunslinger (WIP) [gunslinger]

by StarNinjas » Sun Jan 06, 2019 22:40

Ok thanks!

:(

Code: Select all
2019-01-06 15:49:12: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'gunslinger' in callback item_OnUse(): C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:165: attempt to perform arithmetic on field 'time' (a function value)
2019-01-06 15:49:12: ERROR[Main]: stack traceback:
2019-01-06 15:49:12: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:165: in function <C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:124>


^^^^^^^ when i use the cheetah gun.
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Mon Jan 07, 2019 09:48

Fixed. Again, thanks for reporting. :)

Created another release. Please update your mod to the latest version.
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1

Re: [Mod] Gunslinger (WIP) [gunslinger]

by StarNinjas » Mon Jan 07, 2019 21:46

Thanks hope it works:)!
ugh again after a while of trying to shoot this is what it gives me:(
Code: Select all
2019-01-07 15:06:42: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'gunslinger' in callback environment_Step(): C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:55: attempt to index local 'stack' (a nil value)
2019-01-07 15:06:42: ERROR[Main]: stack traceback:
2019-01-07 15:06:42: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:55: in function 'fire'
2019-01-07 15:06:42: ERROR[Main]:    C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:196: in function <C:\MT-0.5-master\bin\..\mods\gunslinger-master/api.lua:185>
2019-01-07 15:06:42: ERROR[Main]:    C:\MT-0.5-master\bin\..\builtin\game\register.lua:420: in function <C:\MT-0.5-master\bin\..\builtin\game\register.lua:400>
2019-01-07 15:06:42: ERROR[Main]: stack traceback:
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Tue Jan 08, 2019 08:00

I've encountered this myself quite a few times, I'll look into it.
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Sun Jan 13, 2019 17:45

Updates!



  • The fire function aborts if stack is nil, avoiding the error described here.
  • The gun definition field style_of_fire has been renamed to mode.
  • Some firing modes have been renamed for consistency and factual accuracy:
    • semi-automatic --> hybrid
    • manual --> semi-automatic
  • A new firing mode has been introduced: manual. Manual guns are truly manual, as in they have to be manually loaded after each shot. This can be used for guns like bolt-action sniper rifles, for example.

As usual, I've created a pre-release on CDB for those who prefer that to downloading from GitHub.
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1

Re: [Mod] Gunslinger (WIP) [gunslinger]

by StarNinjas » Sun Jan 13, 2019 21:41

How do you even shoot?
I keep clicking left and right mouse button but nothing happens:(
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Tue Jan 15, 2019 04:23

StarNinjas wrote:How do you even shoot?
I keep clicking left and right mouse button but nothing happens:(


lol, sorry. I forgot to rename style_of_fire field in the gun's definition to mode. Fixed now.
 

User avatar
StarNinjas
Member
 
Posts: 228
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

User avatar
ANAND
Member
 
Posts: 275
Joined: Sun Jan 28, 2018 12:54
Location: India
GitHub: ClobberXD
IRC: ANAND
In-game: ANAND ClobberXD [A-Za-z]+Tomato

Re: [Mod] Gunslinger (WIP) [gunslinger]

by ANAND » Tue Jan 15, 2019 07:57

Updates!

- Fix a potential crash.
- Set firing mode of `gunslinger:cheetah` to `burst` until `automatic` mode is fixed.
- Use particles for visual feedback of projectile path.

Created another release as usual.
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 2 guests