Giter Club home page Giter Club logo

spaceengineers-mod-teleportingsensors's Introduction

Thumbnail

Short description

A mod for Space Engineers that allows using sensors for teleportation.

Usage

  1. Enable the mod TeleportingSensor in the savegame settings.

  2. Create two sensors somewhere at two different places.

  3. Adjust the both sensor ranges like:

     Left extent  : 0.1 m
     Right extent : 0.1 m
     Bottom extent: 0.1 m
     Top extent   : 0.1 m
     Back extent  : 0.1 m
     Front extent : 1.0 m
    
  4. Edit the Custom Data of the first one:

     teleporter.name=Teleporter 1
     teleporter.target=Teleporter 2
    
  5. Edit the Custom Data of the second one:

     teleporter.name=Teleporter 2
     teleporter.target=Teleporter 1
    
  6. Reach 1.0 meters of range to the front of one sensor.

  7. Bzzzzt! Find your self 3.0 meters away from the other sensor.

Building simple teleporter gates

  1. Build two gates like on the thumbnail:

     2x steel blocks vertically on the left side
     1x block space
     2x steel blocks vertically on the right side
     1x rounded corner block on the top of each pillar pointing to the center
     1x steel block between the rounded corner blocks
     1x sensor below the center steel block
     1x light on the inner side of the center space
     2x LCDs on the center block showing the destination
    
  2. Adjust the sensors ranges:

     Left extent  : 1.0 m
     Right extent : 1.0 m
     Bottom extent: 1.0 m
     Top extent   : 1.0 m
     Back extent  : 0.1 m
     Front extent : 4.5 m
    
  3. Edit the Custom Data of the first one:

     teleporter.name=Teleporter 3
     teleporter.target=Teleporter 4
    
  4. Edit the Custom Data of the second one:

     teleporter.name=Teleporter 4
     teleporter.target=Teleporter 3
    
  5. Step into the gate.

  6. Bzzzzt! Find your self in the other teleporter gate.

  7. Step out quickly, or you will get into a teleporter loop. Improve this with teleporter.offset!

IMPORTANT: Make sure there is no space at the beginning of the lines. You will get them by accident, if you just copy and paste the code from here.

Custom Data (Properties)

Properties on the sensors

The sensors which shall function as a teleporter need to be configured via its Custom Data.

teleporter.name (string)

This string-property will define a unique(!) name for the teleporter to identify and use it on another teleporting sensor.

IMPORTANT: If this is not given, the sensor will not be identified as a teleporting sensor!

Example

teleporter.name=Teleporter 1

teleporter.target (string)

This string-property will define the name of a teleporting sensor to teleport to. This has to be set on the target sensors Custom Data via teleporter.name.

This is optional. If not given, the sensor will be a receive-only target.

Example

teleporter.target=Teleporter 2

teleporter.offset (float,float,float)

This property is a comma-separated vector/list of float-values with 3 entries defining an offset 3 meters in front of the sensor to teleport the player to.

This is very useful to adjust the teleportation spots to break teleporter loops or to place the player on a specific block away from the sensor.

IMPORTANT: There is no limitation in this offset, so one could use it to teleport the player where ever one likes. To other planets, asteroids or even into empty space. So be very sensitive with this!

The first entry will define the offset in meters on the x-axis, the second the offset on the y-axis and the third the offset on the z-axis.

How to determine a good offset

  1. Stand right before the (disabled) teleporting sensor.
  2. Make a new GPS-marker using New from current position
  3. Go away from the sensor to the position you like to use
  4. Make a second GPS-marker using New from current position
  5. Take the coordinates from the first marker and the second marker and calculate the difference.
  6. Enter the offset (maybe rounded) to this property
  7. Test it
  8. Adjust it

Example

teleporter.offset=0.0,5.0,0.0

The result of the example would be: sensor.y + sensor.front.y * 3.0 m + 5.0 m

That's between 5 and 8 meters away from the sensors front side on the y-axis (depending on the sensors direction / alignment with the y-axis).

Tested

With Space Engineers Version 1.203.630 b0 default in Survival with following mods active:

With Space Engineers Version 1.203.630 b0 default in Multiplayer with following mods active:

For Multiplayer there is one (yet) known issue: issues/6

Steam Workshop

https://steamcommunity.com/sharedfiles/filedetails/?id=2451488811

spaceengineers-mod-teleportingsensors's People

Contributors

mflink3012 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

kowlown stelzi79

spaceengineers-mod-teleportingsensors's Issues

