Skip to content

[Bug] ModEventTemplate注册事件会有不影响游戏的报错 #100

Description

@vitechliu

模块范围

Assets(资源)

严重程度

Minor(轻微)

发生了什么?

事件使用reme教程的写法

[RegisterSharedEvent]
public sealed class XXX: ModEventTemplate {
   public override EventAssetProfile AssetProfile => new(
        InitialPortraitPath: "res://VYgo/images/events/fiendsmith_forge.png"
    );
}

实测使用控制台进入事件,会报错, 可能会影响资源预载,不过不影响事件本身正常逻辑。
不确定正常手段进入事件是否会报错。

AI的建议是:

RitsuLib的事件资源补丁会“追加”自定义底图,却没有从预加载列表移除自动合成的原版路径;我会在该事件覆写 GetAssetPaths(),只过滤这条不存在的默认底图,并保留布局及自定义底图。


### 复现步骤

使用控制台进入事件

### 期望行为

不报错

### 日志 / 堆栈

```shell
23:42:26 ERROR [Godot/EngineError] Error occurred [0]: No loader found for resource: res://images/events/v_ygo_event_fiendsmith_forge.png (expected type: unknown)
Method/function failed. Returning: Ref<Resource>()
core/io/resource_loader.cpp:328 @ _load()
23:42:26 ERROR [Godot/EngineError] Error occurred [0]: Error loading resource: 'res://images/events/v_ygo_event_fiendsmith_forge.png'.
Condition "err != OK" is true. Returning: ret
core/core_bind.cpp:74 @ load()
C# backtrace (most recent call first):
    [0] Godot.Resource Godot.ResourceLoader.Load(string, string, Godot.ResourceLoader+CacheMode)
    [1] T Godot.ResourceLoader.Load<T>(string, string, Godot.ResourceLoader+CacheMode)
    [2] void MegaCrit.Sts2.Core.Assets.AssetLoadingSession.CheckLoadingStatus()
    [3] void MegaCrit.Sts2.Core.Assets.AssetLoadingSession.Process()
    [4] void MegaCrit.Sts2.Core.Nodes.NAssetLoader._Process(double)
    [5] bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
    [6] bool MegaCrit.Sts2.Core.Nodes.NAssetLoader.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
    [7] Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*)
23:42:26 ERROR Failed to load resource synchronously: res://images/events/v_ygo_event_fiendsmith_forge.png
   at MegaCrit.Sts2.Core.Assets.AssetLoadingSession.CheckLoadingStatus()
   at MegaCrit.Sts2.Core.Assets.AssetLoadingSession.Process()
   at MegaCrit.Sts2.Core.Nodes.NAssetLoader._Process(Double delta)
   at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
   at MegaCrit.Sts2.Core.Nodes.NAssetLoader.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
   at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret)

RitsuLib 版本

最新版

运行环境

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/assetsTextures, atlases, resource paths, or asset loading.priority/p3Low priority or backlog.severity/minorMinor defect, polish issue, or low-impact bug.status/confirmedConfirmed and actionable.type/bugDefect or incorrect behavior in RitsuLib.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions