Post your modding questions here

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Mon Jan 23, 2017 15:37

How can I maintain an entity's data to restart a server?

When I create a variable such as self.owner="bob", after rebooting the server it will be null.
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Mon Jan 23, 2017 17:07

@BrunoMine: You can use on_staticdata eg.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--...
on_activate = function(self, staticdata)
if staticdata ~= "" then
self.owner = staticdata
end
end,

on_staticdata = function(self)
return self.owner
end,
--...
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Tue Jan 24, 2017 21:27

Is it possible to use a texture for the inventory slots?
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Tue Jan 24, 2017 21:32

DS-minetest wrote:@BrunoMine: You can use on_staticdata eg.
...

If you have multiple values:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
on_activate = function(self, staticdata)
  if staticdata ~= "" then
    local t=minetest.deserialize(staticdata)
    self.owner = t.owner
    self.otherstuff = t.otherstuff
  end
end,
--!!! not on_staticdata!!!--
get_staticdata = function(self)
  return minetest.serialize({
    owner=self.owner
    otherstuff=self.otherstuff 
  })
end,
--...

minetest.serialize turns a table into a string, deserialize does the opposite.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Tue Jan 24, 2017 21:34

D00Med wrote:Is it possible to use a texture for the inventory slots?

Which ones? The ones in the inventory form (pressing E) or the hotbar on_screen?
Inv form: see player:set_inventory_formspec(). You can put an image[] element behind the inventory list and set listcolors to transparent.
hotbar: There's a texture with a specific name you can override.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Tue Jan 24, 2017 22:57

The ones in the inventory form.
Thanks :D
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

How to stop looping sounds?

by Napiophelios » Wed Jan 25, 2017 14:52

I have a simple mesecon node I want to play sound (looped) when activated
The sounds works but I can't get the sounds to stop when its deactivated.
Can anyone tell me what's wrong with this/what I am doing wrong here?
Am I going about this the wrong way?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local monochrome, sounds = {}, {}

function monochrome.play_sound(pos)
   local spos = minetest.hash_node_position(pos)
   sounds[spos] =minetest.sound_play("monochrome_mc",{pos=pos, max_hear_distance=5, gain=1.25, loop=true})
end

function monochrome.stop_sound(pos)
   local spos = minetest.hash_node_position(pos)
   if sounds[spos] then minetest.sound_stop(sounds[spos]) end
end

minetest.register_node("monochrome:mc_on", {
   description = "Monochrome",
   tiles = {
      {image = "nbea_monochrome2.png",
      backface_culling = false,
         animation = {
            type = "vertical_frames",
            aspect_w = 16,
            aspect_h = 16,
            length = 3.0
         },
      }
   },
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
    drop = "monochrome:mc_off",
   groups = {cracky = 3, not_in_creative_inventory = 1},
   sounds = default.node_sound_metal_defaults(),
   mesecons = {effector = {
        state = mesecon.state.on,
        action_off = function (pos, node)
            monochrome.stop_sound(pos)
            minetest.swap_node(pos, {name = "monochrome:mc_off"})
        end,
    }},
})

minetest.register_node("monochrome:mc_off", {
   description = "Monochrome",
   tiles = {"nbea_monochrome.png"},
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
   groups = {cracky = 3},
   sounds = default.node_sound_metal_defaults(),
   mesecons = {effector = {
        state = mesecon.state.off,
        action_on = function (pos, node)
            minetest.swap_node(pos, {name = "monochrome:mc_on"})
            monochrome.play_sound(pos)
        end,
    }}
})
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Post your modding questions here

by azekill_DIABLO » Wed Jan 25, 2017 14:55

how to animate a model? (ouch i'm sure it's a bad question)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
SAMIAMNOT
Member
 
Posts: 363
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie

Re: Post your modding questions here

by SAMIAMNOT » Wed Jan 25, 2017 19:22

Hi, sorry if this is a silly question, but I don't know Lua. What would be the simplest way to make leaves decay (for games that don't support decaying leaves)?
I test mines.
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Wed Jan 25, 2017 20:30

