#(JustinS) Limited fire spreading (OLD:how to get the blocks attached to a location)

175 messages · Page 1 of 1 (latest)

strong raven
#

Im trying to prevent blocks from igniting if theyre not flagged with fire_spread_block. Issue is, the context.location returns the location of the fire. Not the location of the block that's on fire. So I tried getting the blocks around the fire using - define locations <context.location.find_blocks_flagged[fire_spread_block].within[1].filter_tag[<[filter_value].material.is_solid>]> I tried multiple values in the within, but all of them give me a very weird result. See the image, the middle block is flagged with the fire_spread_block flag. For some reason, the top left 3 blocks can also get ignited by my fireball, but the other 5 cant??!? The only block thats supposed to be ignited is the middle block, thats flagged. Im confused

digital edgeBOT
#

(JustinS) how to get the blocks attached to a location?

digital edgeBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

strong raven
#

ig .is_within isnt the right tag. Is there another one I could use for this?

strong raven
#

what the fuck is going on here

        on block ignites:
            - define l_up <context.location.add[0,1,0]>
            - define l_down <context.location.add[0,-1,0]>
            - define l_1 <context.location.add[1,0,0]>
            - define l_2 <context.location.add[-1,0,0]>
            - define l_3 <context.location.add[0,0,1]>
            - define l_4 <context.location.add[0,0,1]>
            - define locs <list[<[l_up]>, <[l_down]>, <[l_1]>, <[l_2]>, <[l_3]>, <[l_4]>]>

            - foreach <[locs]> as:loc:
                - if <[loc].material.is_solid> && <[loc].has_flag[fire_spread_block]>:
                    - announce "solid loc: <[loc]>"
                    - stop```
The debugs are making 0 sense. I'm literally getting a list of locations, then looping through it, and the debug is saying that <[loc]> == <[locs]>?!??!?!?!? https://paste.denizenscript.com/View/123431 am I just being stupid here or...?!??!
#

(JustinS) debug making 0 sense (OLD: how to get the blocks attached to a location?)

royal quartz
#

Perhaps you might want to look into the physics event.

strong raven
#

You mean this?

royal quartz
#

Yes.

strong raven
#

Could you maybe give an example? I find that event very confusing

royal quartz
#

Put the event in a test server, and light a block, or wait for firespread. A void/flat world would help.

strong raven
#

oh jesus thats a lot of messages Im getting

#

every physics event is now triggering

royal quartz
#

Yep. Hence a flat world or void world suggestion.

strong raven
#

I dont see how this could be very useful

#

I cant check if it's fire

#

I simply need to prevent all blocks from catching fire and breaking from fire, except those flagged with fire_spread_block, which should go back in 5 minutes if theyre broken by fire

strong raven
#

(JustinS) debug making 0 sense and how to get the blocks attached to a location

thorn plank
#

!e fire

novel rivetBOT
# thorn plank !e fire
Cannot Specify Searched Event

Multiple possible events: firework bursts, crackshot player fires projectile, crackshot player fires automatic weapon.

thorn plank
#

huh i could've sworn there was a fire spreads event

fathom vigil
#

!e block spread

novel rivetBOT
# fathom vigil !e block spread
Group

Block

Event Lines

block spreads

Switches

type:<block> to only run if the block spreading matches the material input.

Triggers

when a block spreads based on world conditions, EG, when fire spreads, or when mushrooms spread, or when vines grow.

Context

<context.source_location> returns the LocationTag of the block that spread.
<context.location> returns the LocationTag of the new block.
<context.material> returns the MaterialTag of the block that spread.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

thorn plank
#

yup

strong raven
#

Yeah Im using that

#

Im using all the events that do anything with fire

thorn plank
#

that and

#

!e block burns

novel rivetBOT
# thorn plank !e block burns
Group

Block

Event Lines

<block> burns

Triggers

when a block is destroyed by fire.

Context

<context.location> returns the LocationTag the block was burned at.
<context.material> returns the MaterialTag of the block that was burned.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

strong raven
#

and on block ignites

#

yeah

thorn plank
strong raven
#

Let me reformulate

fathom vigil
#

he wants the location of the block the fire is attached to

#

not the actual fire block location

night tundra
#

!t MaterialTag.faces

novel rivetBOT
strong raven
#

The on block burns questions works perfectly fine.
If I use on block ignites, it will only ignite the fire_spread_blocks. WIth some experimenting I found out it takes years before it then finally gets them all. So that doesnt work
And for on block ignites, see what Tek said. I cant get the location working

night tundra
#

Might be able to do something with that?

thorn plank
#

i was thinking flood fill

night tundra
#

(To get the block a fire is on)

strong raven
#

whats flood fill

strong raven
thorn plank
thorn plank
novel rivetBOT
# thorn plank !t location.flood_fill

Returns the set of all blocks, starting at the given location,
that can be directly reached in a way that only travels through blocks of the same type as the starting block.
For example, if starting at an air block inside an enclosed building, this will return all air blocks inside the building (but none outside, and no non-air blocks).
As another example, if starting on a block of iron_ore in the ground, this will find all other blocks of iron ore that are part of the same vein.
This will not t...

Group

world

Returns

ListTag(LocationTag)

strong raven
#

How do I change the face of the fire to a direction though?

thorn plank
#

you could use that on the fire spreads event, to see if any adjacent blocks are "unflammable" by your rules

strong raven
#

The only unflammable blocks are those that are standard unflammable in minecraft or dont have the flag 'fire_spreads_block'

#

not sure if flood_fill can do that

#

Because if I have wood and hay next to each other it''ll only get the hay

strong raven
#

is it possible to remove the fire after it has been burning for 10 seconds?

#

if its not a flagged block

thorn plank
#

aya probably has the best answer, use the faces thingie

strong raven
#

Tried - announce <context.location.material.faces>

#

and it narrates "context.location.material.faces"

thorn plank
#

huh

strong raven
#

because its air

#

air is getting ignited?

#

I dont get it anymore

thorn plank
#

that should be in the block spreads event

strong raven
#

why

#

the block ignites event usually returns the fire's location with <context.location>

thorn plank
#

because it's the one that's referring to fire, "block burns" is referring to wood, hay, etc

strong raven
#

yeah

thorn plank
#

!e block ignites

novel rivetBOT
# thorn plank !e block ignites
Group

Block

Event Lines

block ignites

Switches

cause:<cause> to only process the event when it came from a specified cause.

Triggers

when a block is set on fire.

Context

<context.location> returns the LocationTag of the block that was set on fire.
<context.entity> returns the EntityTag of the entity that ignited the block (if any).
<context.origin_location> returns the LocationTag of the fire block that ignited this block (if any).
<context.cause> returns an ElementTag of the cause of the event: <@link url https://hub.spigotmc.o...

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

strong raven
#

dont you want the face of the fire?

#

Apparently Im confused on what I want to do with the faces

thorn plank
#

the LocationTag of the block that was set on fire
you need the location of the fire

strong raven
#

it returns the location of the fire

#

the docs are just wrong there

#

Already tested that

#

I tried putting it in on block burns anyways. Same issue

#

still thinks it's air

#

right so now it seems both of those events return air

#

Im lost

fathom vigil
novel rivetBOT
#
Possible Confusion

Did you mean to search for script event after vs on?

novel rivetBOT
# fathom vigil !lang on vs after

Modern ScriptEvents let you choose between "on" and "after".
An "on" event looks like "on player breaks block:" while an "after" event looks like "after player breaks block:".

An "on" event fires *before* the event actually happens in the world. This means some relevant data won't be updated
(for example, "<context.location.material>" would still show the block type that is going to be broken)
and the result of the event can be changed (eg the event can be cancelled to stop it from actually going through).

An "after" event, as the name implies, fires *after* the event actually happens. This means data will be already updated to the new state
(so "<context.location.material>" would now show air) but could potentially contain an arbitrary new state from unrelated changes
(for example "<con...

Group

Script Events

fathom vigil
#

it's because you're using on block ignites

#

it fires before the actual event happens

#

therefore the location is still air

strong raven
#

hmmm

#

I see

#

that seems to work

#

that only returns the fire on the sides though

fathom vigil
strong raven
#

oh its empty otherwise

#

now how do I get the block thats facing the face?

#

Aka how do I convert EAST or WEST into a direction

#

Tried block_facing

fathom vigil
#

i didnt really find any tag that lets you convert direction into a normal vector

#

i tried playing around with raytrace but it seems funky when i raytrace from the fire's location and return a normal vector

#

so i just made a proc for it

#
faces_to_normal_vec:
  type: procedure
  definitions: face
  script:
  - definemap vectors:
      west: 1,0,0
      north: 0,0,1
      east: -1,0,0
      south: 0,0,-1
  - determine <[vectors.<[face]>]||null>

...

    after block ignites:
    - define face <context.location.material.faces.first||null>

    - if <[face]> == null:
      - announce "Burnt block is below."
      - debugblock <context.location.below> players:<server.online_players> d:5s
      - stop
    - announce "Burnt block is on the side."
    - define vec <[face].proc[faces_to_normal_vec]>
    - debugblock <context.location.sub[<[vec]>]> players:<server.online_players> d:5s```
