Search found 394 matches

by AspireMint
Mon Nov 23, 2020 20:19
Forum: General Discussion
Topic: Is it possible to find a lost chest?
Replies: 6
Views: 793

Re: Is it possible to find a lost chest?

Try to find technic:gold_locked_chest in debug.txt file:

Code: Select all

2020-11-23 21:16:07: ACTION[Server]: singleplayer places node technic:gold_locked_chest at (-189,12,2)
by AspireMint
Sat Nov 14, 2020 20:30
Forum: Modding Discussion
Topic: How to rotate entity position around the center?
Replies: 3
Views: 542

Re: How to rotate entity position around the center?

[ooops, sorry, idk how to remove post]
by AspireMint
Wed Nov 11, 2020 22:00
Forum: General Discussion
Topic: Post your screenshots!
Replies: 11110
Views: 2060985

Re: Post your screenshots!

Image

Image
by AspireMint
Fri May 08, 2020 10:38
Forum: Modding Discussion
Topic: How to register a function dynamically and add it to a table
Replies: 1
Views: 257

Re: How to register a function dynamically and add it to a table

Lets start with this: morphinggrid = {} morphinggrid.demorph = function () print("im batman") end to save their functions, use for example registered_demorphs table maybe put into morphinggrid? like this: morphinggrid.registered_demorphs = {} morphinggrid.register_on_demorph = function(fn)...
by AspireMint
Mon May 04, 2020 18:10
Forum: Modding Discussion
Topic: One pos and one direction
Replies: 4
Views: 413

Re: One pos and one direction

Or that... but depends on how accurate it should be. How many nodes(in-game) intersects with line from (0,0,0) to (2,0,1) ?
3 or 4? :P
by AspireMint
Mon May 04, 2020 15:48
Forum: Modding Discussion
Topic: One pos and one direction
Replies: 4
Views: 413

Re: One pos and one direction

But you already know from_pos and direction.
Do you want to trace all nodes across map?
If no, then calculate to_pos from known from_pos, direction and max_distance.
Then use line_of_sight or raycast or whatever.
by AspireMint
Thu Apr 30, 2020 21:42
Forum: Game Discussion
Topic: Questions on animated player model and animated entities
Replies: 3
Views: 1912

Re: Questions on animated player model and animated entities

player:set_local_animation expects 5 params - 4 tables and 5th is number (frame speed)
Your 3rd param is number, not table.
by AspireMint
Sat Apr 18, 2020 02:01
Forum: Modding Discussion
Topic: How can I disable the player inventory?
Replies: 6
Views: 819

Re: How can I disable the player inventory?

to hide all formspecs: minetest.register_globalstep(function(dtime) for _, player in pairs(minetest.get_connected_players()) do minetest.close_formspec(player:get_player_name(), "") -- sadly builtin inventory does not have formname end end) + set empty formspec (to hide hotbar) EDIT: not t...
by AspireMint
Sat Apr 18, 2020 00:14
Forum: Modding Discussion
Topic: How can I disable the player inventory?
Replies: 6
Views: 819

Re: How can I disable the player inventory?

It should be register_on_inventory_open that returns true client_lua_api
But it does not work for me, is it bug? (5.1.0)
(that function is missing in minetest/core table)

Code: Select all

minetest.register_on_inventory_open(function(inventory)
	return true
end)
by AspireMint
Fri Apr 03, 2020 02:04
Forum: General Discussion
Topic: Post your code!
Replies: 100
Views: 32847

Re: Post your code!

Try-catch block: Exception = '' FileException = 'No such file or directory' CustomException = '[0-9]' -- add your own exceptions... function try(fn) function TCBlock() local o = { status = nil, exception = nil } o.try = function(fn) o.status, o.exception = pcall(fn) o.try = nil return o end local fi...
by AspireMint
Sun Mar 29, 2020 14:12
Forum: Modding Discussion
Topic: How to get the usual recipe table for an registered item?
Replies: 8
Views: 1206

Re: How to get the usual recipe table for an registered item

Ohh, it would not work in case second row is empty. So this should work: function i_give_up_this_is_last_try(t) local ret = {} local last_index = 0 for k,_ in pairs(t.items) do if last_index < k then last_index = k end end if t.width == 0 or last_index == 0 then return ret end local max_items = math...
by AspireMint
Sun Mar 29, 2020 11:26
Forum: Modding Discussion
Topic: How to get the usual recipe table for an registered item?
Replies: 8
Views: 1206

Re: How to get the usual recipe table for an registered item

