Time Nick Message 18:16 shaft init.lua:18: attempt to call field 'set_sprite' (a nil value) 18:17 shaft Why is set_sprite not working. I have a Lua entity and try to call self.set_sprite() when it activates 18:17 shaft ? 18:55 shaft So why is set_sprite a nil value? It says here https://minetest.gitlab.io/minetest/class-reference/#lua-entity-only-no-op-for-other-objects that it exists 18:57 celeron55 in your case "self" is probably not an ObjectRef 18:57 celeron55 but i can't tell because you're not linking any code to check 18:57 MTDiscord It rarely ever is 18:58 MTDiscord try self.object:set_sprite() and see 19:00 shaft The documentation says it's for the lua entity "Lua entity only (no-op for other objects)ΒΆ" 19:00 shaft function Bird:on_activate(self, staticdata, dtime_s) 19:00 shaft self.object:set_sprite({x=0,y=0},1,0.5) 19:00 shaft end 19:00 celeron55 that just means the object has to represent a lua entity 19:01 celeron55 it is not the entity by itself. the relation of a lua entity to an object is that the object is of the type "luaentity", and has a linked set of extra data that contain the lua entity state 19:01 shaft Bird is my sprite entity 19:02 celeron55 that code should work i think 19:03 shaft AsyncErr: Lua: Runtime error from mod 'birds' in callback luaentity_Activate(): 19:03 shaft attempt to index field 'object' (a nil value) 19:03 shaft I must be doing something fundamentally wrong 19:07 celeron55 wait why is there a self as the first parameter of Bird::on_activate 19:07 celeron55 self is implied when you use : there 19:07 MTDiscord it should be either .on_activate(self, whatever... or :on_activate(whatever... 19:07 MTDiscord Don't use both : and an explicit self 19:08 celeron55 now self is staticdata, i think, and that's nil when the entity is newly created 19:08 shaft Yes, just noticed myself 19:08 shaft I was just being retarded 19:08 celeron55 frigging dynamic languages, it's as if they were invented to be as difficult to reason about as possible 19:09 MTDiscord Nah, it's optional syntactic sugar that's messing you up here. 19:09 shaft It was my fault. I just copied the paremeters from the documentation not thinking about it 19:09 shaft para 19:10 celeron55 that's one of those things to be hyper aware about when writing lua. stick to either : or . or it will get you 20:10 MinetestBot 02[git] 04sfan5 -> 03minetest/minetest: Return texture filter settings to previous state 137f93268 https://github.com/minetest/minetest/commit/7f9326805cf558b80c998aaad3a0b4fa96f14841 (152023-11-29T20:09:21Z) 20:10 MinetestBot 02[git] 04sfan5 -> 03minetest/minetest: Enable clean transparent filter in more cases 13d6a8b54 https://github.com/minetest/minetest/commit/d6a8b546e4d97f1d6537747e250aeac742ab8694 (152023-11-29T20:09:21Z) 20:10 MinetestBot 02[git] 04SmallJoker -> 03minetest/minetest: Server: avoid re-use of recent ParticleSpawner and Sound IDs (#14045) 13a7e5456 https://github.com/minetest/minetest/commit/a7e545609909e4e56b60878b2030fa13ddc630de (152023-11-29T20:10:19Z) 20:57 shaft My bird is getting along. I used select_x_by_camera and it looks pretty good when viewed from the sides 20:58 shaft And automatic_face_movement_dir 20:58 shaft Problem is that when viewed from the top the sprite always aligns with the screens instead of the direction the bird is heading in. 20:58 shaft Can I prevent the sprite from freely rotating when viewed from top or bottom? 21:00 shaft https://litter.catbox.moe/1d5m6s.png 21:00 shaft To illustrate my problem 21:02 Krock shaft: use an upright sprite 21:03 Krock or a custom mesh that simply consists of two panes intersecting each other, similar to grass- that would suffice as a simple 3D model 21:05 shaft Upright sprite would work but doesn't from the sides. And it brings per player troubles if I switch between them 21:06 shaft Krock, that wouldn't work out with the wings 21:06 Krock hence the idea of a custom mesh. it might even be possible to register a node using nodeboxes that you could spawn as entity (wielded item) 21:06 Krock you'd need a top and side texture 21:07 shaft But then you'd see multiple of them at one if I put them on the sides of a block, right? 21:07 shaft Like left face, front face, top face 21:10 Krock shaft: https://i.postimg.cc/mgkR3D9P/grafik.png 21:11 Krock change the box thickness to 1/32 or smaller to have a better appearance 21:11 shaft But I also have a front and back view 21:12 MTDiscord MT's sprites IIRC don't deal with pitch angle. 21:12 Krock well then you probably need Blender 21:12 MTDiscord we just do like the 5-way thing that you'd find in games like Doom where sprites are only ever viewed from the side. 21:13 shaft Can I prevent the top and bottom view somehow then and only show left right front back? 21:15 Krock if there's nothing in the API then probably not 21:20 MTDiscord To prevent top/bottom view, just make sure that the player can never reach an angle significantly above/below it. 21:20 shaft I tried using a four sprite wide image instead of 6 sprites but it just used other sprites. 21:21 shaft That would kinda defeat the purpose warr. It's supposed to be a minetest mod and I don't want to suddenly make the birds fly up just because the player is firing himself in the air with a canon or whatever 21:22 shaft I think the idea by Krock is not that bad 21:22 shaft How do I do that? 21:32 shaft Wouldn't it be better to have two double sided sprites instead of these boxes? 21:32 shaft But then the top view wouldn't be right. Scratch that 21:33 shaft I made the model. What do I need to export it as and how do I apply the animated sprites on the surfaces?