-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support indicator terminating after all of its bullets have termi…
…nated - also add tick delay to indicator termination so we can easily play a termination animation later
- Loading branch information
1 parent
54c535e
commit 04ce2e7
Showing
6 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
13 changes: 8 additions & 5 deletions
13
...ega-flowey/data/entity/functions/hostile/omega-flowey/attack/flies/bullet/loop.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
scoreboard players add @s attack.clock.i 1 | ||
|
||
data merge storage utils:damage { damage: 2, radius: 1 } | ||
execute positioned ~ ~ ~ run function entity:utils/damage with storage utils:damage | ||
|
||
# Move forward | ||
function entity:hostile/omega-flowey/attack/flies/bullet/loop/move | ||
|
||
# TODO: validate/determine a value for how long until the flies bullets terminate | ||
# Terminate after X seconds | ||
execute if score @s attack.clock.i matches 60.. run function entity:hostile/omega-flowey/attack/flies/bullet/terminate | ||
# Begin terminating after reaching the venus fly trap's mouth | ||
execute unless entity @s[tag=is_terminating] run function entity:group/start | ||
execute unless entity @s[tag=is_terminating] if entity @e[scores={group.id=0},tag=attack-indicator,tag=flies,distance=..4] run tag @s add is_terminating | ||
execute unless entity @s[tag=is_terminating] run function entity:group/end | ||
# guard against flies who move past the fly trap and outside the arena due to e.g. lag | ||
execute unless entity @s[tag=is_terminating] unless entity @s[x=-25,dx=50,y=-100,dy=200,z=-7,dz=29] run tag @s add is_terminating | ||
|
||
execute if entity @s[tag=is_terminating] run function entity:hostile/omega-flowey/attack/flies/bullet/loop/terminating |
5 changes: 5 additions & 0 deletions
5
...ata/entity/functions/hostile/omega-flowey/attack/flies/bullet/loop/terminating.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scoreboard players add @s attack.clock.i 1 | ||
|
||
# Start animation | ||
|
||
execute if score @s attack.clock.i matches 5.. run function entity:hostile/omega-flowey/attack/flies/bullet/terminate |
8 changes: 8 additions & 0 deletions
8
...lowey/data/entity/functions/hostile/omega-flowey/attack/flies/bullet/terminate.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# Play sound | ||
playsound omega-flowey:attack.flies.swallow hostile @a ~ ~ ~ 5 1 1 | ||
|
||
kill @s | ||
|
||
# Check if indicator should terminate | ||
function entity:group/start | ||
execute as @e[scores={group.id=0},tag=attack-indicator,tag=flies] run function entity:hostile/omega-flowey/attack/flies/indicator/maybe_terminate | ||
function entity:group/end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...tity/functions/hostile/omega-flowey/attack/flies/indicator/loop/flies_are_done.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# After flies are done, continue incrementing attack.clock.i | ||
scoreboard players add @s attack.clock.i 1 | ||
|
||
# Begin animation | ||
# execute if score @s attack.clock.i matches 0 run | ||
|
||
# Terminate after X ticks (Y seconds) | ||
execute if score @s attack.clock.i matches 9.. run function entity:hostile/omega-flowey/attack/flies/indicator/terminate |
6 changes: 6 additions & 0 deletions
6
...a/entity/functions/hostile/omega-flowey/attack/flies/indicator/maybe_terminate.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## terminate if there are no more associated flies | ||
# (`function entity:group/start` has already been ran by the bullet who called this function) | ||
scoreboard players set #attack.flies.count math.0 0 | ||
execute as @e[scores={group.id=0},tag=attack-bullet,tag=flies] run scoreboard players add #attack.flies.count math.0 1 | ||
execute if score #attack.flies.count math.0 matches 0 run scoreboard players set @s attack.clock.i -1 | ||
execute if score #attack.flies.count math.0 matches 0 run tag @s add flies_are_done |