Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Portals #9

Merged
merged 9 commits into from
Feb 12, 2017
Merged

Added Portals #9

merged 9 commits into from
Feb 12, 2017

Conversation

nihal111
Copy link
Member

@nihal111 nihal111 commented Feb 10, 2017

This adds portal blocks, which allow you to teleport from A to B.
There are two types of Portal blocks- blue and orange.

Activating Portals

Since there can exist many portal blocks in the world, a portal block needs to be activated to allow teleportation. To activate a portal block, it has to be interacted with by 'e' click. Activating a portal block, would deactivate previously activated portal block of the same color, i.e. no two portal blocks of same color can remain activated at once, so as to allow a discrete teleportation pathway.

Travelling through Portals

Once both the blue and orange portals are activated, you can travel/teleport thorugh them by jumping on top of the portal blocks. The portals are two-way, i.e. jumping through A will take you out of B and vice-versa.

Testing

  • give bluePortalBlock
  • give orangePoralBlock
  • Place one of each at different locations and activate both by 'e' click
  • Jump on top of anyone

Outstanding

  • Teleportation happens directly without testing if the player may get stuck at the new teleported location.
    Added a check to see if blocks around are free up till playerHeight
  • Check happens at CharacterMoveInputEvent, which can be optimized. This issue discusses more.
    Added an additional check inside to continue only if playerPosition has changed,
    gifrecord_2017-02-11_130214

@Cervator
Copy link
Member

Tested it out - code looks great and I get sensible notifications when activating the blocks, but for some reason I'm not actually triggering the teleport. Clearly you had it working at some point - am wondering if my workspace is bad or maybe the final bit of optimizing broke something? Maybe there was some stale code letting it still work using a less optimized approach?

In any case I'm sure that's easy to sort out. Let me know if you can confirm the latest working for you (try a rebuild if it does appear to work) and if so I'll have to see what's wrong on my side :-)

@nihal111
Copy link
Member Author

Yep, sorry, my mistake. I missed out a line which was required for the added optimization to work. I think I had it working on a debug mode when oldPosition was somehow already initialised, while I made changes to the code. Anyway, it should work now. :)

@Cervator
Copy link
Member

Tests out! Yay! :D

Thanks for the cool new functionality :-)

@Cervator Cervator merged commit c76b8c3 into Terasology:master Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants