if i dont have the attach, it works
ship_mount:
type: task
debug: false
definitions: type|scale
script:
- spawn item_display[item=<[type]>;scale=<[scale]>] save:ship <player.location.with_yaw[<player.location.yaw>]>
- spawn ship_seat save:seat <player.location.with_pitch[0].with_yaw[<player.location.yaw>]>
- flag <entry[seat].spawned_entity> ship:<entry[ship].spawned_entity>
- mount <player>|<entry[seat].spawned_entity>
- attach <entry[ship].spawned_entity> to:<entry[seat].spawned_entity> sync_server offset:0,6.5,1 pitch_offset:0 relative
ship_handler:
type: world
debug: false
events:
on player steers ship_seat:
- define forward <context.forward>
- define side <context.sideways>
- if <[forward]> == 0:
- define forward 0.001
- define location <player.location.forward_flat[<[forward].div[2]>].add[0,-0.35,0]>
- teleport <player.vehicle.flag[ship]> <[location].with_pitch[0]>
- if <[forward]> == 0:
- stop
- if <[side]> != 0:
- define side <[side].mul[-1]>
- define tpLoc <[location].with_pitch[<player.vehicle.location.pitch.add[<[side]>]>]>
# - teleport <player.vehicle> <[tpLoc]>
- look <player.vehicle.flag[ship]> yaw:<player.vehicle.flag[ship].location.yaw.add[<[side]>]>
- look <player> yaw:<player.location.yaw.add[<[side]>]> pitch:<player.location.pitch>