Skip to content

Commit

Permalink
add support indicator terminating after all of its bullets have termi…
Browse files Browse the repository at this point in the history
…nated

- also add tick delay to indicator termination so we can easily play a termination animation later
  • Loading branch information
TheAfroOfDoom committed Jan 27, 2024
1 parent 54c535e commit 04ce2e7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
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
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
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
scoreboard players add @s attack.clock.i 1
execute if entity @s[tag=flies_are_done] run function entity:hostile/omega-flowey/attack/flies/indicator/loop/flies_are_done
execute if entity @s[tag=flies_are_done] run return 0

# Increment attack.clock.i before all flies are done (have been summoned + terminated)
execute if score @s attack.clock.i matches ..-1 run scoreboard players add @s attack.clock.i 1

# Ignore bullet summoning logic while `attack.clock.i` is negative
execute if score @s attack.clock.i matches ..-1 run return 0
Expand All @@ -7,7 +11,3 @@ execute if score @s attack.clock.i matches ..-1 run return 0
scoreboard players operation @s math.0 = @s attack.clock.i
scoreboard players operation @s math.0 %= @s attack.indicator.rate
execute if score @s attack.bullets.remaining matches 1.. if score @s math.0 matches 0 run function entity:hostile/omega-flowey/attack/flies/indicator/loop/bullet/presummon

# Terminate after flies shoot animation finishes
# TODO should only run terminate check upon a bullet's termination
execute if score @s attack.bullets.remaining matches ..0 run function entity:hostile/omega-flowey/attack/flies/indicator/terminate
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
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

0 comments on commit 04ce2e7

Please sign in to comment.