internal NPCCheckActionEventArgs NPCCheckActionEvent(Farmer who, NPC npc) { var args = new NPCCheckActionEventArgs { NPC = npc, Farmer = who, Cancelled = false }; if (NPCCheckAction != null) { NPCCheckAction.Invoke(this, args); } return(args); }
private void Events_NPCCheckAction(object sender, NPCCheckActionEventArgs args) { if (args.Cancelled) { return; //someone else already ate this one } if (Game1.player.ActiveObject == null) //empty hands to sleep { if (!NoSleep.Contains(args.NPC.Name) && args.NPC.isSleeping) { if (Attempts.Contains(args.NPC.Name)) { return; //already tried. no means no. } args.Cancelled = true; Game1.currentLocation.lastQuestionKey = "sleepover"; Game1.currentLocation.createQuestionDialogue("Sleepover with " + args.NPC.Name + "?", new[] { new Response(args.NPC.Name, "Yes"), new Response(".nope.", "No") }, QuestionCallback); } } }