public bool RunCmd(string cmdName) { if (string.IsNullOrEmpty(cmdName)) { return(false); } GlobalPlayer ply = this.GPlayer; if (ply == null || ply.CmdCfg == null) { return(false); } Cmd_Command cmd = ply.CmdCfg.GetCommand(cmdName); if (cmd == null) { return(false); } bool mustCheckTrigger; AI_Command aiCmd = ply.CmdCfg.GetAICommand(cmd, this, out mustCheckTrigger); if (aiCmd == null || (mustCheckTrigger && !aiCmd.CanTrigger(this, cmdName))) { return(false); } CNSConfig cnsCfg = ply.CnsCfg; if (cnsCfg == null) { if (ply.LuaCfg != null) { cnsCfg = ply.LuaCfg.CnsCfg; if (cnsCfg == null) { return(false); } } else { return(false); } } int id; if (!cnsCfg.GetCNSStateId(aiCmd.value, out id)) { return(false); } return(ChangeState((PlayerState)id, true)); }
public bool IsCommandInputKeyOk(string cmdName) { if (string.IsNullOrEmpty(cmdName)) { return(false); } GlobalPlayer ply = this.GPlayer; if (ply == null || ply.CmdCfg == null) { return(false); } Cmd_Command cmd = ply.CmdCfg.GetCommand(cmdName); if (cmd == null) { return(false); } bool ret = PlayerControls.GetInstance().InputCtl.CheckPlayerCmdCommandInputOk(this.PlyType, cmd); return(ret); }