Initial commit
This commit is contained in:
113
scripts/sports/football/sports_football_tasks.dsc
Normal file
113
scripts/sports/football/sports_football_tasks.dsc
Normal file
@@ -0,0 +1,113 @@
|
||||
sports_football_join:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id|player|team
|
||||
script:
|
||||
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
|
||||
- if <[team]> == red:
|
||||
- teleport <[player]> <[extra].get[red_start]>
|
||||
- else if <[team]> == blue:
|
||||
- teleport <[player]> <[extra].get[blue_start]>
|
||||
- run sports_football_update_glow def.id:<[id]>
|
||||
- define count <proc[sports_arena_player_count].context[<[id]>]>
|
||||
- if <[count]> == 2:
|
||||
- define teams <proc[sports_arena_teams].context[<[id]>]>
|
||||
- repeat 3:
|
||||
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> title:<&6><element[3].sub[<[value].sub[1]>]> fade_in:0 fade_out:0 stay:1s
|
||||
- wait 1s
|
||||
- if <proc[sports_arena_player_count].context[<[id]>]> < 2:
|
||||
- stop
|
||||
- run sports_football_restart_game def.id:<[id]>
|
||||
- if <[count]> < 2:
|
||||
- run sports_football_idle_game def.id:<[id]>
|
||||
|
||||
sports_football_leave:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id|player
|
||||
script:
|
||||
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
|
||||
- teleport <[player]> <[extra].get[exit]>
|
||||
- glow <[player]> reset
|
||||
- if <proc[sports_arena_player_count].context[<[id]>]> <= 1:
|
||||
- run sports_football_idle_game def.id:<[id]>
|
||||
|
||||
sports_football_redistribute:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id|player|from|to
|
||||
script:
|
||||
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
|
||||
- if <[to]> == red:
|
||||
- teleport <[player]> <[extra].get[red_start]>
|
||||
- narrate targets:<[player]> format:formats_prefix "You were auto-balanced to the <&c>red team"
|
||||
- else if <[to]> == blue:
|
||||
- teleport <[player]> <[extra].get[blue_start]>
|
||||
- narrate targets:<[player]> format:formats_prefix "You were auto-balanced to the <&9>blue team"
|
||||
- run sports_football_update_glow def.id:<[id]>
|
||||
|
||||
sports_football_restart_game:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id
|
||||
script:
|
||||
- define arena <proc[sports_arena].context[<[id]>]>
|
||||
- define extra <[arena].get[extra_data]>
|
||||
- run sports_arena_redistribute def.id:<[id]>
|
||||
- define teams <proc[sports_arena_teams].context[<[id]>]>
|
||||
- run sports_football_update_glow def.id:<[id]>
|
||||
- foreach <[teams].get[red]> as:red_player:
|
||||
- teleport <[red_player]> <[extra].get[red_start]>
|
||||
- foreach <[teams].get[blue]> as:blue_player:
|
||||
- teleport <[blue_player]> <[extra].get[blue_start]>
|
||||
- run sports_arena_set_status def.id:<[id]> def.status:normal
|
||||
- run ball_create def.id:sports_football def.location:<[extra].get[ball_start]> def.size:<[arena].get[ball_size]> def.display_item:<[arena].get[ball_display]> def.gravity_multiplier:<[arena].get[ball_gravity]>
|
||||
- glow <proc[ball_get].context[<[id]>]> true for:<[teams].get[red].include[<[teams].get[blue]>]>
|
||||
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "Next round..."
|
||||
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&e>Next Round" fade_in:0 fade_out:0 stay:1s
|
||||
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_PLING pitch:1 volume:30
|
||||
|
||||
sports_football_update_glow:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id
|
||||
script:
|
||||
- define teams <proc[sports_arena_teams].context[<[id]>]>
|
||||
- foreach <[teams].get[red]> as:red_player:
|
||||
- glow <[red_player]> true for:<[teams].get[red]>
|
||||
- glow <[red_player]> false for:<[teams].get[blue]>
|
||||
- foreach <[teams].get[blue]> as:blue_player:
|
||||
- glow <[blue_player]> true for:<[teams].get[blue]>
|
||||
- glow <[blue_player]> false for:<[teams].get[red]>
|
||||
|
||||
sports_football_idle_game:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id
|
||||
script:
|
||||
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
|
||||
- define teams <proc[sports_arena_teams].context[<[id]>]>
|
||||
- run sports_arena_set_status def.id:<[id]> def.status:waiting
|
||||
- run ball_remove def.id:<[id]>
|
||||
- teleport <[teams].get[red].include[<[teams].get[blue]>]> <[extra].get[ball_start]>
|
||||
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "Not enough players. Waiting..."
|
||||
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> title:<&7>Waiting fade_in:0 fade_out:0 stay:3s
|
||||
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_HAT pitch:1 volume:30
|
||||
|
||||
sports_football_score_goal:
|
||||
debug: false
|
||||
type: task
|
||||
definitions: id|team
|
||||
script:
|
||||
- run sports_arena_set_status def.id:<[id]> def.status:goal
|
||||
- define teams <proc[sports_arena_teams].context[<[id]>]>
|
||||
- if <[team]> == red:
|
||||
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&c>Goal for Red" fade_in:0 fade_out:0 stay:2s
|
||||
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "<&c>Red team <&7>scored a goal!"
|
||||
- if <[team]> == blue:
|
||||
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&9>Goal for Blue" fade_in:0 fade_out:0 stay:2s
|
||||
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "<&9>Blue team <&7>scored a goal!"
|
||||
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_PLING pitch:2 volume:30
|
||||
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:ENTITY_FIREWORK_ROCKET_TWINKLE_FAR pitch:1 volume:30
|
||||
- wait 3s
|
||||
- run sports_football_restart_game def.id:<[id]>
|
||||
55
scripts/sports/football/sports_football_world.dsc
Normal file
55
scripts/sports/football/sports_football_world.dsc
Normal file
@@ -0,0 +1,55 @@
|
||||
sports_football_world:
|
||||
debug: false
|
||||
type: world
|
||||
events:
|
||||
## ball click
|
||||
on player damages entity bukkit_priority:low:
|
||||
- ratelimit <player> 10t
|
||||
- if !<context.entity.has_flag[ball]>:
|
||||
- stop
|
||||
- if !<context.entity.flag[ball].starts_with[sports_football]>:
|
||||
- stop
|
||||
- if !<player.has_flag[sports]>:
|
||||
- stop
|
||||
- define arena_id <player.flag[sports].get[id]>
|
||||
- if !<[arena_id].starts_with[sports_football]>:
|
||||
- stop
|
||||
- if <proc[sports_arena_get_status].context[<[arena_id]>]> != normal:
|
||||
- stop
|
||||
- define min_y <player.eye_location.direction.vector.y>
|
||||
- if <[min_y]> < 0:
|
||||
- define min_y 0
|
||||
- define velo <context.entity.flag[ball_velocity].normalize.mul[0.05]>
|
||||
- define kick <player.eye_location.direction.vector.mul[0.75].with_y[<[min_y]>].add[0,0.25,0].add[<[velo]>]>
|
||||
- if <player.is_sprinting>:
|
||||
- define kick <player.eye_location.direction.vector.with_y[0.25].mul[1.5]>
|
||||
- if !<player.is_on_ground>:
|
||||
- define kick <player.eye_location.direction.vector.with_y[0.75].mul[1.5]>
|
||||
- run ball_vector_add def.ball:<context.entity> def.vector:<[kick]>
|
||||
## out of bounds & ball collision
|
||||
on player walks:
|
||||
- if !<player.has_flag[sports]>:
|
||||
- stop
|
||||
- define arena_id <player.flag[sports].get[id]>
|
||||
- if !<[arena_id].starts_with[sports_football]>:
|
||||
- stop
|
||||
- if <proc[sports_arena_get_status].context[<[arena_id]>]> != normal:
|
||||
- stop
|
||||
# ball collision
|
||||
- define ball <proc[ball_get].context[<[arena_id]>]>
|
||||
- if <player.location.y.add[0.1]> > <[ball].location.y>:
|
||||
- if <player.location.distance_squared[<[ball].location>]> < 0.5:
|
||||
- run ball_vector_add def.ball:<[ball]> def.vector:<[ball].location.sub[<player.location>].normalize.mul[0.5].add[0,0.05,0]>
|
||||
- ratelimit <player> 10t
|
||||
## goal scoring
|
||||
on custom event id:ball_move bukkit_priority:low:
|
||||
- if !<context.ball_id.starts_with[sports_football]>:
|
||||
- stop
|
||||
- define arena_id <context.ball_id>
|
||||
- if <proc[sports_arena_get_status].context[<[arena_id]>]> != normal:
|
||||
- stop
|
||||
- define extra <proc[sports_arena].context[<[arena_id]>].get[extra_data]>
|
||||
- if <[extra].get[red_goal].contains[<context.now>]> || <[extra].get[red_goal].contains[<context.next>]>:
|
||||
- run sports_football_score_goal def.id:<[arena_id]> def.team:blue
|
||||
- else if <[extra].get[blue_goal].contains[<context.now>]> || <[extra].get[blue_goal].contains[<context.next>]>:
|
||||
- run sports_football_score_goal def.id:<[arena_id]> def.team:red
|
||||
Reference in New Issue
Block a user