56 lines
2.3 KiB
C#
56 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using HutongGames.PlayMaker;
|
|
using UnityEngine;
|
|
|
|
namespace MSCO
|
|
{
|
|
/// <summary>
|
|
/// Admin-Cheats für den eigenen Spieler (Geld, Bedürfnisse). Nur aus dem Admin-Menü erreichbar, also nur für
|
|
/// Server-Admins bzw. den P2P-Host. Geld wird über MoneySync automatisch an alle weitergegeben.
|
|
/// </summary>
|
|
public static class Cheats
|
|
{
|
|
// Globale PlayMaker-Variablen des Spielers: Wert, auf den "auffüllen" sie setzt
|
|
static readonly KeyValuePair<string, float>[] Needs =
|
|
{
|
|
new KeyValuePair<string, float>("PlayerHunger", 0f),
|
|
new KeyValuePair<string, float>("PlayerThirst", 0f),
|
|
new KeyValuePair<string, float>("PlayerStress", 0f),
|
|
new KeyValuePair<string, float>("PlayerUrine", 0f),
|
|
new KeyValuePair<string, float>("PlayerFatigue", 0f),
|
|
new KeyValuePair<string, float>("PlayerDirtiness", 0f),
|
|
};
|
|
|
|
public static string AddMoney(float amount)
|
|
{
|
|
FsmFloat money = FsmVariables.GlobalVariables.FindFsmFloat("PlayerMoney");
|
|
if (money == null) return "Money not found (only works in the game)";
|
|
money.Value += amount;
|
|
return "+" + amount.ToString("0") + " MK (now " + money.Value.ToString("0") + " MK)";
|
|
}
|
|
|
|
public static string FillNeeds()
|
|
{
|
|
int done = 0;
|
|
foreach (KeyValuePair<string, float> need in Needs)
|
|
{
|
|
FsmFloat v = FsmVariables.GlobalVariables.FindFsmFloat(need.Key);
|
|
if (v == null) continue;
|
|
v.Value = need.Value;
|
|
done++;
|
|
}
|
|
return done > 0 ? "Hunger, thirst, stress, fatigue, bladder and dirt reset" : "Player needs not found (only works in the game)";
|
|
}
|
|
|
|
/// <summary>Eigenen Spieler an eine Position setzen (etwas darüber, damit er nicht im Boden steckt).</summary>
|
|
public static bool Teleport(Transform player, Vector3 position)
|
|
{
|
|
if (player == null) return false;
|
|
player.position = position + Vector3.up * 0.3f;
|
|
Rigidbody rb = player.GetComponent<Rigidbody>();
|
|
if (rb != null && !rb.isKinematic) rb.velocity = Vector3.zero;
|
|
return true;
|
|
}
|
|
}
|
|
}
|