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

Basic NFC Modem functionality for Pocket Computer #1689

Open
wants to merge 6 commits into
base: mc-1.20.x
Choose a base branch
from

Conversation

hugeblank
Copy link
Member

@hugeblank hugeblank commented Jan 19, 2024

Attaches a 0-block radius "NFC" wireless modem to the top of the pocket computer. This is done to address the core issue presented in both #1406 and #1688.

TODO:

  • Rename peripheral type to "nfc"
  • Use per-player wireless network instead of the global one to prevent ender modem sniffing of NFC transmissions.
  • Rename transmission events to "nfc_message"

Feedback would be greatly appreciated on this to do list, specifically whether any/all of the items should actually be done.

@hugeblank hugeblank changed the title Basic NFC Modem functionality Basic NFC Modem functionality for Pocket Computer Jan 19, 2024
@Wojbie
Copy link
Contributor

Wojbie commented Jan 19, 2024

Feedback

Rename peripheral type to "nfc"
Rename transmission events to "nfc_message"

Does it really need to implement as separate logic? I mean if this was just a normal wireless modem it would work with all already written code (and rednet).

Use per-player wireless network instead of the global one to prevent ender modem sniffing of NFC transmissions.

We could achieve same effect just by not allowing messages from this modem to be heard on range over 1 block. Not sure how feasible that would be to invert this bit of message networking logic but it might be less complicated then creating completely new system.

Suggestion

I would suggest increasing range to 1 block to allow near range communication
This way while adding ability to network inside player inventory we also add ability to communicate between 2 players close to each other (like in a boat) [Sneakernet anyone?] or between player and wireless modem right next to it (commonly used for door locks in CC:T).

setLocation(access);

var state = getModemState();
if (state.pollChanged()) access.setLight(state.isOpen() ? 0xf39d20 : -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Traditionally only main peripherals set light status. This might look odd if this one and back peripheral will both try to set different colours.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, not sure how to address it though. Color blending? Blinking between the two colors?

Copy link
Member Author

Choose a reason for hiding this comment

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

5c67b6c is my attempt at addressing this, the light slowly cycles between the two active colors

@hugeblank
Copy link
Member Author

Does it really need to implement as separate logic? I mean if this was just a normal wireless modem it would work with all already written code (and rednet).

This is true, in that case I won't implement list entries 1, and 3.

We could achieve same effect just by not allowing messages from this modem to be heard on range over 1 block. Not sure how feasible that would be to invert this bit of message networking logic but it might be less complicated then creating completely new system.

IMO, the objective here is strictly to have a means to transmit messages contained within the player's inventory. If it's desired to have out-of-inventory communication, then that's when you'd attach a wireless modem.

@fatboychummy
Copy link
Contributor

fatboychummy commented Jan 19, 2024

I would suggest increasing range to 1 block to allow near range communication

Personally I'd say 2 blocks. Depending on where the range is checked from, you may end up in situations like the following: (assuming it checks from the feet)

SmartSelect_20240119_152448_Samsung Notes

Where gray is range of 1, purple is range of 2. If it checks from the feet, a computer at head-height beside the player would be out of range with a range of 1, even if you stood right beside it. Having a 2 block range would fix that.

(Please ignore my great drawing skills, not at a PC at the moment so all I have is my phone's notes app)

@Wojbie
Copy link
Contributor

Wojbie commented Jan 19, 2024

IMO, the objective here is strictly to have a means to transmit messages contained within the player's inventory. If it's desired to have out-of-inventory communication, then that's when you'd attach a wireless modem.

I see your point. And in the end if someone really wanted long range modem communication they could just carry a wireless pocket that would repeat messages between wireless modem and this inner modem. I just think that combining this with short range (1-block) mode from #1688 would provide more wide game play possibilities. Like sneakernet or pokemon style pocket gaming.

Personally I'd say 2 blocks. Depending on where the range is checked from, you may end up in situations like the following: (assuming it checks from the feet)

If i remember right CC modems transmit from eyes of player.

@hugeblank
Copy link
Member Author

I see your point. And in the end if someone really wanted long range modem communication they could just carry a wireless pocket that would repeat messages between wireless modem and this inner modem. I just think that combining this with short range (1-block) mode from #1688 would provide more wide game play possibilities. Like sneakernet or pokemon style pocket gaming.

I agree, I just don't think it's in the scope of this PR, and more-so something that should be added onto wireless modems like proposed in the referenced issue.

tested as functional in multiplayer
@hugeblank
Copy link
Member Author

Latest commit isolates networks on a per-entity basis, preventing sniffing from ender modems.

@hugeblank hugeblank marked this pull request as ready for review January 20, 2024 00:12
Slowly cycles between the orange NFC modem color, and the color set by the back peripheral if both are active.
@hugeblank
Copy link
Member Author

hugeblank commented Jan 20, 2024

Demonstration of the light cycle effect:

2024-01-19.23-44-33-00.00.09.437-00.00.28.044.mp4

This is a bit extreme, but I thought it would be interesting to see what it looks like and field discussion from there.

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.

None yet

3 participants