LazyDuchess / OpenTS2

Open source re-implementation of The Sims 2 in Unity
Mozilla Public License 2.0
248 stars 19 forks source link

Implement Build Mode Test Scene #57

Open JDrocks450 opened 8 months ago

JDrocks450 commented 8 months ago

image

Build Mode Test Scene

This pull request implements the features detailed below in service of a build mode test scene environment allowing basic construction.

Loading Lot Architecture This scene is based on the pre-existing work of loading a lot from file, with the advantage of now being able to edit the LotArchitecture on the fly through using build tools.

These changes are now in a new class called LotLoad.cs LotLoad.cs allows for a lot to be loaded into the current scene as easily as: image Which will perform the behind the scenes tasks of:

Build Mode HUD image The Build Mode HUD has been implemented with a controller (LotBuildModeHUD.cs).

The Build Mode HUD currently has the ability to perform the following tasks:

Build Mode Server Since all of the tools listed below make direct changes to the LotArchitecture instance supplied by LotLoad -- a build mode server has been added as a pipeline to modify the lot. The Build Mode Server has a constructor that takes the current LotLoad instance for modification.

For clarity, each tool below has its relative function signature(s) on the BuildModeServer attached for reference.

Wall Tool

https://github.com/LazyDuchess/OpenTS2/assets/16988651/130ef00c-e093-402b-8615-8e124d4eaa60

This tool (mainly) uses the following functions: image This method creates walls by doing the following:

image image These functions utilize the same logic as above but in reverse. Deleting walls can be done diagonally and also by Room as well (hold shift) Invoke the delete function by holding Ctrl :)

Floor Tool

https://github.com/LazyDuchess/OpenTS2/assets/16988651/3a818386-41bf-411d-8d04-dd6dde228e46

This tool (mainly) uses the following functions: image This function will ensure the pattern is added to the FloorMap. You can also use this function for wallpaper as well.

image This function adds floors to the FloorPatterns on the LotArchitecture. It will also do the following:

image This function uses the CreateFloors() method, but sets the FloorPattern to be empty.

Foundation Tool image

The foundation tool uses both of these functions above together. It will do the following:

Terrain Tool

https://github.com/LazyDuchess/OpenTS2/assets/16988651/98deb9fa-6721-4f4b-aeba-7d53ca03a4fa

The terrain tool has three sizes matching the original games. The sizes are found in the enum TerrainBrushSizes: image

It uses the following function: image

This function supports the following: Raise, Lower, Water. In the future it can also support: Smooth and Terrain paint. This function also supports the constrainfloorelevation cheat I added as well by using the IsFloorAt() function.

Note: This function will modify Elevation data for any floor provided, so walls, foundations, etc. can be modified.

The flatten lot function is also implemented, but should be revisited to remove all the stuff on the lot (there also is no confirmation message yet -- be careful)

Quick note on Cheats Added the SimpleProperty, which can be used with the RegisterProperty function in the Cheat System. I almost reimplemented the whole cheat system until I saw it already existed! Anyway, this can be used to create properties like CFE which are a simple toggle on/off.

Final note This is still proof of concept and help/feedback is welcome. If this pr is merged, I would highly recommend doing so to a dedicated branch as the features can be a little buggy right now.

JDrocks450 commented 8 months ago

https://github.com/LazyDuchess/OpenTS2/assets/16988651/d095cbcc-32ba-4d1d-a6f0-a039317019ba

Fixed bug mentioned in initial comment.

JDrocks450 commented 8 months ago

My apologies I will have that cleaned up in the next commit and respond back. Thanks!