diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-20 22:31:24 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-20 22:31:24 -0500 |
| commit | 85b92e122cdcf6879e1c7950c8015ecb2a0675e4 (patch) | |
| tree | d0f36a9a1ddafdf4be788201585a275171274250 | |
| parent | 98596bf290559eb84944e3a1e93eb393890e964a (diff) | |
| download | wintersurvival2-85b92e122cdcf6879e1c7950c8015ecb2a0675e4.tar.gz wintersurvival2-85b92e122cdcf6879e1c7950c8015ecb2a0675e4.tar.bz2 wintersurvival2-85b92e122cdcf6879e1c7950c8015ecb2a0675e4.zip | |
Started on spell minigames
| -rw-r--r-- | gamemode/hud/draw.lua | 1 | ||||
| -rw-r--r-- | gamemode/hud/draw_spell.lua | 81 | ||||
| -rw-r--r-- | gamemode/hud/spellminigames/connectthedots.lua | 7 |
3 files changed, 89 insertions, 0 deletions
diff --git a/gamemode/hud/draw.lua b/gamemode/hud/draw.lua index 1d30d6a..5e6454e 100644 --- a/gamemode/hud/draw.lua +++ b/gamemode/hud/draw.lua @@ -28,4 +28,5 @@ function GM:HUDPaint() DrawIndicators()
DrawWepSwap()
DrawTargets()
+ DrawSpellOverlay()
end
diff --git a/gamemode/hud/draw_spell.lua b/gamemode/hud/draw_spell.lua new file mode 100644 index 0000000..c1879ef --- /dev/null +++ b/gamemode/hud/draw_spell.lua @@ -0,0 +1,81 @@ +CASTING_SPELL = nil + +--AddLUACSFolder("spellminigames") + +--A table of spells to functions? +Spells = {} +--[[ + ["fireball"] = { + ["minigame"] = connectthedots, + ["interupt"] = connectextradots, + ["difficulty"] = 1 + } +}]]-- + +function loadgames() + GAMEMODE.minigames = {} + local Folder = GAMEMODE.Folder:gsub("gamemodes/","").."/gamemode/hud/" + print("WS2A:Looking for minigames in:" .. Folder) + local games = file.Find(Folder.."*","LUA") + local game = {} + print("WS2A:Loading " .. #(games) .. " minigames") + for k,v in pairs(games) do + print(k) + print(v) + --[[ + if (v != "base.lua") then + AddCSLuaFile(Folder.."/"..v) + include(Folder.."/"..v) + if((not game.Name) or (not game.minigame) or (not game.interupt)) then + print("WS2A:Error loading " .. Folder .. "/" .. v .. "One or more of the are missing: Name, minigame, interupt") + continue + else + print("WS2A:Loaded " .. Folder .. "/" .. v) + end + + table.insert(GAMEMODE.Spells,{ + Spell.Name + }) + + NPC = table.Copy(BaseItem) + + end + ]]-- + end +end + +hook.Add("Initialize","Loadspells",function() + loadgames() +end) + +concommand.Add("reloadgames",function(ply,cmd,args) + loadgames() +end) + +function StartMinigame(spell) + print("starting " .. spell) + if not spell then return end + --If we're already casting, and are told to cast again do someting. + if CASTING_SPELL != nil then + CASTING_SPELL["interupt"]() + return + end + + if spells[spell] then + CASTING_SPELL = spells[spell] + spells[spell]["minigame"](spells[spell]["difficulty"]) + else + print("Could not find spell " .. spell) + end +end + +function DrawSpellOverlay() + if(CASTING_SPELL) then + CASTING_SPELL["minigame"]() + end +end + +concommand.Add("startminigame",function(ply,cmd,args) + print("Starting " .. args[1]) + StartMinigame(args[1]) +end) diff --git a/gamemode/hud/spellminigames/connectthedots.lua b/gamemode/hud/spellminigames/connectthedots.lua new file mode 100644 index 0000000..c24ff14 --- /dev/null +++ b/gamemode/hud/spellminigames/connectthedots.lua @@ -0,0 +1,7 @@ +--The connet the dots spell game +print("Hi from connectthedots.lua") + +function connectthedots() + print("Blah!") + return 100 +end |