How to animate a model in blender:
(do this in the default view)
Before you start, make sure your model is joined(no separate cubes etc.), if they aren't select them all and click join from the tool panel. Press 't' to change to wireframe mode. Then you'll need to add bones. Add one using the 'create' panel, and then(IMPORTANT), switch to edit mode and add any other bones you need. If you select the little circle on the end of a bone and press 'e', you can make a bone that is connected to the one you have highlighted. Make a bone for every part that should move, for example a head would have at least one bone. Then in object mode, first select the model, then the bones(not the other way around) and press 'p', and choose "with automatic weights" from the menu. If you're lucky this will work nicely, if you aren't you'll have to do more work. Highlight the bones and press 'ctrl+tab'(pose mode), and highlight a bone(it should be blue), then use 'r' to rotate it a bit to see if it works. Rightclick afterwards to cancel, this is just a test. Do the same for all bones. It's likely that some bones will move parts you don't want them to.

Fixing bone problems:
Staying in 'pose mode', right click the model and switch to edit mode. You can then select the face(or lines and vertices) of a moving part. Once you have done this(just for one part), find the panel on the right(or wherever you have the properties panel with all the icon tabs) and click the icon of an inverted triangle. You should then see a list of bones(you may need to make the panel a bit wider). Find the bone you need the part to attach to and rightclick it. Then choose 'assign'. If you don't know which bone to assign to, just go to object mode, then right click on the correct bone. It's name should show up in the bottom left corner. If you are trying to stop a bone controlling a certain part, you would do the same, but this time click 'remove' instead of 'assign'.

