#(Funkyhehim) Preventing A Lamp From Ever Being Powered From A Block Update

42 messages · Page 1 of 1 (latest)

karmic wolf
#

Title. What I’m trying to make is a new redstone component/device which is a speaker. Basically, I have a redstone lamp which is flagged that I want to play a sound when it’s powered (switched). Then, to stop it from making light, I flip it off without physics, returning it to its original state. The problem I’m having is if the block is updated (for example, when you place something adjacent) the sound will trigger, which is not the desired effect. How can I prevent this from happening, and only have the event activate from it being powered?

dense barnBOT
#

(Funkyhehim) Preventing A Lamp From Ever Being Poweed

#

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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

karmic wolf
#

What I have ^

#

The custom event I’m using ^

#

(Funkyhehim) Preventing A Lamp From Ever Being Powered From A Block Update

trail horizon
#

!e block physics

frank vergeBOT
# trail horizon !e block physics
Group

Block

**WARNING**

This event may fire very rapidly.

Event Lines

<block> physics

Switches

adjacent:<block> to only process the event if the block or an immediately adjacent block (up/down/n/e/s/w) matches the LocationTag matcher specified. This can be useful to prevent blocks from breaking.

Triggers

when a block's physics update.

Context

<context.location> returns a LocationTag of the block the physics is affecting.
<context.new_material> returns a MaterialTag of what the block is becoming.

Has Known Location

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

Cancellable

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

trail horizon
#

with location_flagged switch

#

its cancellable

karmic wolf
#

uh huh yeah i know

#

I'm trying not to update it when a player puts a block next to it or any reason other than being powered

gleaming widget
#

if so, in what way?

karmic wolf
#

Basically, I only want the block to trigger when it receives power from a source for the first time, like a dispenser

#

My current method works, however, whenever the block updates due to other reasons, the lamp lights up again, misfiring the trap

#

My end end goal is to make a custom traps system

karmic wolf
karmic wolf
#

Looking at the spigot docs for the BlockPhysicsEvent I see that the getSourceBlock() method is not used in Denizen’s BlockPhysicsScriptEvent and I was thinking that may possibly be relevant or be a solution to getting what location caused the block update?

GitHub

NPC and general Spigot scripting, using the Denizen Scripting Language! - Denizen/BlockPhysicsScriptEvent.java at dev · DenizenScript/Denizen

karmic wolf
#

Any updates on this? I’d also be content if I could somehow fake the lantern into not emitting light.

karmic wolf
#

Maybe I could use pistons for this instead?? I’ll tias later

tough rover
#

You could flag the block with it's powered state, then when block physics triggers, see if the powered state has changed. If it didn't, then it was probably just a block being placed nearby, and you can ignore it

karmic wolf
#

I mean that’s an option too I suppose

#

oh yeah a piston wouldn’t work…

karmic wolf
karmic wolf
#

Resolving this because SOMEBODY decided to implement this WITHOUT TELLING ME @junior dirge

#

actually should I keep this open as a feature rqst

junior dirge
#

wat

junior dirge
karmic wolf
#

No </3

civic fogBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@karmic wolf