Level teleporters with custom locations

This commit is contained in:
Marco 2025-09-11 10:02:55 +02:00
commit 47f8252e65
6 changed files with 897 additions and 502 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,14 @@ classname = "actor_level_teleporter"
description = "Teleporter to the next level"
base_classes = Array[Resource]([ExtResource("1_klaoa")])
class_properties = {
"enabled": false
"enabled": false,
"invisible": false,
"mapid": ""
}
class_property_descriptions = {
"enabled": "Enabled or disabled"
"enabled": "Enabled or disabled",
"invisible": "Is it invisible?",
"mapid": "The id of the map to go to, goes to next map if empty"
}
meta_properties = {
"model": "\"3D/MapModels/actor_level_teleporter.glb\"",

View file

@ -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);
}
}
}

View file

@ -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)