public void OnVariableSet(DreamObject dreamObject, string varName, DreamValue value, DreamValue oldValue) { ParentType?.OnVariableSet(dreamObject, varName, value, oldValue); switch (varName) { case "fps": if (!value.TryGetValueAsInteger(out var fps)) { fps = 10; } _cfg.SetCVar(CVars.NetTickrate, fps); break; case "maxz": value.TryGetValueAsInteger(out var maxz); _dreamMapManager.SetZLevels(maxz); break; case "log": if (value.TryGetValueAsString(out var logStr)) { dreamObject.SetVariableValue("log", new DreamValue(_dreamRscMan.LoadResource(logStr))); } else if (!value.TryGetValueAsDreamResource(out _)) { dreamObject.SetVariableValue("log", new DreamValue(new ConsoleOutputResource())); } break; } }
public override void OnVariableSet(DreamObject dreamObject, string variableName, DreamValue variableValue, DreamValue oldVariableValue) { base.OnVariableSet(dreamObject, variableName, variableValue, oldVariableValue); switch (variableName) { case "fps": _cfg.SetCVar(CVars.NetTickrate, variableValue.GetValueAsInteger()); break; case "maxz": _dreamMapManager.SetZLevels(variableValue.GetValueAsInteger()); break; case "log": if (variableValue.TryGetValueAsString(out var logStr)) { dreamObject.SetVariableValue("log", new DreamValue(_dreamRscMan.LoadResource(logStr))); } else if (!variableValue.TryGetValueAsDreamResource(out _)) { dreamObject.SetVariableValue("log", new DreamValue(new ConsoleOutputResource())); } break; } }