Giter Site home page Giter Site logo

mcelevator-with-createandcc's Introduction

一种基于机械动力0.3和ComputerCraft电脑的电梯设计

致谢

感谢Cod0fDuty提供的电梯内电脑屏幕触屏选层设计。

Cod0fDutyYoutube主页:Cod0fDuty

电脑屏幕触屏选择链接

触屏选择源码

使用方法

建议配合B站教学视频使用,文字有点抽象了(((((如果传送门没亮就是教学视频还没做完

传送门

1.MC中自己搭建好一个电梯间和电梯本体。同时准备(4+楼层数)个高级电脑

2.选定一个作为控制齿轮反转的电脑(computer3),选择一个作为控制齿轮开关的电脑(computer4),选择一个作为**信息处理的电脑(computer2),选择一个作为电梯内玩家选层的电脑(computer1),其他均为放置在对应楼层的电脑(computer5,6,7,....)。

3.不同的computer按照下面的对应关系,使用以下指令,直接将代码从pastebin上复制下来。

computer1-----pastebin get vvV3LdE0 startup

computer2-----pastebin get xT2S4feR startup

computer3-----pastebin get qvsfCPpT startup

computer4-----pastebin get sG16BBBg startup

computer5,6,7,8-----pastebin get Y4sVEzEx startup

其中computer1的配置按照Cod0fDuty的教程自己配置好,输入两个参数就可以了。

computer5,6,7,...对应楼层的电脑需要修改代码中的CurrentFloor的值为对应楼层的值。楼层默认从第零层开始。

对于computer2中的代码请确保CurFloorNum变量的值和你实际在的楼层是一致的。

然后让电脑运行startup程序即可,或者重启电脑也可以(毕竟是开机自启动的)

注意事项

  1. 请注意电脑id,电脑id一定要对应,如果有变更,那么在代码中对应的api中的参数也需要变化。

  2. 使用电脑前记得label打标签,不然当前电脑信息不会保存的。

  3. computer1的wifi可以贴任意地方,computer2,3,4的只能贴左边,computer5,6,7...的只能贴下边。同时computer3,4的红石能量输出口为后边,computer5,6,7...的红石能量接收口为左边和后边。左边的是玩家呼叫电梯的输入口,后面的需要连接Create里面的接触式红石发生器。

  4. 如果你看得懂一点lua代码,那么你完全可以自己修改一下wifi的输入口和红石能量的输入口,如果当前设计不利于你的建筑的话QWQ

  5. 本电梯设计是基于Cod0fDuty实现的触屏选层来实现的。

  6. 我所使用的机械动力版本是0.3,实验环境是在机械动力官方整合包

  7. 电梯运行没有类似SCAN的电梯调度算法,哪一层按了按钮就去哪一层,后来按的会覆盖之前按的目标层。

实现原理

实现电梯其实就是做三个步骤:1.在电梯内前往某一层 2.呼叫电梯 3.在目的层停下。

1.在电梯内前往某一层

通过在电梯内按下某一层之后,让**处理电脑比较当前层数和目标层数的大小,如果目标层大于当前层,那么让齿轮正转(或者反转),反之亦然,从而实现电梯向目的层前进

**处理电脑通过rednet发送消息给computer3从而控制齿轮的正反转

2.在电梯外呼叫电梯

类似于在电梯内前往某一层的过程,只不过不是computer1发送消息给**处理电脑,而是对应楼层的电脑发送消息给**处理电脑,然后让**处理电脑进行如第一步的处理。

3.在目的层停下

通过Create里面的接触式红石发生器,当电梯每次抵达一个层的时候,会发送红石信号给对应层的电脑,电脑接收到红石信号后发送当前电梯的位置给**处理电脑,由**处理电脑来比较当前位置和目的层是否一致。如果一致则发送齿轮停转的消息给computer4来关闭齿轮。

后记

写readme的时候我突然发现,用于控制齿轮正反转和开关的电脑室完全可以不需要的,直接让**处理电脑来发送对应的红石信号不就可以了吗(?)这里可以简化一下的

mcelevator-with-createandcc's People

Contributors

ausertdream avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.