Elin Decompiled Documentation EA 23.277 Nightly Patch 1
Loading...
Searching...
No Matches
AI_Sleep.cs
Go to the documentation of this file.
1public class AI_Sleep : AI_TargetThing
2{
3 public Chara lover;
4
5 public override bool GotoTarget => lover == null;
6
7 public override void OnProgressComplete()
8 {
9 if (!owner.CanSleep())
10 {
11 Msg.Say((EClass._zone.events.GetEvent<ZoneEventQuest>() != null) ? "badidea" : "notSleepy");
12 return;
13 }
14 if (lover != null && lover.ExistsOnMap && lover.Dist(owner) <= 1)
15 {
16 owner.Say("sleep_beside", owner, lover);
17 owner.MoveImmediate(lover.pos, focus: false, cancelAI: false);
18 }
19 else if (base.target != null && !owner.pos.Equals(base.target.pos))
20 {
21 owner._Move(base.target.pos);
22 }
23 owner.Sleep(base.target, base.target.pos.FindThing<TraitPillow>()?.owner as Thing);
24 }
25}
new Chara owner
Definition: AIAct.cs:14
override void OnProgressComplete()
Definition: AI_Sleep.cs:7
override bool GotoTarget
Definition: AI_Sleep.cs:5
Chara lover
Definition: AI_Sleep.cs:3
bool ExistsOnMap
Definition: Card.cs:2111
Point pos
Definition: Card.cs:60
int Dist(Card c)
Definition: Card.cs:7867
void MoveImmediate(Point p, bool focus=true, bool cancelAI=true)
Definition: Card.cs:5903
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7020
Definition: Chara.cs:10
override MoveResult _Move(Point newPoint, MoveType type=MoveType.Walk)
Definition: Chara.cs:2764
bool CanSleep()
Definition: Chara.cs:1325
void Sleep(Thing bed=null, Thing pillow=null, bool pickup=false, ItemPosition posBed=null, ItemPosition posPillow=null)
Definition: Chara.cs:9858
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool Equals(int _x, int _z)
Definition: Point.cs:960
Definition: Thing.cs:8
Card owner
Definition: Trait.cs:28
ZoneEventManager events
Definition: Zone.cs:40