mirror of
https://github.com/LoneWolfHT/grenades.git
synced 2024-11-25 16:23:49 +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 flash = settings:get_bool("enable_flashbang_grenade")
|
||||||
local smoke = settings:get_bool("enable_smoke_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
|
if not regular or regular == true then
|
||||||
grenades.register_grenade("regular", {
|
grenades.register_grenade("regular", {
|
||||||
description = "A regular grenade (Kills anyone near where it explodes)",
|
description = "A regular grenade (Kills anyone near where it explodes)",
|
||||||
@ -36,6 +47,11 @@ if not regular or regular == true then
|
|||||||
end
|
end
|
||||||
end
|
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
|
timeout = 3
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -68,12 +84,17 @@ if not flash or flash == true then
|
|||||||
end
|
end
|
||||||
end
|
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
|
timeout = 3
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if not smoke or smoke == true then
|
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)",
|
description = "A smoke grenade (Generates a lot of smoke around the detonation area)",
|
||||||
image = "grenades_smoke_grenade.png",
|
image = "grenades_smoke_grenade.png",
|
||||||
on_explode = function(pos, player, self)
|
on_explode = function(pos, player, self)
|
||||||
@ -98,6 +119,11 @@ if not smoke or smoke == true then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
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
|
timeout = 3
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
13
init.lua
13
init.lua
@ -1,3 +1,5 @@
|
|||||||
|
local settings = minetest.settings
|
||||||
|
|
||||||
grenades = {}
|
grenades = {}
|
||||||
|
|
||||||
local function throw_grenade(name, player)
|
local function throw_grenade(name, player)
|
||||||
@ -14,6 +16,8 @@ local function throw_grenade(name, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function grenades.register_grenade(name, def)
|
function grenades.register_grenade(name, def)
|
||||||
|
if not def.type then def.type = "shaped" end
|
||||||
|
|
||||||
local grenade_entity = {
|
local grenade_entity = {
|
||||||
physical = true,
|
physical = true,
|
||||||
timer = 0,
|
timer = 0,
|
||||||
@ -80,6 +84,15 @@ function grenades.register_grenade(name, def)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
dofile(minetest.get_modpath("grenades").."/grenades.lua")
|
dofile(minetest.get_modpath("grenades").."/grenades.lua")
|
||||||
|
@ -6,3 +6,6 @@ enable_flashbang_grenade (Add a flashbang grenade to the world) bool true
|
|||||||
|
|
||||||
#Add a smoke grenade
|
#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