Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Server displays AttributeError error #2

Open
mzfr opened this issue Apr 16, 2020 · 2 comments
Open

Server displays AttributeError error #2

mzfr opened this issue Apr 16, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@mzfr
Copy link

mzfr commented Apr 16, 2020

Describe the bug
When I run the server and after players start playing on my terminal in the server I can see a lot of traceback being generated. Giving the following error:

Traceback (most recent call last):
  File "data/scripts/bsGame.py", line 352, in __del__
    self.handleMessage(DieMessage())
  File "data/scripts/bsPowerup.py", line 487, in handleMessage
    if self.nodeLight.exists():

To Reproduce
Steps to reproduce the behavior:

  1. Start the server.
  2. Wait for people to join and start playing.
  3. See error

Expected behavior
There should be any traceback displayed.

Platform(please complete the following information):

  • Device: Digital ocean droplet
  • OS: Ubuntu

Additional context

if we print out all the attributes of the object we can see the following

['__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_activity', '_handleMessageSanityCheck', '_powersGiven', '_startFlashing', 'autoRetain', 'delete_portal', 'exists', 'getActivity', 'getFactory', 'handleMessage', 'isAlive', 'isFinalized', 'node', 'onFinalize', 'portal', 'powerupType']

And as we can see that there is no nodeLight there, this is because inline 360 of bsPowerup.py you set self.nodeLigh to certain values but only when settings.discoLightsOnPowerUps are on. Here is the code snippet of bsPowerup.py from line 359 to 366

if settings.discoLightsOnPowerUps:
    self.nodeLight = bs.newNode('light',
                                attrs={'position': self.node.position,
                                        'color': color,
                                        'radius': 0.05,
                                        'volumeIntensityScale': 0.03})
    self.node.connectAttr('position', self.nodeLight, 'position')
    bsUtils.animateArray(self.nodeLight, 'color', 3, prefixAnim, True)

Fix

So I think the fix would be to add a simple check condition above line 486 and the complete code would look like(from line 479 to 488):

elif isinstance(msg, bs.DieMessage):
    if self.node.exists():
        if (msg.immediate):
            self.node.delete()
        else:
            curve = bs.animate(self.node, "modelScale", {0: 1, 100: 0})
            bs.gameTimer(100, self.node.delete)
    if settings.discoLightsOnPowerUps: 
		if self.nodeLight.exists():
       	 self.nodeLight.delete()

Sorry to just write everything here, if you would put the source code on this repository I would be happy to make a PR for it.

@mzfr mzfr added the bug Something isn't working label Apr 16, 2020
@rahulraman0108
Copy link
Owner

Hi Mehtab,

Thank you for figuring out the bug in the code. I would have fixed this bug soon.

But now, I am going to archive this repository since I can no longer work on this repository frequently.
But, there will be a new repository in the organization account @BombSquaders where the server 1.4 version release will be available and after the original server builds for 1.5 is released the code on the repository will also be updated to support the latest API.

Watch the organization for updates about the repository.

@mzfr
Copy link
Author

mzfr commented Apr 16, 2020

oh great...I would be happy to contribute to the org if the source code would be available on github directly :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants