Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redstone #941

Closed
wants to merge 8 commits into from
Closed

redstone #941

wants to merge 8 commits into from

Conversation

xNatsuri
Copy link
Contributor

This pr is built from #739

the goal for this pr is to add the base for redstone.

this pr adds

levers
buttons
pressure plates

redstone wire
redstone torch
redstone block
redstone lamp
redstone ore

iron door
iron trap door

hopper locking

Copy link
Member

@TwistedAsylumMC TwistedAsylumMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far, keep up the good work!

Comment on lines +238 to +241
case "ButtonType":
return "uint64(" + s + ".Uint8())", 6
case "PressurePlateType":
return "uint64(" + s + ".Uint8())", 8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, you can reduce this to 2 for buttons and 3 for pressure plates

return
}

h.Powered = powered
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If !powered you should reset the cooldowns as well as short circuiting the Tick() method like mentioned on discord

server/block/iron_door.go Show resolved Hide resolved
"time"
)

// IronTrapDoor is a solid, transparent block that can be used as an openable 1×1 barrier.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention it's redstone functionality similarly to iron doors

server/block/iron_trapdoor.go Show resolved Hide resolved

// NeighbourUpdateTick ...
func (p PressurePlate) NeighbourUpdateTick(pos, _ cube.Pos, w *world.World) {
if d, ok := w.Block(pos.Side(cube.FaceDown)).(LightDiffuser); ok && d.LightDiffusionLevel() == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check for support supposed to be different to the one below in UseOnBlock()

server/block/redstone.go Show resolved Hide resolved
server/block/redstone_ore.go Show resolved Hide resolved
import "github.com/df-mc/dragonfly/server/item"

// RedstoneOre is a common ore.
type RedstoneOre struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the server needs to handle the state of redstone becoming active when interacted with?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing lit state

server/world/block.go Show resolved Hide resolved

// Uint8 ...
func (b ButtonType) Uint8() uint8 {
return b.wood.Uint8() | uint8(b.button)<<4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ideal. With the current order, as we get more wood variants, this will need to be updated, which might not be obvious to whoever is doing that.

Comment on lines +31 to +34
if b.Type == StoneButton() || b.Type == PolishedBlackstoneButton() {
return item.FuelInfo{}
}
return newFuelInfo(time.Second * 5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be checking if type == Wood() if future types were to be added, although Wood currently takes a parameter...

Comment on lines +93 to +96
delay := time.Millisecond * 1500
if b.Type == StoneButton() || b.Type == PolishedBlackstoneButton() {
delay = time.Millisecond * 1000
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably better in ButtonType

server/block/tnt.go Show resolved Hide resolved
server/block/redstone_torch.go Show resolved Hide resolved
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierIron.HarvestLevel
}, pickaxeEffective, silkTouchOneOf(RedstoneWire{}, c)).withXPDropRange(1, 5)
if c.Type == DeepslateOre() {
i = i.withBlastResistance(9)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for redstone ore

func (c RedstoneOre) BreakInfo() BreakInfo {
i := newBreakInfo(c.Type.Hardness(), func(t item.Tool) bool {
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierIron.HarvestLevel
}, pickaxeEffective, silkTouchOneOf(RedstoneWire{}, c)).withXPDropRange(1, 5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop needs fixing

import "github.com/df-mc/dragonfly/server/item"

// RedstoneOre is a common ore.
type RedstoneOre struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing lit state

server/block/redstone_block.go Show resolved Hide resolved
@xNatsuri xNatsuri closed this Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants