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

Engine placement usability improvements #481

Open
Discord-Github-Bridge opened this issue Jan 7, 2024 · 20 comments
Open

Engine placement usability improvements #481

Discord-Github-Bridge opened this issue Jan 7, 2024 · 20 comments

Comments

@Discord-Github-Bridge
Copy link
Collaborator

yarden.zamir on Discord says

Currently placing an engine out of alignment breaks it and it's hard to place them correctly, we want auto alignment at least, and maybe more to improve user experience. Either implemented on the mod side or on our side through script

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

Even if it is through the mod I expect it will take a bit so we should make a temp script solution

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

  • listen to block place event for engine
  • check space in front and behind (Note that it's not always the player front and behind directions as it already auto connects to shafts)
  • check orientation of first neibor engine found and change self orentation to match

@Discord-Github-Bridge
Copy link
Collaborator Author

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

The shaft alignment likley happens after the block place event so the best aproach might be to use schedule in ticks to check a tick after

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

Probably similar to A&B's dynamo script??

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

Did not know they have one, lets steal it then

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

Ehhhh not sure it's exactly what your looking for

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

Engines work a different without snapping but it'd be good to look at to get an idea of how to rotate stuff according to directions with kjs

@Discord-Github-Bridge
Copy link
Collaborator Author

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

// Block Placement

function opposite(face) {
if (face.equals('down'))
return 'up'
if (face.equals('east'))
return 'west'
if (face.equals('west'))
return 'east'
if (face.equals('north'))
return 'south'
if (face.equals('south'))
return 'north'
return 'down'
}

BlockEvents.placed(event => {
let block = event.getBlock()
// Reverse placed Dynamos on Sneak
if (event.getEntity() == null)
return

if (block.getId().startsWith('thermal:dynamo')) {
    let properties = block.getProperties()
    if (!(event.getEntity().isCrouching()))
        properties['facing'] = opposite(properties['facing'].toString())
        block.set(block.getId(), properties)
    Direction.ALL.values().forEach(face => {
        if (face.toString().toLowerCase() != opposite(properties['facing'].toString()))
            return
    });
}

})```

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

Ah no th ta the easy part. We need to align to shafts and shaft related devices

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

Which I expect will be easiest with a scheduled delay then check the orientation as I wrote

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

But that does save us some writing

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

Yeah for sure

@Discord-Github-Bridge
Copy link
Collaborator Author

deepacat on Discord says

Also I just realized this is my version of the script I changed a little and ported to 1.19 for my pack lol

@Discord-Github-Bridge
Copy link
Collaborator Author

kikis2111 on Discord says

hey can you explain the second bullet point here a bit more

@Discord-Github-Bridge
Copy link
Collaborator Author

kikis2111 on Discord says

you mean like if there is a shaft in front or behind then match the engine's spin to the shafts spin either clockwise or anti

@Discord-Github-Bridge
Copy link
Collaborator Author

kikis2111 on Discord says

and then the third bullet point means if there is an engine adjacent instead of a shaft then match too that spin too?

@Discord-Github-Bridge
Copy link
Collaborator Author

yarden.zamir on Discord says

at block place should do schedule in ticks for one tick later, at that point the engine will auto align to the shaft. then figure out what is front and what is back and check for neighbor engines and. their spin

@Yarden-zamir
Copy link
Member

should maybe be fixed in the newest update to the mod, #576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants