mirror of
https://github.com/Wesley-DeMontigny/WLUS.git
synced 2026-02-07 18:48:31 -06:00
Added event handling and handlers for the packets Session Info and Minifigure list request
32 lines
822 B
Python
32 lines
822 B
Python
import game_types
|
|
import threading
|
|
|
|
'''
|
|
Scripts can be attached to just about any object.
|
|
They are executed in a seperate thread and have access to their script object's properties even from another file (Although PyCharm or any other editor won't realize that and will try to tell you its an error).
|
|
'''
|
|
|
|
class Script():
|
|
def __init__(self, parent, script_name :str = "", script_path : str = ""):
|
|
self._parent = parent
|
|
self._name : str = script_name
|
|
self._script_path : str = script_path
|
|
|
|
def set_path(self, script_path : str):
|
|
self._script_path = script_path
|
|
|
|
def set_name(self, name):
|
|
self._name = name
|
|
|
|
def get_name(self):
|
|
return self._name
|
|
|
|
def get_parent(self):
|
|
return self._parent
|
|
|
|
def run(self):
|
|
script_file = open(self._script_path, 'r')
|
|
script_str = script_file.read()
|
|
exec(script_str)
|
|
|