Merge branch 'master' into sgt
Conflicts: li/cil/oc/OpenComputers.scala
@ -10,6 +10,7 @@ To support accepting energy from their respective power systems:
|
||||
To support bundled redstone input and output:
|
||||
- RedLogic [6], license: MIT License, see thread.
|
||||
- MineFactory Reloaded [7], license: custom, see thread.
|
||||
- Project: Red [9], license: Restricted Public Software License [10].
|
||||
|
||||
For providing a peripheral and reading their floppy disks:
|
||||
- ComputerCraft [8], copyright Daniel Ratcliffe.
|
||||
@ -21,4 +22,6 @@ For providing a peripheral and reading their floppy disks:
|
||||
[5] http://teamcofh.com/
|
||||
[6] http://www.minecraftforum.net/topic/1852277-162-redlogic-wip-replacement-for-rp2-wiringlogiccontrollighting/
|
||||
[7] http://www.minecraftforum.net/topic/2016680-162164-powercrystals-mods-minefactoryreloaded-powercrystalscore-and-netherores-updated/
|
||||
[8] http://www.computercraft.info/
|
||||
[8] http://www.computercraft.info/
|
||||
[9] http://projectredwiki.com/
|
||||
[10] https://github.com/MrTJP/ProjectRed/blob/master/LICENSE.md
|
65
README.md
@ -4,10 +4,73 @@ OpenComputers is a Minecraft mod that adds programmable computers and robots to
|
||||
|
||||
For more information on the mod, please [see the wiki](https://github.com/MightyPirates/OpenComputers/wiki). If you still have questions, visit the [community forums](http://opencomputers.net/).
|
||||
|
||||
Contributing
|
||||
------------
|
||||
If you'd like to contribute, the easiest way to do so is to provide a translation. See [`assets/opencomputers/lang`](https://github.com/MightyPirates/OpenComputers/tree/master/assets/opencomputers/lang) for already existing translations. New translations should be based on the English localization, since it will usually be the most up-to-date.
|
||||
|
||||
You can also implement your own item and block components using [the public API](https://github.com/MightyPirates/OpenComputers/tree/master/li/cil/oc/api), which unlike the rest of the mod is in plain Java, so you don't have to know or learn Scala.
|
||||
|
||||
If you encounter any bugs, please report them [in the issue tracker](https://github.com/MightyPirates/OpenComputers/issues?state=open), if they have not already been reported. If you report a crash, always provide your log file.
|
||||
|
||||
If you wish to discuss or suggest a new feature, the [forums](http://opencomputers.net/index.php?/forum/22-feedback-and-suggestions/) are a good place for that.
|
||||
If you wish to discuss or suggest a new feature, the [forums](http://opencomputers.net/index.php?/forum/22-feedback-and-suggestions/) are a good place for that.
|
||||
|
||||
Building
|
||||
========
|
||||
Java
|
||||
----
|
||||
You'll need a Forge development environment set up with support for Scala. There are no dependencies other than the bundled APIs. Compile it like any other mod.
|
||||
|
||||
Natives
|
||||
-------
|
||||
You'll usually not have to go through this, since the compiled library is in the repository for the more common operating systems (Windows, Linux and MacOS). This is here for reference, and in case you don't trust precompiled binaries.
|
||||
|
||||
First clone [Eris](https://github.com/fnuecke/eris). Build it using the provided makefile or manually.
|
||||
|
||||
For example, for Windows I used the command line compiler that comes with VS2012 with the following script:
|
||||
```cmd
|
||||
cl.exe /nologo /c /O2 /MT *.c
|
||||
del lua.obj
|
||||
del luac.obj
|
||||
lib.exe /nologo /LTCG /OUT:lua52.lib *.obj
|
||||
del *.obj
|
||||
```
|
||||
|
||||
For Linux use the makefile using the linux target.
|
||||
|
||||
For MacOS use the macosx target.
|
||||
|
||||
|
||||
Next, clone the [Eris Branch of JNLua](https://github.com/fnuecke/jnlua/tree/eris). Build it using the library built in step one. Copy the library generated in the first step to the `src\main\c` folder, as well as the includes to an `include` subfolder. For Linux and MacOS I named the library according to its format, i.e. `liblua.32.a` and `liblua.64.a`. For Windows I just replaced the file as necessary, because I suck at batch scripting.
|
||||
|
||||
For example, for Windows I again used the command line compiler of VS2012:
|
||||
```cmd
|
||||
cl.exe /nologo /c /O2 /MT jnlua.c /Iinclude
|
||||
link.exe /nologo /OUT:native.dll /DLL jnlua.obj /LIBPATH:. lua52.lib
|
||||
del native.exp
|
||||
del native.lib
|
||||
del jnlua.obj
|
||||
```
|
||||
Then rename the `native.dll` according to its format (i.e. native.32.dll or native.64.dll).
|
||||
|
||||
For Linux I used the following script:
|
||||
```sh
|
||||
FLAGS="-fno-strict-aliasing -fPIC -O2 -Wall -DNDEBUG -D_REENTRANT -DLUA_USE_LINUX -s"
|
||||
ARCH=32
|
||||
JDK_DIR="/usr/lib/jvm/java-6-openjdk"
|
||||
INCLUDES="-I$JDK_DIR/include -I$JDK_DIR/include/linux -Iinclude"
|
||||
gcc -c $FLAGS -m$ARCH $INCLUDES jnlua.c -ojnlua.o
|
||||
gcc -m$ARCH -shared -Wl,-soname=native.$ARCH.so -onative.$ARCH.so jnlua.o liblua.$ARCH.a
|
||||
strip --strip-unneeded native.$ARCH.so
|
||||
```
|
||||
|
||||
For MacOS I used a slightly modified version of the Linux script, which I don't have handy anymore because I don't have the Mac Mini I built it on here, but it should've been *similar* to this:
|
||||
```sh
|
||||
FLAGS="-fno-strict-aliasing -fPIC -O2 -Wall -DNDEBUG -D_REENTRANT -DLUA_USE_MACOSX -s"
|
||||
ARCH=32
|
||||
JDK_DIR="System/Library/Frameworks/JavaVM.framework/Headers"
|
||||
INCLUDES="-I$JDK_DIR -I$JDK_DIR/linux -Iinclude"
|
||||
gcc $FLAGS -m$ARCH $INCLUDES jnlua.c liblua.$ARCH.a
|
||||
gcc -m$ARCH -shared -onative.$ARCH.dylib jnlua.o
|
||||
```
|
||||
|
||||
Perform these steps twice, once for the 32 bit and once for the 64 bit version of the library. Adjust scripts as necessary (e.g. Lua makefile).
|
123
assets/opencomputers/lang/fr_FR.lang
Normal file
@ -0,0 +1,123 @@
|
||||
# Blocks
|
||||
oc:block.Adapter.name=Adaptateur
|
||||
oc:block.Cable.name=Cable
|
||||
oc:block.Capacitor.name=Capaciteur
|
||||
oc:block.Case0.name=Boitier
|
||||
oc:block.Case1.name=Boitier avancé
|
||||
oc:block.Case2.name=Boitier supérieur
|
||||
oc:block.Charger.name=Chargeur
|
||||
oc:block.DiskDrive.name=Lecteur de disquettes
|
||||
oc:block.Keyboard.name=Clavier
|
||||
oc:block.PowerConverter.name=Convertisseur
|
||||
oc:block.PowerDistributor.name=Distributeur
|
||||
oc:block.Redstone.name=Redstone E/S
|
||||
oc:block.Robot.name=Robot
|
||||
oc:block.RobotAfterimage.name=Robot
|
||||
oc:block.Router.name=Routeur
|
||||
oc:block.Screen0.name=Ecran
|
||||
oc:block.Screen1.name=Ecran avancé
|
||||
oc:block.Screen2.name=Ecran supérieur
|
||||
|
||||
# Items
|
||||
oc:item.Acid.name=Grog
|
||||
oc:item.ALU.name=Unité de logique arithmétique
|
||||
oc:item.Analyzer.name=Analyseur
|
||||
oc:item.ArrowKeys.name=Touches directionnelles
|
||||
oc:item.ButtonGroup.name=Groupe de boutons
|
||||
oc:item.CardBase.name=Base de carte
|
||||
oc:item.CircuitBoard.name=Plaque de circuit imprimé
|
||||
oc:item.ControlUnit.name=Unité de contrôle
|
||||
oc:item.CPU.name=Processeur
|
||||
oc:item.CuttingWire.name=Fil de coupe
|
||||
oc:item.Disk.name=Disque
|
||||
oc:item.FloppyDisk.name=Disquette
|
||||
oc:item.GraphicsCard0.name=Carte graphique
|
||||
oc:item.GraphicsCard1.name=Carte graphique avancée
|
||||
oc:item.GraphicsCard2.name=Carte graphique supérieure
|
||||
oc:item.HardDiskDrive.name=Disque dur
|
||||
oc:item.IronNugget.name=Pépite de fer
|
||||
oc:item.Memory.name=Mémoire
|
||||
oc:item.Microchip0.name=Puce électronique
|
||||
oc:item.Microchip1.name=Puce électronique avancée
|
||||
oc:item.Microchip2.name=Puce électronique supérieure
|
||||
oc:item.NetworkCard.name=Carte réseau
|
||||
oc:item.NumPad.name=Pavé numérique
|
||||
oc:item.PrintedCircuitBoard.name=Circuit imprimé
|
||||
oc:item.RawCircuitBoard.name=Plaque de circuit imprimé brute
|
||||
oc:item.RedstoneCard.name=Carte Redstone
|
||||
oc:item.Transistor.name=Transistor
|
||||
oc:item.UpgradeCrafting.name=Amélioration "Artisanat"
|
||||
oc:item.UpgradeGenerator.name=Amélioration "Générateur"
|
||||
oc:item.UpgradeNavigation.name=Amélioration "Navigation"
|
||||
oc:item.UpgradeSign.name=Amélioration "Panneau"
|
||||
oc:item.UpgradeSolarGenerator.name=Amélioration "Panneau solaire"
|
||||
oc:item.WirelessNetworkCard.name=Carte réseau sans fil
|
||||
|
||||
# GUI
|
||||
oc:gui.Analyzer.Address=Addresse
|
||||
oc:gui.Analyzer.ComponentName=Nom du composant
|
||||
oc:gui.Analyzer.LastError=Dernière erreur
|
||||
oc:gui.Analyzer.RobotName=Nom
|
||||
oc:gui.Analyzer.RobotOwner=Propriétaire
|
||||
oc:gui.Analyzer.RobotXp=Expérience
|
||||
oc:gui.Analyzer.StoredEnergy=Energie stockée
|
||||
oc:gui.Analyzer.TotalEnergy=Energie totale
|
||||
oc:gui.Analyzer.Users=Utilisateurs
|
||||
oc:gui.Robot.Power=Energie
|
||||
oc:gui.Robot.TurnOff=Eteindre
|
||||
oc:gui.Robot.TurnOn=Allumer
|
||||
|
||||
# Containers
|
||||
oc:container.Adapter=Adaptateur
|
||||
oc:container.Case=Ordinateur
|
||||
oc:container.DiskDrive=Disque dur
|
||||
|
||||
# Item / Block Tooltips
|
||||
oc:tooltip.Acid=Un produit semi-liquide très toxique, uniquement bu par certains pirates. Grâce à ses propriétés corrosives, il est très utile à la gravure de circuits imprimés.
|
||||
oc:tooltip.Adapter=Utilisé pour contrôler des blocs n'étant pas des composants d'ordinateurs, comme des blocs Vanilla ou d'autres mods.
|
||||
oc:tooltip.ALU=Ajoute des nombres pour que vous n'ayez pas à le faire. C'est peut-être mieux comme ça.
|
||||
oc:tooltip.Analyzer=Utilisé pour afficher des informations sur des blocs, comme leur §faddresse§7 et leur §fnom de composant§7.[nl] Affiche aussi les erreurs en cas de crash d'un ordinateur.
|
||||
oc:tooltip.Cable=Un moyen peu coûteux de relier des ordinateurs entre eux.
|
||||
oc:tooltip.Capacitor=Stocke l'énergie pour une utilisation ultérieure. Peut être chargé et déchargé très rapidement.
|
||||
oc:tooltip.CardBase=Comme son nom l'indique, c'est le bloc de construction basique pour toutes les cartes.
|
||||
oc:tooltip.Case=La tour est le bloc principal de l'ordinateur, et héberge ses §fcartes§7, sa §fMémoire RAM§7 et ses §fdisques durs§7.[nl] Emplacements: §f%s§7.
|
||||
oc:tooltip.Charger=Transfère l'énergie depuis des capaciteurs pour les robots adjacents. La puissance du transfert dépends du §fsignal de redstone§7, ou une absence de signal ne charge pas les robots, et un signal maximum charge les robots le plus vite possible.
|
||||
oc:tooltip.CircuitBoard=Hé ben, on y arrive. Peut être gravé pour obtenir un circuit imprimé.
|
||||
oc:tooltip.ControlUnit=C'est une unité qui... controle... des trucs. On en a besoin pour faire un processeur. Donc, ouais, super important.
|
||||
oc:tooltip.CPU=Un composant essentiel pour tout ordinateur. La fréquence d'horloge est un peu douteuse, mais, vous vous attendiez à quoi avec un cadran solaire de poche ?
|
||||
oc:tooltip.CuttingWire=Utilisé pour couper des blocs d'argile en plaque de circuit imprimé. Se casse après utilisation, ce qui rends cet outil le moins efficace jamais utilisé.
|
||||
oc:tooltip.Disk=Moyen primitif qui peut être utilisé pour faire des appareils de stockage persistants.
|
||||
oc:tooltip.DiskDrive.CC=Les disquettes ComputerCraft sont §asupportées§7.
|
||||
oc:tooltip.DiskDrive=Permet de lire des disquettes.
|
||||
oc:tooltip.GraphicsCard=Utilisé pour changer ce qui est affiché sur écran.[nl] Résolution maximum: §f%sx%s§7.[nl] Couleurs maximales: §f%s§7.[nl] Operations/tick: §f%s§7.
|
||||
oc:tooltip.IronNugget=Une pépite de fer. D'ou son nom.
|
||||
oc:tooltip.Keyboard=Peut être attaché à un écran pour permettre la saisie.
|
||||
oc:tooltip.Memory=Requis pour faire fonctionner les ordinateurs. Plus vous en avez, plus complexes les programmes seront utilisables.
|
||||
oc:tooltip.Microchip=La puce anciennement circuit intégré. J'ai aucune idée du comment ça marche avec la redstone, mais ça marche.
|
||||
oc:tooltip.NetworkCard=Permet à des ordinateurs distants de communiquer en s'envoyant des messages.
|
||||
oc:tooltip.PowerConverter.BC=§fBuildCraft MJ§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.IC2=§fIndustrialCraft² EU§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.TE=§fThermal Expansion RF§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.UE=§fUniversal Electricity Joules§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter=Convertis l'énergie d'autres mods en l'énergie requise pour faire fonctionner les ordinateurs.
|
||||
oc:tooltip.PowerDistributor=Distribue l'énergie dans plusieurs réseaux. Utile pour partager cette énergie depuis un convertisseur vers différents sous-réseaux qui doivent rester séparés.
|
||||
oc:tooltip.PrintedCircuitBoard=Le composant basique pour les cartes, la mémoire, etc.
|
||||
oc:tooltip.RawCircuitBoard=Peut être durci dans n'importe quel four.
|
||||
oc:tooltip.Redstone=Permet de recevoir et d'émettre des signaux de redstone autour du bloc. Contrôlable par n'importe quel ordinateur connecté à ce bloc. En gros, une carte redstone externe.
|
||||
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7 est §asupporté§7.
|
||||
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7 est §asupporté§7.
|
||||
oc:tooltip.RedstoneCard=Permet la réception et l'émission de signaux de redstone autour de l'ordinateur ou du robot.
|
||||
oc:tooltip.Robot=Contrairement aux ordinateurs, les robots peuvent se déplacer et intéragir avec le monde comme un joueur le fait. Ils ne peuvent §opas§r§7 intéragir avec des composants d'ordinateur extérieurs, ceci dit !
|
||||
# The underscore makes sure this isn't hidden with the rest of the tooltip.
|
||||
oc:tooltip.Robot_Level=§fNiveau§7: §a%s§7.
|
||||
oc:tooltip.Robot_StoredEnergy=§fEnergie stockée§7: §a%s§7.
|
||||
oc:tooltip.Router=Permet de connecter différents réseaux entre eux. Seulement des messages réseau seront transmis, les composants ne seront pas visibles via celui ci. A utiliser pour séparer des réseaux tout en leur permettant de communiquer entre eux, grâce aux Cartes réseau, par exemple.
|
||||
oc:tooltip.Screen=Affiche du texte, contrôlé par une Carte graphique dans un Boitier.[nl] Résolution maximum: §f%sx%s§7.[nl] Couleurs maximales: §f%s§7.
|
||||
oc:tooltip.TooLong=Maintenez la touche Majuscule (Shift) pour plus d'informations.
|
||||
oc:tooltip.Transistor=Un élément basique constituant la plupart des pièces d'un ordinateur. Il est un peu tordu, mais il fait son boulot.
|
||||
oc:tooltip.UpgradeCrafting=Permet aux robots d'utiliser le coin en haut à gauche de leur inventaire comme table d'artisanat. Vous devez respecter la position des objets comme pour un artisanat normal.
|
||||
oc:tooltip.UpgradeGenerator=Utilisé pour générer de l'énergie directement sur un robot, indépendament d'un chargeur. Consume du comburant (ex: charbon) pour une génération sur la durée, en fonction de l'efficacité du combustible. [nl] §fEfficacité§7: §a%s%%§7
|
||||
oc:tooltip.UpgradeNavigation=Utilisé pour déterminer la position et l'orientation d'un robot. Cette position est relative au centre de la zone (affichée sur une carte) ou l'amélioration a été créée.
|
||||
oc:tooltip.UpgradeSign=Permets de lire et d'écrire sur des panneaux.
|
||||
oc:tooltip.UpgradeSolarGenerator=Utilisé pour générer de l'énergie directement sur un robot, indépendament d'un chargeur, via le soleil. Aucun bloc ne doit se trouver au-dessus du robot pour que cette génération fonctionne. Génère de l'énergie à %s%% de la vitesse d'un moteur stirling (BuildCraft).
|
||||
oc:tooltip.WirelessNetworkCard=Permet l'envoi de messages réseaux sans fil. Pensez à régler la §fforce du signal§7, sinon aucun paquet ne sera envoyé!
|
135
assets/opencomputers/lang/pt_PT.lang
Normal file
@ -0,0 +1,135 @@
|
||||
# This is the portuguese lang file, adapted from the english master file.
|
||||
#
|
||||
# CHANGES:
|
||||
# LordFokas (6-JAN-2014): first translation from en_US to pt_PT.
|
||||
# It's not perfect, but it's hard to translate, especially because
|
||||
# given I'm a Computer Science Engineering student, I tend to mix in
|
||||
# technical english words. I suggest someone less involved with CSE to
|
||||
# try and revise my translation.
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
|
||||
# Blocks
|
||||
oc:block.Adapter.name=Adaptador
|
||||
oc:block.Cable.name=Cabo
|
||||
oc:block.Capacitor.name=Condensador
|
||||
oc:block.Case0.name=Caixa Básica
|
||||
oc:block.Case1.name=Caixa Avançada
|
||||
oc:block.Case2.name=Caixa Superior
|
||||
oc:block.Charger.name=Carregador
|
||||
oc:block.DiskDrive.name=Drive de Disquetes
|
||||
oc:block.Keyboard.name=Teclado
|
||||
oc:block.PowerConverter.name=Conversor de Energia
|
||||
oc:block.PowerDistributor.name=Distribuidor de Energia
|
||||
oc:block.Redstone.name=E/S de Redstone
|
||||
oc:block.Robot.name=Robô
|
||||
oc:block.RobotAfterimage.name=Robô
|
||||
oc:block.Router.name=Roteador
|
||||
oc:block.Screen0.name=Ecrã Básico
|
||||
oc:block.Screen1.name=Ecrã Avançado
|
||||
oc:block.Screen2.name=Ecrã Superior
|
||||
|
||||
# Items
|
||||
oc:item.Acid.name=Grogue
|
||||
oc:item.ALU.name=Unidade Aritmética e Lógica
|
||||
oc:item.Analyzer.name=Analizador
|
||||
oc:item.ArrowKeys.name=Setas
|
||||
oc:item.ButtonGroup.name=Grupo de Botões
|
||||
oc:item.CardBase.name=Placa Base
|
||||
oc:item.CircuitBoard.name=Placa de Circuitos
|
||||
oc:item.ControlUnit.name=Unidade de Controlo
|
||||
oc:item.CPU.name=Processador
|
||||
oc:item.CuttingWire.name=Arame de Corte
|
||||
oc:item.Disk.name=Disco
|
||||
oc:item.FloppyDisk.name=Disquete
|
||||
oc:item.GraphicsCard0.name=Placa Gráfica Básica
|
||||
oc:item.GraphicsCard1.name=Placa Gráfica Avançada
|
||||
oc:item.GraphicsCard2.name=Placa Gráfica Superior
|
||||
oc:item.HardDiskDrive.name=Disco Rígido
|
||||
oc:item.IronNugget.name=Pepita de Ferro
|
||||
oc:item.Memory.name=Memória
|
||||
oc:item.Microchip0.name=Circuito Integrado Simples
|
||||
oc:item.Microchip1.name=Circuito Integrado Avançado
|
||||
oc:item.Microchip2.name=Circuito Integrado Superior
|
||||
oc:item.NetworkCard.name=Placa de Rede
|
||||
oc:item.NumPad.name=Teclado Numérico
|
||||
oc:item.PrintedCircuitBoard.name=Placa de Circuitos Impressos
|
||||
oc:item.RawCircuitBoard.name=Placa de Circuitos Vazia
|
||||
oc:item.RedstoneCard.name=Placa de Redstone
|
||||
oc:item.Transistor.name=Transístor
|
||||
oc:item.UpgradeCrafting.name=Melhoramento: Fabrico
|
||||
oc:item.UpgradeGenerator.name=Melhoramento: Gerador
|
||||
oc:item.UpgradeNavigation.name=Melhoramento: Navegação
|
||||
oc:item.UpgradeSign.name=Melhoramento: Escrita e Leitura de Placas
|
||||
oc:item.UpgradeSolarGenerator.name=Melhoramento: Gerador Solar
|
||||
oc:item.WirelessNetworkCard.name=Placa de Rede sem Fios
|
||||
|
||||
# GUI
|
||||
oc:gui.Analyzer.Address=Endereço
|
||||
oc:gui.Analyzer.ComponentName=Nome do Componente
|
||||
oc:gui.Analyzer.LastError=Último erro
|
||||
oc:gui.Analyzer.RobotName=Nome
|
||||
oc:gui.Analyzer.RobotOwner=Proprietário
|
||||
oc:gui.Analyzer.RobotXp=Experiência
|
||||
oc:gui.Analyzer.StoredEnergy=Energia Armazenada
|
||||
oc:gui.Analyzer.TotalEnergy=Total de Energia Armazenada
|
||||
oc:gui.Analyzer.Users=Utilizadores
|
||||
oc:gui.Robot.Power=Energia
|
||||
oc:gui.Robot.TurnOff=Desligar
|
||||
oc:gui.Robot.TurnOn=Ligar
|
||||
|
||||
# Containers
|
||||
oc:container.Adapter=Adaptador
|
||||
oc:container.Case=Computador
|
||||
oc:container.DiskDrive=Drive de Disquetes
|
||||
|
||||
# Item / Block Tooltips
|
||||
oc:tooltip.Acid=Um líquido muito tóxico, geralmente apenas consumido por alguns piratas. Graças à sua natureza corrosiva é perfeito para gravar placas de circuitos.
|
||||
oc:tooltip.Adapter=Usado para controlar blocos que não sejam componentes, tais como blocos do Minecraft Vanilla ou de outros mods.
|
||||
oc:tooltip.ALU=Faz cálculos por ti. Talvez seja melhor assim.
|
||||
oc:tooltip.Analyzer=Usado para mostrar informação acerca de blocos, tais como o seu §fendereço§7 e §fnome de componente§7.[nl] também mostra o erro que fez o computador crashar caso este não se tenha desligado normalmente.
|
||||
oc:tooltip.Cable=Uma forma barata de conectar blocos.
|
||||
oc:tooltip.Capacitor=Armazena energia para ser usada mais tarde. Pode encher e esvaziar-se muito rapidamente.
|
||||
oc:tooltip.CardBase=Como o nome indica, é o componente básico para construir placas de expansão.
|
||||
oc:tooltip.Case=A Caixa é o bloco básico para a construção de computadores e contém as §fplacas de expansão§7, §fRAM§7 e §fdiscos rígidos§7.[nl] Slots: §f%s§7.
|
||||
oc:tooltip.Charger=Transfere energia dos condensadores para robôs adjacentes. A taxa de transferência depende do §fsinal de redstone§7 aplicado, onde nenhum sinal significa não carregar, e o sinal máximo significa carregar à velocidade máxima.
|
||||
oc:tooltip.CircuitBoard=Agora estamos a chegar a algum lado. Pode ser gravada para obter uma placa de circuitos impressos.
|
||||
oc:tooltip.ControlUnit=Esta é a unidade que... controla... coisas. Precisas dela para montar um Processador. Portanto, sim, pode-se dizer que é importante.
|
||||
oc:tooltip.CPU=Um componente essencial de qualquer computador. A frequencia é pouco fiável, mas o que é que esperas quando corre com um relógio de sol?
|
||||
oc:tooltip.CuttingWire=Usado para cortar blocos de barro na forma de uma placa. Parte-se ao fim de um uso, o que faz dela a ferramenta menos eficiente de sempre.
|
||||
oc:tooltip.Disk=Um meio primitivo que pode ser usado para construir dispositivos de armazenamento persistente.
|
||||
oc:tooltip.DiskDrive.CC=Disquetes do ComputerCraft são §asuportadas§7.
|
||||
oc:tooltip.DiskDrive=Permite ler e escrever dados em Disquetes.
|
||||
oc:tooltip.GraphicsCard=Usado para alterar o que é mostrado nos ecrãs.[nl] Resolução máxima: §f%sx%s§7.[nl] Profundidade de cor máxima: §f%s§7.[nl] Operações/ciclo: §f%s§7.
|
||||
oc:tooltip.IronNugget=Uma pepita feita de ferro, por isso é que se chama Pepita de Ferro, duh...
|
||||
oc:tooltip.Keyboard=Pode ligar-se a um ecrã para permitir escrever através dele.
|
||||
oc:tooltip.Memory=Necessária para poder usar um computador. Quanta mais RAM tiveres, mais complexos são os programas que podes correr.
|
||||
oc:tooltip.Microchip=Um chip antes conhecido por Circuito Integrado. Não faço ideia como é que isto funciona com redstone, mas funciona.
|
||||
oc:tooltip.NetworkCard=Permite a computadores distantes ligados por blocos (tais como Cabos) comunicar enviando mensagens entre eles.
|
||||
oc:tooltip.PowerConverter.BC=§fMJ de Buildcraft§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.IC2=§fEU de IndustrialCraft²§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.TE=§fRF de Thermal Expansion§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter.UE=§fJoules de Universal Electricity§7: §a%s:%s§7.
|
||||
oc:tooltip.PowerConverter=Converte energia de outros mods para o tipo de energia usado internamente. Taxas de conversão:
|
||||
oc:tooltip.PowerDistributor=Distribui energia entre diferentes redes. É util para alimentar várias redes separadas através de uma fonte de energia partilhada.
|
||||
oc:tooltip.PrintedCircuitBoard=O componente básico de placas de expansão, memórias e afins.
|
||||
oc:tooltip.RawCircuitBoard=Pode ser endurecida em qualquer fornalha.
|
||||
oc:tooltip.Redstone=Permite receber e emitir sinais de redstone. Pode ser controlado por qualquer computador ao qual o bloco esteja conectado. Basicamente isto é uma placa de controlo de redstone.
|
||||
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7 é §asuportado§7.
|
||||
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7 é §asuportado§7.
|
||||
oc:tooltip.RedstoneCard=Permite ao computador ou robô receber e emitir sinais de redstone.
|
||||
oc:tooltip.Robot=Ao contrário dos computadores, os robôs podem mover-se e interagir com o mundo como um jogado. No entanto, eles §onão§r§7 podem interagir com componentes externos!
|
||||
# The underscore makes sure this isn't hidden with the rest of the tooltip.
|
||||
oc:tooltip.Robot_Level=§fNível§7: §a%s§7.
|
||||
oc:tooltip.Robot_StoredEnergy=§fEnergia Armazenada§7: §a%s§7.
|
||||
oc:tooltip.Router=Permite interligar redes diferentes. Apenas pacotes de rede serão passados, componentes não serão visiveis em redes vizinhas. Usa isto para separar várias redes e ao mesmo tempo permitir comunicação através de placas de rede, por exemplo.
|
||||
oc:tooltip.Screen=Mostra texto, controlado por uma placa gráfica numa Caixa.[nl] Resolução máxima: §f%sx%s§7.[nl] Profundidade de cor máxima: §f%s§7.
|
||||
oc:tooltip.TooLong=Prime SHIFT para uma descrição detalhada.
|
||||
oc:tooltip.Transistor=Um componente básico do hardware do computador. É um pouco retorcido, mas faz o seu trabalho.
|
||||
oc:tooltip.UpgradeCrafting=Permite aos robôs usar a parte superior esquerda do seu inventório para fabricar objectos. Os itens têm de estar alinhados como numa mesa de fabrico.
|
||||
oc:tooltip.UpgradeGenerator=Pode ser usado para gerar energia a partir de combustível. Queima itens para gerar energia ao longo do tempo, dependendo da energia que pode ser extraída de cada componente.[nl] §fEficiência§7: §a%s%%§7
|
||||
oc:tooltip.UpgradeNavigation=Pode ser usado para determinar a posição e orientação do robô. A posição é relativa ao centro do mapa usado para fabricar este melhoramento.
|
||||
oc:tooltip.UpgradeSign=Permiter ler e escrever texto em Placas.
|
||||
oc:tooltip.UpgradeSolarGenerator=Pode ser usado para gerar energia a partir da luz solar. Requer exposição directa à luz solar. Gera energia a %s%% da velocidade de um motor a carvão.
|
||||
oc:tooltip.WirelessNetworkCard=Permite trocar mensagens em redes com e sem fios. Certifica-te que defines a §fforça do sinal§7 ou nenhum pacote será enviado via redes sem fios!
|
@ -10,7 +10,7 @@ end
|
||||
|
||||
local filename = shell.resolve(args[1])
|
||||
|
||||
local readonly = options.r or fs.get(filename).isReadOnly()
|
||||
local readonly = options.r or fs.get(filename) == nil or fs.get(filename).isReadOnly()
|
||||
|
||||
if fs.isDirectory(filename) or readonly and not fs.exists(filename) then
|
||||
print("file not found")
|
||||
|
@ -117,15 +117,15 @@ transistor {
|
||||
}
|
||||
chip1 {
|
||||
type: assembly
|
||||
input: [itemPartCircuit, {item="oc:item", subID=23}]
|
||||
input: ["ic2.itemPartCircuit", {item="oc:item", subID=23}]
|
||||
count: [1, 4]
|
||||
eu:25
|
||||
eu: 25
|
||||
time: 480
|
||||
output: 4
|
||||
}
|
||||
chip2 {
|
||||
type: assembly
|
||||
input: [itemPartCircuitAdv, {item="oc:item", subID=23}]
|
||||
input: ["ic2.itemPartCircuitAdv", {item="oc:item", subID=23}]
|
||||
count: [1, 8]
|
||||
eu: 25
|
||||
time: 640
|
||||
@ -183,7 +183,7 @@ adapter {
|
||||
}
|
||||
cable {
|
||||
type: assembly
|
||||
input: [itemCable, {item=item.GT_Dusts, subID=35}]
|
||||
input: ["ic2.itemCable", {item=item.GT_Dusts, subID=35}]
|
||||
count: [8, 1]
|
||||
eu: 32
|
||||
time: 64
|
||||
@ -201,17 +201,17 @@ charger {
|
||||
}
|
||||
case1 {
|
||||
input: [[screwAluminium, "oc:craftingCircuitBoardPrinted", craftingToolWrench]
|
||||
[reactorVentSpread, craftingRawMachineTier01, "oc:circuitBasic"]
|
||||
["ic2.reactorVentSpread", craftingRawMachineTier01, "oc:circuitBasic"]
|
||||
[screwAluminium, "oc:craftingCPU", craftingToolScrewdriver]]
|
||||
}
|
||||
case2 {
|
||||
input: [[screwStainlessSteel , "oc:craftingCircuitBoardPrinted", craftingToolWrench]
|
||||
[reactorVentGold, "oc:craftingCaseBasic", "oc:circuitAdvanced"]
|
||||
["ic2.reactorVentGold", "oc:craftingCaseBasic", "oc:circuitAdvanced"]
|
||||
[screwStainlessSteel, "oc:craftingCPU", craftingToolScrewdriver]]
|
||||
}
|
||||
case3 {
|
||||
input: [[screwTitanium , "oc:craftingCircuitBoardPrinted", craftingToolWrench]
|
||||
[reactorVentDiamond, "oc:craftingCaseAdvanced", "oc:circuitElite"]
|
||||
["ic2.reactorVentDiamond", "oc:craftingCaseAdvanced", "oc:circuitElite"]
|
||||
[screwTitanium, "oc:craftingCPU", craftingToolScrewdriver]]
|
||||
}
|
||||
diskDrive {
|
||||
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 472 B |
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 425 B |
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 429 B |
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 323 B |
@ -10,7 +10,7 @@ import net.minecraft.item.{ItemMap, Item, ItemStack}
|
||||
object CraftingHandler extends ICraftingHandler {
|
||||
override def onCrafting(player: EntityPlayer, craftedStack: ItemStack, inventory: IInventory) = {
|
||||
if (craftedStack.isItemEqual(Items.acid.createItemStack())) {
|
||||
for (i <- 0 to inventory.getSizeInventory) {
|
||||
for (i <- 0 until inventory.getSizeInventory) {
|
||||
val stack = inventory.getStackInSlot(i)
|
||||
if (stack != null && stack.getItem == Item.bucketWater) {
|
||||
stack.stackSize = 0
|
||||
@ -20,7 +20,7 @@ object CraftingHandler extends ICraftingHandler {
|
||||
}
|
||||
|
||||
if (craftedStack.isItemEqual(Items.pcb.createItemStack())) {
|
||||
for (i <- 0 to inventory.getSizeInventory) {
|
||||
for (i <- 0 until inventory.getSizeInventory) {
|
||||
val stack = inventory.getStackInSlot(i)
|
||||
if (stack != null && stack.isItemEqual(Items.acid.createItemStack())) {
|
||||
val container = new ItemStack(Item.bucketEmpty, 1)
|
||||
@ -35,7 +35,7 @@ object CraftingHandler extends ICraftingHandler {
|
||||
Registry.itemDriverFor(craftedStack) match {
|
||||
case Some(driver) =>
|
||||
var oldMap = None: Option[ItemStack]
|
||||
for (i <- 0 to inventory.getSizeInventory) {
|
||||
for (i <- 0 until inventory.getSizeInventory) {
|
||||
val stack = inventory.getStackInSlot(i)
|
||||
if (stack != null) {
|
||||
if (stack.isItemEqual(Items.upgradeNavigation.createItemStack())) {
|
||||
|
@ -2,7 +2,8 @@ package li.cil.oc
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import li.cil.oc.common.item
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.item.{Item, ItemStack}
|
||||
import net.minecraftforge.oredict.OreDictionary
|
||||
|
||||
object Items {
|
||||
@ -116,6 +117,8 @@ object Items {
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
registerExclusive("craftingPiston", new ItemStack(Block.pistonBase), new ItemStack(Block.pistonStickyBase))
|
||||
registerExclusive("nuggetGold", new ItemStack(Item.goldNugget))
|
||||
registerExclusive("nuggetIron", ironNugget.createItemStack())
|
||||
register("oc:craftingCircuitBoardRaw", rawCircuitBoard.createItemStack())
|
||||
register("oc:craftingCircuitBoard", circuitBoard.createItemStack())
|
||||
@ -153,9 +156,11 @@ object Items {
|
||||
}
|
||||
}
|
||||
|
||||
def registerExclusive(name: String, item: ItemStack) {
|
||||
def registerExclusive(name: String, items: ItemStack*) {
|
||||
if (OreDictionary.getOres(name).isEmpty) {
|
||||
OreDictionary.registerOre(name, item)
|
||||
for (item <- items) {
|
||||
OreDictionary.registerOre(name, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -13,9 +13,7 @@ import li.cil.oc.client.{PacketHandler => ClientPacketHandler}
|
||||
import li.cil.oc.common.Proxy
|
||||
import li.cil.oc.server.{PacketHandler => ServerPacketHandler}
|
||||
|
||||
@Mod(modid = "OpenComputers", name = "OpenComputers", version = "1.1.0",
|
||||
dependencies = "required-after:Forge@[9.11.1.940,);after:BuildCraft|Energy;after:ComputerCraft;after:IC2;after:MineFactoryReloaded;after:OpenComputersAPI;after:ProjRed|Transmission;after:RedLogic;after:StargateTech2;after:ThermalExpansion",
|
||||
modLanguage = "scala")
|
||||
@Mod(modid = "OpenComputers", modLanguage = "scala", useMetadata = true)
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false,
|
||||
clientPacketHandlerSpec = new SidedPacketHandler(
|
||||
channels = Array("OpenComp"), packetHandler = classOf[ClientPacketHandler]),
|
||||
|
@ -62,6 +62,7 @@ object Recipes {
|
||||
addRecipe(Items.hdd2.createItemStack(), recipes, "hdd2")
|
||||
addRecipe(Items.hdd3.createItemStack(), recipes, "hdd3")
|
||||
|
||||
addRecipe(Items.abstractBus.createItemStack(), recipes, "abstractBusCard")
|
||||
addRecipe(Items.gpu1.createItemStack(), recipes, "graphicsCard1")
|
||||
addRecipe(Items.gpu2.createItemStack(), recipes, "graphicsCard2")
|
||||
addRecipe(Items.gpu3.createItemStack(), recipes, "graphicsCard3")
|
||||
|
@ -43,6 +43,7 @@ class Settings(config: Config) {
|
||||
val maxUsers = config.getInt("computer.maxUsers") max 0
|
||||
val maxUsernameLength = config.getInt("computer.maxUsernameLength") max 0
|
||||
val allowBytecode = config.getBoolean("computer.allowBytecode")
|
||||
val logLuaCallbackErrors = config.getBoolean("computer.logCallbackErrors")
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// robot
|
||||
|
@ -135,14 +135,23 @@ object MonospaceFontRenderer {
|
||||
private val bgv2 = 256.0 / 256.0
|
||||
|
||||
private def draw(color: Int, offset: Int, width: Int) = if (color != 0 && width > 0) {
|
||||
val t = Tessellator.instance
|
||||
t.startDrawingQuads()
|
||||
t.setColorOpaque_I(color)
|
||||
t.addVertexWithUV(charWidth * offset, charHeight, 0, bgu1, bgv2)
|
||||
t.addVertexWithUV(charWidth * (offset + width), charHeight, 0, bgu2, bgv2)
|
||||
t.addVertexWithUV(charWidth * (offset + width), 0, 0, bgu2, bgv1)
|
||||
t.addVertexWithUV(charWidth * offset, 0, 0, bgu1, bgv1)
|
||||
t.draw()
|
||||
// IMPORTANT: we must not use the tessellator here. Doing so can cause
|
||||
// crashes on certain graphics cards with certain drivers (reported for
|
||||
// ATI/AMD and Intel chip sets). These crashes have been reported to
|
||||
// happen I have no idea why, and can only guess that it's related to
|
||||
// using the VBO/ARB the tessellator uses inside a display list (since
|
||||
// this stuff is eventually only rendered via display lists).
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glColor3ub(((color >> 16) & 0xFF).toByte, ((color >> 8) & 0xFF).toByte, (color & 0xFF).toByte)
|
||||
GL11.glTexCoord2d(bgu1, bgv2)
|
||||
GL11.glVertex3d(charWidth * offset, charHeight, 0)
|
||||
GL11.glTexCoord2d(bgu2, bgv2)
|
||||
GL11.glVertex3d(charWidth * (offset + width), charHeight, 0)
|
||||
GL11.glTexCoord2d(bgu2, bgv1)
|
||||
GL11.glVertex3d(charWidth * (offset + width), 0, 0)
|
||||
GL11.glTexCoord2d(bgu1, bgv1)
|
||||
GL11.glVertex3d(charWidth * offset, 0, 0)
|
||||
GL11.glEnd()
|
||||
}
|
||||
|
||||
private def flush() = if (listBuffer.position > 0) {
|
||||
|
@ -91,7 +91,8 @@ object Cable {
|
||||
def neighbors(world: IBlockAccess, x: Int, y: Int, z: Int) = {
|
||||
var result = 0
|
||||
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (world.getBlockId(tx, ty, tz) != 0) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
case robot: tileentity.RobotProxy =>
|
||||
case host: SidedEnvironment =>
|
||||
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
|
||||
|
@ -101,7 +101,8 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
|
||||
def findMovingRobot(world: IBlockAccess, x: Int, y: Int, z: Int): Option[tileentity.Robot] = {
|
||||
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (world.getBlockId(tx, ty, tz) != 0) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
case proxy: tileentity.RobotProxy if proxy.robot.moveFromX == x && proxy.robot.moveFromY == y && proxy.robot.moveFromZ == z => return Some(proxy.robot)
|
||||
case _ =>
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.api.network.{SidedEnvironment, Analyzable, Visibility}
|
||||
import li.cil.oc.client.renderer.MonospaceFontRenderer
|
||||
import li.cil.oc.client.{PacketSender => ClientPacketSender}
|
||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.entity.Entity
|
||||
@ -116,10 +117,9 @@ class Screen(var tier: Int) extends Buffer with SidedEnvironment with Rotatable
|
||||
(rx, ry)
|
||||
}
|
||||
|
||||
// Convert to absolute coordinates and send the (checked) signal.
|
||||
if (!world.isRemote) {
|
||||
val (bx, by) = (brx * bw, bry * bh)
|
||||
origin.node.sendToReachable("computer.checked_signal", player, "touch", Int.box(bx.toInt + 1), Int.box(by.toInt + 1), player.getCommandSenderName)
|
||||
// Convert to absolute coordinates and send the packet to the server.
|
||||
if (world.isRemote) {
|
||||
ClientPacketSender.sendMouseClick(this, (brx * bw).toInt + 1, (bry * bh).toInt + 1, drag = false)
|
||||
}
|
||||
true
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ import scala.Array.canBuildFrom
|
||||
import scala.Some
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
import scala.collection.mutable
|
||||
import scala.math.ScalaNumber
|
||||
import scala.runtime.BoxedUnit
|
||||
|
||||
class Computer(val owner: tileentity.Computer) extends ManagedComponent with Context with Runnable {
|
||||
val node = api.Network.newNode(this, Visibility.Network).
|
||||
@ -665,57 +663,6 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
private def init(): Boolean = {
|
||||
// Utility functions for varargs callbacks.
|
||||
def parseArgument(lua: LuaState, index: Int): AnyRef = lua.`type`(index) match {
|
||||
case LuaType.BOOLEAN => Boolean.box(lua.toBoolean(index))
|
||||
case LuaType.NUMBER => Double.box(lua.toNumber(index))
|
||||
case LuaType.STRING => lua.toByteArray(index)
|
||||
case LuaType.TABLE => lua.toJavaObject(index, classOf[java.util.Map[_, _]])
|
||||
case _ => Unit
|
||||
}
|
||||
|
||||
def parseArguments(lua: LuaState, start: Int) =
|
||||
for (index <- start to lua.getTop) yield parseArgument(lua, index)
|
||||
|
||||
def pushList(value: Iterator[(Any, Int)]) {
|
||||
lua.newTable()
|
||||
var count = 0
|
||||
value.foreach {
|
||||
case (x, index) => x match {
|
||||
case (entry: ScalaNumber) =>
|
||||
pushResult(lua, entry.underlying())
|
||||
case (entry) =>
|
||||
pushResult(lua, entry.asInstanceOf[AnyRef])
|
||||
}
|
||||
lua.rawSet(-2, index + 1)
|
||||
count = count + 1
|
||||
}
|
||||
lua.pushString("n")
|
||||
lua.pushInteger(count)
|
||||
lua.rawSet(-3)
|
||||
}
|
||||
|
||||
def pushResult(lua: LuaState, value: AnyRef): Unit = value match {
|
||||
case null | Unit | _: BoxedUnit => lua.pushNil()
|
||||
case value: java.lang.Boolean => lua.pushBoolean(value.booleanValue)
|
||||
case value: java.lang.Byte => lua.pushNumber(value.byteValue)
|
||||
case value: java.lang.Character => lua.pushString(String.valueOf(value))
|
||||
case value: java.lang.Short => lua.pushNumber(value.shortValue)
|
||||
case value: java.lang.Integer => lua.pushNumber(value.intValue)
|
||||
case value: java.lang.Long => lua.pushNumber(value.longValue)
|
||||
case value: java.lang.Float => lua.pushNumber(value.floatValue)
|
||||
case value: java.lang.Double => lua.pushNumber(value.doubleValue)
|
||||
case value: java.lang.String => lua.pushString(value)
|
||||
case value: Array[Byte] => lua.pushByteArray(value)
|
||||
case value: Array[_] => pushList(value.zipWithIndex.iterator)
|
||||
case value: Product => pushList(value.productIterator.zipWithIndex)
|
||||
case value: Seq[_] => pushList(value.zipWithIndex.iterator)
|
||||
// TODO maps?
|
||||
case _ =>
|
||||
OpenComputers.log.warning("A component callback tried to return an unsupported value of type " + value.getClass.getName + ".")
|
||||
lua.pushNil()
|
||||
}
|
||||
|
||||
// Reset error state.
|
||||
message = None
|
||||
|
||||
@ -862,7 +809,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
|
||||
lua.setField(-2, "totalMemory")
|
||||
|
||||
lua.pushScalaFunction(lua => {
|
||||
lua.pushBoolean(signal(lua.checkString(1), parseArguments(lua, 2): _*))
|
||||
lua.pushBoolean(signal(lua.checkString(1), lua.toSimpleJavaObjects(2): _*))
|
||||
1
|
||||
})
|
||||
lua.setField(-2, "pushSignal")
|
||||
@ -1029,7 +976,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
|
||||
lua.pushScalaFunction(lua => {
|
||||
val address = lua.checkString(1)
|
||||
val method = lua.checkString(2)
|
||||
val args = parseArguments(lua, 3)
|
||||
val args = lua.toSimpleJavaObjects(3)
|
||||
try {
|
||||
(Option(node.network.node(address)) match {
|
||||
case Some(component: server.network.Component) if component.canBeSeenFrom(node) || component == node =>
|
||||
@ -1048,57 +995,68 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
|
||||
}) match {
|
||||
case results: Array[_] =>
|
||||
lua.pushBoolean(true)
|
||||
results.foreach(pushResult(lua, _))
|
||||
results.foreach(result => lua.pushValue(result))
|
||||
1 + results.length
|
||||
case _ =>
|
||||
lua.pushBoolean(true)
|
||||
1
|
||||
}
|
||||
} catch {
|
||||
case _: LimitReachedException =>
|
||||
0
|
||||
case e: IllegalArgumentException if e.getMessage != null =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString(e.getMessage)
|
||||
2
|
||||
case e: Throwable if e.getMessage != null =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString(e.getMessage)
|
||||
3
|
||||
case _: ArrayIndexOutOfBoundsException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("index out of bounds")
|
||||
2
|
||||
case _: IllegalArgumentException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("bad argument")
|
||||
2
|
||||
case _: NoSuchMethodException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("no such method")
|
||||
2
|
||||
case _: FileNotFoundException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("file not found")
|
||||
3
|
||||
case _: SecurityException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("access denied")
|
||||
3
|
||||
case _: IOException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("i/o error")
|
||||
3
|
||||
}
|
||||
catch {
|
||||
case e: Throwable =>
|
||||
OpenComputers.log.log(Level.WARNING, "Unexpected error in Lua callback.", e)
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("unknown error")
|
||||
3
|
||||
if (Settings.get.logLuaCallbackErrors && !e.isInstanceOf[LimitReachedException]) {
|
||||
OpenComputers.log.log(Level.WARNING, "Exception in Lua callback.", e)
|
||||
}
|
||||
e match {
|
||||
case _: LimitReachedException =>
|
||||
0
|
||||
case e: IllegalArgumentException if e.getMessage != null =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString(e.getMessage)
|
||||
2
|
||||
case e: Throwable if e.getMessage != null =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString(e.getMessage)
|
||||
if (true) {
|
||||
lua.pushString(e.getStackTraceString)
|
||||
4
|
||||
}
|
||||
else 3
|
||||
case _: IndexOutOfBoundsException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("index out of bounds")
|
||||
2
|
||||
case _: IllegalArgumentException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("bad argument")
|
||||
2
|
||||
case _: NoSuchMethodException =>
|
||||
lua.pushBoolean(false)
|
||||
lua.pushString("no such method")
|
||||
2
|
||||
case _: FileNotFoundException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("file not found")
|
||||
3
|
||||
case _: SecurityException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("access denied")
|
||||
3
|
||||
case _: IOException =>
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("i/o error")
|
||||
3
|
||||
case e: Throwable =>
|
||||
OpenComputers.log.log(Level.WARNING, "Unexpected error in Lua callback.", e)
|
||||
lua.pushBoolean(true)
|
||||
lua.pushNil()
|
||||
lua.pushString("unknown error")
|
||||
3
|
||||
}
|
||||
}
|
||||
})
|
||||
lua.setField(-2, "invoke")
|
||||
@ -1293,19 +1251,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
|
||||
else (signals.synchronized(if (signals.isEmpty) None else Some(signals.dequeue())) match {
|
||||
case Some(signal) =>
|
||||
lua.pushString(signal.name)
|
||||
signal.args.foreach {
|
||||
case Unit => lua.pushNil()
|
||||
case arg: Boolean => lua.pushBoolean(arg)
|
||||
case arg: Double => lua.pushNumber(arg)
|
||||
case arg: String => lua.pushString(arg)
|
||||
case arg: Array[Byte] => lua.pushByteArray(arg)
|
||||
case arg: Map[String, String] =>
|
||||
lua.newTable(0, arg.size)
|
||||
for ((key, value) <- arg if key != null && value != null) {
|
||||
lua.pushString(value)
|
||||
lua.setField(-2, key)
|
||||
}
|
||||
}
|
||||
signal.args.foreach(arg => lua.pushValue(arg))
|
||||
lua.resume(1, 1 + signal.args.length)
|
||||
case _ =>
|
||||
lua.resume(1, 0)
|
||||
|
@ -590,7 +590,7 @@ class Robot(val robot: tileentity.Robot) extends Computer(robot) with RobotConte
|
||||
player.side.offsetZ * range)
|
||||
val hit = world.clip(origin, target)
|
||||
player.closestEntity[Entity]() match {
|
||||
case Some(entity@(_: EntityLivingBase | _: EntityMinecart)) if hit == null || player.getPosition(1).distanceTo(hit.hitVec) > player.getDistanceToEntity(entity) => new MovingObjectPosition(entity)
|
||||
case Some(entity@(_: EntityLivingBase | _: EntityMinecart)) if hit == null || world.getWorldVec3Pool.getVecFromPool(player.posX, player.posY, player.posZ).distanceTo(hit.hitVec) > player.getDistanceToEntity(entity) => new MovingObjectPosition(entity)
|
||||
case _ => hit
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package li.cil.oc.server.network
|
||||
import cpw.mods.fml.common.FMLCommonHandler
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import java.lang.reflect.{Method, InvocationTargetException}
|
||||
import java.util
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.api.network._
|
||||
import li.cil.oc.server.component
|
||||
@ -249,7 +248,7 @@ object Component {
|
||||
|
||||
def isTable(index: Int) =
|
||||
index >= 0 && index < count && (args(index) match {
|
||||
case value: util.Map[_, _] => true
|
||||
case value: java.util.Map[_, _] => true
|
||||
case value: Map[_, _] => true
|
||||
case value: mutable.Map[_, _] => true
|
||||
case _ => false
|
||||
@ -272,7 +271,7 @@ object Component {
|
||||
case _: java.lang.Double => "double"
|
||||
case _: java.lang.String => "string"
|
||||
case _: Array[Byte] => "string"
|
||||
case value: util.Map[_, _] => "table"
|
||||
case value: java.util.Map[_, _] => "table"
|
||||
case value: Map[_, _] => "table"
|
||||
case value: mutable.Map[_, _] => "table"
|
||||
case _ => value.getClass.getSimpleName
|
||||
|
@ -1,16 +1,87 @@
|
||||
package li.cil.oc.util
|
||||
|
||||
import com.naef.jnlua.{JavaFunction, LuaState}
|
||||
import com.naef.jnlua.{LuaType, JavaFunction, LuaState}
|
||||
import li.cil.oc.OpenComputers
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
import scala.collection.mutable
|
||||
import scala.language.implicitConversions
|
||||
import scala.math.ScalaNumber
|
||||
import scala.runtime.BoxedUnit
|
||||
|
||||
object ExtendedLuaState {
|
||||
|
||||
implicit def extendLuaState(state: LuaState) = new ExtendedLuaState(state)
|
||||
|
||||
class ExtendedLuaState(val state: LuaState) {
|
||||
def pushScalaFunction(f: (LuaState) => Int) = state.pushJavaFunction(new JavaFunction {
|
||||
class ExtendedLuaState(val lua: LuaState) {
|
||||
def pushScalaFunction(f: (LuaState) => Int) = lua.pushJavaFunction(new JavaFunction {
|
||||
override def invoke(state: LuaState) = f(state)
|
||||
})
|
||||
|
||||
def pushValue(value: Any) {
|
||||
(value match {
|
||||
case number: ScalaNumber => number.underlying
|
||||
case reference: AnyRef => reference
|
||||
case null => null
|
||||
case primitive => primitive.asInstanceOf[AnyRef]
|
||||
}) match {
|
||||
case null | Unit | _: BoxedUnit => lua.pushNil()
|
||||
case value: java.lang.Boolean => lua.pushBoolean(value.booleanValue)
|
||||
case value: java.lang.Byte => lua.pushNumber(value.byteValue)
|
||||
case value: java.lang.Character => lua.pushString(String.valueOf(value))
|
||||
case value: java.lang.Short => lua.pushNumber(value.shortValue)
|
||||
case value: java.lang.Integer => lua.pushNumber(value.intValue)
|
||||
case value: java.lang.Long => lua.pushNumber(value.longValue)
|
||||
case value: java.lang.Float => lua.pushNumber(value.floatValue)
|
||||
case value: java.lang.Double => lua.pushNumber(value.doubleValue)
|
||||
case value: java.lang.String => lua.pushString(value)
|
||||
case value: Array[Byte] => lua.pushByteArray(value)
|
||||
case value: Array[_] => pushList(value.zipWithIndex.iterator)
|
||||
case value: Product => pushList(value.productIterator.zipWithIndex)
|
||||
case value: Seq[_] => pushList(value.zipWithIndex.iterator)
|
||||
case value: java.util.Map[_, _] => pushTable(value.toMap)
|
||||
case value: Map[_, _] => pushTable(value)
|
||||
case value: mutable.Map[_, _] => pushTable(value.toMap)
|
||||
case _ =>
|
||||
OpenComputers.log.warning("Tried to push an unsupported value of type to Lua: " + value.getClass.getName + ".")
|
||||
lua.pushNil()
|
||||
}
|
||||
}
|
||||
|
||||
def pushList(list: Iterator[(Any, Int)]) {
|
||||
lua.newTable()
|
||||
var count = 0
|
||||
list.foreach {
|
||||
case (value, index) =>
|
||||
pushValue(value)
|
||||
lua.rawSet(-2, index + 1)
|
||||
count = count + 1
|
||||
}
|
||||
lua.pushString("n")
|
||||
lua.pushInteger(count)
|
||||
lua.rawSet(-3)
|
||||
}
|
||||
|
||||
def pushTable(map: Map[_, _]) {
|
||||
lua.newTable(0, map.size)
|
||||
for ((key: AnyRef, value: AnyRef) <- map) {
|
||||
if (key != null && key != Unit && !key.isInstanceOf[BoxedUnit]) {
|
||||
pushValue(key)
|
||||
pushValue(value)
|
||||
lua.setTable(-3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def toSimpleJavaObject(index: Int): AnyRef = lua.`type`(index) match {
|
||||
case LuaType.BOOLEAN => Boolean.box(lua.toBoolean(index))
|
||||
case LuaType.NUMBER => Double.box(lua.toNumber(index))
|
||||
case LuaType.STRING => lua.toByteArray(index)
|
||||
case LuaType.TABLE => lua.toJavaObject(index, classOf[java.util.Map[_, _]])
|
||||
case _ => null
|
||||
}
|
||||
|
||||
def toSimpleJavaObjects(start: Int) =
|
||||
for (index <- start to lua.getTop) yield toSimpleJavaObject(index)
|
||||
}
|
||||
|
||||
}
|
15
mcmod.info
@ -2,7 +2,20 @@
|
||||
{
|
||||
"modid": "OpenComputers",
|
||||
"name": "OpenComputers",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.0pre4a",
|
||||
"requiredMods": [
|
||||
"Forge@[9.11.1.940,)"
|
||||
],
|
||||
"dependencies": [
|
||||
"BuildCraft|Energy",
|
||||
"ComputerCraft",
|
||||
"IC2",
|
||||
"MineFactoryReloaded",
|
||||
"ProjRed|Transmission",
|
||||
"RedLogic",
|
||||
"ThermalExpansion"
|
||||
],
|
||||
"useDependencyInformation": "true",
|
||||
"credits" : "Inspired by a couple of other mods, most notably ComputerCraft.",
|
||||
"authors": ["Florian 'Sangar' Nücke", "Johannes 'Lord Joda' Lohrer"],
|
||||
"description": "This mod adds modular computers and robots that can be programmed in Lua.",
|
||||
|
@ -150,6 +150,15 @@ opencomputers {
|
||||
# list of registered users on the Lua side.
|
||||
# See also: `canComputersBeOwned`.
|
||||
maxUsernameLength: 32
|
||||
|
||||
# This setting is meant for debugging errors that occur in Lua callbacks.
|
||||
# Per default, if an error occurs and it has a message set, only the
|
||||
# message is pushed back to Lua, and that's it. If you encounter weird
|
||||
# errors or are developing an addon you'll want the stacktrace for those
|
||||
# errors. Enabling this setting will log them to the game log. This is
|
||||
# disabled per default to avoid spamming the log with inconsequentual
|
||||
# exceptions such as IllegalArgumentExceptions and the like.
|
||||
logCallbackErrors: false
|
||||
}
|
||||
|
||||
# Robot related settings, what they may do and general balancing.
|
||||
|