DollClothDynamic
* Added new prefix for lookahead type. * Added tracked item rebuild for the purpose of tracking types
This commit is contained in:
parent
8aa1a84efb
commit
99fbcd4ea7
@ -1,6 +1,6 @@
|
|||||||
init python:
|
init python:
|
||||||
class DollClothDynamic(DollCloth):
|
class DollClothDynamic(DollCloth):
|
||||||
prefixes = ["!=", "?=", "+=", "!", "?", "+"]
|
prefixes = ["!=", "?=", "+=", "!", "?", "+", "*"]
|
||||||
|
|
||||||
def __init__(self, name, categories, type, id, color, zorder=None, unlocked=False, level=0, blacklist=[], modpath=None, tracking=None, parent=None):
|
def __init__(self, name, categories, type, id, color, zorder=None, unlocked=False, level=0, blacklist=[], modpath=None, tracking=None, parent=None):
|
||||||
self._tracking = tracking
|
self._tracking = tracking
|
||||||
@ -21,7 +21,7 @@ init python:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def tracking_object(self):
|
def tracking_object(self):
|
||||||
if self.prefix in ("!", "?", "+"):
|
if self.prefix in ("!", "?", "+", "*"):
|
||||||
return self.char.states.get(self.tracking)[0]
|
return self.char.states.get(self.tracking)[0]
|
||||||
else:
|
else:
|
||||||
return eval(self.tracking)
|
return eval(self.tracking)
|
||||||
@ -49,6 +49,18 @@ init python:
|
|||||||
return "default"
|
return "default"
|
||||||
return tracking_id
|
return tracking_id
|
||||||
|
|
||||||
|
def _lookahead_type(path):
|
||||||
|
tracking_object = self.tracking_object
|
||||||
|
|
||||||
|
if not tracking_object:
|
||||||
|
return "default"
|
||||||
|
|
||||||
|
path = posixpath.join(path, tracking_object.type)
|
||||||
|
|
||||||
|
if not any(fp.startswith(path) for fp in renpy.list_files()):
|
||||||
|
return "default"
|
||||||
|
return tracking_object.type
|
||||||
|
|
||||||
def _chainload():
|
def _chainload():
|
||||||
|
|
||||||
def __wrapper(obj):
|
def __wrapper(obj):
|
||||||
@ -89,6 +101,7 @@ init python:
|
|||||||
"!": lambda tracking, _: _negative_lookahead(),
|
"!": lambda tracking, _: _negative_lookahead(),
|
||||||
"?": lambda tracking, path: _lookahead(path),
|
"?": lambda tracking, path: _lookahead(path),
|
||||||
"+": lambda tracking, _: _chainload(),
|
"+": lambda tracking, _: _chainload(),
|
||||||
|
"*": lambda tracking, path: _lookahead_type(path),
|
||||||
"!=": lambda tracking, _: _negative_lookahead_item(),
|
"!=": lambda tracking, _: _negative_lookahead_item(),
|
||||||
"?=": lambda tracking, _: _lookahead_item(),
|
"?=": lambda tracking, _: _lookahead_item(),
|
||||||
"+=": lambda tracking, _: _chainload(),
|
"+=": lambda tracking, _: _chainload(),
|
||||||
|
@ -235,16 +235,24 @@ init python:
|
|||||||
def unequip(self, *args):
|
def unequip(self, *args):
|
||||||
"""Takes argument(s) containing string cloth type(s) to unequip."""
|
"""Takes argument(s) containing string cloth type(s) to unequip."""
|
||||||
|
|
||||||
|
def _tracker_rebuild(type):
|
||||||
|
for tracking in self.get_trackers_list(type):
|
||||||
|
tracking.is_stale()
|
||||||
|
|
||||||
def _unequip_all():
|
def _unequip_all():
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
if not k in self.blacklist_unequip:
|
if not k in self.blacklist_unequip:
|
||||||
v[0], v[2] = None, True
|
v[0], v[2] = None, True
|
||||||
|
|
||||||
|
_tracker_rebuild(k)
|
||||||
|
|
||||||
def _unequip_type(type):
|
def _unequip_type(type):
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
if not k in self.blacklist_unequip and istype(v[0], type):
|
if not k in self.blacklist_unequip and istype(v[0], type):
|
||||||
v[0], v[2] = None, True
|
v[0], v[2] = None, True
|
||||||
|
|
||||||
|
_tracker_rebuild(k)
|
||||||
|
|
||||||
def _unequip_slot(slot):
|
def _unequip_slot(slot):
|
||||||
if slot in self.blacklist_unequip:
|
if slot in self.blacklist_unequip:
|
||||||
return
|
return
|
||||||
@ -256,6 +264,8 @@ init python:
|
|||||||
else:
|
else:
|
||||||
self.states[slot][0], self.states[slot][2] = None, True
|
self.states[slot][0], self.states[slot][2] = None, True
|
||||||
|
|
||||||
|
_tracker_rebuild(slot)
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isinstance(arg, str):
|
if isinstance(arg, str):
|
||||||
if arg == "all":
|
if arg == "all":
|
||||||
@ -302,16 +312,24 @@ init python:
|
|||||||
|
|
||||||
def strip(self, *args):
|
def strip(self, *args):
|
||||||
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
||||||
|
def _tracker_rebuild(type):
|
||||||
|
for tracking in self.get_trackers_list(type):
|
||||||
|
tracking.is_stale()
|
||||||
|
|
||||||
def _strip_all():
|
def _strip_all():
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
if not k.startswith(self.blacklist_unequip):
|
if not k.startswith(self.blacklist_unequip):
|
||||||
v[2] = False
|
v[2] = False
|
||||||
|
|
||||||
|
_tracker_rebuild(k)
|
||||||
|
|
||||||
def _strip_type(type):
|
def _strip_type(type):
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
if istype(v[0], type) and not k in self.blacklist_unequip and (k in self.multislots or not k.startswith(self.blacklist_strip)):
|
if istype(v[0], type) and not k in self.blacklist_unequip and (k in self.multislots or not k.startswith(self.blacklist_strip)):
|
||||||
v[2] = False
|
v[2] = False
|
||||||
|
|
||||||
|
_tracker_rebuild(k)
|
||||||
|
|
||||||
def _strip_slot(slot):
|
def _strip_slot(slot):
|
||||||
if slot in self.blacklist_unequip:
|
if slot in self.blacklist_unequip:
|
||||||
return
|
return
|
||||||
@ -323,6 +341,8 @@ init python:
|
|||||||
else:
|
else:
|
||||||
self.states[slot][2] = False
|
self.states[slot][2] = False
|
||||||
|
|
||||||
|
_tracker_rebuild(slot)
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
|
||||||
if arg == "all":
|
if arg == "all":
|
||||||
@ -342,15 +362,23 @@ init python:
|
|||||||
|
|
||||||
def wear(self, *args):
|
def wear(self, *args):
|
||||||
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
|
||||||
|
def _tracker_rebuild(type):
|
||||||
|
for tracking in self.get_trackers_list(type):
|
||||||
|
tracking.is_stale()
|
||||||
|
|
||||||
def _wear_all():
|
def _wear_all():
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
v[2] = True
|
v[2] = True
|
||||||
|
|
||||||
|
_tracker_rebuild(k)
|
||||||
|
|
||||||
def _wear_type(type):
|
def _wear_type(type):
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
if istype(v[0], type):
|
if istype(v[0], type):
|
||||||
v[2] = True
|
v[2] = True
|
||||||
|
|
||||||
|
_tracker_rebuild(v)
|
||||||
|
|
||||||
def _wear_slot(slot):
|
def _wear_slot(slot):
|
||||||
if slot in self.multislots:
|
if slot in self.multislots:
|
||||||
for k, v in self.states.items():
|
for k, v in self.states.items():
|
||||||
@ -359,6 +387,8 @@ init python:
|
|||||||
else:
|
else:
|
||||||
self.states[slot][2] = True
|
self.states[slot][2] = True
|
||||||
|
|
||||||
|
_tracker_rebuild(slot)
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
|
||||||
if arg == "all":
|
if arg == "all":
|
||||||
|
Loading…
Reference in New Issue
Block a user