#

the location in the debugblock commands is the block being burnt

strong raven
#

ohh thats great

#

Ill have a good luck tomorrow. Brain has melted by now

#

look*

fathom vigil
#

not sure if faces can have more values (up/down whatever) so ill leave that for you to discover (i turned off server already)

#

if they can you can just exclude them i guess

strong raven
#

I dont think so, at least not for fire

#

we'll see

strong raven
#

my lord and saviour Tek

#

it works

#

Determine cancelled didnt work so I used - modifyblock <context.location> air for the on ignite

#

and I paired it with the on block burns event

#

Only thing now is, I need to put the broken block back after 5 min. Should be possible

#

only thing is, for larger structures it takes ages to fully combust

#

and it doesnt always spread properly

#

hmm theres a little issue

maiden pawn
#

- define face <context.location.material.faces.first||null>
shouldnt you be foreaching the faces

strong raven
#

yeah maybe

#

just figured out it can have multiple faces. didnt know that first

maiden pawn
#

you mean you didn't know that at listtag.first ;D

strong raven
maiden pawn
#

a debug might show if the block has the flag, or not

#

definitely odd

strong raven
#

Well Im looking at the block and narrating its flags

#

but

#

sure Ill get the debug

#

alright its getting weirder, bcs why not. I set both 4 front middle blocks on fire. This is what I ended up with after like a minute of burning. What shouldve happened: all 8 middle blocks gone, pretty fast.
https://paste.denizenscript.com/View/123433

