From 01c024d8b06aaf8798e4e8c2366e16545fe8a12e Mon Sep 17 00:00:00 2001 From: Wilma456 Date: Thu, 22 Jun 2017 14:05:42 +0200 Subject: [PATCH] Add equip and unequip for Pocket Computers --- .../resources/assets/computercraft/lua/rom/help/equip.txt | 3 ++- .../resources/assets/computercraft/lua/rom/help/unequip.txt | 3 ++- .../assets/computercraft/lua/rom/programs/pocket/equip.lua | 6 ++++++ .../computercraft/lua/rom/programs/pocket/unequip.lua | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/computercraft/lua/rom/programs/pocket/equip.lua create mode 100644 src/main/resources/assets/computercraft/lua/rom/programs/pocket/unequip.lua diff --git a/src/main/resources/assets/computercraft/lua/rom/help/equip.txt b/src/main/resources/assets/computercraft/lua/rom/help/equip.txt index dfb7bebb2..684aad125 100644 --- a/src/main/resources/assets/computercraft/lua/rom/help/equip.txt +++ b/src/main/resources/assets/computercraft/lua/rom/help/equip.txt @@ -1,4 +1,5 @@ -equip is a program for Turtles. equip will equip an item from the Turtle's inventory for use as a tool of peripheral. +equip is a program for Turtles and Pocket Computer. equip will equip an item from the Turtle's inventory for use as a tool of peripheral. On a Pocket Computer you don't need to write a side. ex: "equip 5 left" will equip the item from slot 5 of the turtle onto the left side of the turtle +"equip" on a Pocket Computer will equip the first item from your inventory. diff --git a/src/main/resources/assets/computercraft/lua/rom/help/unequip.txt b/src/main/resources/assets/computercraft/lua/rom/help/unequip.txt index f1d8169b4..9f52805d0 100644 --- a/src/main/resources/assets/computercraft/lua/rom/help/unequip.txt +++ b/src/main/resources/assets/computercraft/lua/rom/help/unequip.txt @@ -1,4 +1,5 @@ -unequip is a program for Turtles. unequip will remove tools of peripherals from the specified side of the turtle. +unequip is a program for Turtles and Pocket Computers. unequip will remove tools of peripherals from the specified side of the turtle. On a Pocket Computer you don't need to write a side. ex: "unequip left" will remove the item on the left side of the turtle +"unequip" on a Pocket Computer will remove the item from the Pocket Computer diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/pocket/equip.lua b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/equip.lua new file mode 100644 index 000000000..2632e6f8d --- /dev/null +++ b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/equip.lua @@ -0,0 +1,6 @@ +local ok, err = pcall( pocket.equipBack ) +if not ok then + printError( "Nothing to equip" ) +else + print( "Item equipped" ) +end \ No newline at end of file diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/pocket/unequip.lua b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/unequip.lua new file mode 100644 index 000000000..c6639d9ea --- /dev/null +++ b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/unequip.lua @@ -0,0 +1,6 @@ +local ok, err = pcall( pocket.unequipBack ) +if not ok then + printError( "Nothing to unequip" ) +else + print( "Item unequipped" ) +end \ No newline at end of file