1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
local function Vibrate ( duration , coarseMotor , fineMotor , leftTriggerMotor , rightTriggerMotor , foundInfo , debugSourceInfo )
SetGamepadVibration ( duration , coarseMotor , fineMotor , leftTriggerMotor , rightTriggerMotor , debugSourceInfo )
end
end
-- WARNING! If you change this function, please update the event filter in c++ also, or remove
-- the filter (REGISTER_FILTER_VIBRATION_FILTER) below.
local actionType = nil
--player doing stuff to people
if sourceType == COMBAT_UNIT_TYPE_PLAYER then
if actionResult == ACTION_RESULT_DIED or --player killed someone (self included ie falling damage)
actionResult == ACTION_RESULT_DIED_XP or
actionResult == ACTION_RESULT_KILLING_BLOW then
actionType = GAMEPAD_VIBRATION_TRIGGER_KILLED
end
end
--people doing stuff to player
if targetType == COMBAT_UNIT_TYPE_PLAYER and sourceType ~= COMBAT_UNIT_TYPE_PLAYER then
if actionResult == ACTION_RESULT_DIED or --player died
actionResult == ACTION_RESULT_DIED_XP or
actionResult == ACTION_RESULT_KILLING_BLOW then
actionType = GAMEPAD_VIBRATION_TRIGGER_DIED
elseif actionResult == ACTION_RESULT_STUNNED then --player got stunned
actionType = GAMEPAD_VIBRATION_TRIGGER_STUNNED
elseif actionResult == ACTION_RESULT_KNOCKBACK then --player got knockedback
actionType = GAMEPAD_VIBRATION_TRIGGER_KNOCKED_BACK
elseif actionResult == ACTION_RESULT_STAGGERED then --player got staggered
actionType = GAMEPAD_VIBRATION_TRIGGER_STAGGERED
end
end
return actionType ;
end
actionResult ,
isError ,
abilityName ,
abilityGraphic ,
abilityActionSlotType ,
sourceName ,
sourceType ,
targetName ,
targetType ,
hitValue ,
powerType ,
damageType ,
shouldLog )
if actionType ~= nil then
end
end
end
end
local FOUND_INFO = true
local function OnVibrationEvent ( eventId , duration , coarseMotor , fineMotor , leftTriggerMotor , rightTriggerMotor , debugSourceInfo )
Vibrate ( duration , coarseMotor , fineMotor , leftTriggerMotor , rightTriggerMotor , FOUND_INFO , debugSourceInfo )
end
EVENT_MANAGER : AddFilterForEvent ( "Vibration" , EVENT_COMBAT_EVENT , REGISTER_FILTER_VIBRATION_FILTER , 0 )
|