Removed formspecs, fixed textures.

master
NathanSalapat 2014-10-27 15:29:45 -05:00
parent 1bb68535a0
commit 65c3a8866c
15 changed files with 49 additions and 231 deletions

View File

@ -2,6 +2,8 @@ Textures:
Flint image created by me with Blender.
Charcoal_Lump created from the default_coal_lump that ships with minetest.
campfire inventory image from Esteban on the minetest forum licensed CC by SA
Kindling inventory image created by modifying Esteban's campfire image.
Lighter image created by me with Blender.
Code:
Torch rotation by addi, shamelessly copied from the 3d_torches mod.

View File

@ -1,7 +1,14 @@
10-27-14:
Made the torches a tad bit smaller.
Removed all the formspec stuff from the campfires. I couldn't get them to work, so I'll come back to that when I learn more of the coding needed.
Removed the .mlt files from the models folder as I discovered they aren't needed and just give errors in the debug.
10-26-14:
Added kindling, craft it from a stick, wood, and two other flammable grouped items. Light it with the lighter, which is made with flint and steel.
10-25-14:
Torches stick to the wall or the floor according as they should. Copied code from the 3d_torch mod.
10-24-14:
Campfires now have animated fire. Turns out that I was exporting the file wrong. :S

114
init.lua
View File

