Jump to content




make pocket computers stay on while in non-player entities (such as minecarts)


9 replies to this topic

#1 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 19 June 2014 - 02:53 AM

Can you please make it so pocket computers don't turn off when in the inventory of a non-player entity such as a minecart?

For a while now, I've been trying to make an automatic train routing system. I was going to just make a rule that the first cart of every train has to be a chest cart, and there has to be a floppy in the first slot with routing information, but I've found this to be nearly impractical. When pocket computers were added, I realized that they were the perfect solution to my problem - I wouldn't have to stop the train so a turtle could unload the floppy, put it in a disk drive, read it, and put it back - the switches could be set up while the train was still far away, and the train could just run right through without stopping (supposing there was no congestion, but that shouldn't be a problem since it's a small server). Unfortunately, my plans were ruined when I realized that pocket computers turn off when in any inventory other than a player inventory.

I can understand why it might not be possible to keep them on while in tile entities, but it would seem that since EntityPlayer is (indirectly) a subclass of Entity, it should be possible to keep the position of a pocket computer updated by just keeping a reference to its containing Entity. The only problem I can see with this is that, while player names never change, entity IDs change (or used to change) across world reloads, so they wouldn't be able to automatically start up again on world load, but still, from the little I know, it should be possible to make pocket computers stay on while in chest minecarts.

electrodude

Edited by electrodude512, 19 June 2014 - 02:55 AM.


#2 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 21 June 2014 - 04:07 PM

The problem is: how to get a reference to the containing entity in the first place? For items in player inventory, there is a callback getting called every tick, but that does not happen even in other vanilla inventories. To find out where it is, the mod would have to constantly scan all entities and tile entities, and that would kill the performance totally.

#3 misson20000

  • Members
  • 18 posts

Posted 24 June 2014 - 05:52 PM

Maybe ComputerCraft could keep a list of loaded pdas?

#4 apemanzilla

  • Members
  • 1,421 posts

Posted 25 June 2014 - 12:51 AM

View Postmisson20000, on 24 June 2014 - 05:52 PM, said:

Maybe ComputerCraft could keep a list of loaded pdas?
Then problems arise when other mods move items around in inventories without notifying CC properly - the PDA is "lost" according to CC.

#5 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 26 June 2014 - 08:19 PM

So if I make a special chest minecart that notifies items it contains about location changes and such, then my pocket computer will stay on and GPS will work?

Edited by electrodude512, 26 June 2014 - 08:20 PM.


#6 Sebra

  • Members
  • 726 posts

Posted 26 June 2014 - 08:57 PM

You would need Dan200's support for it.

#7 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 30 June 2014 - 03:08 AM

But if I lied properly to the pocket computer, it would work without Dan200 having to do anything?

#8 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 30 June 2014 - 07:32 AM

So a fakeplayer minecart?

#9 Sebra

  • Members
  • 726 posts

Posted 30 June 2014 - 01:37 PM

View Postelectrodude512, on 30 June 2014 - 03:08 AM, said:

But if I lied properly to the pocket computer, it would work without Dan200 having to do anything?
Try it ;)

#10 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 June 2014 - 02:57 PM

If implementing your cart doesn't involve modifying any of ComputerCraft's code, then it's not a problem.

If it does, then you'd need Dan's permission - which, as far as I'm aware, he's never given to anyone for any reason.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users