Skip to content

Commit 99660ec

Browse files
committed
Merge branch 'master' of https://github.com/andrewknoll/FreeSO
2 parents e3ecdb9 + 024637e commit 99660ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+406
-80
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ TSOClient/tso.client/GlobalSettings1.Designer.cs
8484
*.DS_Store
8585
TSOClient/.vs/config/applicationhost.config
8686
*.nvuser
87+
88+
TSOClient/Mario

TSOClient/FSO.IDE/EditorComponent/Primitives/RelationshipDescriptor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public override string GetBody(EditorScope scope)
5454
string prepend = "";
5555
if (op.FailIfTooSmall) { flagStr.Append(prepend + "Fail if too small"); prepend = ","; }
5656
if (op.UseNeighbor) { flagStr.Append(prepend + "Use Neighbor"); prepend = ","; }
57+
if (op.FSONeverPersist) { flagStr.Append(prepend + "Never Persist (FSO)"); prepend = ","; }
5758

5859
if (flagStr.Length != 0)
5960
{
@@ -82,6 +83,7 @@ public override void PopulateOperandView(BHAVEditor master, EditorScope escope,
8283
panel.Controls.Add(new OpFlagsControl(master, escope, Operand, "Flags:", new OpFlag[] {
8384
new OpFlag("Fail if too small", "FailIfTooSmall"),
8485
new OpFlag("Use Neighbor", "UseNeighbor"),
86+
new OpFlag("Never Persist (FSO)", "FSONeverPersist")
8587
}));
8688

8789
if (!old) panel.Controls.Add(new OpComboControl(master, escope, Operand, "Object in Local:", "Local", new OpStaticNamedPropertyProvider(escope.GetVarScopeDataNames(VMVariableScope.Local))));

TSOClient/FSO.Server.DataService/Model/Avatar.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ public bool IsDefaultName
208208

209209
#region FSO Data Service
210210

211-
private uint _Avatar_ModerationStatus;
212-
public uint Avatar_ModerationStatus
211+
private uint _Avatar_ModerationLevel;
212+
public uint Avatar_ModerationLevel
213213
{
214-
get { return _Avatar_ModerationStatus; }
215-
set { _Avatar_ModerationStatus = value; NotifyPropertyChanged("Avatar_ModerationStatus"); }
214+
get { return _Avatar_ModerationLevel; }
215+
set { _Avatar_ModerationLevel = value; NotifyPropertyChanged("Avatar_ModerationLevel"); }
216216
}
217217

218218
private uint _Avatar_MayorNhood;

TSOClient/FSO.Server/DataService/Providers/ServerAvatarProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ private Avatar HydrateOne(DbAvatar dbAvatar, DbLot dbLot)
334334
};
335335
result.Avatar_PrivacyMode = dbAvatar.privacy_mode;
336336
result.Avatar_SkillsLockPoints = (ushort)(20 + result.Avatar_Age/7);
337-
result.Avatar_ModerationStatus = dbAvatar.moderation_level;
337+
result.Avatar_ModerationLevel = dbAvatar.moderation_level;
338338
result.Avatar_MayorNhood = (uint)(dbAvatar.mayor_nhood ?? 0);
339339

340340
result.JobLevelProvider = JobLevelProvider;

TSOClient/FSO.Server/Servers/Lot/Domain/LotContainer.cs

+33-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public class LotContainer
108108
0x475CC813, //water balloon controller
109109
0x2D583771, //winter weather controller
110110
0x7A78195C, //snowball controller
111-
0x33AD8F84, //face mask controller
111+
0x063F2ABE, //global accessory controller
112112
0x04AB1D1F, //zombie spawner controller
113113
0x0DF8592E, //mini sims
114114
0x48F32C7B, //au game controller
@@ -202,13 +202,37 @@ public LotContainer(IDAFactory da, LotContext context, ILotHost host, IKernel ke
202202
public void GenerateTerrain()
203203
{
204204
Terrain = new VMTSOSurroundingTerrain();
205+
205206
var coords = MapCoordinates.Unpack(LotPersist.location);
206207
var map = Realestate.GetMap();
207-
for (int y = 0; y < 3; y++)
208+
209+
if (LotPersist.location >= 0x10200 && LotPersist.location < 0x20000)
208210
{
209-
for (int x = 0; x < 3; x++)
211+
// Special off-world property. Currently these are all islands.
212+
for (int y = 0; y < 3; y++)
213+
{
214+
for (int x = 0; x < 3; x++)
215+
{
216+
var baseType = (x == 1 && y == 1) ? Content.Model.TerrainType.SAND : Content.Model.TerrainType.WATER;
217+
218+
Terrain.BlendN[x, y] = new Content.Model.TerrainBlend()
219+
{
220+
Base = baseType,
221+
Blend = baseType,
222+
AdjFlags = 0,
223+
WaterFlags = 0
224+
};
225+
}
226+
}
227+
}
228+
else
229+
{
230+
for (int y = 0; y < 3; y++)
210231
{
211-
Terrain.BlendN[x, y] = map.GetBlend((coords.X-1)+x, (coords.Y-1)+y);
232+
for (int x = 0; x < 3; x++)
233+
{
234+
Terrain.BlendN[x, y] = map.GetBlend((coords.X - 1) + x, (coords.Y - 1) + y);
235+
}
212236
}
213237
}
214238

@@ -440,7 +464,10 @@ private void ReturnOOWObjects()
440464
{
441465
//we can delete these without respecting slot rules because of how SLOTs work (deleting table under us will move us to OOW)
442466

443-
var ents = Lot.Entities.Where(x => x.Position == LotView.Model.LotTilePos.OUT_OF_WORLD && !ValidOOWGUIDs.Contains(x.Object.OBJ.GUID)).ToList();
467+
var ents = Lot.Entities.Where(x =>
468+
x.Position == LotView.Model.LotTilePos.OUT_OF_WORLD &&
469+
(!(x is VMGameObject) || !((VMGameObject)x).Disabled.HasFlag(VMGameObjectDisableFlags.Transient)) &&
470+
!ValidOOWGUIDs.Contains(x.Object.OBJ.GUID)).ToList();
444471
ents.AddRange(Lot.Entities.Where(x => x.MultitileGroup.Objects.Any(y => InvalidGUIDs.Contains(y.Object.OBJ.GUID))));
445472

446473
foreach (var ent in ents)
@@ -752,6 +779,7 @@ public void ResetVM()
752779
{
753780
Tuning = Tuning
754781
});
782+
Lot.Tick();
755783
}
756784

757785
Lot.Context.UpdateTSOBuildableArea();

TSOClient/tso.client/Rendering/City/CityGeometry.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,14 @@ public void RegenMeshVerts(GraphicsDevice gd, Rectangle? range)
468468

469469
RoadIndices?.Dispose();
470470
RoadVertices?.Dispose();
471-
RoadIndices = new IndexBuffer(gd, IndexElementSize.ThirtyTwoBits, roadIndices.Count, BufferUsage.None);
472-
RoadIndices.SetData(roadIndices.ToArray());
473-
RoadVertices = new VertexBuffer(gd, typeof(TLayerVertex), roadVertices.Count, BufferUsage.None);
474-
RoadVertices.SetData(roadVertices.ToArray());
475-
RoadPrims = roadIndices.Count / 3;
471+
if (roadVertices.Count > 0)
472+
{
473+
RoadIndices = new IndexBuffer(gd, IndexElementSize.ThirtyTwoBits, roadIndices.Count, BufferUsage.None);
474+
RoadIndices.SetData(roadIndices.ToArray());
475+
RoadVertices = new VertexBuffer(gd, typeof(TLayerVertex), roadVertices.Count, BufferUsage.None);
476+
RoadVertices.SetData(roadVertices.ToArray());
477+
RoadPrims = roadIndices.Count / 3;
478+
}
476479
}
477480

478481
private int O(int x, int y, int minx, int maxx)

TSOClient/tso.client/Rendering/City/CityMapData.cs

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public void Load(string baseDir, Func<string, Texture2D> texLoader, string filet
8383
roadMap.Dispose();
8484
}
8585

86+
public bool IsInBounds(int x, int y)
87+
{
88+
return x > -0 && x < 512 && y >= 0 && y < 512;
89+
}
8690

8791
private Tuple<int, int> InBounds(int x, int y)
8892
{

TSOClient/tso.client/Rendering/City/Terrain.cs

+3
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,9 @@ private void Draw3DHouses(int passIndex)
794794

795795
short x = lots[i].x;
796796
short y = lots[i].y;
797+
798+
if (!MapData.IsInBounds(x, y)) continue;
799+
797800
var pos = new Vector3(x + 0.5f, MapData.ElevationData[(y * 512 + x)] / 12.0f, y + 0.5f);
798801
verts.Add(new DGRP3DVert(pos, Vector3.Up, new Vector2()));
799802
verts.Add(new DGRP3DVert(pos, Vector3.Up, new Vector2(1, 0)));

TSOClient/tso.client/UI/Controls/UILotButton.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ public override void Draw(UISpriteBatch batch)
271271
{
272272
var terrain = ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer;
273273
var Size = new Vector2(80, 50);
274-
Vector2 startVec = new Vector2(40, 25) + Position, end = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId);
274+
Vector2 startVec = new Vector2(40, 25) + Position;
275+
Vector2? dest = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId);
276+
if (!dest.HasValue) return;
277+
278+
Vector2 end = dest.Value;
275279
Vector2 start = end;
276280

277281
// position line around border

TSOClient/tso.client/UI/Controls/UIMapWaypoint.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ public override void Draw(UISpriteBatch batch)
282282
{
283283
if (!Visible) return;
284284
var terrain = ((CoreGameScreen)GameFacade.Screens.CurrentUIScreen).CityRenderer;
285-
Vector2 startVec = (new Vector2(60 / 2, 60 / 2) + Position), end = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId) / FSOEnvironment.DPIScaleFactor;
285+
Vector2 startVec = (new Vector2(60 / 2, 60 / 2) + Position);
286+
Vector2? dest = UITerrainHighlight.GetEndpointFromLotId(terrain, startVec, (int)LotId);
287+
if (!dest.HasValue) return;
288+
289+
Vector2 end = dest.Value / FSOEnvironment.DPIScaleFactor;
286290
Vector2 start = end;
287291

288292
//position line around border all pretty like

TSOClient/tso.client/UI/Panels/UILiveMode.cs

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ public UILiveMode (UILotControl lotController) {
163163
DynamicOverlay.Add(MotiveDisplay);
164164

165165
PersonGrid = new UIPersonGrid(LotController.vm);
166+
PersonGrid.NextPageButton = NextPageButton;
167+
PersonGrid.PreviousPageButton = PreviousPageButton;
166168
Add(PersonGrid);
167169
PersonGrid.Position = new Vector2(409, 51);
168170
if (Small800) {

TSOClient/tso.client/UI/Panels/UILotControl.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ public void LiveModeUpdate(UpdateState state, bool scrolled)
680680
var obj = vm.GetObjectById(ObjectHover);
681681
if (obj is VMAvatar)
682682
{
683-
cursor = (((VMAvatar)obj).GetPersonData(VMPersonDataVariable.PersonType) != 255) ? CursorType.LivePerson : CursorType.LiveObjectAvail;
683+
cursor = (((VMAvatar)obj).GetPersonData(VMPersonDataVariable.PersonType) < 254) ? CursorType.LivePerson : CursorType.LiveObjectAvail;
684684
}
685685
else
686686
{
@@ -709,7 +709,10 @@ private string GetAvatarString(VMAvatar ava)
709709
{
710710
int prefixNum = 3;
711711
string prefixSrc = "217";
712-
if (ava.IsPet) prefixNum = 5;
712+
var personType = ava.GetPersonData(VMPersonDataVariable.PersonType);
713+
714+
if (personType >= 254) return ava.ToString();
715+
else if (ava.IsPet) prefixNum = 5;
713716
else if (ava.PersistID == 0) prefixNum = 4;
714717
else
715718
{

TSOClient/tso.client/UI/Panels/UILotPage.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ private void RefreshUI()
423423
}
424424
}
425425

426-
var canJoin = isMyProperty || isRoommate || isOnline || GameFacade.EnableMod || isCommunity;
426+
bool inBounds = CurrentLot.Value == null || CurrentLot.Value.Lot_Location_Packed < 0x10200 || CurrentLot.Value.Lot_Location_Packed >= 0x20000;
427+
var canJoin = isMyProperty || isRoommate || (inBounds && (isOnline || isCommunity)) || GameFacade.EnableMod;
427428

428429
HouseNameButton.Disabled = !isMyProperty;
429430

TSOClient/tso.client/UI/Panels/UIPersonGrid.cs

+26-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public UIPersonGrid(VM vm)
3030
UpdatePeople();
3131
}
3232

33+
34+
public UIButton NextPageButton { get; set; }
35+
public UIButton PreviousPageButton { get; set; }
36+
3337
public void UpdatePeople()
3438
{
3539
bool change = false;
@@ -46,7 +50,7 @@ public void UpdatePeople()
4650

4751
foreach (var sim in vm.Context.ObjectQueries.Avatars)
4852
{
49-
if (!Display.Contains(sim) && sim.PersistID != vm.MyUID && (sim as VMAvatar)?.GetPersonData(SimAntics.Model.VMPersonDataVariable.PersonType) != 255)
53+
if (!Display.Contains(sim) && sim.PersistID != vm.MyUID && (sim as VMAvatar)?.GetPersonData(SimAntics.Model.VMPersonDataVariable.PersonType) < 254)
5054
{
5155
Display.Add((VMAvatar)sim);
5256
change = true;
@@ -61,10 +65,23 @@ public void UpdatePeople()
6165
}
6266
}
6367

68+
private void UpdateButtons()
69+
{
70+
if (PreviousPageButton != null)
71+
{
72+
PreviousPageButton.Disabled = Page == 0;
73+
}
74+
if (NextPageButton != null)
75+
{
76+
NextPageButton.Disabled = Page == NumPages - 1;
77+
}
78+
}
79+
6480
public override void Update(UpdateState state)
6581
{
6682
base.Update(state);
6783
UpdatePeople();
84+
UpdateButtons();
6885
}
6986

7087
public void DrawPage()
@@ -101,5 +118,13 @@ public void PreviousPage()
101118
Page--;
102119
DrawPage();
103120
}
121+
122+
public int NumPages
123+
{
124+
get
125+
{
126+
return ((Display.Count - 1) / (Columns * Rows)) + 1;
127+
}
128+
}
104129
}
105130
}

TSOClient/tso.client/UI/Panels/UIPersonPage.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class UIPersonPage : UIContainer
2525
public UIImage BackgroundExpandedImage { get; set; }
2626
public UIImage BackgroundNameImage { get; set; }
2727
public UISim SimBox { get; set; }
28+
public UIButton ProfileBadge { get; private set; } // FounderButton
29+
private Texture2D FounderButtonTexture;
2830

2931
/** Auto wired **/
3032
public UIButton ExpandButton { get; set; }
@@ -276,6 +278,9 @@ public UIPersonPage()
276278
Add(OptionsBackgroundImage);
277279

278280
var ui = this.RenderScript("personpage.uis");
281+
ProfileBadge = this.Children.Find(x => x.ID == "FounderButton") as UIButton;
282+
FounderButtonTexture = ProfileBadge.Texture; // grab the original texture in case the badge has to be reset while a profile page is open
283+
279284

280285
MechanicalSkillBar = ui.Create<UISkillBar>("MechanicalSkillBarArea");
281286
CookingSkillBar = ui.Create<UISkillBar>("CookingSkillBarArea");
@@ -323,7 +328,7 @@ public UIPersonPage()
323328
screen.vm.SendCommand(new VMNetSkillLockCmd()
324329
{
325330
SkillID = VMSkillMap[bar.SkillID],
326-
LockLevel = (byte)bar.LockLevel
331+
LockLevel = (short)bar.LockLevel
327332
});
328333
}
329334

