Skip to content

Commit

Permalink
feat(poh): finished. read notes
Browse files Browse the repository at this point in the history
The POH Handler is finished. At least the original intention I had for it which was an accurate way of knowing a player position on anyone's POH no matter their layout.
Actual walking will be done at a later time, but most people could add it in now by looking at how walker does it.
It was also not my original intention for the first release to have it, but it does include some very basic interaction with some very few "Room Objects".
This only includes the fairy ring, the jewellery box and the pool. I only tested this on a max house so the `Finders` might need adjustments. Also, while only this 3 objects are included as a proof of concept, it's not very hard to add other stuff, like portals, nexus, etc. Do keep in mind though, the syntax for this is subject to change in the future.
Things that changed since the last updates:
- All map and "cached" rooms things were moved into their own `TPOHMap` record.
This is a helper record and you likely will never have to interact with it directly nor none of it's methods.
- A lot of methods were renamed to make more sense
- The file was renamed from pohhandler.simba to poh.simba
- The whole file has been documented thoroughly and includes usage examples of the several things the POH Handler can do.
  • Loading branch information
Torwent committed Feb 5, 2024
1 parent 9555c23 commit 1e2ad53
Show file tree
Hide file tree
Showing 4 changed files with 563 additions and 230 deletions.
2 changes: 1 addition & 1 deletion optional.simba
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ However, this is not really recommended. You should include only the files you r
{$IFNDEF WL_LOOT_HANDLER_INCLUDED} {$I optional/handlers/loothandler.simba}
{$IFNDEF WL_COMBAT_HANDLER_INCLUDED} {$I optional/handlers/combathandler.simba}
{$IFNDEF WL_HOUSEOBJECTS_INCLUDED} {$I optional/handlers/houseobjects.simba}
{$IFNDEF WL_POH_HANDLER_INCLUDED} {$I optional/handlers/pohhandler.simba}
{$IFNDEF WL_POH_HANDLER_INCLUDED} {$I optional/handlers/poh.simba}
{$IFNDEF SKUNK_TELEPORT_UTILS} {$I optional/handlers/teleports/rsteleportutils.simba}
{$IFNDEF SKUNK_TELEPORTS} {$I optional/handlers/teleports/rsteleports.simba}
{$IFNDEF SKUNK_UNIVERSAL_TRANSPORT} {$I optional/handlers/teleports/transport.simba}
Expand Down
73 changes: 73 additions & 0 deletions optional/handlers/houseobjects.simba
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
(*
# RoomObjects
*)

{$DEFINE WL_HOUSEOBJECTS_INCLUDED}
{$IFNDEF WL_OSR}
{$I WaspLib/osr.simba}
{$ENDIF}

type
(*
## ERSRoomObject
```pascal
ERSRoomObject = (POOL, FAIRY_TREE, JEWELLERY_BOX, PRAYER_ALTAR, MAGIC_ALTAR, LARDER, LECTERN, MYTH_CAPE, NEXUS, PORTAL);
```
*)
ERSRoomObject = (POOL, FAIRY_TREE, JEWELLERY_BOX, PRAYER_ALTAR, MAGIC_ALTAR, LARDER, LECTERN, MYTH_CAPE, NEXUS, PORTAL);

(*
## TRoomObject
```pascal
TRoomObject = record
Coordinates: TPointArray;
Shape: Vector3;
UpText: TStringArray;
Finder: TRSObjectFinder;
RoomOffset: TPoint;
end;
```
Record used to store and interact information about POH room objects.
*)
TRoomObject = record
Coordinates: TPointArray;
Shape: Vector3;
Expand All @@ -14,6 +37,13 @@ type
RoomOffset: TPoint;
end;

(*
## TRoomObject.Init()
```pascal
procedure TRoomObject.Init(upText: TStringArray; shape: Vector3; roomOffset: TPoint);
```
This method sets up some basic info about a {ref}`TRoomObject`.
*)
procedure TRoomObject.Init(upText: TStringArray; shape: Vector3; roomOffset: TPoint);
begin
Self := [];
Expand All @@ -25,6 +55,22 @@ begin
Self.Finder.Grow := 4;
end;

(*
## TRoomObject.Setup()
```pascal
procedure TRoomObject.Setup(obj: ERSRoomObject); overload;
```
Basically the same as {ref}`TRoomObject.Init()` with some already known information.

Example:
```pascal
var
obj: TRoomObject;
begin
obj.Setup(ERSRoomObject.POOL);
end;
```
*)
procedure TRoomObject.Setup(obj: ERSRoomObject); overload;
begin
case obj of
Expand All @@ -48,12 +94,39 @@ begin
end;
end;

(*
## TRoomObject.AddCoordinates()
```pascal
procedure TRoomObject.AddCoordinates(coordinates: TPointArray);
```
Adds `coordinates` to a {ref}`TRoomObject`.
Can be called multiple times to add more `coordinates`.

Example:
```pascal
var
obj: TRoomObject;
begin
obj.Setup(ERSRoomObject.POOL);
obj.AddCoordinates([[50, 50]]);
end;
```
*)
procedure TRoomObject.AddCoordinates(coordinates: TPointArray);
begin
Self.Coordinates += coordinates;
end;


(*
## TRoomObject.Interact
```pascal
function TRoomObject.Hover(mmPoints: TPointArray; radians: Double): Boolean;
function TRoomObject.Click(mmPoints: TPointArray; radians: Double): Boolean;
function TRoomObject.Select(options: TStringArray; mmPoints: TPointArray; radians: Double): Boolean;
```
Interacts with a {ref}`TRoomObject`. The interaction type is self explanatory.
*)
function TRoomObject.Hover(mmPoints: TPointArray; radians: Double): Boolean;
var
i: Int32;
Expand Down
Loading

0 comments on commit 1e2ad53

Please sign in to comment.