9 public override bool CanStack
23 if (this.owner.c_bedType != BedType.residentOne)
25 return ((base.GetParam(1,
null) ==
null) ? 1 : base.GetParam(1,
null).ToInt()) + this.owner.c_containerSize;
33 public override bool IsChangeFloorHeight
42 public override void TrySetAct(
ActPlan p)
46 target = this.owner.Thing
50 target = this.owner.Thing
52 if (
EClass._zone.IsPCFaction)
54 p.TrySetAct(
"bedConfig", delegate()
56 UIContextMenu uicontextMenu =
EClass.ui.CreateContextMenuInteraction();
59 uicontextMenu.AddButton(
"unassignBed", delegate()
65 else if (this.owner.c_bedType == BedType.resident ||
this.owner.c_bedType == BedType.residentOne)
67 uicontextMenu.AddButton(
"claimBed", delegate()
71 Msg.Say(
"claimBed",
EClass.pc,
null,
null,
null);
72 SE.Play(
"jingle_embark");
75 using (List<BedType>.Enumerator enumerator =
new List<BedType>
82 while (enumerator.MoveNext())
84 BedType t = enumerator.Current;
85 if (t != BedType.livestock && t != BedType.patient)
87 uicontextMenu.AddButton(((t == this.owner.c_bedType) ?
"context_checker".lang() :
"") + (
"bed_" + t.ToString()).lang(), delegate()
95 CursorSystem.ignoreCount = 5;
98 }, this.owner,
null, 1,
false,
true,
false);
103 public void AddHolder(
Chara c)
105 CharaList charaList = this.owner.c_charaList;
106 if (charaList ==
null)
108 charaList = (this.owner.c_charaList =
new CharaList());
114 public void RemoveHolder(
Chara c)
116 CharaList c_charaList = this.owner.c_charaList;
117 if (c_charaList ==
null)
121 c_charaList.Remove(c);
122 if (c_charaList.list.Count == 0)
124 this.owner.c_charaList =
null;
129 public void ClearHolders()
131 CharaList c_charaList = this.owner.c_charaList;
132 if (c_charaList !=
null)
134 c_charaList.list.Clear();
139 public bool IsHolder(
Chara c)
141 CharaList c_charaList = this.owner.c_charaList;
142 return c_charaList !=
null && c_charaList.list.Contains(c.uid);
148 CharaList c_charaList = this.owner.c_charaList;
149 return c_charaList !=
null && c_charaList.list.Count >= this.MaxHolders;
153 public bool HasHolder()
155 CharaList c_charaList = this.owner.c_charaList;
156 return c_charaList !=
null && c_charaList.list.Count > 0;
160 public bool CanAssign(
Chara c)
162 CharaList c_charaList = this.owner.c_charaList;
163 if (c_charaList !=
null && c_charaList.list.Count >=
this.MaxHolders)
167 BedType c_bedType = this.owner.c_bedType;
168 FactionMemberType memberType = c.memberType;
169 return (memberType == FactionMemberType.Default && (c_bedType == BedType.resident || c_bedType == BedType.residentOne)) || (memberType == FactionMemberType.Livestock && c_bedType == BedType.livestock) || (memberType == FactionMemberType.Guest && c_bedType == BedType.guest);
173 public void SetBedType(BedType bedType)
175 if (bedType == this.owner.c_bedType)
179 this.owner.c_bedType = bedType;
184 public override void SetName(ref
string s)
186 CharaList c_charaList = this.owner.c_charaList;
187 if (c_charaList !=
null)
189 List<Chara> list = c_charaList.Get();
192 s =
"_bed".lang(list[0].NameSimple, s,
null,
null,
null);
197 s =
"_bed".lang(
"_and".lang(list[0].NameSimple, list[1].NameSimple,
null,
null,
null), s,
null,
null,
null);
201 if (this.owner.c_bedType == BedType.resident)
205 string @ref = (
"bed_" + this.owner.c_bedType.ToString()).lang().ToLower();
206 s =
"_of4".lang(@ref, s,
null,
null,
null);
210 public override string GetHoverText()
212 CharaList c_charaList = this.owner.c_charaList;
213 if (c_charaList ==
null || c_charaList.Get().Count < 3)
218 foreach (
Chara chara
in c_charaList.Get())
224 text += chara.NameSimple;
226 return "(" + text +
")";