Edoting player's formspec problems

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Edoting player's formspec problems

by 4aiman » Mon Nov 12, 2012 21:32

Hello everyone!
I spent many hours trying to change formspec of the player, but it doesn't work at all!
Player.cpp definetily stated on the line #55 that deafault player's formspec could be changed:
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
 // Can be redefined via Lua
inventory_formspec = "size[8,7.5]"
//"image[1,0.6;1,2;player.png]"
"list[current_player;main;0,3.5;8,4;]"
"list[current_player;craft;3,0;3,3;]"
"list[current_player;equipment;0.5,0;1,4;]"
"list[current_player;craftpreview;7,1;1,1;]";

What I want is to alter size of craft list to 2x2 and to add some new list 1x1.
There is a function set_player_properties() which was used in the player_textures mod to give dfferent players different textures.
I tried to set inventory_formspec using that function but it didn't work.
So, could anyone help me to set player's formspec?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Nov 13, 2012 14:34

Here is a little example code: https://github.com/PilzAdam/MiniTest/blob/master/mods/inventory/init.lua
I hope that helps a bit. If you still have questions feel free to ask again.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Thu Nov 22, 2012 20:54

Thanks alot, PilzAdam! It works!
May I ask where did you learn from about set_inventory_formspec func? There's no mention about it in the modding API.
Is there any other "hidden" functions?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Nov 23, 2012 11:20

 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Fri Nov 23, 2012 11:46

I must've been using an old one...
Thanks, PilzAdam!
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Sat Nov 24, 2012 13:41

One more question...
Adam, I took a look at your player_textures mod and now I want to have a texture of a player to be shown in the formspec of a workbench. The problem is that workbenches are "public"... One should determine what player has "opened" workbench and get his/her texture instead of texture of it's placer. Is there any way to determine current player's name when formspec of some node is shown to him?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Nov 24, 2012 13:45

4aiman wrote:One more question...
Adam, I took a look at your player_textures mod and now I want to have a texture of a player to be shown in the formspec of a workbench. The problem is that workbenches are "public"... One should determine what player has "opened" workbench and get his/her texture instead of texture of it's placer. Is there any way to determine current player's name when formspec of some node is shown to him?

I see no way to do this with the current API. It would be possible if there would be a callback function when a player opens the formspec, but there currently isnt.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 10 guests

cron