GithubHelp home page GithubHelp logo

mflink3012 / spaceengineers-mod-teleportingsensors Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 341 KB

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

C# 100.00%
spaceengineers mod teleportation vscode steamworkshop

spaceengineers-mod-teleportingsensors's People

Contributors

mflink3012 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

kowlown stelzi79

spaceengineers-mod-teleportingsensors's Issues

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)

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.

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

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.

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.