[Minetest] Installation de RaspberryJamMod Python

[Minetest] Installation de RaspberryJamMod Python.

Lua : Version 5.1.5

1/ Installation des paquets de développement de base :

pi@raspberrypi:~ $  sudo apt-get install lua-sec lua-socket lua-socket-dev

2/ Répertoire de travail :

pi@raspberrypi:~ $ mkdir -p JEUX/PYTHON
pi@raspberrypi:~ $ cd JEUX/PYTHON/

3/ Téléchargement du code source :

pi@raspberrypi:~/JEUX/PYTHON $ wget https://github.com/arpruss/raspberryjammod-minetest/archive/0.20.tar.gz
pi@raspberrypi:~/JEUX/PYTHON $ tar xvfz 0.20.tar.gz 

4/ Installation du mod :

pi@raspberrypi:~/JEUX/PYTHON $ cd ../MINETEST/minetest/mods/
pi@raspberrypi:~/JEUX/MINETEST/minetest/mods $ ln -s ../../../PYTHON/raspberryjammod-minetest-0.20/raspberryjammod

5/ Configuration de Minetest :

Ouvrir :

~/JEUX/MINETEST/minetest/games/minetest_game/minetest.conf

Ajouter :

creative_mode = true
secure.enable_security = false
secure.trusted_mods = raspberryjammod

6/ Modification du script d’initialisation :

Ouvrir :

~/JEUX/MINETEST/raspberryjammod-minetest-0.20/raspberryjammod/init.lua

Chercher :

if minetest.request_insecure_environment then
   ie = minetest.request_insecure_environment()
else
   ie = _G
end

Remplacer par :

ie = _G

7/ Lancer Minetest.

8/ Activer le mod ‘raspberryjammod‘.

9/ Création d’un script Python de test :

Ouvrir :

~/JEUX/MINETEST/minetest/mods/raspberryjammod/mcpipy/pillar.py

Ajouter :

#!/usr/bin/env python

import mcpi.minecraft as minecraft
import mcpi.block as block
import server
import math

# Connect to the Minecraft server
world = minecraft.Minecraft.create(server.address)

# Get the player's current position and store the coordinates
[x,y,z] = world.player.getPos()

# Set some variables to customize your pillar
height = 3 
material = block.BRICK_BLOCK

# Build the pillar. It will be "height" blocks high and located one step away from the player.
for level in range(0, height):
    world.setBlock( x+1, y+level, z+1, material )
    level = level + 1;

10/ Executer le script python :

pi@raspberrypi:~/JEUX/MINETEST/minetest/mods/raspberryjammod/mcpipy $ ./pillar.py

11/ Capture d’écran :

2016-10-19-185009_1280x1024_scrot

12/ Lien :

https://forum.minetest.net/viewtopic.php?f=11&t=13316