creative_object_interface no longer can be used with castable_subtype due to lack of <castable> specifier

Summary

Providing a class which implements the creative_object_interface as a value for the type castable_subtype(creative_object_interface) does not work to properly cast different creative objects into devices, props, etc (common workflow when using Verse tags).

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

Use this code in your project.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

(InDevice:creative_object_interface).CastTo(cast_type:castable_subtype(creative_object_interface))<transacts><decides>:cast_type =
    cast_type[InDevice]

TestFunction(InAgent:agent, InDevice:creative_object_interface):void =
    if(TriggerDevice := InDevice.CastTo[trigger_device]):
        TriggerDevice.Trigger(InAgent)

Expected Result

Compiles and works as expected. Assumption and understanding is that implementations of creative_object_interface should be <castable> but they are not. Perhaps some clarification could be provided.

Observed Result

Does not compile. If statement has LSP error: This function parameter expects a value of type tuple(creative_object_interface,castable_subtype(creative_object_interface)), but this argument is an incompatible value of type tuple(creative_object_interface,type(trigger_device, trigger_device))

Platform(s)

windows

Additional Notes

Removing the castable_ part from the parametric argument castable_subtype(creative_object_interface) fixes the issue. It compiles and properly casts. However, it is unclear if this type of behavior and syntax is intentional from Epic/Verse. As mentioned before: some clarification should be provided if this is unintentional or intentional etc.

Functional snippet:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

(InDevice:creative_object_interface).CastTo(cast_type:castable_subtype(creative_object_interface))<transacts><decides>:cast_type =
    cast_type[InDevice]

TestFunction(InAgent:agent, InDevice:creative_object_interface):void =
    if(TriggerDevice := InDevice.CastTo[trigger_device]):
        TriggerDevice.Trigger(InAgent)

My proposition: remove castable and castable_subtype, leave subtype castable by default and we have some kind of simplification of the language instead of making it more complex every update.

2 Likes

FORT-950079 changed to ‘Needs More Info’. We’re missing information that would help us determine the source of the issue.

This topic was automatically closed after 180 days. New replies are no longer allowed.