Now that the bones are assigned you can actually start animating the model. Down the bottom of the window there should be a timeline. Move the green line to 1 or 0 or wherever the start is, move your mouse over the model and press 'i', then choose 'locrotscale'. This is how you insert a frame into the animation. It's best to do this straight away so you don't lose the initial position of the model. Then you can move to a different frame(like 5 or 6) and use the bones to put the model into the right starting pose for an animation. You can move, rotate, or scale bones(although if you scale bones you can't scale the model easily afterwards). When you have done that, use 'i' to insert the frame.
You don't have to do this for every frame, just for the important ones. For example, to make a bone bend, you would make one frame with it's stating position, move a few frames ahead(like 10) and then rotate it and make a new frame. Blender will automatically fill in the frames in-between with the rotation of the arm.
Notes:
You can delete frames with 'alt+i'
You can set the end and start points of the animation, this is useful for testing.

I hope this is useful for you and that I haven't missed anything important.
Also you should keep an eye on this thread: viewtopic.php?f=47&t=16455

Also about leafdecay, add this to the groups of the node "leafdecay=1"
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: How to stop looping sounds?

by orwell » Wed Jan 25, 2017 21:00

Napiophelios wrote:I have a simple mesecon node I want to play sound (looped) when activated
The sounds works but I can't get the sounds to stop when its deactivated.
Can anyone tell me what's wrong with this/what I am doing wrong here?
Am I going about this the wrong way?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local monochrome, sounds = {}, {}

function monochrome.play_sound(pos)
   local spos = minetest.hash_node_position(pos)
   sounds[spos] =minetest.sound_play("monochrome_mc",{pos=pos, max_hear_distance=5, gain=1.25, loop=true})
end

function monochrome.stop_sound(pos)
   local spos = minetest.hash_node_position(pos)
   if sounds[spos] then minetest.sound_stop(sounds[spos]) end
end

minetest.register_node("monochrome:mc_on", {
   description = "Monochrome",
   tiles = {
      {image = "nbea_monochrome2.png",
      backface_culling = false,
         animation = {
            type = "vertical_frames",
            aspect_w = 16,
            aspect_h = 16,
            length = 3.0
         },
      }
   },
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
    drop = "monochrome:mc_off",
   groups = {cracky = 3, not_in_creative_inventory = 1},
   sounds = default.node_sound_metal_defaults(),
   mesecons = {effector = {
        state = mesecon.state.on,
        action_off = function (pos, node)
            monochrome.stop_sound(pos)
            minetest.swap_node(pos, {name = "monochrome:mc_off"})
        end,
    }},
})

minetest.register_node("monochrome:mc_off", {
   description = "Monochrome",
   tiles = {"nbea_monochrome.png"},
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
   groups = {cracky = 3},
   sounds = default.node_sound_metal_defaults(),
   mesecons = {effector = {
        state = mesecon.state.off,
        action_on = function (pos, node)
            minetest.swap_node(pos, {name = "monochrome:mc_on"})
            monochrome.play_sound(pos)
        end,
    }}
})

This looks correct, IDK what's the problem.
But best add an after_dig_node() callback in which you stop the sound, too. maybe that works...
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Jan 25, 2017 21:03

D00Med wrote:How to animate a model in blender:
(do this in the default view)
Before you start, make sure your model is joined(no separate cubes etc.), if they aren't select them all and click join from the tool panel. Press 't' to change to wireframe mode. Then you'll need to add bones. Add one using the 'create' panel, and then(IMPORTANT), switch to edit mode and add any other bones you need. If you select the little circle on the end of a bone and press 'e', you can make a bone that is connected to the one you have highlighted. Make a bone for every part that should move, for example a head would have at least one bone. Then in object mode, first select the model, then the bones(not the other way around) and press 'p', and choose "with automatic weights" from the menu. If you're lucky this will work nicely, if you aren't you'll have to do more work. Highlight the bones and press 'ctrl+tab'(pose mode), and highlight a bone(it should be blue), then use 'r' to rotate it a bit to see if it works. Rightclick afterwards to cancel, this is just a test. Do the same for all bones. It's likely that some bones will move parts you don't want them to.

Fixing bone problems:
Staying in 'pose mode', right click the model and switch to edit mode. You can then select the face(or lines and vertices) of a moving part. Once you have done this(just for one part), find the panel on the right(or wherever you have the properties panel with all the icon tabs) and click the icon of an inverted triangle. You should then see a list of bones(you may need to make the panel a bit wider). Find the bone you need the part to attach to and rightclick it. Then choose 'assign'. If you don't know which bone to assign to, just go to object mode, then right click on the correct bone. It's name should show up in the bottom left corner. If you are trying to stop a bone controlling a certain part, you would do the same, but this time click 'remove' instead of 'assign'.

Now that the bones are assigned you can actually start animating the model. Down the bottom of the window there should be a timeline. Move the green line to 1 or 0 or wherever the start is, move your mouse over the model and press 'i', then choose 'locrotscale'. This is how you insert a frame into the animation. It's best to do this straight away so you don't lose the initial position of the model. Then you can move to a different frame(like 5 or 6) and use the bones to put the model into the right starting pose for an animation. You can move, rotate, or scale bones(although if you scale bones you can't scale the model easily afterwards). When you have done that, use 'i' to insert the frame.
You don't have to do this for every frame, just for the important ones. For example, to make a bone bend, you would make one frame with it's stating position, move a few frames ahead(like 10) and then rotate it and make a new frame. Blender will automatically fill in the frames in-between with the rotation of the arm.
Notes:
You can delete frames with 'alt+i'
You can set the end and start points of the animation, this is useful for testing.

I hope this is useful for you and that I haven't missed anything important.
Also you should keep an eye on this thread: viewtopic.php?f=47&t=16455

No Armature?
There are many videos about it on youtube. Make sure to export the model to .b3d format to use in MT.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Thu Jan 26, 2017 00:03

collection of bones = armature??
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Thu Jan 26, 2017 01:16

@Orwell:
Turns out it was just conflicting with something else in the mod its supposed to be apart of,
when I test it by itself as a separate mod, it works as expected.
I still added "on_construct" and "on_destruct" like you suggested.
Without it, the sounds still play after the node is dug, so thanks for that little gem of wisdom.
I haven't tried it yet, but I am thinking I can remove the sound functions from the mesecon action on/off part.
Thanks for your help

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local monochrome, sounds = {}, {}

function monochrome.play_sound(pos)
   local spos = minetest.hash_node_position(pos)
   sounds[spos] =minetest.sound_play("monochrome_mc",{pos=pos, max_hear_distance=5, gain=1.25, loop=true})
end

function monochrome.stop_sound(pos)
   local spos = minetest.hash_node_position(pos)
   if sounds[spos] then minetest.sound_stop(sounds[spos]) end
end

minetest.register_node("monochrome:mc_on", {
   description = "Monochrome",
   tiles = {
      {image = "monochrome_monochrome2.png",
      backface_culling = false,
         animation = {
            type = "vertical_frames",
            aspect_w = 16,
            aspect_h = 16,
            length = 3.0
         },
      }
   },
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
    drop = "monochrome:mc_off",
   groups = {cracky = 3, mesecon = 1, not_in_creative_inventory = 1},
   sounds = default.node_sound_metal_defaults(),
   on_destruct = function(pos)
            monochrome.stop_sound(pos)
   end,
   mesecons = {effector = {
        state = mesecon.state.on,
        action_off = function (pos, node)
            monochrome.stop_sound(pos)
            minetest.swap_node(pos, {name = "monochrome:mc_off"})
        end,
    }},
})

minetest.register_node("monochrome:mc_off", {
   description = "Monochrome",
   tiles = {"monochrome_monochrome.png"},
   paramtype = "light",
   sunlight_propagates = true,
   is_ground_content = false,
   groups = {cracky = 3, mesecon_effector_off = 1, mesecon = 1},
   sounds = default.node_sound_metal_defaults(),
   on_construct = function(pos)
            monochrome.stop_sound(pos)
   end,
   mesecons = {effector = {
        state = mesecon.state.off,
        action_on = function (pos, node)
            minetest.swap_node(pos, {name = "monochrome:mc_on"})
            monochrome.play_sound(pos)
        end,
    }}
})
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Sat Jan 28, 2017 08:08

Hi folks ) I found a lot of cruel magic, but don't know WTH is does.

If you start next code as is and punch anywhere two time you will see 2 entity with his different metadata based on us_time().
Now go away from it while it disappering (server destroy ones).
Ingame console show us correct different names in get_staticdata()
Now go back to entities while its appears again.
Another message show us right different names accepted via staticdata string (looks like server remember it f each entity).

BUT, if you select in code t = true (another block code will work) then after entity disappeared, message show equaled names.

Why additional table added in same place works different ???

17:26 oops minor code fixed
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
---  "I just don't know what went wrong!" (c) ...
modName = minetest.get_current_modname()


--- t = true
t = false

local     eObj = {   
   visual = "cube",
   visual_size = {x=1, y=1, z=1},

   enameInObj = "old",
   p={enameInObj1 = "old"}
}

function eObj:get_staticdata()
   if t then
      minetest.chat_send_player("singleplayer","get_staticdata self.p.enameInObj"..self.p.enameInObj1)
      do return minetest.serialize(self.p.enameInObj1)    end
   else
      minetest.chat_send_player("singleplayer","get_staticdata self.enameInObj"..self.enameInObj)
      do return minetest.serialize(self.enameInObj)    end
   end
end

function eObj:on_activate( staticdata)
   if staticdata == "" then   
      if t then
         self.p.enameInObj1 = "new name"..minetest.get_us_time()
         minetest.chat_send_player("singleplayer","on_activate INIT self.p.enameInObj1"..self.p.enameInObj1)
      else
         self.enameInObj = "new name"..minetest.get_us_time()
         minetest.chat_send_player("singleplayer","on_activate INIT self.enameInObj"..self.enameInObj)
      end
   else
      if t then
         self.p.enameInObj1 = minetest.deserialize(staticdata)
         minetest.chat_send_player("singleplayer","on_activate NEXT self.p.enameInObj1"..self.p.enameInObj1)
      else
         self.enameInObj = minetest.deserialize(staticdata)
         minetest.chat_send_player("singleplayer","on_activate NEXT self.enameInObj"..self.enameInObj)   
      end
   end
end

minetest.register_entity( modName .. ":eProto", eObj )
minetest.register_on_punchnode( function( pos, node, puncher, pointed_thing)

   minetest.add_entity(pos, modName .. ":eProto")
   minetest.chat_send_player("singleplayer","entity created right now time "..minetest.get_us_time())
end )

I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Sat Jan 28, 2017 19:37

Nyarg wrote:Hi folks ) I found a lot of cruel magic, but don't know WTH is does.

