public DreamValue OnVariableGet(DreamObject dreamObject, string varName, DreamValue value) { return(varName switch { "type" => new DreamValue(dreamObject.ObjectDefinition.Type), "parent_type" => new DreamValue(_dreamManager.ObjectTree.GetTreeEntry(dreamObject.ObjectDefinition.Type) .ParentEntry.ObjectDefinition.Type), "vars" => new DreamValue(DreamListVars.Create(dreamObject)), _ => ParentType?.OnVariableGet(dreamObject, varName, value) ?? value });
public override DreamValue OnVariableGet(DreamObject dreamObject, string variableName, DreamValue variableValue) { if (variableName == "type") { return(new DreamValue(dreamObject.ObjectDefinition.Type)); } else if (variableName == "parent_type") { return(new DreamValue(_dreamManager.ObjectTree.GetTreeEntry(dreamObject.ObjectDefinition.Type).ParentEntry.ObjectDefinition.Type)); } else if (variableName == "vars") { return(new DreamValue(DreamListVars.Create(dreamObject))); } else { return(base.OnVariableGet(dreamObject, variableName, variableValue)); } }