Mechanica

Mechanica

评价数不足
Guide and list of game commands
由 Oignontom8283 制作
This guide lists and describes the use of commands for the game Mechanica (>= v1.2.3.2).
   
奖励
收藏
已收藏
取消收藏
Guide and list of game commands
Hello, Mechanica community!

I noticed a lack of documentation on the game's commands. So here is a list that I directly extracted from the game code, containing all available vanilla commands in Mechanica (v1.2.3.2).

/unlock <research name>
Instantly unlocks a technology research.

Arguments:
  • <research name>: Exact name (case insensitive)

Notes:

Example:
/unlock Intermediate Weapons
/clearitems
Clears all items stored in storage units.

Arguments:
No arguments required.

Example:
/clearitems
/replenishresources
/replenishresources
Refills all depleted natural resources.

Arguments:
No arguments required.

Example:
/replenishresources
/settime <time>
Changes the world's time.

Arguments:
  • <time>: keyword (morning, noon, night, etc.) or 24h format (1330)

Argument values:
  • morning → 0600
  • midday, noon, day → 1200
  • afternoon, evening → 1600
  • night, midnight → 2359

Notes:
  • Time between 0000 and 2400
  • Minutes must be valid (e.g.: 1465 = error)

Examples:
/settime morning # → 600 /settime 1800 # → 18:00 /settime midnight # → 2359
/teleport <x> <y> <z>
Teleports the player to a given position.

Arguments:
  • <x>, <y>, <z>: float coordinates, from -10000.00 to 10000.00

  • Teleporting beyond 10,000 or below -10,000 is not possible
  • Teleporting to another player is not possible. Teleporting another player, either. Teleporting another player to a position, either.
  • To see your coordinates, they are visible at the top right when in programming mode.

Example:
/teleport 0.12 5 10.457
/kick <player name>
Kicks a player from the server.

Argument:
  • <player name>: Exact or partial name

Notes:
  • Works only in multiplayer
  • You cannot kick yourself
  • Error if the name is ambiguous or does not exist

Example:
/kick Jean
/startmusic
Starts the background music if it is not already active.

Arguments:
No arguments required.

Notes:
  • Does not start the background music if it is already active.

Example:
/startmusic
/stopmusic
Stops the background music.

Arguments:
No arguments required.

Example:
/stopmusic
/killbots
Destroys all enemy bots present in the world.

Arguments:
No arguments required.

Notes:
  • Does not destroy robot drop ships.
  • Killed robots drop loot.

Example:
/killbots
🦺 Game code
For those interested, here is the piece of code that manages the parsing of commands in the game.




