private void Start() { Globals.validgamepath = Cvar.Get("validgamepath", "0", null, CvarType.HIDDEN); Globals.validmodname = Cvar.Get("validmodname", "0", null, CvarType.HIDDEN); Globals.gamepath = Cvar.Get("gamepath", gamepath, OnCvarGamepathSet, CvarType.DEFAULT); Globals.modname = Cvar.Get("modname", modname, OnCvarModnameSet, CvarType.DEFAULT); OnCvarGamepathSet(Globals.gamepath); OnCvarModnameSet(Globals.modname); Globals.map = Cvar.Get("map", mapname, null, CvarType.HIDDEN); Cvar.Add("maploaded", "0", null, CvarType.HIDDEN); CommandManager.RegisterCommand("map", Map_c, "loads a map file. Format: map <mapname> <optional modname>.", CommandType.normal); CommandManager.RegisterCommand("writeconf", ConfigManager.SaveConfig, "writes a config file. Format: writeconf <optional config name>", CommandType.normal); CommandManager.RegisterCommand("loadconf", ConfigManager.LoadConfig, "loads a config file. Format: loadconf <optional config name>", CommandType.normal); CommandManager.RegisterCommand("printmapinfo", BSPFile.Printmapinfo_c, "prints information about the current map", CommandType.normal); }
private void Awake() { //register commands CommandManager.RegisterCommand("recall", Recall_c, "resets player position", CommandType.normal); CommandManager.RegisterCommand("store", Store_c, "stores player position", CommandType.normal); CommandManager.RegisterCommand("remstore", RemStore_, "removes stored player position", CommandType.normal); CommandManager.RegisterCommand("setfps", SetFps_c, "sets framerate cap", CommandType.normal); CommandManager.RegisterCommand("gamemode", PlayerState.GameMode_c, "sets game mode (fly, spectating, training, timeattack or 0, 1, 2, 3)", CommandType.normal); CommandManager.RegisterCommand("noclip", PlayerState.Noclip_c, "toggles noclip cvar", CommandType.normal); //add cvars Cvar.Add("noclip", "0", PlayerState.OnCvarNoclipSet, CvarType.DEFAULT); smoothCamera = Cvar.Get("smooth_camera", "0"); mouseSensitivity = Cvar.Get("mouse_sensitivity", "1.35"); Globals.flySpeed = Cvar.Get("flyspeed", "300"); //default movement binds BindManager.SetBind(KeyCode.A, "+left", BindType.hold, false); BindManager.SetBind(KeyCode.S, "+back", BindType.hold, false); BindManager.SetBind(KeyCode.D, "+right", BindType.hold, false); BindManager.SetBind(KeyCode.W, "+forward", BindType.hold, false); BindManager.SetBind(KeyCode.Mouse1, "+jump", BindType.hold, false); BindManager.SetBind(KeyCode.LeftControl, "+duck", BindType.hold, false); //store and recall BindManager.SetBind(KeyCode.R, "recall", BindType.toggle, false); BindManager.SetBind(KeyCode.Q, "store", BindType.toggle, false); BindManager.SetBind(KeyCode.P, "remstore", BindType.toggle, false); //state binds BindManager.SetBind(KeyCode.Alpha1, "gamemode flying", BindType.toggle, false); BindManager.SetBind(KeyCode.Alpha2, "gamemode training", BindType.toggle, false); BindManager.SetBind(KeyCode.Alpha3, "gamemode timeattack", BindType.toggle, false); BindManager.SetBind(KeyCode.N, "noclip", BindType.toggle, false); //default fps binds BindManager.SetBind(KeyCode.Z, "setfps 66", BindType.toggle, false); BindManager.SetBind(KeyCode.X, "setfps 22", BindType.toggle, false); BindManager.SetBind(KeyCode.C, "setfps 120", BindType.toggle, false); BindManager.SetBind(KeyCode.V, "setfps 27", BindType.toggle, false); BindManager.SetBind(KeyCode.B, "setfps 90", BindType.toggle, false); BindManager.SetBind(KeyCode.G, "setfps 200", BindType.toggle, false); }
// Start is called before the first frame update void Start() { OnCvarFovSet(Cvar.Get("fov", "100", OnCvarFovSet, CvarType.DEFAULT)); maxfps = Cvar.Get("maxfps", "120", OnCvarFpsSet, CvarType.DEFAULT); OnCvarFpsSet(maxfps); afps = Cvar.Get("afps", "500", OnCvarAfpsSet, CvarType.DEFAULT); OnCvarAfpsSet(afps); Globals.async = Cvar.Get("async", "1", OnCvarAsyncSet, CvarType.DEFAULT); OnCvarAsyncSet(Globals.async); Cvar.Add("vid_antialiasing", "0", OnCvarAntialiastingSet, CvarType.DEFAULT); Cvar.Add("vid_brightness", "0", OnCvarVidBrightnessSet, CvarType.DEFAULT); Cvar.Add("vid_gamma", "0", OnCvarVidGammaSet, CvarType.DEFAULT); Cvar.Add("vid_gain", "0", OnCvarVidGainSet, CvarType.DEFAULT); OnCvarLightmapSet(Cvar.Get("lightmap_mix", "1", OnCvarLightmapSet, CvarType.DEFAULT)); OnCvarLightnessSet(Cvar.Get("lightsomeness", "15", OnCvarLightnessSet, CvarType.DEFAULT)); }
private void Awake() { if (Instance) { DestroyImmediate(gameObject); } else { Instance = this; } #endregion CommandManager.RegisterCommand("+fire", Fire_c, "fires the weapon if player has any", CommandType.normal); BindManager.SetBind(KeyCode.Mouse0, "+fire", BindType.hold, false); weaponSlots = new Weapon[Enum.GetNames(typeof(WeaponClassname)).Length]; #if DEBUG Cvar.Add("debug_rocketmult", "1"); CommandManager.RegisterCommand("debug_giverocket", DebugGiveRocket, "debug only command for giving rocket launcher to player", CommandType.normal); #endif }
private void Start() { Cvar.Add("volume", "1", OnCvarVolumeChanged, CvarType.DEFAULT); }