If you start next code as is and punch anywhere two time you will see 2 entity with his different metadata based on us_time().
Now go away from it while it disappering (server destroy ones).
Ingame console show us correct different names in get_staticdata()
Now go back to entities while its appears again.
Another message show us right different names accepted via staticdata string (looks like server remember it f each entity).

BUT, if you select in code t = true (another block code will work) then after entity disappeared, message show equaled names.

Why additional table added in same place works different ???

17:26 oops minor code fixed
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
---  "I just don't know what went wrong!" (c) ...
modName = minetest.get_current_modname()


--- t = true
t = false

local     eObj = {   
   visual = "cube",
   visual_size = {x=1, y=1, z=1},

   enameInObj = "old",
   p={enameInObj1 = "old"}
}

function eObj:get_staticdata()
   if t then
      minetest.chat_send_player("singleplayer","get_staticdata self.p.enameInObj"..self.p.enameInObj1)
      do return minetest.serialize(self.p.enameInObj1)    end
   else
      minetest.chat_send_player("singleplayer","get_staticdata self.enameInObj"..self.enameInObj)
      do return minetest.serialize(self.enameInObj)    end
   end
end

function eObj:on_activate( staticdata)
   if staticdata == "" then   
      if t then
         self.p.enameInObj1 = "new name"..minetest.get_us_time()
         minetest.chat_send_player("singleplayer","on_activate INIT self.p.enameInObj1"..self.p.enameInObj1)
      else
         self.enameInObj = "new name"..minetest.get_us_time()
         minetest.chat_send_player("singleplayer","on_activate INIT self.enameInObj"..self.enameInObj)
      end
   else
      if t then
         self.p.enameInObj1 = minetest.deserialize(staticdata)
         minetest.chat_send_player("singleplayer","on_activate NEXT self.p.enameInObj1"..self.p.enameInObj1)
      else
         self.enameInObj = minetest.deserialize(staticdata)
         minetest.chat_send_player("singleplayer","on_activate NEXT self.enameInObj"..self.enameInObj)   
      end
   end
