mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 17:05:54 +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
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
|
|
@ -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\"",
|
||||
|
|
|
|||
|
|
@ -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