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

nanobot coding. #168

Open
gravestristen opened this issue Nov 2, 2016 · 0 comments
Open

nanobot coding. #168

gravestristen opened this issue Nov 2, 2016 · 0 comments

Comments

@gravestristen
Copy link

Description

[Description of the issue]
If an infected player is offline it breaks the code

Steps to Reproduce

  1. [First step]
local bots = peripheral.wrap("top")
bots.setLabel("nano") -- what does this line do?

for _, id in --[[i]]pairs(bots.getInfectedEntities()) do
  local currId = bots.getInfectedEntity(id)
  
  if currId.isPlayer() then
    print(currId.getPlayerName())
  end
end
  1. [Second step]
    run the program and it returns with a list of infected players

Expected behavior: [What was supposed to happen]
when the program runs it gives a list of the infected players
Actual behavior: [What actually happened]
when the program runs It gives a list of infected players UNLESS they are not unline then it says entity with an id (Player's UUID) cannot be interacted with and stops the program not finishing the list
Stacktrace (if applicable): [PASTEBIN or HASTEBIN link to the stacktrace. Do NOT copy and paste the log into the issue post itself.]

Version affected: [The version of Peripherals++ and Forge]
Peripherals++-1.3.6, fml 7.10.99.99

Additional Information

[Any other information that may be able to help me with the problem]
I would suggest implementing something like .isInteractable() to check if the id is interactable and return with a true/false so I could do something like:

for _, id in --[[i]]pairs(bots.getInfectedEntities()) do
local currId = bots.getInfectedEntity(id)

if currId.isPlayer() and currId.isInteractable() then
print(currId.getPlayerName())

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

No branches or pull requests

1 participant