Advertisement
Zibi92

addon_game_mode.lua

Sep 23rd, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. --[[
  2. Dota PvP game mode
  3. ]]
  4.  
  5. print( "Dota PvP game mode loaded." )
  6.  
  7. if DotaPvP == nil then
  8.     DotaPvP = class({})
  9. end
  10.  
  11. --------------------------------------------------------------------------------
  12. -- ACTIVATE
  13. --------------------------------------------------------------------------------
  14. function Activate()
  15.     GameRules.DotaPvP = DotaPvP()
  16.     GameRules.DotaPvP:InitGameMode()
  17. end
  18.  
  19. --------------------------------------------------------------------------------
  20. -- PRECACHE
  21. --------------------------------------------------------------------------------
  22. function Precache( context )
  23.     PrecacheResource( "particle_folder", "particles/base_attacks", context )
  24.     print("Precache done!")
  25. end
  26.  
  27.  
  28. --------------------------------------------------------------------------------
  29. -- INIT
  30. --------------------------------------------------------------------------------
  31. function DotaPvP:InitGameMode()
  32.     local GameMode = GameRules:GetGameModeEntity()
  33.  
  34.     -- Enable the standard Dota PvP game rules
  35.     GameRules:GetGameModeEntity():SetTowerBackdoorProtectionEnabled( true )
  36.  
  37.     -- Register Think
  38.     GameMode:SetContextThink( "DotaPvP:GameThink", function() return self:GameThink() end, 0.25 )
  39.  
  40.     -- Register Game Events
  41. end
  42.  
  43. --------------------------------------------------------------------------------
  44. function DotaPvP:GameThink()
  45.     return 0.25
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement