-- A fighting unit's lock (Targeting Component.LockTarget, an FComponentSocket: what its skills aim at and its grabs go -- for) on a unit the arena sends nobody at (options.untargetable, boss_stages.lua: 冷荼 while the game marks her out of -- reach, from her first round of summons until she fights herself) is moved to the unit's assigned opponent, or dropped -- when it has none in reach. A lock on anyone else is the game's own and is left alone. -- The game keeps a lock until a skill asks for a new one. A unit that locked her while she was the only enemy in sight -- kept the lock after the arena sent it at her summons (its blackboard target changed, its lock did not), so its skills -- and grabs kept going for her while she could not be hurt. -- UTargetingComponent (SGameCombatSystem): SetLockTarget(FComponentSocket), StopLockTarget(). local U=require('ue_observe') local Lock={} local LINES=30 function Lock.new(options) local log=options.log or function()end local untargetable=options.untargetable or function()return false end local fname=options.fname or function(text)return FName(text)end local self={moved=0,stopped=0,failed=0} local lines=0 local function name(object) if not U.valid(object) then return '无效对象' end local ok,value=pcall(function()return object:GetFName():ToString()end) return ok and type(value)=='string' and value or '?' end -- The actor a targeting component is locked on, with the lock and its component. local function lockOf(tc) local lock,read=U.field(tc,'LockTarget') if not read then return nil,nil,nil,false end local part,componentRead=U.struct(lock,'Component') if not componentRead then return nil,lock,nil,false end if not U.valid(part) then return nil,lock,nil,true end local ok,owner=pcall(function()return part:GetOwner()end) if ok then owner=U.unwrap(owner) else owner=nil end return U.valid(owner) and owner or nil,lock,part,ok and U.valid(owner) end local function failed(reason) self.failed=self.failed+1 if lines0 and lines