end

minetest.register_entity( modName .. ":eProto", eObj )
minetest.register_on_punchnode( function( pos, node, puncher, pointed_thing)

   minetest.add_entity(pos, modName .. ":eProto")
   minetest.chat_send_player("singleplayer","entity created right now time "..minetest.get_us_time())
end )



Each entity gets a copy of all the variables in the entity definition. P is a table pointer, so all entities get a pointer to the same table, so you end up modifying the name of the same table for each entity, and accessing the table will give you the same table each time.
Every time a mod API is left undocumented, a koala dies.
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Sun Jan 29, 2017 11:01

Byakuren wrote:P is a table pointer
Oops it's my epic fail. I completely forgot it (
But now all works fine, thank you )

I have a new little question.
Is it possible increase visible range for entities more than ~50 nodes far ?
I need ~200 nodes far visible for entity, but experiments with minetest.conf take no effect.
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Post your modding questions here

by azekill_DIABLO » Sun Jan 29, 2017 14:04

Thank you doomed! but in minetest how do i active animation, for an entity?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Sun Jan 29, 2017 16:37

I have a question about the combination of textures.
The problem is for cases where the textures resolution changes.

For example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
"[combine:16x32:0,0=default_stone.png:0,16=default_wood.png"


This code works great for reusing the default textures, but will not work if you apply an texture pack with higher resolutions (32x32, 64x64)

I want to use default game textures in UV mapping to mesh. This maintains the theme of the textures packs without it being necessary to be created out for specific texture packs.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sun Jan 29, 2017 22:49

Nyarg wrote:I have a new little question.
Is it possible increase visible range for entities more than ~50 nodes far ?
I need ~200 nodes far visible for entity, but experiments with minetest.conf take no effect.

Maybe play with these two settings at the same time:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
active_block_range = 10
active_object_send_range_blocks = 10

=256 nodes
Such high values MAY CAUSE MASSIVE LAG! Keep that in mind.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sun Jan 29, 2017 22:54

azekill_DIABLO wrote:Thank you doomed! but in minetest how do i active animation, for an entity?

