public void GiveInventory(Command.Exec e) { string itemName = e.tok.GetToken(1).ToString(); //GetStr(1, Commander.Instance.GetScope()); //Show.Log("Give " + itemName + " (" + e.tok.ToString() + ")"); Inventory inv = main; GameObject itemObj = inv.RemoveItem(itemName); if (itemObj != null) { if (e.tok.TokenCount == 2 || e.tok.GetToken(2).ToString() == ";") { UnityEngine.Object.Destroy(itemObj); //Show.Log("giving to nobody... destroying"); //e.print("destroying " + itemName); } else { Token recieptiant = e.tok.GetToken(2); string message = "TODO give " + itemObj + " to " + recieptiant; Show.Warning(message); e.print(message); } } else { string message = "missing " + itemName + ". have: " + inv.GetItems().JoinToString(", ", go => go.name); Show.Warning(message); e.print(message); } }
public void Update(Command.Exec inst) //, CmdLine_base cmd) { bool somethingPrinted = false; if (log != null) { while (log.Count > 0) { //cmd.HandleLog(log[0], "", CmdLine_base.LogType.Log); inst.print(log[0]); log.RemoveAt(0); somethingPrinted = true; } } if (err != null) { while (err.Count > 0) { //cmd.HandleLog(err[0], "", CmdLine_base.LogType.Error); inst.print(err[0]); err.RemoveAt(0); somethingPrinted = true; } } string s = null; if (inst != null) { s = inst.tok.str; if (s != null) { DoCommand(s, inst.src); } } if (string.IsNullOrEmpty(s) && string.IsNullOrEmpty(currentCommand) && (somethingPrinted || promptNeedsRedraw)) { //cmd.NeedToRefreshUserPrompt = true; } //if (cmd.NeedToRefreshUserPrompt) //{ // promptNeedsRedraw = false; //} }