mirror of
https://github.com/LoneWolfHT/grenades.git
synced 2024-11-21 22:33:45 +01:00
Add crafting recipes and afew other things
This commit is contained in:
parent
536a9a309d
commit
3606178b96
28
grenades.lua
28
grenades.lua
@ -4,6 +4,17 @@ local regular = settings:get_bool("enable_regular_grenade")
|
||||
local flash = settings:get_bool("enable_flashbang_grenade")
|
||||
local smoke = settings:get_bool("enable_smoke_grenade")
|
||||
|
||||
minetest.register_craftitem("grenades:gun_powder", {
|
||||
description = "A dark powder used for crafting smoke grenades",
|
||||
inventory_image = "grenades_gun_powder.png"
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "grenades:gun_powder",
|
||||
recipe = {"default:coal_lump", "default:coal_lump", "default:coal_lump", "default:coal_lump"},
|
||||
})
|
||||
|
||||
if not regular or regular == true then
|
||||
grenades.register_grenade("regular", {
|
||||
description = "A regular grenade (Kills anyone near where it explodes)",
|
||||
@ -36,6 +47,11 @@ if not regular or regular == true then
|
||||
end
|
||||
end
|
||||
end,
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", ""},
|
||||
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||
},
|
||||
timeout = 3
|
||||
})
|
||||
end
|
||||
@ -68,12 +84,17 @@ if not flash or flash == true then
|
||||
end
|
||||
end
|
||||
end,
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", ""},
|
||||
{"default:steel_ingot", "default:torch", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||
},
|
||||
timeout = 3
|
||||
})
|
||||
end
|
||||
|
||||
if not smoke or smoke == true then
|
||||
grenades.register_grenade("smoke_greande", {
|
||||
grenades.register_grenade("smoke", {
|
||||
description = "A smoke grenade (Generates a lot of smoke around the detonation area)",
|
||||
image = "grenades_smoke_grenade.png",
|
||||
on_explode = function(pos, player, self)
|
||||
@ -98,6 +119,11 @@ if not smoke or smoke == true then
|
||||
})
|
||||
end
|
||||
end,
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", ""},
|
||||
{"default:steel_ingot", "grenades:gun_powder", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||
},
|
||||
timeout = 3
|
||||
})
|
||||
end
|
||||
|
13
init.lua
13
init.lua
@ -1,3 +1,5 @@
|
||||
local settings = minetest.settings
|
||||
|
||||
grenades = {}
|
||||
|
||||
local function throw_grenade(name, player)
|
||||
@ -14,6 +16,8 @@ local function throw_grenade(name, player)
|
||||
end
|
||||
|
||||
function grenades.register_grenade(name, def)
|
||||
if not def.type then def.type = "shaped" end
|
||||
|
||||
local grenade_entity = {
|
||||
physical = true,
|
||||
timer = 0,
|
||||
@ -80,6 +84,15 @@ function grenades.register_grenade(name, def)
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
if def.recipe and (not settings:get_bool("enable_grenade_recipes") or
|
||||
settings:get_bool("enable_grenade_recipes") == true) then
|
||||
minetest.register_craft({
|
||||
type = def.type,
|
||||
output = "grenades:grenade_"..name,
|
||||
recipe = def.recipe
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("grenades").."/grenades.lua")
|
||||
|
@ -5,4 +5,7 @@ enable_regular_grenade (Add a regular grenade to the world) bool true
|
||||
enable_flashbang_grenade (Add a flashbang grenade to the world) bool true
|
||||
|
||||
#Add a smoke grenade
|
||||
enable_smoke_grenade (Add a smoke grenade to the world) bool true
|
||||
enable_smoke_grenade (Add a smoke grenade to the world) bool true
|
||||
|
||||
#Enable Recipes
|
||||
enable_grenade_recipes (Gives enabled grenades cafting recipes) bool true
|
BIN
textures/grenades_gun_powder.png
Normal file
BIN
textures/grenades_gun_powder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 B |
Loading…
Reference in New Issue
Block a user