In Blender, export it to b3d (you need an extra plugin for that!)
Write down the start and end frames of your animation.
Then, with an entity use
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
self.object:set_animation({x=<start frame>, y=<end frame>}, 15, 0, true)

The 15 is the animation speed, adjust as needed. The true means that the animation is looped, if false, the animation stops at the end frame.

(Contrary to lua_api.txt, the parameters to set_animation are NOT optional!)
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Mon Jan 30, 2017 04:42

orwell wrote:Maybe play with these two settings at the same time:
=256 nodes

I set it but have no effect.
So it's good if anyone share actual maintest.conf that gives entity be visible ~200 nods far then I comparise it with my unworked minetest.conf.
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Tue Jan 31, 2017 06:02

Nyarg wrote:
orwell wrote:Maybe play with these two settings at the same time:
=256 nodes

I set it but have no effect.

Thank again. Now I found what went wrong !!!
New settings aditionally need client (not even creating new world) be restarted !
Wow now my entities stay visible really FARrrrrr ! MUAHAHAHA
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Tue Jan 31, 2017 06:36

Nyarg wrote:Wow now my entities stay visible really FARrrrrr ! MUAHAHAHA

But you should know that other parts of the game are effected too, like ABMs
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Wed Feb 01, 2017 13:17

Is it possible to use modpack names for dependencies?
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Post your modding questions here

by azekill_DIABLO » Wed Feb 01, 2017 13:55

*trying*

no. it still think it does not exist sorry. :/
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Wed Feb 01, 2017 14:04

azekill_DIABLO wrote:*trying*

no. it still think it does not exist sorry. :/

Thx for testing. Couldn't try it myself right now. Issue submitted. I think that this would be useful
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Thu Feb 02, 2017 21:41

If you depend on whole modpacks you are doing sth wrong. What if one mod gets removed from the modpack, but you need it?
Better list exactly the mods from the modpack you depend on. If you need to distingush between a mod and a modified version of that mod in a modpack, test for something unique this modified mod defines inside your mod code.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

problem with entity attach or activate

by DS-minetest » Sat Feb 04, 2017 15:32

I've got a very big problem. I'm not sure if this is the right place to post this but I'm not sure enough to open an issue.

To test I made this mod:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_entity(
   "eat:test1",
   {
      on_activate = function(self, staticdata, dtime_s)
         minetest.chat_send_all("<1> activated")
         minetest.chat_send_all("<1> "..dtime_s)
         if staticdata == nil then
            minetest.chat_send_all("<1> nil")
         elseif staticdata == "" then
            minetest.chat_send_all("<1> \"\"")
         else
            minetest.chat_send_all("<1> "..staticdata)
         end
         if not self.at then
            self.at = minetest.add_entity(self.object:getpos(), "eat:test2")
         end
         if self.at then
            self.at:set_attach(self.object, "", {x=0,y=1,z=1}, {x=0,y=0,z=0})
            minetest.chat_send_all("<1> attach")
         end
         self.object:setvelocity({x=1,y=0,z=0})
      end,

      get_staticdata = function(self)
         return "sta"
      end,
   }
)

minetest.register_entity(
   "eat:test2",
   {
      on_activate = function(self, staticdata, dtime_s)
         minetest.chat_send_all("<2> activated")
         minetest.chat_send_all("<2> "..dtime_s)
         if staticdata == nil then
            minetest.chat_send_all("<2> nil")
         elseif staticdata == "" then
            minetest.chat_send_all("<2> \"\"")
         else
            minetest.chat_send_all("<2> "..staticdata)
         end
         if staticdata ~= "" then
            if not self.object:get_attach() then
               minetest.chat_send_all("<2> remove")
               self.object:remove()
            end
         end
      end,

      get_staticdata = function(self)
         return "sta"
      end,
   }
)

entity-activation-test.zip
Download
(936 Bytes) Downloaded 130 times

Entity2 should be always attached to entity1, even after de- and activation.
I spawned the entity and flew away and came again and watched what happens.
I'm pretty sure that something is wrong. I'm just not sure what exactly is wrong. The reason for this is that different things happen.
On join everything is ok.
Most of the times entity2 isn't attached for some reason.
It seems like if I don't fly far enough away the entities are deactivated but not activated again.
Try it out yourself and be confused like me.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Sat Feb 04, 2017 20:57