@ -1,50 +1,5 @@
-- A couple variables used throughout.
percent = 100
-- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
more_fire = {}
-- functions
function default.get_hotbar_bg(x,y)
local out = ""
for i=0,7,1 do
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end
return out
end
function more_fire.campfire_active(pos, percent, item_percent)
local formspec =
"size[8,6.75]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;fuel;2,1.5;4,1;]"..
"list[current_player;main;0,2.75;8,1;]"..
"list[current_player;main;0,4;8,3;8]"..
default.get_hotbar_bg(0,2.75)
return formspec
end
function more_fire.get_campfire_active_formspec(pos, percent)
local meta = minetest.get_meta(pos)local inv = meta:get_inventory()
local fuellist = inv:get_list("fuel")
if fuellist then
end
local item_percent = 0
if cooked then
item_percent = meta:get_float("src_time")/cooked.time
end
return more_fire.campfire_active(pos, percent, item_percent)
end
function burn(pointed_thing) --kindling doesn't always start from the first spark
ignite_chance = math.random(5)
print (ignite_chance, 'ignite chance')
if ignite_chance == 1 then
minetest.env:swap_node(pointed_thing.under, {name = 'more_fire:campfire'})
else --do nothing
@ -107,17 +62,6 @@ minetest.register_abm({
end
end,
})
-- formspecs
more_fire.campfire_inactive_formspec =
"size[8,6.75]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;fuel;2,1.5;4,1;]"..
"list[current_player;main;0,2.75;8,1;]"..
"list[current_player;main;0,4;8,3;8]"..
default.get_hotbar_bg(0,2.75)
-- node definitions
minetest.register_node(':default:gravel', {
@ -208,60 +152,6 @@ minetest.register_node('more_fire:campfire', {
light_source = 14,
is_ground_content = true,
groups = {cracky=2,hot=2,attached_node=1,dig_immediate=3,igniter=1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('formspec', more_fire.campfire_inactive_formspec)
meta:set_string('infotext', 'Campfire')
local inv = meta:get_inventory()
inv:set_size('fuel', 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty('fuel') then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == 'fuel' then
if inv:is_empty('fuel') then
meta:set_string("infotext","Campfire is out of wood.")
return stack:get_count()
else
return 0
end
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=4,items={stack}}).time ~= 0 then
if inv:is_empty("fuel") then
meta:set_string("infotext","Campfire is out of wood.")
end
return count
else
return 0
end
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
})
minetest.register_node('more_fire:contained_fire', {
@ -388,7 +278,7 @@ minetest.register_tool('more_fire:lighter', {
full_punch_interval = 1.0,
max_drop_level = 0,
groupcaps = {
flammable = {uses = 65, maxlevel = 1},
flammable = {uses = 80, maxlevel = 1},
}
},
on_use = function(itemstack, user, pointed_thing, pos)
@ -396,7 +286,7 @@ minetest.register_tool('more_fire:lighter', {
and string.find(minetest.get_node(pointed_thing.under).name, 'more_fire:kindling')
then
burn(pointed_thing)
itemstack:add_wear(65535/65)
itemstack:add_wear(65535/80)
return itemstack
end
end,

View File

@ -1,24 +0,0 @@
# Blender MTL File: 'campfire.blend'
# Material Count: 2
newmtl Fire
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 0.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire.png
map_d /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire.png
newmtl Flames
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 0.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire_logs.png
map_d /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire.png

View File

@ -1,23 +0,0 @@
# Blender MTL File: 'campfire.blend'
# Material Count: 2
newmtl Fire
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 0.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/fire_basic_flame_animated.png
map_d /home/nathan/.minetest/mods/more_fire/textures/fire_basic_flame_animated.png
newmtl Logs-Stone
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 0.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire_logs.png

View File

@ -1,12 +0,0 @@
# Blender MTL File: 'campfire.blend'
# Material Count: 1
newmtl Logs-Stone
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 0.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_campfire_logs.png

View File

@ -1,12 +0,0 @@
# Blender MTL File: 'torch.blend'
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_torch.png

View File

@ -1,23 +1,23 @@
# Blender v2.71 (sub 6) OBJ File: 'torch.blend'
# Blender v2.72 (sub 0) OBJ File: 'torch.blend'
# www.blender.org
mtllib more_fire_torch.mtl
o Cube.001
v -0.063389 0.097510 0.063389
v -0.063389 0.097510 -0.063389
v 0.063389 0.097510 -0.063389
v 0.063389 0.097510 0.063389
v -0.067241 0.224287 0.067241
v -0.067241 0.224287 -0.067241
v 0.067241 0.224287 -0.067241
v 0.067241 0.224287 0.067241
v 0.070746 -0.500000 -0.070746
v 0.070746 -0.500000 0.070746
v -0.070746 -0.500000 0.070746
v -0.070746 -0.500000 -0.070746
v 0.070746 0.100000 -0.070746
v 0.070746 0.100000 0.070746
v -0.070746 0.100000 0.070746
v -0.070746 0.100000 -0.070746
o Torch_Ground_Cube.001
v -0.053243 0.005921 0.053243
v -0.053243 0.005921 -0.053243
v 0.053243 0.005921 -0.053243
v 0.053243 0.005921 0.053243
v -0.056479 0.112407 0.056479
v -0.056479 0.112407 -0.056479
v 0.056479 0.112407 -0.056479
v 0.056479 0.112407 0.056479
v 0.059423 -0.495953 -0.059423
v 0.059423 -0.495953 0.059423
v -0.059423 -0.495953 0.059423
v -0.059423 -0.495953 -0.059423
v 0.059423 0.008013 -0.059423
v 0.059423 0.008013 0.059423
v -0.059423 0.008013 0.059423
v -0.059423 0.008013 -0.059423
vt 0.992873 0.992178
vt 0.831122 0.992178
vt 0.835756 0.839624

View File

@ -1,12 +0,0 @@
# Blender MTL File: 'torch.blend'
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 1
map_Kd /home/nathan/.minetest/mods/more_fire/textures/more_fire_torch.png

View File

@ -1,23 +1,23 @@
# Blender v2.71 (sub 6) OBJ File: 'torch.blend'
# Blender v2.72 (sub 0) OBJ File: 'torch.blend'
# www.blender.org
mtllib more_fire_torch_wall.mtl
o Torch_Wall_Cube.000
v 0.312774 0.237322 0.063389
v 0.196587 0.186597 0.063389
v 0.196587 0.186597 -0.063389
v 0.312774 0.237322 -0.063389
v 0.265579 0.355051 0.067241
v 0.142331 0.301242 0.067241
v 0.142331 0.301242 -0.067241
v 0.265579 0.355051 -0.067241
v 0.428916 -0.363944 -0.070746
v 0.558589 -0.307331 -0.070746
v 0.558589 -0.307331 0.070746
v 0.428916 -0.363944 0.070746
v 0.188847 0.185935 -0.070746
v 0.318521 0.242548 -0.070746
v 0.318521 0.242548 0.070746
v 0.188847 0.185935 0.070746
v 0.389233 0.142734 0.048199
v 0.300888 0.104164 0.048199
v 0.300888 0.104164 -0.048199
v 0.389233 0.142734 -0.048199
v 0.353348 0.232252 0.051129
v 0.259632 0.191337 0.051129
v 0.259632 0.191337 -0.051129
v 0.353348 0.232252 -0.051129
v 0.477546 -0.314455 -0.053794
v 0.576146 -0.271408 -0.053794
v 0.576146 -0.271408 0.053794
v 0.477546 -0.314455 0.053794
v 0.295003 0.103660 -0.053794
v 0.393603 0.146708 -0.053794
v 0.393603 0.146708 0.053794
v 0.295003 0.103660 0.053794
vt 0.992873 0.992178
vt 0.831122 0.992178
vt 0.835756 0.839624

Binary file not shown.

Binary file not shown.

View File

@ -3,3 +3,5 @@ Put this folder into your Mods folder and enable.
This mod is using the newly added Mesh type so you need a recent build for it to work. If you are on linux consider using the daily build PPA or build from source.
If you have any ideas for more fire related things please let me know, or consider forking the project on GIT. I'm always ready to add more good stuff.
There is a bug where placing torches on a stone wall sometimes reacts strangly. If you put two torches next to each other one will usually fall off the wall. Not sure why...

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 1.2 KiB