'Entity with ID %s has no audio component. Audio file %s cannot be played from this entity.' % (entityID, audioName)) return True def _PlayTutorialVoiceOver(self, messageKey): sm.GetService('tutorial').Action_Play_MLS_Audio(messageKey) return True PerformPythonUICallback = ProcTypeDef( isMaster=True, procCategory='UI', properties=[ ProcPropertyTypeDef('callbackKey', 'S', userDataType=None, isPrivate=True) ], description= 'Performs a UI callback (opens a UI window, etc.). These are set per-game.' ) PlayEntityAudio = ProcTypeDef( isMaster=True, procCategory='Audio', properties=[ ProcPropertyTypeDef('audioName', 'S', userDataType=None, isPrivate=True, displayName='Audio Name'), ProcPropertyTypeDef('mls',
name = name + const.aiming.AIMING_CLIENTSERVER_FLAGS[ clientServerFlag] retList.append( (name, target[const.aiming.AIMING_VALID_TARGETS_FIELD_ID], '')) return retList AITarget = ('listMethod', GetAITargetList) TargetSelect = ProcTypeDef( isMaster=False, procCategory='AI', properties=[ ProcPropertyTypeDef('Target', 'I', userDataType='AITarget', isPrivate=True, displayName='Set Target'), ProcPropertyTypeDef('Candidate', 'I', userDataType='AICandidate', isPrivate=True, displayName='From Candidate List'), ProcPropertyTypeDef('Subject', 'I', userDataType='AISubject', isPrivate=True, displayName='Where Subject is'), ProcPropertyTypeDef('Confidence', 'I', userDataType='AIConfidence',
binding.sourceObject.name, typename) removableBindings.append(binding) curveSet.Update() for binding in removableBindings: curveSet.bindings.remove(binding) ApplyParticleEffect = ProcTypeDef( isMaster=True, procCategory='Graphics', displayName='Apply Particle Effect', properties=[ ProcPropertyTypeDef('redFile', 'S', userDataType=None, isPrivate=True, displayName='Red File'), ProcPropertyTypeDef('duration', 'I', userDataType=None, isPrivate=True, displayName='Duration (milliseconds)'), ProcPropertyTypeDef('boneName', 'S', userDataType=None, isPrivate=True, displayName='Bone Name'), ProcPropertyTypeDef('xOffset', 'F', userDataType=None,
locatorObjs = Locator.GetAllLocators() for loc in locatorObjs: locatorList.append((loc.GetName(), loc.GetName(), '')) return locatorList MotionState = ('list', MotionStateList) TargetTypeList = ('list', TargetTypeList) LocatorList = ('listMethod', CreateLocatorList) SetEntityPosition = ProcTypeDef( isMaster=True, procCategory='Entity', properties=[ ProcPropertyTypeDef('MotionState', 'I', userDataType='MotionState', isPrivate=True) ], description= 'Sets the requesting entity\'s position. This uses the ALIGN_POSITION and ALIGN_ROTATION properties right now, though could be altered to use specified properties. The "MotionState" corresponds to move modes -- Keyframe and Character.' ) GetEntitySceneID = ProcTypeDef( isMaster=True, procCategory='Entity', description='Gets the entity scene ID of the entity performing this action.' ) GetBonePosRot = ProcTypeDef( isMaster=True, procCategory='Entity', properties=[ ProcPropertyTypeDef('boneName',
if rows is not None: for row in rows: quat = geo2.QuaternionRotationSetYawPitchRoll( row.rotY, row.rotX, row.rotZ) pos = (row.posX, row.posY, row.posZ) exits.append({'pos': pos, 'rot': quat}) return exits UseActionObject = ProcTypeDef( isMaster=True, procCategory='ActionObject', properties=[ ProcPropertyTypeDef('Distance', 'F', userDataType=None, isPrivate=False) ], description='Set the ActionObject in use by the requesting entity.') StopUsingActionObject = ProcTypeDef( isMaster=True, procCategory='ActionObject', description= 'Set the ActionObject as no longer in use by the requesting entity.') IsActionObjectActionAvailable = ProcTypeDef( isMaster=True, isConditional=True, procCategory='ActionObject', properties=[ ProcPropertyTypeDef('Distance', 'F',
session.charid, -1.0): ForceDecisionTreeToRootFunc(session.charid) ForceDecisionTreeToRootDef = ProcTypeDef( isMaster=False, procCategory='AI', description= 'Forces the AI decision tree evaluate from the root node. Will interrupt any waitfor procs' ) AttemptAction = ProcTypeDef( isMaster=False, procCategory='AI', properties=[ ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True) ], description="Attempt to change the entity's ZAction to the selected action" ) AttemptActionOnTarget = ProcTypeDef( isMaster=False, procCategory='AI', properties=[ ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True, displayName='Attempt Action'), ProcPropertyTypeDef('Target', 'I',
settings.char.zaction.Set(Name, Value) def _CharacterPrefEqualsBool(self, Name, Value): prefVal = settings.char.zaction.Get(Name, None) if prefVal is None: return False return prefVal == Value SetClientPrefInt = ProcTypeDef( isMaster=True, procCategory='Client Preferences', properties=[ ProcPropertyTypeDef('Name', 'S', userDataType=None, isPrivate=True, displayName='Pref Name'), ProcPropertyTypeDef('Value', 'I', userDataType=None, isPrivate=True, displayName='Value') ], description='Sets a client preference (integer value).') ClientPrefEqualsInt = ProcTypeDef( isMaster=True, procCategory='Client Preferences', isConditional=True, properties=[ ProcPropertyTypeDef('Name',
retList.sort(key=lambda row: row[1]) return retList def GetAISubjectList(propRow): retList = [] for subject in perception.Subject.GetMyRows(_getDeleted=False): retList.append((subject.subjectName, subject.subjectID, '')) return retList def GetAIStimTypeList(propRow): retList = [] for stimType in perception.StimType.GetMyRows(_getDeleted=False): retList.append((stimType.stimTypeName, stimType.stimTypeID, '')) return retList AICandidate = ('listMethod', GetAICandidateList) AIConfidence = ('listMethod', GetAIConfidenceList) AISubject = ('listMethod', GetAISubjectList) AIStimType = ('listMethod', GetAIStimTypeList) DropStimulus = ProcTypeDef(isMaster=False, procCategory='AI', properties=[ProcPropertyTypeDef('StimType', 'I', userDataType='AIStimType', isPrivate=True, displayName='Stimulus type'), ProcPropertyTypeDef('Range', 'F', userDataType=None, isPrivate=True, displayName='Range (-1 for default)'), ProcPropertyTypeDef('SwapTarget', 'B', userDataType=None, isPrivate=True, displayName='Drop from target')]) exports = {'actionProperties.AICandidate': AICandidate, 'actionProperties.AIConfidence': AIConfidence, 'actionProperties.AISubject': AISubject, 'actionProperties.AIStimType': AIStimType, 'actionProcTypes.DropStimulus': DropStimulus}
binding.sourceObject.value = prop[:3] elif 'Tr2PyBindingSentinelVector4' == typename and len(prop) >= 4: binding.sourceObject.value = prop[:4] else: self.LogWarn('Found Tr2PyBindingSentinel for a particle effect and matching list property, but types or list lengths do not match!', binding.sourceObject.name, typename, type(prop)) else: self.LogWarn('Found Tr2PyBindingSentinel for a particle effect and matching property, but types do not match!', binding.sourceObject.name, typename, type(prop)) else: self.LogWarn('Found Tr2PyBindingSentinel for a particle effect and no matching attribute or property!', binding.sourceObject.name, typename) removableBindings.append(binding) curveSet.Update() for binding in removableBindings: curveSet.bindings.remove(binding) ApplyParticleEffect = ProcTypeDef(isMaster=True, procCategory='Graphics', displayName='Apply Particle Effect', properties=[ProcPropertyTypeDef('redFile', 'S', userDataType=None, isPrivate=True, displayName='Red File'), ProcPropertyTypeDef('duration', 'I', userDataType=None, isPrivate=True, displayName='Duration (milliseconds)'), ProcPropertyTypeDef('boneName', 'S', userDataType=None, isPrivate=True, displayName='Bone Name'), ProcPropertyTypeDef('xOffset', 'F', userDataType=None, isPrivate=True, displayName='X Offset'), ProcPropertyTypeDef('yOffset', 'F', userDataType=None, isPrivate=True, displayName='Y Offset'), ProcPropertyTypeDef('zOffset', 'F', userDataType=None, isPrivate=True, displayName='Z Offset'), ProcPropertyTypeDef('yawOffset', 'F', userDataType=None, isPrivate=True, displayName='Yaw Offset (deg)'), ProcPropertyTypeDef('pitchOffset', 'F', userDataType=None, isPrivate=True, displayName='Pitch Offset (deg)'), ProcPropertyTypeDef('rollOffset', 'F', userDataType=None, isPrivate=True, displayName='Roll Offset (deg)'), ProcPropertyTypeDef('ignoreTransform', 'B', userDataType=None, isPrivate=True, displayName='Ignore Effect Transform'), ProcPropertyTypeDef('effectIDProp', 'S', userDataType=None, isPrivate=True, displayName='Effect ID Storage Property')], description='Creates a particle effect on the entity. Effect will offset from entity position if Bone Name is omitted.') RemoveParticleEffect = ProcTypeDef(isMaster=True, procCategory='Graphics', displayName='Remove Particle Effect', properties=[ProcPropertyTypeDef('effectIDProp', 'S', userDataType=None, isPrivate=True, displayName='Effect ID Storage Property')], description='Removes a particle effect on the entity. This uses a previously stored effect ID in the specified property.') exports = {'actionProcTypes.ApplyParticleEffect': ApplyParticleEffect, 'actionProcTypes.RemoveParticleEffect': RemoveParticleEffect}
if audioName.startswith('wise:/'): audioName = audioName[6:] for entityID in targetList: entity = self.entityService.FindEntityByID(entityID) audioComponent = entity.GetComponent('audioEmitter') if audioComponent: audioComponent.emitter.SendEvent(unicode(audioName)) else: self.LogWarn('Entity with ID %s has no audio component. Audio file %s cannot be played from this entity.' % (entityID, audioName)) return True def _PlayTutorialVoiceOver(self, messageKey): sm.GetService('tutorial').Action_Play_MLS_Audio(messageKey) return True PerformPythonUICallback = ProcTypeDef(isMaster=True, procCategory='UI', properties=[ProcPropertyTypeDef('callbackKey', 'S', userDataType=None, isPrivate=True)], description='Performs a UI callback (opens a UI window, etc.). These are set per-game.') PlayEntityAudio = ProcTypeDef(isMaster=True, procCategory='Audio', properties=[ProcPropertyTypeDef('audioName', 'S', userDataType=None, isPrivate=True, displayName='Audio Name'), ProcPropertyTypeDef('mls', 'B', userDataType=None, isPrivate=True, displayName='MLS')], description='Plays location-based audio at the location of the *target* entity.') PlayTutorialVoiceover = ProcTypeDef(isMaster=True, procCategory='Audio', properties=[ProcPropertyTypeDef('messageKey', 'S', userDataType=None, isPrivate=True, displayName='MLS Message Key')], description='Plays the specified tutorial voiceover.') PushCameraWithTransition = ProcTypeDef(isMaster=True, procCategory='Camera', properties=[ProcPropertyTypeDef('cameraName', 'S', userDataType=None, isPrivate=True, displayName='Camera Class Name'), ProcPropertyTypeDef('behaviorNames', 'S', userDataType=None, isPrivate=True, displayName='Behavior Class Names (comma separ.)'), ProcPropertyTypeDef('transitionSeconds', 'F', userDataType=None, isPrivate=True, displayName='Transition Seconds'), ProcPropertyTypeDef('startHeight', 'F', userDataType=None, isPrivate=True, displayName='Start Height From Floor')], description='Pushes a new camera onto the camera stack. THIS MAY BE DEPRECATED.') PopCameraWithTransition = ProcTypeDef(isMaster=True, procCategory='Camera', properties=[ProcPropertyTypeDef('transitionSeconds', 'F', userDataType=None, isPrivate=True, displayName='Transition Seconds'), ProcPropertyTypeDef('retainYaw', 'B', userDataType=None, isPrivate=True, displayName='Retain yaw between cameras'), ProcPropertyTypeDef('retainPitch', 'B', userDataType=None, isPrivate=True, displayName='Retain pitch between cameras')], description='Pops a camera off the camera stack with a transition. THIS MAY BE DEPRECATED.') exports = {'actionProcTypes.PerformPythonUICallback': PerformPythonUICallback, 'actionProcTypes.PlayEntityAudio': PlayEntityAudio, 'actionProcTypes.PlayTutorialVoiceover': PlayTutorialVoiceover, 'actionProcTypes.PushCameraWithTransition': PushCameraWithTransition, 'actionProcTypes.PopCameraWithTransition': PopCameraWithTransition}
return True return False def ActionPopupMenu(entID): entity = sm.GetService('entityClient').FindEntityByID(entID) if entity: perceptionComponent = entity.GetComponent('perception') if perceptionComponent: clientManager = sm.GetService('perceptionClient').GetPerceptionManager(session.worldspaceid) if clientManager: if clientManager.DropOneStimulusSimple('Interact', entID, session.charid, -1.0): ForceDecisionTreeToRootFunc(session.charid) ForceDecisionTreeToRootDef = ProcTypeDef(isMaster=False, procCategory='AI', description='Forces the AI decision tree evaluate from the root node. Will interrupt any waitfor procs') AttemptAction = ProcTypeDef(isMaster=False, procCategory='AI', properties=[ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True)], description="Attempt to change the entity's ZAction to the selected action") AttemptActionOnTarget = ProcTypeDef(isMaster=False, procCategory='AI', properties=[ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True, displayName='Attempt Action'), ProcPropertyTypeDef('Target', 'I', userDataType='AITarget', isPrivate=True, displayName='On Target')], description="Attempt to change the entity's ZAction to the selected action using the current target") IsActionAvailable = ProcTypeDef(isMaster=False, isConditional=True, procCategory='AI', properties=[ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True)], description='Check if the Action is available') IsActionAvailableOnTarget = ProcTypeDef(isMaster=False, isConditional=True, procCategory='AI', properties=[ProcPropertyTypeDef('NewAction', 'I', userDataType='ActionList', isPrivate=True, displayName='Attempt Action'), ProcPropertyTypeDef('Target', 'I', userDataType='AITarget', isPrivate=True, displayName='On Target')], description='Check if the action is available on the target') PathSetTarget = ProcTypeDef(isMaster=False, procCategory='AI', properties=[ProcPropertyTypeDef('Target', 'I', userDataType='AITarget', isPrivate=True, displayName='Path to Target')], description="Path to a target entity's location. Will not follow the target") ForceDecisionTreeToRoot = ForceDecisionTreeToRootDef exports = {'actionProcTypes.ForceDecisionTreeToRoot': ForceDecisionTreeToRoot, 'decisionProcs.ForceDecisionTreeToRoot': ForceDecisionTreeToRootFunc, 'decisionProcs.ActionPopupMenu': ActionPopupMenu, 'actionProcTypes.AttemptAction': AttemptAction, 'actionProcTypes.AttemptActionOnTarget': AttemptActionOnTarget, 'actionProcTypes.IsActionAvailable': IsActionAvailable, 'actionProcTypes.IsActionAvailableOnTarget': IsActionAvailableOnTarget, 'actionProcTypes.PathSetTarget': PathSetTarget}
retList.append((stimType.stimTypeName, stimType.stimTypeID, '')) return retList AICandidate = ('listMethod', GetAICandidateList) AIConfidence = ('listMethod', GetAIConfidenceList) AISubject = ('listMethod', GetAISubjectList) AIStimType = ('listMethod', GetAIStimTypeList) DropStimulus = ProcTypeDef( isMaster=False, procCategory='AI', properties=[ ProcPropertyTypeDef('StimType', 'I', userDataType='AIStimType', isPrivate=True, displayName='Stimulus type'), ProcPropertyTypeDef('Range', 'F', userDataType=None, isPrivate=True, displayName='Range (-1 for default)'), ProcPropertyTypeDef('SwapTarget', 'B', userDataType=None, isPrivate=True, displayName='Drop from target') ]) exports = { 'actionProperties.AICandidate': AICandidate,