public static void AddInteractionsPhone(PhoneSmart phone) { if (phone != null) { foreach (InteractionObjectPair interaction in phone.Interactions) { if (interaction.InteractionDefinition.GetType() == GottaBlogAboutSewing.Singleton.GetType()) { return; } } if (phone.ItemComp.InteractionsInventory != null) { foreach (InteractionObjectPair iop in phone.ItemComp.InteractionsInventory) { if (iop.InteractionDefinition.GetType() == GottaBlogAboutSewing.Singleton.GetType()) { return; } } } phone.AddInteraction(GottaBlogAboutSewing.Singleton); phone.AddInventoryInteraction(GottaBlogAboutSewing.Singleton); } }
private static ListenerAction OnObjectChanged(Event e) { Computer computer = e.TargetObject as Computer; if (computer != null) { AddInteractionsComputer(computer); } PhoneSmart phone = e.TargetObject as PhoneSmart; if (phone != null) { AddInteractionsPhone(phone); } PhoneFuture phone5 = e.TargetObject as PhoneFuture; if (phone != null) { AddInteractionsPhone(phone5); } return(ListenerAction.Keep); }