protected void ParseCommand(string message) { Debug.Log("Parsing command: " + message); message = message.Remove(0, 1); List<string> list = new List<string>(message.Split(new char[] { ' ' })); for (int i = 0; i < list.Count; i++) { list = list.ToLower();
}
string text = list[0];
uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
if (num <= 2423865438U)
{
if (num <= 1449533269U)
{
if (num != 189702654U)
{
if (num == 1449533269U)
{
if (text == "unlock")
{
if (list.Count == 1)
{
this.CreateSystemMessage("Please specify which research to unlock", false);
return;
}
string text2 = string.Empty;
for (int j = 1; j < list.Count; j++)
{
if (j == 1)
{
text2 = list[j];
}
else
{
text2 = text2 + " " + list[j];
}
}
if (Singleton<ResearchManager>.Instance.GetResearchGroup(text2) == null)
{
this.CreateSystemMessage("Cannot find research called '" + text2 + "'", false);
return;
}
Singleton<ResearchManager>.Instance.UnlockResearch(text2);
this.CreateSystemMessage("Success - '" + Singleton<ResearchManager>.Instance.GetResearchGroup(text2).groupName + "' is now unlocked", false);
return;
}
}
}
else if (text == "clearitems")
{
Singleton<StorageUnitManager>.Instance.DestroyAllStorageUnits();
this.CreateSystemMessage("Success - all items have been removed", false);
return;
}
}
else if (num != 2004391066U)
{
if (num == 2423865438U)
{
if (text == "replenishresources")
{
Singleton<NaturalResourceManager>.Instance.ReplenishResources();
this.CreateSystemMessage("Success - all natural resources have been fully replenished", false);
return;
}
}
}
else if (text == "settime")
{
if (list[1] == "morning")
{
Singleton<TimeManager>.Instance.SetTime(600);
this.CreateSystemMessage("Time set to 600", false);
return;
}
if (list[1] == "midday" || list[1] == "noon" || list[1] == "day")
{
Singleton<TimeManager>.Instance.SetTime(1200);
this.CreateSystemMessage("Time set to 1200", false);
return;
}
if (list[1] == "afternoon" || list[1] == "evening")
{
Singleton<TimeManager>.Instance.SetTime(1600);
this.CreateSystemMessage("Time set to 1600", false);
return;
}
if (list[1] == "night" || list[1] == "midnight")
{
Singleton<TimeManager>.Instance.SetTime(2359);
this.CreateSystemMessage("Time set to 2359", false);
return;
}
bool flag = true;
int num2 = 0;
if (!this.IsDigitsOnly(list[1]))
{
flag = false;
}
if (int.TryParse(list[1], out num2))
{
if (num2 % 100 > 60)
{
flag = false;
}
if (num2 > 2400)
{
flag = false;
}
if (num2 < 0)
{
flag = false;
}
}
else
{
flag = false;
}
if (flag)
{
Singleton<TimeManager>.Instance.SetTime(num2);
this.CreateSystemMessage("Time set to " + num2, false);
return;
}
this.CreateSystemMessage("Invalid time format - please use 24-hour format", false);
return;
}
}
else if (num <= 3323728671U)
{
if (num != 3289626814U)
{
if (num == 3323728671U)
{
if (text == "kick")
{
if (list.Count == 1)
{
this.CreateSystemMessage("Please specify which player to kick", false);
return;
}
string text3 = string.Empty;
for (int k = 1; k < list.Count; k++)
{
if (k == 1)
{
text3 = list[k];
}
else
{
text3 = text3 + " " + list[k];
}
}
List<NetworkedPlayer> playerByName = NetworkedGameManager.Instance.GetPlayerByName(text3);
if (playerByName.Count <= 0)
{
this.CreateSystemMessage("Cannot find player '" + text3 + "'", false);
return;
}
if (playerByName.Count != 1)
{
this.CreateSystemMessage("Several players match the description '" + text3 + "'", false);
return;
}
if (!playerByName[0].photonView.IsMine)
{
playerByName[0].KickFromGame("Kicked from game by host");
return;
}
this.CreateSystemMessage("You cannot kick yourself from the game", false);
return;
}
}
}
else if (text == "teleport")
{
bool flag2 = false;
if (list.Count == 4)
{
float num3 = 0f;
float num4 = 0f;
float num5 = 0f;
if (float.TryParse(list[1], out num3) && float.TryParse(list[2], out num4) && float.TryParse(list[3], out num5))
{
flag2 = true;
num3 = Mathf.Clamp(num3, -10000f, 10000f);
num4 = Mathf.Clamp(num4, -10000f, 10000f);
num5 = Mathf.Clamp(num5, -10000f, 10000f);
Singleton<PlayerMovement>.Instance.transform.position = new Vector3(num3, num4, num5);
this.CreateSystemMessage(string.Concat(new object[]
{
"Teleported to ",
num3,
" ",
num4,
" ",
num5
}), false);
}
}
if (!flag2)
{
this.CreateSystemMessage("Invalid position format: please type coordinates as X Y Z", false);
return;
}
return;
}
}
else if (num != 3718563490U)
{
if (num != 3838881355U)
{
if (num == 4226974836U)
{
if (text == "stopmusic")
{
if (Singleton<MusicManager>.Instance.isPlaying)
{
Singleton<MusicManager>.Instance.StopTrack();
this.CreateSystemMessage("Success - music is no longer playing", false);
return;
}
this.CreateSystemMessage("There is no music currently playing", false);
return;
}
}
}
else if (text == "killbots")
{
Singleton<RobotsManager>.Instance.KillAllBots();
this.CreateSystemMessage("Success - all enemy bots have been destroyed", false);
return;
}
}
else if (text == "startmusic")
{
if (!Singleton<MusicManager>.Instance.isPlaying)
{
Singleton<MusicManager>.Instance.PlayTrack();
this.CreateSystemMessage("Success - music is now playing", false);
return;
}
this.CreateSystemMessage("Music is already playing", false);
return;
}
this.CreateSystemMessage("Command '" + text + "' not recognized", false);
}[/code]