Refactor the code to be modular

  • Create an abstract class TeleporterEntity with attributes: Name, Target, Offset, methods: Teleport
  • Create a class TeleporterNetwork, which will manage the teleporters (register, unregister, find, etc.)
  • Create a utility class Properties, which will read the properties from a string (move ReadProperties here)
  • Create a utility class MessagePrinter, which will hold PrintMessage and it's derivates
  • Create a utility class TypeParser, which will hold ParseFloat and ParseVector3D, etc.
  • Let the LogicComponent extend TeleporterEntity
  • Let the LogicComponent use all new classes and drop out not needed methods

NullReferenceException when trying to retrieve players in multiplayer

Exception occurred: System.NullReferenceException: Object reference not set to an instance of an object.
at SpaceEngineers.Mod.TeleportingSensor.LogicComponent.<>c__DisplayClass12_0.b__0(IMyPlayer p)
at Sandbox.Game.Multiplayer.MyPlayerCollection.VRage.Game.ModAPI.IMyPlayerCollection.GetPlayers(List'1 players, Func'2 collect)
at SpaceEngineers.Mod.TeleportingSensor.LogicComponent.UpdateBeforeSimulation100()
at VRage.Game.Components.MyGameLogicComponent.VRage.Game.Entity.EntityComponents.Interfaces.IMyGameLogicComponent.UpdateBeforeSimulation100(Boolean entityUpdate)
at Sandbox.Game.Entities.Cube.MyFunctionalBlock.UpdateBeforeSimulation100()
at Sandbox.Game.Entities.MyParallelEntityUpdateOrchestrator.UpdateBeforeSimulation100()
at Sandbox.Game.Entities.MyParallelEntityUpdateOrchestrator.DispatchBeforeSimulation()
at Sandbox.Game.Entities.MyEntities.UpdateBeforeSimulation()
at Sandbox.Game.World.MySector.UpdateBeforeSimulation()
at Sandbox.Game.World.MySession.UpdateComponents()
at Sandbox.Game.World.MySession.Update(MyTimeSpan updateTime)
at Sandbox.MySandboxGame.Update()
at Sandbox.Engine.Platform.Game.UpdateInternal()
at Sandbox.Engine.Platform.Game.RunSingleFrame()
at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass11_0.b__0()
at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
at Sandbox.Engine.Platform.Game.RunLoop()
at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
at SpaceEngineers.MyProgram.Main(String[] args)

Un- and register again after renaming

Currently the mod will register the teleporting sensors in the TeleporterNetwork, but will not unregister it after changing teleporter.name.

Because the TeleporterNetwork will still hold the object with it's old name, this may lead to problems with

  • exchanging names between teleporters (name already in use)
  • memory leaks (memory consumption will increase)

So the TeleportingSensor should detect changes in names, unregister itself with the old name and register itself with the new name.

Game crash and KeyNotFoundException, when entering non-existing target

The game will crash and give the following exception in the logs:

Exception occurred: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at SpaceEngineers.Mod.TeleportingSensor.LogicComponent.UpdateBeforeSimulation100()
at VRage.Game.Components.MyGameLogicComponent.VRage.Game.Entity.EntityComponents.Interfaces.IMyGameLogicComponent.UpdateBeforeSimulation100(Boolean entityUpdate)
at Sandbox.Game.Entities.Cube.MyFunctionalBlock.UpdateBeforeSimulation100()
at Sandbox.Game.Entities.MyParallelEntityUpdateOrchestrator.UpdateBeforeSimulation100()
at Sandbox.Game.Entities.MyParallelEntityUpdateOrchestrator.DispatchBeforeSimulation()
at Sandbox.Game.Entities.MyEntities.UpdateBeforeSimulation()
at Sandbox.Game.World.MySector.UpdateBeforeSimulation()
at Sandbox.Game.World.MySession.UpdateComponents()
at Sandbox.Game.World.MySession.Update(MyTimeSpan updateTime)
at Sandbox.MySandboxGame.Update()
at Sandbox.Engine.Platform.Game.UpdateInternal()
at Sandbox.Engine.Platform.Game.RunSingleFrame()
at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass11_0.b__0()
at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
at Sandbox.Engine.Platform.Game.RunLoop()
at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
at SpaceEngineers.MyProgram.Main(String[] args)

when giving a non-existent target to a sensors Custom Data.

Reset offset, if offset has been removed from properties

If one gives an offset to a sensors via teleporter.offset, closes the Custom Data dialog and then removes it with editing Custom Data again, the teleporter will not reset the offset internaly.
This will lead to the situation, that the last set offset will still be used when teleporting from a linked teleporter.

Workaround:
Give teleporter.offset=0,0,0.

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.