WIP mcl_torchlighter #45

Closed
SmokeyDope wants to merge 1 commits from mcl_torchlighter into master
Member

This is a mostly complete mod that adds the ability for torches to be placed by right-clicking with a pickaxe on a node. I don't know when I will get enough drive to finish it off. I figured I would upload it here and maybe someone else can fix up the last two issues.

Things that still need done:

  • - Currently torches will place even if none are in inventory. Make local 'success' depend on if player has torches in inventory, maybe with variables 'torch_stack' or 'torch_stack_id'
  • - I ran into a really wierd issue where trying to call 'player' in a function like
examplefunction(player, itemstack, ect)

results in a nil value. I tried everything to get it to call right but it won't and I don't understand right. As a workaround I manually set player = 'singleplayer' which does work but obviously not for multiplayer games. This is the real problem, the wall I hit and could not overcome. Im sure one of you more experienced programmers will spot my mistake right away and tell me how it was so easy to fix.

This is a mostly complete mod that adds the ability for torches to be placed by right-clicking with a pickaxe on a node. I don't know when I will get enough drive to finish it off. I figured I would upload it here and maybe someone else can fix up the last two issues. Things that still need done: - [ ] - Currently torches will place even if none are in inventory. Make local 'success' depend on if player has torches in inventory, maybe with variables 'torch_stack' or 'torch_stack_id' - [ ] - I ran into a really wierd issue where trying to call 'player' in a function like ``` examplefunction(player, itemstack, ect) ``` results in a nil value. I tried everything to get it to call right but it won't and I don't understand right. As a workaround I manually set player = 'singleplayer' which does work but obviously not for multiplayer games. This is the real problem, the wall I hit and could not overcome. Im sure one of you more experienced programmers will spot my mistake right away and tell me how it was so easy to fix.
SmokeyDope added 1 commit 2023-09-19 03:52:04 +02:00
Member

There should be a placer in the on_place parameters that would return the player, if the player is placing the object.

maybe check to see if that is not nil?

There should be a `placer` in the `on_place` parameters that would return the player, if the player is placing the object. maybe check to see if that is not nil?
SmokeyDope closed this pull request 2024-01-03 19:15:39 +01:00
Member

Oh, uhm... look at the Sprint code or the FOVAPI code for how to get player...

Oh, uhm... look at the Sprint code or the FOVAPI code for how to get `player`...
Author
Member

I recently saw a commit for a nil check which sounds like it may be what could be needed. Ill check out what you suggested in a bit

I recently saw a [commit](https://git.minetest.land/MineClone2/MineClone2/commit/2f8389d3f52c18304976987d018bf5d5304d5de9) for a nil check which sounds like it may be what could be needed. Ill check out what you suggested in a bit
Member

Okay. let me know what you find out.

Okay. let me know what you find out.

Pull request closed

Sign in to join this conversation.
No description provided.