Minetest logo

IRC log for #minetest-hub, 2023-08-13

| Channels | #minetest-hub index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
04:00 MTDiscord joined #minetest-hub
04:52 calcul0n_ joined #minetest-hub
06:04 pgimeno left #minetest-hub
06:29 MTDiscord <.niklp> Fixed 3 months ago (https://notabug.org/TenPlus1/ethereal/commit/5854098bd6df8d4f601a74f60d98dc99e1846d89) You need to update your ethereal in the content tab or via git pull
07:36 olliy joined #minetest-hub
08:20 calcul0n_ joined #minetest-hub
08:22 Warr1024 joined #minetest-hub
08:38 MinetestBot joined #minetest-hub
08:46 Warr1024 joined #minetest-hub
10:34 TenPlus1 joined #minetest-hub
10:34 TenPlus1 Hi folks, can someone please assist me with the initial_properties inside objects
10:36 TenPlus1 I'm getting an " WARNING[Server]: Reading initial object properties directly from an entity definition is deprecated, move it to the 'initial_properties' table instead. (Property 'hp_max' in entity 'mobs_npc:igor')" error when trying to use a simple integer check
10:45 luk3yx TenPlus1: So your code looks something like minetest.register_entity({hp_max = 123, something_else = 456})?
10:46 luk3yx *minetest.register_entity(name, {hp_max = 123, something_else = 456})
10:46 TenPlus1 basically, yes ( https://notabug.org/TenPlus1/mobs_redo/src/master/api.lua#L3594 )
10:46 luk3yx I think you need to change it to something like minetest.register_entity(name, {initial_properties = {hp_max = 123}, something_else = 456})
10:47 TenPlus1 tried that, didn't help, same error
10:47 TenPlus1 I'm only reading self.hp_max to show a damage status on mouseover for mob
10:48 TenPlus1 this line: https://notabug.org/TenPlus1/mobs_redo/src/master/api.lua#L770
10:49 TenPlus1 using latest 5.8dev build if that helps any, but I'm wondering why reading a simple object value is now giving errors and telling me it'll soon be deprecated
10:49 luk3yx Oh sorry, I'm a bit tired and misread the warning
10:49 luk3yx Does self.initial_properties.hp_max work?
10:50 TenPlus1 let me check
10:50 Krock it's not an error. it's a warning. to solve it, move https://notabug.org/TenPlus1/mobs_redo/src/master/api.lua#L3615 into initial_properties = {} which will then be copied to "self" once the object spawns
10:53 TenPlus1 tried that, it just crashes
10:53 Krock crashes or errors? what's the log?
10:53 TenPlus1 is the initial error because hp_max is a specific object flag ? if I rename it to hp_maxi would it go away I'm thinking
10:55 luk3yx TenPlus1: I believe so, however that would mean that the engine would no longer set the object's hp_max (but I am tired so maybe it'd be better to just disregard everything I say)
10:55 Krock it's a field used for players but it should as well be possible to use that for normal entities because Minetest does not do anything in that case
10:55 TenPlus1 dont worry luk3yx, thanks for help :)
10:56 TenPlus1 Krock, just finding it strange that all of a sudden it's complaining about one variable out of many, will tinker and change it's name maybe to save hassle
10:57 Krock I'd rather look into investigating the initial_properties follow-up error that you're getting because from what I can see this should work
10:57 Krock oh! you're using a metatable which specifies the defaults. you'd have to use another metatable for the properties
10:58 TenPlus1 do you know specifically which version of minetest this was added, changelogs dont state when initial_properties was added
10:58 Krock it's been there for years but never enforced
10:59 TenPlus1 5.8dev is bringing up warnings now, which is highly annoying
10:59 TenPlus1 yeah, changing to self.hp_maxi stops the error, then it moves right onto "physical" setting in entity
10:59 TenPlus1 I'm gonna have to redo mob api to work properly in 5.8 it seems without error
11:08 TenPlus1 thanks luk3yx and Krock, gotta go think about this one :)
11:57 MTDiscord <luatic> TenPlus1: warnings are a good thing
12:09 rubenwardy yeah, this is deprecated because you might think that `self.hp_max` is the _current_ hp max - not the initiail one
12:10 rubenwardy you should instead use `initial_properties` and `self.object:get_properties()`
12:12 rubenwardy a metatable that does `self.object.properties.hp_max` would be handy
13:37 MTDiscord <braindamage> imagine being scottish
13:37 MTDiscord <braindamage> i don't understand why they like the english so much
14:00 Threadripper3995 joined #minetest-hub
14:34 olliy joined #minetest-hub
14:48 Desour joined #minetest-hub
15:43 olliy joined #minetest-hub
17:46 Alias joined #minetest-hub
22:33 panwolfram joined #minetest-hub
23:17 AliasAlreadyTake joined #minetest-hub

| Channels | #minetest-hub index | Today | | Google Search | Plaintext