@@ -464,7 +469,7 @@ public UIPersonPage()
464469
.WithMultiBinding(x =>
465470
{
466471
Redraw();
467-
}, "Avatar_Name", "Avatar_IsOnline", "Avatar_Description", "Avatar_PrivacyMode");
472+
}, "Avatar_Name", "Avatar_IsOnline", "Avatar_Description", "Avatar_PrivacyMode", "Avatar_ModerationLevel");
468473

469474
MyAvatar = new Binding<Avatar>()
470475
.WithMultiBinding(x =>
@@ -931,6 +936,21 @@ private void Redraw()
931936
isMe = FindController<CoreGameScreenController>().IsMe(CurrentAvatar.Value.Avatar_Id);
932937
hasProperty = CurrentAvatar.Value.Avatar_LotGridXY != 0;
933938

939+
if (CurrentAvatar.Value.Avatar_ModerationLevel != 0)
940+
{
941+
ProfileBadge.Texture = Content.Content.Get().CustomUI.Get("momi_badge.png").Get(GameFacade.GraphicsDevice);
942+
ProfileBadge.ScaleX = 1f;
943+
ProfileBadge.ScaleY = 1f;
944+
ProfileBadge.Tooltip = "Staff";
945+
}
946+
else
947+
{
948+
ProfileBadge.Texture = FounderButtonTexture;
949+
ProfileBadge.Tooltip = "Founder";
950+
ProfileBadge.ScaleX = 1f;
951+
ProfileBadge.ScaleY = 1f;
952+
}
953+
934954
if (OriginalDescription != CurrentAvatar.Value.Avatar_Description)
935955
{
936956
OriginalDescription = CurrentAvatar.Value.Avatar_Description;

TSOClient/tso.client/UI/Panels/UIPieMenu.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public UIPieMenu(List<VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller,
7777

7878
lerpSpeed = 0.125f * (60.0f / FSOEnvironment.RefreshRate);
7979
m_Bg = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
80-
m_Bg.SetSize(0, 0); //is scaled up later
80+
m_Bg.SetSize(2, 2); //is scaled up later
81+
m_Bg.Position = new Vector2(-1, -1);
8182
this.AddAt(0, m_Bg);
8283

8384
m_PieTree = new UIPieMenuItem()

0 commit comments

Comments
 (0)