grymlahv

Warden mine

Jul 6th, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. local WARDEN_LMB_ACTIONS =
  2. {
  3. "MINE",
  4. }
  5.  
  6. local WARDEN_ACTION_TAGS = {}
  7.  
  8. for i, v in ipairs(WARDEN_LMB_ACTIONS_LMB_ACTIONS) do
  9. table.insert(WARDEN_ACTION_TAGS, v.."_workable")
  10. end
  11. local function GetWardenAction(inst, target)
  12. for i, v in ipairs(WARDEN_LMB_ACTIONS) do
  13. if target:HasTag(v.."_workable") then
  14. return not target:HasTag("sign") and ACTIONS[v] or nil
  15. end
  16. end
  17. end
  18. local function WardenLeftClickPicker(inst, target)
  19. if target ~= nil and target ~= inst then
  20. for i, v in ipairs(WARDEN_LMB_ACTIONS) do
  21. if target:HasTag(v.."_workable") then
  22. return not target:HasTag("sign")
  23. and inst.components.playeractionpicker:SortActionList({ ACTIONS[v] }, target, nil)
  24. or nil
  25. end
  26. end
  27. end
  28. end
  29. local function SetWorker(inst, mode)
  30. inst:RemoveEventCallback("working", onworked)
  31.  
  32. if mode == WEREMODES.NONE then
  33. if inst.components.worker == nil then
  34. inst:AddComponent("worker")
  35. inst.components.worker:SetAction(ACTIONS.MINE, 2)
  36. inst.components.worker:SetAction(ACTIONS.HAMMER, 1)
  37. OnWorking(inst)
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment