mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Level teleporters with custom locations
This commit is contained in:
parent
6263c7e23b
commit
47f8252e65
6 changed files with 897 additions and 502 deletions
|
|
@ -9,6 +9,7 @@ namespace Cirno.Scripts.Activables._3D;
|
|||
public partial class LevelTeleporter3D : Teleporter3D
|
||||
{
|
||||
[Export] public bool SaveInventory { get; set; }
|
||||
[Export] public StringName MapId { get; set; }
|
||||
|
||||
public override void _func_godot_apply_properties(Dictionary<string, Variant> props)
|
||||
{
|
||||
|
|
@ -16,6 +17,8 @@ public partial class LevelTeleporter3D : Teleporter3D
|
|||
//
|
||||
// TargetName = props["targetname"].AsString();
|
||||
IsEnabled = props["enabled"].AsBool();
|
||||
MapId = props["mapid"].AsString();
|
||||
Invisible = props["invisible"].AsBool();
|
||||
}
|
||||
|
||||
protected override async Task Teleport(IsoPlayerStateMachine player)
|
||||
|
|
@ -42,7 +45,14 @@ public partial class LevelTeleporter3D : Teleporter3D
|
|||
GlobalState.Instance.SessionSettings.EquippedWeaponId = string.Empty;
|
||||
}
|
||||
|
||||
var nextMap = GlobalState.Instance.MapsDatabase.FindNextMap(GlobalState.Instance.SessionSettings.MapId);
|
||||
GlobalState.Instance.GotoScene(nextMap);
|
||||
if (!string.IsNullOrWhiteSpace(MapId))
|
||||
{
|
||||
GlobalState.Instance.GotoScene(GlobalState.Instance.MapsDatabase.FindMap(MapId));
|
||||
}
|
||||
else
|
||||
{
|
||||
var nextMap = GlobalState.Instance.MapsDatabase.FindNextMap(GlobalState.Instance.SessionSettings.MapId);
|
||||
GlobalState.Instance.GotoScene(nextMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -71,8 +71,7 @@ public partial class GameController : Node
|
|||
GlobalState.Session.LevelNumber = MapResource.LevelId;
|
||||
GlobalState.Session.MapId = MapResource.MapId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GlobalState.Instance.ChangeCursor(false);
|
||||
|
||||
if (GlobalState.Instance.SessionSettings.AllowSaving)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue