diff options
| author | Apickx <apickx@cogarr.com> | 2018-03-08 20:15:37 -0500 |
|---|---|---|
| committer | Apickx <apickx@cogarr.com> | 2018-03-08 20:15:37 -0500 |
| commit | 4f48a4ec5f7a92857f518bba67deb52ab0ced988 (patch) | |
| tree | c640043c18db82e0a1392d5f4e0a6123857e5549 /gamemode/itemsystem | |
| parent | 9722802672a6edba9f7dd8f6a435a02284691925 (diff) | |
| download | wintersurvival2-4f48a4ec5f7a92857f518bba67deb52ab0ced988.tar.gz wintersurvival2-4f48a4ec5f7a92857f518bba67deb52ab0ced988.tar.bz2 wintersurvival2-4f48a4ec5f7a92857f518bba67deb52ab0ced988.zip | |
Fixed fireball
Fixed a bug with fireball spell, and projectile entity
Diffstat (limited to 'gamemode/itemsystem')
| -rw-r--r-- | gamemode/itemsystem/items/spell_fireball.lua | 18 | ||||
| -rw-r--r-- | gamemode/itemsystem/loaditems.lua | 17 |
2 files changed, 32 insertions, 3 deletions
diff --git a/gamemode/itemsystem/items/spell_fireball.lua b/gamemode/itemsystem/items/spell_fireball.lua index 14bca66..dc7d7e0 100644 --- a/gamemode/itemsystem/items/spell_fireball.lua +++ b/gamemode/itemsystem/items/spell_fireball.lua @@ -10,6 +10,15 @@ ITEM.HoldType = "magic" game.AddParticles("particles/particletest.pcf") PrecacheParticleSystem("firetest") +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} ITEM.Recipe = { Resources = { @@ -21,6 +30,7 @@ ITEM.Recipe = { } ITEM.CD = 0.25 +ITEM.Range = 9999 --[[ The number of fireballs a player has is held in a global table where each entry is @@ -46,7 +56,7 @@ fireball["onhit"] = function (self,data,phys) end end - self:Remove() + self.Remove(self) end function ITEM:DoFireball(pl) @@ -100,6 +110,10 @@ end function ITEM:OnPrimary(pl,tr) if CLIENT then return end print("Attempting to cast...") - pl:Cast("Fireball",fireballfunc,self) + if NumFireballs[pl] == nil or NumFireballs[pl] < 3 then + pl:Cast("Fireball",fireballfunc,self) + else + pl:ChatPrint("You can't summon any more fireballs") + end end RegisterItem(ITEM) diff --git a/gamemode/itemsystem/loaditems.lua b/gamemode/itemsystem/loaditems.lua index 374fd18..2e5be4e 100644 --- a/gamemode/itemsystem/loaditems.lua +++ b/gamemode/itemsystem/loaditems.lua @@ -8,9 +8,12 @@ GM.Recipes = GM.Items or {} --This is so that the client can store info about items/recepies too.
local gmitems = (GAMEMODE or GM).Items
local gmrecepies = (GAMEMODE or GM).Recipes
-
+local itemfiles = {}
function RegisterItem(tbl)
assert(gmitems[tbl] == nil, "Cannot register 2 items with the same name!")
+ tb = debug.getinfo(2)
+ src = string.sub(tb.source,2)
+ itemfiles[#itemfiles + 1] = src
insert(gmitems,tbl)
if tbl.Recipe then
insert(gmrecepies,tbl)
@@ -18,6 +21,18 @@ function RegisterItem(tbl) print("Registered item:", tbl.Name)
end
+(GAMEMODE or GM).LoadItems = function()
+ allfiles = table.Copy(itemfiles)
+ for _,itemfile in pairs(allfiles) do
+ f = file.Read(itemfile,"GAME")
+ c = CompileString(f,itemfile)
+ print("executing",c)
+ if c ~= nil then
+ c()
+ end
+ end
+end
+
function GetItemByName(name)
for k,v in pairs( gmitems ) do
if (v.Name == name) then return v end
|