#

all middle 8 blocks are flagged with fire_spread_block

strong raven
#

so fire doesnt spread at all anymore

#

🤔

fathom vigil
#

that if will never run

#

ill play around w this later more if someone doesnt get to u first

strong raven
#

k awesome

fathom vigil
#

hi

fathom vigil
#

is the first event working as you want it to?

strong raven
#

Yeah, the burning works

#

The spreading is just bugging out now and then. See the vids/images

fathom vigil
#

oke ill check it out

strong raven
#

Awesome

fathom vigil
#

@strong raven i didnt have a lot of time to test but i can replicate it yeah

#

it makes me think there's maybe some underlaying conditions or something to do with how fire spread/burning is handled internally

#

because if you leave off the second part of the script all flagged blocks eventually burn

strong raven
#

I'd be fine with fire spreading on other blocks too, as long as it disappears in like 7 seconds, and doesnt combust

#

But Im not sure if its possible to check how long fire is alive

#

in seconds

fathom vigil
#

@strong raven hi

#

the only way i could get this working without fire spreading to the other blocks is to imitate the burning on your own

fathom vigil
#

sorry got distracted

#

anyway

#

only middle 4 blocks were flagged

#

though if you want like, depth to it (say there's 8 blocks flagged, 2x2 on top of each other), you probably want the fire to spread and then manually remove it

strong raven
#

Hmm

#

Well yeah it should spread to other fire_spread_blocks

strong raven
#

I did some more testing and I think I know why I cant light deeper blocks on fire even thought theyre flagged. In the code it mentions:

            - foreach <context.location.material.faces> as:face:
                - define vec <[face].proc[faces_to_normal_vec]>
                - if !<context.location.sub[<[vec]>].has_flag[fire_spread_block]>:
                    - modifyblock <context.location> air```
Now, if i try setting one of the deeper blocks on fire, usually theres 2 or 3 faces of which a few face a not-flagged block. So I need to somehow check if ALL the faces are facing a non flagged block
#

instead of just one

#

Not sure how I would do that to be honest

#

(JustinS) Limited fire spreading (OLD:how to get the blocks attached to a location)

strong raven
#

So I tried changing it to this, to check whether any of the faces are flagged

            - if <context.location.material.faces.is_empty>:
                - if !<context.location.below.has_flag[fire_spread_block]>:
                    - modifyblock <context.location> air
                - stop
            - foreach <context.location.material.faces> as:face:
                - define vec <[face].proc[faces_to_normal_vec]>
                - if !<context.location.sub[<[vec]>].has_flag[fire_spread_block]>:
                    - define no_fire_faces:->:<context.location.sub[<[vec]>]>
            # If all the faces arent connected to a fire block, stop
            - if <[no_fire_faces].size> == <context.material.faces.size>:
                - modifyblock <context.location> air```
#

Still doesnt allow deeper flagged blocks to ignite though

#

hmm wait it does, sort of. It just doesnt work for standing fires (fires that sit on the block below them)

#

So I basically need to check if the blocks surrounding the standing fire have a fire spread flag

            - if <context.location.material.faces.is_empty> && !<context.location.below.has_flag[fire_spread_block]>:
                - modifyblock <context.location> air
                - stop```
strong raven
#

Alright so I changed it to this, and it seems to work
https://paste.denizenscript.com/View/123490
There's only 1 issue. When all the flagged blocks have burnt, the fire still remains and keeps spreading to where the old fire_spread_blocks were. If the blocks then respawn, they catch fire again, and it loops

strong raven
#

I kinda made it work. Still sucks but it's better

#

Thanks for the help Tek!