If anyone would be able to help me please?

I am going to update my angled walls mod but...., am currently changing all the code for the angled glass (windows).

The excellent model pithy provided for the windows accepts 2 textures, the material and the glass so, I want to correct the code to utilize this. It will really clean up the code and the mod.

However, upon setting off on it..., I added a separate function to register the glass node, etc..
Nothing was showing up so, I then decided to add a dofile to the init.lua and split the glass into it's own mod.

I am stuck now because still, nothing shows up.
Does anyone see what's wrong and why this first node is not even showing up in inventory at all?
As far as I can tell, everything is as it should be, yet no results so, obviously not. WTH am I missing here?

Thank you

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- [MOD] Angled Glass [angledglass] [1.2] by TumeniNodes 6-24-2016

angledglass = {}

-- Angled place function
-- To use put "on_place = angledglass.angled_place" in the node def

function angledglass.angled_place(itemstack, placer, pointed_thing)
   local placer_pos = placer:getpos()
   local pos = pointed_thing.above
   local param2
   if pos.x > placer_pos.x then
      if pos.z > placer_pos.z then
         param2 = 1
      else
         param2 = 2
      end
   else
      if pos.z > placer_pos.z then
         param2 = 0
      else
         param2 = 3
      end
   end
   return minetest.item_place(itemstack, placer, pointed_thing, param2)
end


--Register angledglass.
--Node will be called angledglass:glass_<subname>

function angledglass.register_glass(subname, recipeitem, groups, images, description, sounds)
   groups.glass = 1
minetest.register_node(":angledglass:glass" .. subname, {
   description = description,
   drawtype = "mesh",
   mesh = "angled_glass.obj",
   tiles = images,
   use_texture_alpha = true,
   paramtype = "light",
   sunlight_propogates = true,
   paramtype2 = "facedir",
   is_ground_content = false,
   groups = groups,
   sounds = sounds,
   collision_box = {
      type = "fixed",
      fixed = {
         {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
         {-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
         {-0.4375, -0.5, -0.4375, -0.3125, 0.5, -0.3125},
         {0.3125, -0.5, 0.3125, 0.4375, 0.5, 0.4375},
         {0.25, -0.5, 0.25, 0.375, 0.5, 0.375},
         {-0.375, -0.5, -0.375, -0.25, 0.5, -0.25},
         {0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
         {-0.3125, -0.5, -0.3125, -0.1875, 0.5, -0.1875},
         {0.125, -0.5, 0.125, 0.25, 0.5, 0.25},
         {-0.25, -0.5, -0.25, -0.125, 0.5, -0.125},
         {0.0625, -0.5, 0.0625, 0.1875, 0.5, 0.1875},
         {-0.1875, -0.5, -0.1875, -0.0625, 0.5, -0.0625},
         {0, -0.5, 0, 0.125, 0.5, 0.125},
         {-0.125, -0.5, -0.125, 0, 0.5, 0},
         {-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
      }
   },
   on_place = angledglass.angled_place
})
end

-- Angled glass registration function.
-- Nodes will be called angledglass:{glass}_<subname>

function angledglass.register_glass(subname, recipeitem, groups, images, desc_glass, sounds)
end


-- Register glass

angledglass.register_glass("wood", "default:wood",
      {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
      {"default_wood.png", "default_glass.png"},
      "Wooden Glass",
      default.node_sound_glass_defaults())


This is the dofile I added
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- [MOD] Angled Walls [angledwalls] [1.2] by TumeniNodes 6-24-2016

dofile(minetest.get_modpath("angledwalls").."/angledwalls.lua")
dofile(minetest.get_modpath("angledwalls").."/angledglass.lua")

if minetest.get_modpath("bakedclay") then
   dofile(minetest.get_modpath("angledwalls").."/bakedclay.lua")
end

if minetest.get_modpath("quartz") then
   dofile(minetest.get_modpath("angledwalls").."/quartz.lua")
end
Flick?... Flick who?
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron