midspace / Space-Engineers-Admin-script-mod

Modding script for Space Engineers with dozens of Admin commands for creating game scenarios or supporting servers.
44 stars 13 forks source link

Interesting SE APIs.... #105

Open midspace opened 9 years ago

midspace commented 9 years ago

A list of interesting methods from the SE API that may be of use. These may or may not work in the Mod API, and need to be investigated before use.

VRage.Utils.MyLog.Default.WriteLine("####### HELLO WORLD ######"); Confirmed as working.

MyRemoteControl.ForceReleaseControl() MyRemoteControl.GetNaturalGravity() MyRemoteControl.ClearWaypoints() MyRemoteControl.AddWaypoint(...) MyRemoteControl.SetAutoPilotEnabled(bool enabled)

MyRemoteControl.GetNearestPlayer() Is only supposed to work for NPC. It isn't faction dependant.

MySession.Static.Players.IdentityIsNpc() MySession.Static.Players.GetOnlinePlayers() MySession.Static.Players.GetAllPlayers() MySession.Static.Players.GetAllIdentities() MySession.Static.Players.KillPlayer() MySession.Static.Players.RevivePlayer()

midspace commented 9 years ago

There is a Console, that can be activated by Alt~

Commands can start with Character. Console. Entity.

Look at classes MyCommandCharacter, MyCommandEntity and MyCommandConsole which inherit from MyCommand to register these commands. There is a tooltip that appears after pressing ".". There might be some use, or reuse of this.

zrisher commented 9 years ago

MyRemoteControl.GetNearestPlayer() Is only supposed to work for NPC. It isn't faction dependant.

I've heard people are changing the ownership of a couple blocks on their ship to Space Pirates and then they can use this via PB to locate people. As long as its closer to them than you (so you need antenna network), it'll return them. Pretty crazy bug.

midspace commented 9 years ago

There are hidden chat message commands that are accepted by Dedicated Servers. +save to save the game. +uban to unban a SteamId.

The MyDedicatedBattleServer has an additional command. +reload which I believe will restart the server.

When typed into the Client, it will appear like a normal chat message and not respond. But the server does react to the +save command.