Browse Source

Merge pull request #183 from Hoikas/msb

Fix oversights in MSBs.
pull/186/head
Adam Johnson 4 years ago committed by GitHub
parent
commit
3102c1f18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      korman/nodes/node_avatar.py
  2. 28
      korman/nodes/node_messages.py

19
korman/nodes/node_avatar.py

@ -303,6 +303,11 @@ class PlasmaMultiStageBehaviorNode(PlasmaNodeBase, bpy.types.Node):
"link_limit": 1, "link_limit": 1,
"spawn_empty": True, "spawn_empty": True,
}), }),
("condition", {
"text": "Triggered By",
"type": "PlasmaConditionSocket",
"spawn_empty": True,
}),
]) ])
output_sockets = OrderedDict([ output_sockets = OrderedDict([
@ -311,6 +316,10 @@ class PlasmaMultiStageBehaviorNode(PlasmaNodeBase, bpy.types.Node):
"type": "PlasmaBehaviorSocket", "type": "PlasmaBehaviorSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": {"PlasmaPythonFileNode"},
"spawn_empty": True, "spawn_empty": True,
}),
("satisfies", {
"text": "Trigger",
"type": "PlasmaConditionSocket",
}) })
]) ])
@ -326,7 +335,7 @@ class PlasmaMultiStageBehaviorNode(PlasmaNodeBase, bpy.types.Node):
if seek_target is not None: if seek_target is not None:
seek_object = exporter.mgr.find_create_object(plSceneObject, bl=seek_target) seek_object = exporter.mgr.find_create_object(plSceneObject, bl=seek_target)
else: else:
raise ExportError("'{}': MultiStage Behavior's seek point object is invalid".format(self._find_create_key(plMultistageBehMod, exporter, so=so).name)) self.raise_error("MultiStage Behavior's seek point object is invalid")
else: else:
seek_object = so seek_object = so
@ -382,6 +391,14 @@ class PlasmaMultiStageBehaviorNode(PlasmaNodeBase, bpy.types.Node):
msbmod.addStage(animstage) msbmod.addStage(animstage)
receivers = ((i, i.get_key(exporter, so)) for i in self.find_outputs("satisfies"))
for node, key in receivers:
if key is not None:
msbmod.addReceiver(key)
else:
exporter.report.warn("'{}' Node '{}' doesn't expose a key. It won't be triggered by '{}'!",
node.bl_idname, node.name, self.name, indent=3)
@property @property
def requires_actor(self): def requires_actor(self):
return not self.find_input_socket("seek_target").is_linked return not self.find_input_socket("seek_target").is_linked

28
korman/nodes/node_messages.py

@ -831,6 +831,34 @@ class PlasmaTimerCallbackMsgNode(PlasmaMessageWithCallbacksNode, bpy.types.Node)
return msg return msg
class PlasmaTriggerMultiStageMsgNode(PlasmaMessageNode, bpy.types.Node):
bl_category = "MSG"
bl_idname = "PlasmaTriggerMultiStageMsgNode"
bl_label = "Trigger MultiStage"
output_sockets = OrderedDict([
("satisfies", {
"text": "Trigger",
"type": "PlasmaConditionSocket",
"valid_link_nodes": "PlasmaMultiStageBehaviorNode",
"valid_link_sockets": "PlasmaConditionSocket",
"link_limit": 1,
})
])
def convert_message(self, exporter, so):
# Yeah, this is not a REAL Plasma message, but the Korman way is to try to hide these little
# low-level notifications behind higher level abstractions, so here you go. A notify message
# that only targets plMultiStageBehMod. You're welcome!
msg = self.generate_notify_msg(exporter, so, "satisfies")
# The MultiStageBehMod needs to receive the avatar key that whatdonetriggeredit. We don't know
# this information at export-time, but plResponderModifier::IContinueSending will interpret
# a collision event as "ohey, let's add the avatar key for MSBs" - nice.
msg.addEvent(proCollisionEventData())
return msg
class PlasmaFootstepSoundMsgNode(PlasmaMessageNode, bpy.types.Node): class PlasmaFootstepSoundMsgNode(PlasmaMessageNode, bpy.types.Node):
bl_category = "MSG" bl_category = "MSG"
bl_idname = "PlasmaFootstepSoundMsgNode" bl_idname = "PlasmaFootstepSoundMsgNode"

Loading…
Cancel
Save