-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfleshy_pet.cs
69 lines (45 loc) · 2.05 KB
/
fleshy_pet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using XRL.Core;
using XRL.World.Parts.Mutation;
namespace XRL.World.Parts
{
[Serializable]
public class Books_FleshyPet : IPart
{
public string NamePrefix = "{{c|mechanical}}";
public string DescriptionPostfix = "There is a low, persistent hum emanating outward.";
public bool KeepNatural = true;
public bool InheritDescription = true;
public override bool SameAs(IPart P) => true;
public override bool WantEvent(int ID, int cascade) =>
base.WantEvent(ID, cascade) || ID == ObjectCreatedEvent.ID;
public override bool HandleEvent(ObjectCreatedEvent E)
{
/* Copy player */
GameObject thePlayer = IComponent<GameObject>.ThePlayer;
GamePlayer gamePlayer = XRLCore.Core.Game.Player;
GameObject pet = thePlayer.DeepCopy();
/* Stylize pet */
pet.pRender.DisplayName = "{{rusty|fleshy}} " + pet.pRender.DisplayName;
pet.GetPart<Description>().Short = "It's you. There is the disconcerting sound of breathing emanating outward.";
pet.AddPart<Pettable>();
pet.RemovePart<OpeningStory>();
// TODO: Add story, dialogue?
/* Make pet actually a pet */
pet.PartyLeader = thePlayer;
pet.SetActive();
/* Spawn pet */
thePlayer.CurrentCell.GetConnectedSpawnLocation().AddObject(pet);
/* Mechanize player */
Mutations playerMutations = gamePlayer.Body.GetPart<Mutations>();
var playerMutationList = new List<BaseMutation>(playerMutations.MutationList);
playerMutationList.ForEach((mutation) => playerMutations.RemoveMutation(mutation));
gamePlayer.Body.SafeForeachInventoryEquipmentAndCybernetics((C) => C.Obliterate(Silent: true));
Roboticized.Roboticize(thePlayer);
/* Delete self */
ParentObject.Destroy(Silent: true);
return base.HandleEvent(E);
}
}
}