Oh yes. Crafting recipe needs empty strings, but get_all_craft_recipes() returns all recipes without empty strings x) (looks like bug, but maybe there is good reason why its done like this o.O) To get empty strings, replace: ret[r] = ret[r] or {} with this: if not ret[r] then ret[r] = {} for i=1, t....
by AspireMint
Fri Mar 27, 2020 19:22
Forum: Modding Discussion
Topic: Testing code
Replies: 7
Views: 744

Re: Testing code

I remember in old versions of MT there were 2 windows, game and console. But new version just opens game window.
(im using Windows)
by AspireMint
Fri Mar 27, 2020 16:59
Forum: Modding Discussion
Topic: Testing code
Replies: 7
Views: 744

Re: Testing code

Yes, but i needed them to be visible in-game, in most cases dump variables after some user actions, it is faster than searching in code (for me).
by AspireMint
Fri Mar 27, 2020 16:51
Forum: Modding Discussion
Topic: Testing code
Replies: 7
Views: 744

Re: Testing code

Thank you. I did it (almost) same, register test functions and call them from chat command. All these test files are in one folder/mod so other mods are clean.
by AspireMint
Fri Mar 27, 2020 15:30
Forum: Modding Discussion
Topic: Testing code
Replies: 7
Views: 744

Testing code

How do you write test codes in lua? For example you want to test function you wrote to list all players that are at spawn. You make new mod, and put function into init.lua? And if you want to test function that is inside of, lets say, mesecons mod, you make new mod and call mesecons function? (I did...
by AspireMint
Fri Mar 27, 2020 12:07
Forum: Modding Discussion
Topic: disable player swing or punch?
Replies: 3
Views: 1063

Re: disable player swing or punch?

you have 2 options: 1) modify player_api: Not just use - there are globalsteps - first will change player anim if player is not attached (useful for beds mod), yes you can just add player_name to table of attached objs to ignore this globalstep, but another globalsteps will change anim on player con...
by AspireMint
Thu Mar 26, 2020 21:14
Forum: Modding Discussion
Topic: disable player swing or punch?
Replies: 3
Views: 1063

Re: disable player swing or punch?

If you can not swing or punch, and place node (?), you can say his right arm is down, like left arm. Then you just hide wielditem (hand with item) and set player animation of digging to standing, and digging while running to running :-) Here is code to hide right arm: local hud_flags = player:hud_ge...
by AspireMint
Thu Mar 26, 2020 21:00
Forum: Modding Discussion
Topic: Get hotbar selected slot
Replies: 3
Views: 924

Re: Get hotbar selected slot

But you can shift items in hotbar by wield index, then you get first item :-)
Or set hotbar size to 1 and set wield item (probably not what you want, but... x) )
--> Or swap first item with current wield item.
by AspireMint
Thu Mar 26, 2020 19:15
Forum: Modding Discussion
Topic: Get hotbar selected slot
Replies: 3
Views: 924

Re: Get hotbar selected slot

to get ItemStack:

Code: Select all

player:get_wielded_item()
to set item:

Code: Select all

player:set_wielded_item(item)
to get item index (nope, there is not set_wield_index):

Code: Select all

player:get_wield_index()
by AspireMint
Thu Mar 26, 2020 04:44
Forum: Modding Discussion
Topic: How to get the usual recipe table for an registered item?
Replies: 8
Views: 1206

Re: How to get the usual recipe table for an registered item

--snip-- It works with all recipe widths from 0 (shapeless) to 3 (full crafting grid). I wish I could find a way to have it automatically use the correct conversion depending on width without having to manually check the width and "manually" assigning the values (which then would support ...
by AspireMint
Thu Mar 26, 2020 02:22
Forum: Problems
Topic: Issues loading modpacks within modpacks
Replies: 1
Views: 939

Re: Issues loading modpacks within modpacks

inner mods arent they copy of mods that are somewhere else (modname conflict)? see issue: https://github.com/minetest/minetest/issues/9045 Modpack inside modpack is not supported, not in API (correct me if im wrong). Here is something about nested modpacks https://forum.minetest.net/viewtopic.php?f=...
by AspireMint
Thu Mar 26, 2020 02:00
Forum: Feature Discussion
Topic: vector.abs
Replies: 10
Views: 1456

Re: vector.abs

what about vector.distance(p1, p2) < 0.5
by AspireMint
Mon Mar 23, 2020 22:17
Forum: Modding Discussion
Topic: A very tough modding question.
Replies: 4
Views: 871

Re: A very tough modding question.

use player:set_nametag_attributes({text=""})
https://github.com/minetest/minetest/bl ... .txt#L5811