stujones11 / shooter

First Person Shooter Mod for Minetest
Other
30 stars 18 forks source link

attempt to index field 'sounds' (a function value) #9

Closed HybridDog closed 9 years ago

HybridDog commented 9 years ago

Irrlicht log: Could not open file of texture: shooter_arrow_uv.png 2015-05-14 10:58:19: ERROR[main]: ServerError: ~/.minetest/mods/shooter/shooter.lua:96: attempt to index field 'sounds' (a function value) 2015-05-14 10:58:19: ERROR[main]: stack traceback: 2015-05-14 10:58:19: ERROR[main]: ~/.minetest/mods/shooter/shooter.lua:96: in function 'play_node_sound' 2015-05-14 10:58:19: ERROR[main]: ~/.minetest/mods/shooter/crossbow.lua:161: in function <~/.minetest/mods/shooter/crossbow.lua:96>

stujones11 commented 9 years ago

Can you remember exactly which node you shot to trigger that error? I am pretty sure that 'sounds' is supposed to be a table. I can easily add a check in there but would still be interested to find the true cause of this.

HybridDog commented 9 years ago

minetest.register_node("mo:trans", { description = "Transparenz", inventory_image = "alpha.png", tiles = {"alphr.png"}, drawtype = 'allfaces', sunlight_propagates = true, pointable = false, paramtype = 'light', stack_max = 1000, groups = {dig_immediate=3}, sounds = default.node_sound_dirt_defaults })

lt's one of my very old nodes. You're right, sounds should be a table, looks like l had forgot brackets or forgot to remove the sounds, dirt sounds don't fit to an invisible node, sorry.

stujones11 commented 9 years ago

No problem, thanks for letting me know what it was.

Note that it should have been default.node_sound_dirt_defaults() if you did want to use that. Perhaps I should add a check there anyway, just in case someone else makes the same mistake.