Skip to content

v1.0 Super Component

Choose a tag to compare

@DarkThymes DarkThymes released this 08 Jun 21:41
7556534
using { /Fortnite.com }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/AI }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/SceneGraph }
using { /Verse.org }
using { /Verse.org/Assets }
using { /Verse.org/Colors }
using { /Verse.org/Concurrency }
using { /Verse.org/Native }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /Verse.org/Colors/NamedColors }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/SpatialMath }


super_component<public> := class<final_super>(component):
    
    EasingFunc : easing_function = ease_in_out_cubic_bezier_easing_function{}  
    PlaybackMode<public>:keyframed_movement_playback_mode = oneshot_keyframed_movement_playback_mode{}      
    var mCPlayerComp : ?cplayer_component = false
    DeadEvent:event()=event(){}

    AwaitFire()<suspends>:void=
        if:
            CPlayerComp := mCPlayerComp?
            SFX:=Entity.GetComponent[MSS_Loop]
            VFX:=(for(Comp:Entity.FindDescendantComponents(NS_Beam)) do Comp)[0]
        then:
            loop:
                Agent:=CPlayerComp.AimInput.PressedEvent.Await()
                SFX.Play()
                VFX.Play()
                race:
                    loop:
                        if:
                            FC:=Agent.GetFortCharacter[]
                            FCViewRot:=FC.GetViewRotation()
                            FCFwd:=FCViewRot.GetLocalForward()*1500.0
                            Carryable:=CPlayerComp.Carryable
                        then:     
                            if(SweepHits:=Entity.FindSweepHits(FromVector3(FCFwd)).ToArray()[0]):
                                if. Carryable.TeleportTo[FromVector3(SweepHits.ContactPosition), (/UnrealEngine.com/Temporary/SpatialMath:)rotation{}]
                                Carryable.Spawn()
                                Sleep(0.0)
                                Carryable.Explode()
                            else:
                                Print("No hits found")
                        Sleep(0.5)
                    loop:
                        if(FC:=Agent.GetFortCharacter[],FCViewRot:=FC.GetViewRotation(), ViewPitch:=FCViewRot.GetYawPitchRollDegrees()[1]):
                            LocalPitch:=(/UnrealEngine.com/Temporary/SpatialMath:)MakeRotationFromYawPitchRollDegrees(0.0,ViewPitch,0.0)
                            VFX.Entity.SetLocalTransform((/Verse.org/SpatialMath:)transform{Translation:=VFX.Entity.GetLocalTransform().Translation, Rotation:=FromRotation(LocalPitch)})#FCViewRot)})               
                        Sleep(0.0)                    
                    block:
                        CPlayerComp.AimInput.ReleasedEvent.Await()
                        SFX.Stop()
                        VFX.Stop()
                    block:
                        DeadEvent.Await()
                        SFX.Stop()
                        VFX.Stop()
                    
    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
    
    OnSimulate<override>()<suspends>:void =
        Entity.RoundAwait(true)
        if:
            CPlayerComp:=(for(Comp:Entity.GetSimulationEntity[].FindDescendantComponents(cplayer_component)) do Comp)[0]
        then:
            set mCPlayerComp = option. CPlayerComp

        Sleep(0.1)
        spawn. AwaitFire()

    OnEndSimulation<override>():void=
        DeadEvent.Signal()