[Mod] Gunkit [gunkit]

Post Reply
User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

[Mod] Gunkit [gunkit]

by Stix » Post

Adds an api to easily register advanced firearms within Minetest

Image
The mod that adds the gun in the screenshot can be found here.

WARNING: You will need a Minetest build with this commit to avoid any potential crashes.

Features:
  • Full auto guns.
  • Drop/load mags.
  • Customizable mags/mag-types.
  • Generated detailed gun/mag tooltips.
  • Alternate fire mode.
  • Callbacks to ease customization (modders).
Information (users):
  • Firearms start out empty.
  • Punch with a empty firearm in hand to load a mag with a ammo count > 0 and a mag_type corresponding to the wielded firearm.
  • Press the drop key (Q by default) to swap fire mode of wielded firearm (if applicable and ammo count > 0).
  • Press the drop key to drop a guns mag (if the mag is empty).
  • Rightclick with firearm (if mag is not empty) in order to ADS (if applicable).
  • Combine a stack of bullets along with a non-full mag in the craft-grid to fill it.
  • Drop a non-empty mag in the craft-grid to get the bullets out of it.
Information (modders):

Guns and magazines can easily be registered with:
gunkit.register_firearm(name, def)

And:
gunkit.register_mag(name, def)

Respectively. I include a couple examples here but detailed information can be found in the mods README file (see github link).

Registering a firearm:

Code: Select all

gunkit.register_firearm("rpg_guns:smg_ice", {
    description = "Ice Smg",
    inventory_image = "rpg_guns_smg.png",
    wield_scale = {x = 2, y = 2, z = 1},
    mag_type = "smg",

    sounds = {
        mag_load = "rpg_guns_mag_load",
        mag_drop = "rpg_guns_mag_drop",
        fire_empty = "rpg_guns_fire_empty",
    },

    callbacks = {fire = {on_hit = hit_sound}, alt_fire = {on_hit = freeze}},

    fire = {
        bullet_texture = "rpg_guns_bullet.png",
        sounds = {
            fire = "rpg_guns_fire",
            fire_toggle = "rpg_guns_toggle_a",
            shell_drop = "rpg_guns_shell_drop",
        },

        range = 60,
        speed = 300,
        spread = 4,
        dmg = 7,
        shots = 1,
        interval = 0.1,
        zoom = 2,
    },

    alt_fire = {
        bullet_texture = "default_ice.png",
        sounds = {
            fire = "rpg_guns_fire",
            fire_toggle = "rpg_guns_toggle_b",
            shell_drop = "rpg_guns_shell_drop",
        },

        range = 30,
        speed = 300,
        spread = 6,
        dmg = 0,
        shots = 9,
        interval = 5,
        zoom = 1.5,
    },
})
Registering a mag:

Code: Select all

gunkit.register_mag("rpg_guns:smg_mag", {
    description = "Smg Mag",
    inventory_image = "rpg_guns_smg_mag.png",
    ammo = "rpg_guns:bullet",
    max_ammo = 100,
    mag_type = "smg",
})
Downloads:
Attachments
Nice scenery, eh?
Nice scenery, eh?
screenshot_20200501_164646.png (177.79 KiB) Viewed 433 times
Last edited by Stix on Sun May 03, 2020 14:19, edited 1 time in total.
Hey, what can i say? I'm the bad guy.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Gunkit [gunkit]

by Stix » Post

WARNING: The latest update in gunkit uses the new transition-time param added to set_fov, you will need a MT build with this commit or later, though the mod may still work for you without it if you dont use the zoom and zoom_time fields in fire defs.

This warning is a bit late now (by half a day), but better later then never i guess.
Hey, what can i say? I'm the bad guy.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests