diff --git a/gamemodes/zombiesurvival/.gitignore b/gamemodes/zombiesurvival/.gitignore new file mode 100644 index 0000000..1cd3974 --- /dev/null +++ b/gamemodes/zombiesurvival/.gitignore @@ -0,0 +1,2 @@ +gamemode_obsfucated/ +entities_obsfucated/ \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/data/zsmaps/zs_school.txt b/gamemodes/zombiesurvival/content/data/zsmaps/zs_school.txt deleted file mode 100644 index b9f80bf..0000000 --- a/gamemodes/zombiesurvival/content/data/zsmaps/zs_school.txt +++ /dev/null @@ -1 +0,0 @@ -SRL={{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-956.74139404297,-850.40509033203,356.95526123047)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-958.49877929688,-772.64721679688,356.95526123047)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-881.91168212891,-686.60418701172,356.95526123047)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1460.1417236328,-313.86346435547,356.81225585938)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1050.2445068359,-319.27752685547,356.81225585938)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1174.9249267578,-315.91256713867,356.81225585938)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(473.55883789063,-1197.8994140625,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(385.45025634766,-1101.5399169922,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(214.77722167969,-1108.0576171875,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-225.04792785645,-1113.0131835938,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-384.45269775391,-1114.8092041016,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-560.01531982422,-1116.787109375,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-262.05206298828,1834.3687744141,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(118.1318359375,1838.5329589844,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(454.70971679688,1832.7912597656,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(804.56475830078,1732.5345458984,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-484.17163085938,1740.8912353516,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(-663.55169677734,1571.9674072266,-6.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1624.3937988281,-1286.8486328125,-7.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1898.9047851563,-1281.2886962891,-7.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(1087.0125732422,-1342.0225830078,-7.96875)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(2085.2734375,852.02819824219,212.17425537109)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(2214.220703125,1071.9543457031,212.17425537109)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(2215.7624511719,976.77740478516,212.17425537109)},{["Class"]="info_player_zombie",["Angles"]=Angle(0,0,0),["Position"]=Vector(2217.3041992188,881.60095214844,212.17425537109)}} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vtf deleted file mode 100644 index 3f2a44b..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vtf deleted file mode 100644 index 1a016cd..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vtf deleted file mode 100644 index 7353672..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vtf deleted file mode 100644 index 4b82097..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vmt b/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vmt deleted file mode 100644 index a4b3fa9..0000000 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vmt +++ /dev/null @@ -1,10 +0,0 @@ -"UnlitGeneric" -{ - "$basetexture" "killicon/zs_plank" - "$nolod" 1 - "$nomip" 1 - "$ignorez" 1 - "$translucent" 1 - "$vertexalpha" 1 - "$vertexcolor" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vtf deleted file mode 100644 index 9418c2e..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_plank.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vmt b/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vmt deleted file mode 100644 index 6b4a8dc..0000000 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vmt +++ /dev/null @@ -1,10 +0,0 @@ -"UnlitGeneric" -{ - "$basetexture" "killicon/zs_pot" - "$nolod" 1 - "$nomip" 1 - "$ignorez" 1 - "$translucent" 1 - "$vertexalpha" 1 - "$vertexcolor" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vtf deleted file mode 100644 index b3e3a5d..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_pot.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vmt b/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vmt deleted file mode 100644 index 862a1ed..0000000 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vmt +++ /dev/null @@ -1,10 +0,0 @@ -"UnlitGeneric" -{ - "$basetexture" "killicon/zs_shovel" - "$nolod" 1 - "$nomip" 1 - "$ignorez" 1 - "$translucent" 1 - "$vertexalpha" 1 - "$vertexcolor" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vtf deleted file mode 100644 index aaa730c..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_shovel.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vmt b/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vmt deleted file mode 100644 index 90b2e80..0000000 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vmt +++ /dev/null @@ -1,10 +0,0 @@ -"UnlitGeneric" -{ - "$basetexture" "killicon/zs_sledgehammer" - "$nolod" 1 - "$nomip" 1 - "$ignorez" 1 - "$translucent" 1 - "$vertexalpha" 1 - "$vertexcolor" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vtf deleted file mode 100644 index 1baae7b..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_sledgehammer.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vmt b/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vmt deleted file mode 100644 index 3295c31..0000000 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vmt +++ /dev/null @@ -1,8 +0,0 @@ -"UnlitGeneric" -{ - "$translucent" 1 - "$basetexture" "killicon/zs_zombie" - "$vertexcolor" 0 - "$ignorez" 1 - "$additive" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vtf b/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vtf deleted file mode 100644 index a16b66c..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/killicon/zs_zombie.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/arsenalcrate.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/arsenalcrate.png new file mode 100644 index 0000000..3921690 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/arsenalcrate.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/bleed.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/bleed.png new file mode 100644 index 0000000..fdd7f0f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/bleed.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/burn.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/burn.png new file mode 100644 index 0000000..91d291c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/burn.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/crossout.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/crossout.png new file mode 100644 index 0000000..fa1137f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/crossout.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/defense.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/defense.png new file mode 100644 index 0000000..9b1c4d2 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/defense.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/dim_vision.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/dim_vision.png new file mode 100644 index 0000000..788cbec Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/dim_vision.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/frost.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/frost.png new file mode 100644 index 0000000..f9b97aa Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/frost.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/headshot_stacks.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/headshot_stacks.png new file mode 100644 index 0000000..5760ede Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/headshot_stacks.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/infeeble.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/infeeble.png new file mode 100644 index 0000000..95a1398 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/infeeble.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vmt new file mode 100644 index 0000000..d7647e6 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/ancient_nightmare" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vtf new file mode 100644 index 0000000..fa8f7fe Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/ancient_nightmare.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vmt new file mode 100644 index 0000000..b32c5b8 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/assault_rifle_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vtf new file mode 100644 index 0000000..066a718 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/assault_rifle_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vmt new file mode 100644 index 0000000..c8f501b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/blaster_turret" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vtf new file mode 100644 index 0000000..b87dd41 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/blaster_turret.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vmt similarity index 68% rename from gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vmt rename to gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vmt index a39bdcc..f919faf 100644 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_keyboard.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vmt @@ -1,10 +1,10 @@ "UnlitGeneric" { - "$basetexture" "killicon/zs_keyboard" + "$basetexture" "zombiesurvival/killicons/bleed" "$nolod" 1 "$nomip" 1 "$ignorez" 1 "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vtf new file mode 100644 index 0000000..3c85a42 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bleed.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vmt new file mode 100644 index 0000000..e3ea89a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/bloatedzombie" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vtf new file mode 100644 index 0000000..50ca187 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bloatedzombie.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vmt new file mode 100644 index 0000000..443ad32 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/bolts_ammo_icon_2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vtf new file mode 100644 index 0000000..72dce49 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bolts_ammo_icon_2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vmt new file mode 100644 index 0000000..bd144e1 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/bonemesh" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 7 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vtf new file mode 100644 index 0000000..1f2b991 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/bonemesh.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vmt similarity index 68% rename from gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vmt rename to gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vmt index 36f21ae..737fcb1 100644 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_hammer.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vmt @@ -1,10 +1,10 @@ "UnlitGeneric" { - "$basetexture" "killicon/zs_hammer" + "$basetexture" "zombiesurvival/killicons/burn" "$nolod" 1 "$nomip" 1 "$ignorez" 1 "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vtf new file mode 100644 index 0000000..bb4f9a7 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/burn.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vmt new file mode 100644 index 0000000..884c074 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/butcher" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vtf new file mode 100644 index 0000000..428b20a Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/butcher.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vmt new file mode 100644 index 0000000..6ec0dc5 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/chemical_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vtf new file mode 100644 index 0000000..39ee6b0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/chemical_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/crow.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/crow.vmt index d75327d..7e288d2 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/crow.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/crow.vmt @@ -16,4 +16,4 @@ "animatedtextureframerate" 5 } } -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vmt new file mode 100644 index 0000000..322ec0c --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/devourer" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vtf new file mode 100644 index 0000000..2c097e1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/devourer.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vmt similarity index 68% rename from gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vmt rename to gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vmt index 45597c2..361259f 100644 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_fryingpan.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vmt @@ -1,10 +1,10 @@ "UnlitGeneric" { - "$basetexture" "killicon/zs_fryingpan" + "$basetexture" "zombiesurvival/killicons/drone" "$nolod" 1 "$nomip" 1 "$ignorez" 1 "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vtf new file mode 100644 index 0000000..a2cca32 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/drone.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vmt new file mode 100644 index 0000000..5cbdc13 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/env_protrusionspike" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vtf new file mode 100644 index 0000000..728ea35 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/env_protrusionspike.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vmt new file mode 100644 index 0000000..9e3b754 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/explosive_ammo_icon_2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vtf new file mode 100644 index 0000000..1114453 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/explosive_ammo_icon_2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vmt new file mode 100644 index 0000000..02b5a8d --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/fast_legs" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vtf new file mode 100644 index 0000000..188dc14 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_legs.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vmt new file mode 100644 index 0000000..6b13b6b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/fast_torso" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vtf new file mode 100644 index 0000000..88f2fd2 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fast_torso.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vmt new file mode 100644 index 0000000..7d34c04 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/fleshcreeper" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vtf new file mode 100644 index 0000000..3476683 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fleshcreeper.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vmt similarity index 68% rename from gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vmt rename to gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vmt index eaa214a..61f4d77 100644 --- a/gamemodes/zombiesurvival/content/materials/killicon/zs_axe.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vmt @@ -1,10 +1,10 @@ "UnlitGeneric" { - "$basetexture" "killicon/zs_axe" + "$basetexture" "zombiesurvival/killicons/food" "$nolod" 1 "$nomip" 1 "$ignorez" 1 "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vtf new file mode 100644 index 0000000..37c87f1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/food.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vmt new file mode 100644 index 0000000..62f37b8 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/fresh_dead" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vtf new file mode 100644 index 0000000..8aa2e34 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/fresh_dead.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vmt new file mode 100644 index 0000000..0c4a943 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/gigagorechild" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vtf new file mode 100644 index 0000000..9f5fe2f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gigagorechild.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vmt new file mode 100644 index 0000000..cf72af4 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/glass_bottle" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vtf new file mode 100644 index 0000000..645b0f1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/glass_bottle.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vmt new file mode 100644 index 0000000..01b3b7b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/gorechild" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vtf new file mode 100644 index 0000000..aafcd2f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/gorechild.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vmt new file mode 100644 index 0000000..da4b6a0 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/howler" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vtf new file mode 100644 index 0000000..14f334e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/howler.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vmt new file mode 100644 index 0000000..1d3488f --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/impact_mine" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vtf new file mode 100644 index 0000000..4122160 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/impact_mine.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vmt new file mode 100644 index 0000000..cad86d0 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/lacerator" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vtf new file mode 100644 index 0000000..e74dd2e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/lacerator.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/legs.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/legs.vmt index 96755cd..c4ea7ed 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/legs.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/legs.vmt @@ -16,4 +16,4 @@ "animatedtextureframerate" 5 } } -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vmt new file mode 100644 index 0000000..02cc7ec --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/medpower_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vtf new file mode 100644 index 0000000..87fe511 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/medpower_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vmt new file mode 100644 index 0000000..8340de2 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/nail_ammo_icon_2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vtf new file mode 100644 index 0000000..57356d6 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nail_ammo_icon_2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare.vmt index 5d8db93..9ebcbe3 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare.vmt @@ -16,4 +16,4 @@ "animatedtextureframerate" 3 } } -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vmt new file mode 100644 index 0000000..4a3e4fd --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/nightmare2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vtf new file mode 100644 index 0000000..2e475c4 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/nightmare2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vmt new file mode 100644 index 0000000..e04298c --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/pistol_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vtf new file mode 100644 index 0000000..b5013ed Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pistol_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonheadcrab.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonheadcrab.vmt index cfe2709..b3d55c6 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonheadcrab.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonheadcrab.vmt @@ -16,4 +16,4 @@ "animatedtextureframerate" 5 } } -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonzombie.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonzombie.vmt index 24e1854..5cf5952 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonzombie.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/poisonzombie.vmt @@ -16,4 +16,4 @@ "animatedtextureframerate" 5 } } -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vmt new file mode 100644 index 0000000..bad008c --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/projectile_bonemesh" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vtf new file mode 100644 index 0000000..968da39 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_bonemesh.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonflesh.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonflesh.vmt index 2d7445b..6fdac77 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonflesh.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonflesh.vmt @@ -7,4 +7,4 @@ "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonspit.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonspit.vmt index b2f0d2b..11c3ae5 100644 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonspit.vmt +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_poisonspit.vmt @@ -7,4 +7,4 @@ "$translucent" 1 "$vertexalpha" 1 "$vertexcolor" 1 -} +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vmt new file mode 100644 index 0000000..12460e3 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/projectile_shadeice" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vtf new file mode 100644 index 0000000..dd667dc Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/projectile_shadeice.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vmt deleted file mode 100644 index d540df8..0000000 --- a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vmt +++ /dev/null @@ -1,10 +0,0 @@ -"UnlitGeneric" -{ - "$basetexture" "zombiesurvival/killicons/prop_gunturret" - "$nolod" 1 - "$nomip" 1 - "$ignorez" 1 - "$translucent" 1 - "$vertexalpha" 1 - "$vertexcolor" 1 -} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vtf deleted file mode 100644 index c449c3d..0000000 Binary files a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/prop_gunturret.vtf and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vmt new file mode 100644 index 0000000..be6d12a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/pulse_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vtf new file mode 100644 index 0000000..f122e24 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/pulse_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vmt new file mode 100644 index 0000000..48d358b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/rifle_ammo_icon_2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vtf new file mode 100644 index 0000000..aff2449 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/rifle_ammo_icon_2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vmt new file mode 100644 index 0000000..0659b20 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/scrap_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vtf new file mode 100644 index 0000000..e9bf467 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/scrap_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vmt new file mode 100644 index 0000000..602b2d3 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/shadev2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vtf new file mode 100644 index 0000000..66ebbf1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shadev2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vmt new file mode 100644 index 0000000..c5753ef --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/shotgun_ammo_icon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vtf new file mode 100644 index 0000000..c41eacb Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/shotgun_ammo_icon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vmt new file mode 100644 index 0000000..a7e6400 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/sigil_fragment" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vtf new file mode 100644 index 0000000..82a7315 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/sigil_fragment.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vmt new file mode 100644 index 0000000..e07bbe0 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/skeletal_lurker" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vtf new file mode 100644 index 0000000..ffaee4e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_lurker.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vmt new file mode 100644 index 0000000..fc0688e --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vmt @@ -0,0 +1,19 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/skeletal_walker" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 + "Proxies" + { + "AnimatedTexture" + { + "animatedtexturevar" "$basetexture" + "animatedtextureframenumvar" "$frame" + "animatedtextureframerate" 5 + } + } +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vtf new file mode 100644 index 0000000..e21fe4e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/skeletal_walker.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vmt new file mode 100644 index 0000000..7567588 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/smg_ammo_icon_2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vtf new file mode 100644 index 0000000..8134045 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/smg_ammo_icon_2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vmt new file mode 100644 index 0000000..e075d3b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_annabelle2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vtf new file mode 100644 index 0000000..28675b0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_annabelle2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vmt new file mode 100644 index 0000000..0dc04de --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_arsenalcrate" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vtf new file mode 100644 index 0000000..59ee5b8 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_arsenalcrate.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vmt new file mode 100644 index 0000000..94a3293 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_artemis3" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vtf new file mode 100644 index 0000000..8672a20 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_artemis3.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vmt new file mode 100644 index 0000000..8927c71 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_asmd" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vtf new file mode 100644 index 0000000..c889949 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_asmd.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vmt new file mode 100644 index 0000000..b559a3d --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_aspirant2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vtf new file mode 100644 index 0000000..5871772 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_aspirant2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_assaultturret.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_assaultturret.png new file mode 100644 index 0000000..a4730ca Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_assaultturret.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vmt new file mode 100644 index 0000000..2ab53b1 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_avelyn" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vtf new file mode 100644 index 0000000..fbfe587 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_avelyn.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vmt new file mode 100644 index 0000000..b7384f2 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_axe" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vtf new file mode 100644 index 0000000..5435e4c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_axe.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vmt new file mode 100644 index 0000000..5c3e620 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_barrage" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vtf new file mode 100644 index 0000000..8c5088a Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barrage.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vmt new file mode 100644 index 0000000..bf48c2f --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_barricadekit" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vtf new file mode 100644 index 0000000..7cf354d Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_barricadekit.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vmt new file mode 100644 index 0000000..594e5c9 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_battlerifle" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vtf new file mode 100644 index 0000000..5569a14 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_battlerifle.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vmt new file mode 100644 index 0000000..415f857 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_blareduct2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vtf new file mode 100644 index 0000000..72df47d Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blareduct2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vmt new file mode 100644 index 0000000..16a042d --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_blaster" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vtf new file mode 100644 index 0000000..7e2e886 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_blaster.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vmt new file mode 100644 index 0000000..52de75a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_boardpack" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vtf new file mode 100644 index 0000000..d696d3c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_boardpack.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vmt new file mode 100644 index 0000000..4d05316 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_brassknuckles" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vtf new file mode 100644 index 0000000..8576230 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_brassknuckles.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vmt new file mode 100644 index 0000000..41fa9b5 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_broadside2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vtf new file mode 100644 index 0000000..2715001 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broadside2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vmt new file mode 100644 index 0000000..292d247 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_broom" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vtf new file mode 100644 index 0000000..c114771 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_broom.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vmt new file mode 100644 index 0000000..f994f79 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_bulwark2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vtf new file mode 100644 index 0000000..71b791a Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bulwark2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vmt new file mode 100644 index 0000000..2a91e96 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_bust2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vtf new file mode 100644 index 0000000..dcd8ff2 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_bust2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vmt new file mode 100644 index 0000000..98d002d --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_butcherknife2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vtf new file mode 100644 index 0000000..a3b9dde Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_butcherknife2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vmt new file mode 100644 index 0000000..3469079 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_camera" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vtf new file mode 100644 index 0000000..b0dc762 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_camera.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vmt new file mode 100644 index 0000000..55c3aea --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_chainsaw" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vtf new file mode 100644 index 0000000..655bb0f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_chainsaw.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vmt new file mode 100644 index 0000000..ccee535 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_charon3" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vtf new file mode 100644 index 0000000..03849ab Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_charon3.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vmt new file mode 100644 index 0000000..c20c2c9 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_colossus3" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vtf new file mode 100644 index 0000000..f316a4a Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_colossus3.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vmt new file mode 100644 index 0000000..48a161a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_convalescence" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vtf new file mode 100644 index 0000000..ef81baf Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_convalescence.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vmt new file mode 100644 index 0000000..9622ea0 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_corgasgrenade2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vtf new file mode 100644 index 0000000..fca4b5b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_corgasgrenade2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vmt new file mode 100644 index 0000000..5fcd35b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_cosmos2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vtf new file mode 100644 index 0000000..698044e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_cosmos2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vmt new file mode 100644 index 0000000..926031c --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_craftables" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vtf new file mode 100644 index 0000000..e125967 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_craftables.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vmt new file mode 100644 index 0000000..f60d2c3 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_deathdealers" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vtf new file mode 100644 index 0000000..8da4ca1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_deathdealers.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vmt new file mode 100644 index 0000000..2f30800 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_detpack2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vtf new file mode 100644 index 0000000..cbd6433 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_detpack2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone3.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone3.png new file mode 100644 index 0000000..0eb08b3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone3.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone_pulse.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone_pulse.png new file mode 100644 index 0000000..a6f46be Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_drone_pulse.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vmt new file mode 100644 index 0000000..f5f7d9a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_dynamo" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vtf new file mode 100644 index 0000000..c8fbf30 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_dynamo.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vmt new file mode 100644 index 0000000..da7dc28 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_electrohammer" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vtf new file mode 100644 index 0000000..add5721 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_electrohammer.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vmt new file mode 100644 index 0000000..d06af8a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_eminence" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vtf new file mode 100644 index 0000000..3df2809 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_eminence.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindler.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindler.png new file mode 100644 index 0000000..4cb891e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindler.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindlermine.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindlermine.png new file mode 100644 index 0000000..a9206f1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_enkindlermine.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vmt new file mode 100644 index 0000000..eb323c9 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_executioner2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vtf new file mode 100644 index 0000000..72905ef Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_executioner2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vmt new file mode 100644 index 0000000..bafbcb9 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_ffemitter" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vtf new file mode 100644 index 0000000..0219638 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ffemitter.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vmt new file mode 100644 index 0000000..6970018 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_fists" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vtf new file mode 100644 index 0000000..a64f6e7 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fists.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vmt new file mode 100644 index 0000000..9ceeee3 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_flakcannon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vtf new file mode 100644 index 0000000..cdb4b36 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_flakcannon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vmt new file mode 100644 index 0000000..b263109 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_fracture2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vtf new file mode 100644 index 0000000..3a39ca0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fracture2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vmt new file mode 100644 index 0000000..5e93538 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_frotchet" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vtf new file mode 100644 index 0000000..e35475b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_frotchet.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vmt new file mode 100644 index 0000000..5b96c77 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_fryingpan" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vtf new file mode 100644 index 0000000..9d1f92b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_fryingpan.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vmt new file mode 100644 index 0000000..94f0069 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_galestorm" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vtf new file mode 100644 index 0000000..c2b4f98 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_galestorm.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vmt new file mode 100644 index 0000000..0a5a626 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_gladiator" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vtf new file mode 100644 index 0000000..cb625c4 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gladiator.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vmt new file mode 100644 index 0000000..bf0a51c --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_gluon2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vtf new file mode 100644 index 0000000..9022238 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gluon2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vmt new file mode 100644 index 0000000..9184684 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_graveshovel" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vtf new file mode 100644 index 0000000..4208422 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_graveshovel.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vmt new file mode 100644 index 0000000..7a288f9 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_gunturret2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vtf new file mode 100644 index 0000000..ab862d0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vmt new file mode 100644 index 0000000..3e5c2f4 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_gunturret_buckshot" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vtf new file mode 100644 index 0000000..380f8e3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_buckshot.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vmt new file mode 100644 index 0000000..8d09bce --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_gunturret_rocket" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vtf new file mode 100644 index 0000000..80b066f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_gunturret_rocket.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vmt new file mode 100644 index 0000000..2499e6a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_hammer2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vtf new file mode 100644 index 0000000..48f081e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hammer2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vmt new file mode 100644 index 0000000..8f092dd --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_harpoon2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vtf new file mode 100644 index 0000000..a5225a6 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_harpoon2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_haulerdrone.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_haulerdrone.png new file mode 100644 index 0000000..6635b72 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_haulerdrone.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_healingray.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_healingray.png new file mode 100644 index 0000000..fdf64ca Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_healingray.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vmt new file mode 100644 index 0000000..d9c79db --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_heph" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vtf new file mode 100644 index 0000000..77a552b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_heph.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vmt new file mode 100644 index 0000000..f8ef031 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_hook2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vtf new file mode 100644 index 0000000..a1ddeb3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hook2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vmt new file mode 100644 index 0000000..4465fc8 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_hurricane2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vtf new file mode 100644 index 0000000..9105487 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hurricane2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vmt new file mode 100644 index 0000000..ac0a26e --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_hyena" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vtf new file mode 100644 index 0000000..a67a1c0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_hyena.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vmt new file mode 100644 index 0000000..a5b7750 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_innervator2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vtf new file mode 100644 index 0000000..6c0b7a1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_innervator2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vmt new file mode 100644 index 0000000..01293a8 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_inquisitor2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vtf new file mode 100644 index 0000000..1f67d1a Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_inquisitor2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vmt new file mode 100644 index 0000000..9d2709a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_jackhammer2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vtf new file mode 100644 index 0000000..7905b9e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_jackhammer2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vmt new file mode 100644 index 0000000..d1128fa --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_keyboard" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vtf new file mode 100644 index 0000000..e198301 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_keyboard.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vmt new file mode 100644 index 0000000..b4ba257 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_kongolaxe2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vtf new file mode 100644 index 0000000..6086161 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_kongolaxe2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vmt new file mode 100644 index 0000000..49a5c88 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_ladel" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vtf new file mode 100644 index 0000000..dfeeb71 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ladel.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vmt new file mode 100644 index 0000000..20958c5 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_lamp" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vtf new file mode 100644 index 0000000..afd5c96 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_lamp.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vmt new file mode 100644 index 0000000..9f74788 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_longarm2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vtf new file mode 100644 index 0000000..3362d66 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longarm2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vmt new file mode 100644 index 0000000..fe43e28 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_longsword2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vtf new file mode 100644 index 0000000..33a43bb Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_longsword2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vmt new file mode 100644 index 0000000..a6ef6d0 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_manhack" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vtf new file mode 100644 index 0000000..fe5b2f8 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vmt new file mode 100644 index 0000000..4aae372 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_manhack_saw" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vtf new file mode 100644 index 0000000..8acdc14 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_manhack_saw.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vmt new file mode 100644 index 0000000..63b984e --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_meattenderizer2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vtf new file mode 100644 index 0000000..91782ef Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_meattenderizer2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vmt new file mode 100644 index 0000000..3dc62df --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_mediccloudbomb" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vtf new file mode 100644 index 0000000..e46658b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_mediccloudbomb.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vmt new file mode 100644 index 0000000..46d3dca --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_medicgun2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vtf new file mode 100644 index 0000000..7f69a05 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medicgun2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vmt new file mode 100644 index 0000000..6c88d93 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_medkit" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vtf new file mode 100644 index 0000000..e88cc7b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_medkit.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vmt new file mode 100644 index 0000000..f3d1fc7 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_megamasher2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vtf new file mode 100644 index 0000000..35e308d Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_megamasher2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vmt new file mode 100644 index 0000000..4834684 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_messagebeacon" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vtf new file mode 100644 index 0000000..97367d5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_messagebeacon.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vmt new file mode 100644 index 0000000..9fe299f --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_molotov2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vtf new file mode 100644 index 0000000..f1601c0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_molotov2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vmt new file mode 100644 index 0000000..80304cf --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_novablaster2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vtf new file mode 100644 index 0000000..6a51b4b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novablaster2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vmt new file mode 100644 index 0000000..c8ba8d1 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_novacolt2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vtf new file mode 100644 index 0000000..9ce6283 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_novacolt2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vmt new file mode 100644 index 0000000..a0bd6e6 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_oberon2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vtf new file mode 100644 index 0000000..54f0575 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oberon2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_onyx.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_onyx.png new file mode 100644 index 0000000..bc83bf0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_onyx.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vmt new file mode 100644 index 0000000..e8924ff --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_oxygentank" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vtf new file mode 100644 index 0000000..6ad4a04 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_oxygentank.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vmt new file mode 100644 index 0000000..56efa18 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_pipe" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vtf new file mode 100644 index 0000000..c4bc7a0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pipe.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vmt new file mode 100644 index 0000000..b0f9e5a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_plank" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vtf new file mode 100644 index 0000000..b6b1250 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_plank.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vmt new file mode 100644 index 0000000..74a6d27 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_pot" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vtf new file mode 100644 index 0000000..d1b94dd Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_pot.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_powerfist.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_powerfist.png new file mode 100644 index 0000000..75c527c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_powerfist.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proliferator.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proliferator.png new file mode 100644 index 0000000..9c253c1 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proliferator.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vmt new file mode 100644 index 0000000..374ac49 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_proxymine" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vtf new file mode 100644 index 0000000..6b27b05 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_proxymine.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_purger.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_purger.png new file mode 100644 index 0000000..d57ba1e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_purger.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vmt new file mode 100644 index 0000000..951b8ba --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_quasar2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vtf new file mode 100644 index 0000000..9bf4980 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_quasar2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vmt new file mode 100644 index 0000000..a804d74 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_rebarmace2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vtf new file mode 100644 index 0000000..878fcaf Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rebarmace2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_remantler2.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_remantler2.png new file mode 100644 index 0000000..34ca506 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_remantler2.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_renegade.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_renegade.png new file mode 100644 index 0000000..2bf9ccf Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_renegade.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vmt new file mode 100644 index 0000000..8bf512b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_repairfield" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vtf new file mode 100644 index 0000000..5d10172 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_repairfield.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vmt new file mode 100644 index 0000000..886ac06 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_resupplybox" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vtf new file mode 100644 index 0000000..0ed07dd Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_resupplybox.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vmt new file mode 100644 index 0000000..6179985 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_ripper" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vtf new file mode 100644 index 0000000..d3dec24 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_ripper.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rollermine.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rollermine.png new file mode 100644 index 0000000..b4caf00 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_rollermine.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vmt new file mode 100644 index 0000000..e900731 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_sawedoff2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vtf new file mode 100644 index 0000000..2d80ce0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawedoff2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawhack.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawhack.png new file mode 100644 index 0000000..6e1a3ba Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sawhack.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vmt new file mode 100644 index 0000000..80ac287 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_scar2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vtf new file mode 100644 index 0000000..890795c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scar2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vmt new file mode 100644 index 0000000..92bf3b3 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_scythe2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vtf new file mode 100644 index 0000000..a8daea8 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_scythe2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vmt new file mode 100644 index 0000000..6560bcc --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_seditionist2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vtf new file mode 100644 index 0000000..73117f2 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_seditionist2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vmt new file mode 100644 index 0000000..6431133 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_shovel" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vtf new file mode 100644 index 0000000..5bdde5e Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shovel.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vmt new file mode 100644 index 0000000..1f29510 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_shroud2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vtf new file mode 100644 index 0000000..907134b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_shroud2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vmt new file mode 100644 index 0000000..96b5abf --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_sledgehammer" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vtf new file mode 100644 index 0000000..9705723 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_sledgehammer.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vmt new file mode 100644 index 0000000..285f46a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_slinger" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vtf new file mode 100644 index 0000000..93555b5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slinger.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vmt new file mode 100644 index 0000000..245fa0e --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_slugrifle2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vtf new file mode 100644 index 0000000..727ab1f Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_slugrifle2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vmt new file mode 100644 index 0000000..bfe555f --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_spinfusor2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vtf new file mode 100644 index 0000000..b01d318 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spinfusor2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vmt new file mode 100644 index 0000000..bfd3635 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_spotlamp" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vtf new file mode 100644 index 0000000..5996a71 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_spotlamp.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vmt new file mode 100644 index 0000000..1bdbe87 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_stabber" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vtf new file mode 100644 index 0000000..1e1e08c Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stabber.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vmt new file mode 100644 index 0000000..f4819a7 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_stone" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vtf new file mode 100644 index 0000000..f23c118 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_stone.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vmt new file mode 100644 index 0000000..e3b525b --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_tempest" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vtf new file mode 100644 index 0000000..d59b1d3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tempest.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vmt new file mode 100644 index 0000000..01a7423 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_tithonus2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vtf new file mode 100644 index 0000000..47a3bd5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tithonus2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vmt new file mode 100644 index 0000000..8e0d5db --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_trinket" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vtf new file mode 100644 index 0000000..8c60597 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_trinket.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tv.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tv.png new file mode 100644 index 0000000..1330f78 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_tv.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vmt new file mode 100644 index 0000000..ba17f12 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_waraxe2" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vtf new file mode 100644 index 0000000..8a11133 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_waraxe2.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vmt new file mode 100644 index 0000000..c8375cc --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_wrench" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vtf new file mode 100644 index 0000000..d9be5ed Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_wrench.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vmt new file mode 100644 index 0000000..269c331 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_z9000" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vtf new file mode 100644 index 0000000..30acb26 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_z9000.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vmt new file mode 100644 index 0000000..a376c34 --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_zapper" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vtf new file mode 100644 index 0000000..2f08537 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zapper.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vmt new file mode 100644 index 0000000..e25519f --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/weapon_zs_zeus" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vtf new file mode 100644 index 0000000..e06e062 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/weapon_zs_zeus.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vmt b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vmt new file mode 100644 index 0000000..6768a8a --- /dev/null +++ b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vmt @@ -0,0 +1,10 @@ +"UnlitGeneric" +{ + "$basetexture" "zombiesurvival/killicons/zs_headshot" + "$nolod" 1 + "$nomip" 1 + "$ignorez" 1 + "$translucent" 1 + "$vertexalpha" 1 + "$vertexcolor" 1 +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vtf b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vtf new file mode 100644 index 0000000..0157d41 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/killicons/zs_headshot.vtf differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/knock_down.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/knock_down.png new file mode 100644 index 0000000..1a12acb Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/knock_down.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/nest.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/nest.png new file mode 100644 index 0000000..77227eb Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/nest.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/padlock.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/padlock.png new file mode 100644 index 0000000..894f7a8 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/padlock.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/poison.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/poison.png new file mode 100644 index 0000000..4659a27 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/poison.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/reaper.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/reaper.png new file mode 100644 index 0000000..057626b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/reaper.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/remantler.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/remantler.png new file mode 100644 index 0000000..04c092b Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/remantler.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/resupply.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/resupply.png new file mode 100644 index 0000000..b289194 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/resupply.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/sickness.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/sickness.png new file mode 100644 index 0000000..1bd0ade Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/sickness.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/sigil.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/sigil.png new file mode 100644 index 0000000..65a3934 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/sigil.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/skillwebgrid.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/skillwebgrid.png new file mode 100644 index 0000000..ddd9b44 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/skillwebgrid.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/slow.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/slow.png new file mode 100644 index 0000000..f6d47e0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/slow.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/speed_up.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/speed_up.png new file mode 100644 index 0000000..ba0d915 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/speed_up.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/strength_shot.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/strength_shot.png new file mode 100644 index 0000000..bfff2db Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/strength_shot.png differ diff --git a/gamemodes/zombiesurvival/content/materials/zombiesurvival/tremors.png b/gamemodes/zombiesurvival/content/materials/zombiesurvival/tremors.png new file mode 100644 index 0000000..1563456 Binary files /dev/null and b/gamemodes/zombiesurvival/content/materials/zombiesurvival/tremors.png differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx80.vtx b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx80.vtx new file mode 100644 index 0000000..5b725b0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx90.vtx b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx90.vtx new file mode 100644 index 0000000..deec064 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.mdl b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.mdl new file mode 100644 index 0000000..d57082a Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.phy b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.phy new file mode 100644 index 0000000..20e2760 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.phy differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.sw.vtx b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.sw.vtx new file mode 100644 index 0000000..39ac930 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.vvd b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.vvd new file mode 100644 index 0000000..151cf5e Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zelpa/stalker.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.ani b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.ani new file mode 100644 index 0000000..f0f118f Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.ani differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx80.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx80.vtx new file mode 100644 index 0000000..f8fa773 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx90.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx90.vtx new file mode 100644 index 0000000..e9183cb Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.mdl b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.mdl new file mode 100644 index 0000000..406bd13 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.phy b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.phy new file mode 100644 index 0000000..c05c4a5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.phy differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.sw.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.sw.vtx new file mode 100644 index 0000000..3e57f3b Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.vvd b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.vvd new file mode 100644 index 0000000..c8cf471 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_classic_hbfix.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx80.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx80.vtx new file mode 100644 index 0000000..263a46c Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx90.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx90.vtx new file mode 100644 index 0000000..1df9460 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.mdl b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.mdl new file mode 100644 index 0000000..6debaf0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.phy b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.phy new file mode 100644 index 0000000..6f75f6b Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.phy differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.sw.vtx b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.sw.vtx new file mode 100644 index 0000000..f91878b Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.vvd b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.vvd new file mode 100644 index 0000000..5934c8e Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/player/zombie_lacerator2.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx80.vtx new file mode 100644 index 0000000..9cd5d08 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx90.vtx new file mode 100644 index 0000000..d7326f3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.mdl b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.mdl new file mode 100644 index 0000000..0caa4c3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.sw.vtx new file mode 100644 index 0000000..bdbc207 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.vvd b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.vvd new file mode 100644 index 0000000..b44604c Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_aegiskit.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx80.vtx new file mode 100644 index 0000000..3a11bc3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx90.vtx new file mode 100644 index 0000000..43295a3 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.mdl b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.mdl new file mode 100644 index 0000000..a016113 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.sw.vtx new file mode 100644 index 0000000..e313f98 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.vvd b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.vvd new file mode 100644 index 0000000..7c31762 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/c_annabelle.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx80.vtx deleted file mode 100644 index 28cdd21..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx80.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx90.vtx deleted file mode 100644 index 30e8b1e..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.dx90.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.mdl deleted file mode 100644 index e088308..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.mdl and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.sw.vtx deleted file mode 100644 index 3b0e071..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.sw.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.vvd deleted file mode 100644 index 233019f..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_aegiskit.vvd and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx80.vtx deleted file mode 100644 index 82f92b0..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx80.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx90.vtx deleted file mode 100644 index d9bb7f7..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.dx90.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.mdl deleted file mode 100644 index 6ed5a81..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.mdl and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.sw.vtx deleted file mode 100644 index 3a40f65..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.sw.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.vvd deleted file mode 100644 index cb11380..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_annabelle.vvd and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx80.vtx new file mode 100644 index 0000000..f51f2c9 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx90.vtx new file mode 100644 index 0000000..0040351 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.mdl new file mode 100644 index 0000000..5f2c887 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.sw.vtx new file mode 100644 index 0000000..918ea4b Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.vvd new file mode 100644 index 0000000..f588a29 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/c_hammer.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx80.vtx deleted file mode 100644 index 916573c..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx80.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx90.vtx deleted file mode 100644 index 2cdfa81..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.dx90.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.mdl deleted file mode 100644 index b5fe377..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.mdl and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.sw.vtx deleted file mode 100644 index 1d3c306..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.sw.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.vvd deleted file mode 100644 index 2b486c0..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_hammer/v_hammer.vvd and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx80.vtx new file mode 100644 index 0000000..4fe18e0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx80.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx90.vtx new file mode 100644 index 0000000..03de5fb Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.dx90.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.mdl new file mode 100644 index 0000000..de1333c Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.mdl differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.sw.vtx new file mode 100644 index 0000000..f309ed6 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.sw.vtx differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.vvd new file mode 100644 index 0000000..9970c15 Binary files /dev/null and b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/c_sledgehammer.vvd differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx80.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx80.vtx deleted file mode 100644 index 525788a..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx80.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx90.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx90.vtx deleted file mode 100644 index 231a1ab..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.dx90.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.mdl b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.mdl deleted file mode 100644 index 88418f7..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.mdl and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.sw.vtx b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.sw.vtx deleted file mode 100644 index 99a284b..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.sw.vtx and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.vvd b/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.vvd deleted file mode 100644 index 50dc19d..0000000 Binary files a/gamemodes/zombiesurvival/content/models/weapons/v_sledgehammer/v_sledgehammer.vvd and /dev/null differ diff --git a/gamemodes/zombiesurvival/content/particles/vman_explosion.pcf b/gamemodes/zombiesurvival/content/particles/vman_explosion.pcf new file mode 100644 index 0000000..c4a0444 Binary files /dev/null and b/gamemodes/zombiesurvival/content/particles/vman_explosion.pcf differ diff --git a/gamemodes/zombiesurvival/content/resource/fonts/ghoulfriaoe.ttf b/gamemodes/zombiesurvival/content/resource/fonts/ghoulfriaoe.ttf new file mode 100644 index 0000000..73c1f56 Binary files /dev/null and b/gamemodes/zombiesurvival/content/resource/fonts/ghoulfriaoe.ttf differ diff --git a/gamemodes/zombiesurvival/content/resource/fonts/remingtonnoiseless.ttf b/gamemodes/zombiesurvival/content/resource/fonts/remingtonnoiseless.ttf new file mode 100644 index 0000000..2106198 Binary files /dev/null and b/gamemodes/zombiesurvival/content/resource/fonts/remingtonnoiseless.ttf differ diff --git a/gamemodes/zombiesurvival/content/sound/nox/frotchet_test1.ogg b/gamemodes/zombiesurvival/content/sound/nox/frotchet_test1.ogg new file mode 100644 index 0000000..a9539eb Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/nox/frotchet_test1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/nox/scatterfrost.ogg b/gamemodes/zombiesurvival/content/sound/nox/scatterfrost.ogg new file mode 100644 index 0000000..50c4de4 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/nox/scatterfrost.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/nox/sword_hit.ogg b/gamemodes/zombiesurvival/content/sound/nox/sword_hit.ogg new file mode 100644 index 0000000..f948e88 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/nox/sword_hit.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/nox/sword_miss.ogg b/gamemodes/zombiesurvival/content/sound/nox/sword_miss.ogg new file mode 100644 index 0000000..56307c5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/nox/sword_miss.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/main3.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/main3.wav new file mode 100644 index 0000000..524def6 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/main3.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/secondary2.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/secondary2.wav new file mode 100644 index 0000000..bfbc572 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_asmd/secondary2.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/load1.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/load1.wav new file mode 100644 index 0000000..e88b937 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/load1.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/shot1.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/shot1.wav new file mode 100644 index 0000000..0a974e0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_flak/shot1.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_glad/gladshot4.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_glad/gladshot4.wav new file mode 100644 index 0000000..7977ee0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_glad/gladshot4.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_gluon/egon_off1.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_gluon/egon_off1.wav new file mode 100644 index 0000000..403d38a Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_gluon/egon_off1.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro4.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro4.wav new file mode 100644 index 0000000..1aa95aa Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro4.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro5.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro5.wav new file mode 100644 index 0000000..1c092f0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro5.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro6.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro6.wav new file mode 100644 index 0000000..f63aec7 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_heph/electro6.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_inner/innershot.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_inner/innershot.ogg new file mode 100644 index 0000000..c0c5e51 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_inner/innershot.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_longarm/longarm_fire.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_longarm/longarm_fire.ogg new file mode 100644 index 0000000..fab5d88 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_longarm/longarm_fire.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power1.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power1.ogg new file mode 100644 index 0000000..24acf42 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power4.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power4.wav new file mode 100644 index 0000000..89eac74 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_power/power4.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_rail/rail.wav b/gamemodes/zombiesurvival/content/sound/weapons/zs_rail/rail.wav new file mode 100644 index 0000000..d47bc0e Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_rail/rail.wav differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barreldown.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barreldown.ogg new file mode 100644 index 0000000..6054e10 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barreldown.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barrelup.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barrelup.ogg new file mode 100644 index 0000000..51be51a Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/barrelup.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/sawnoff_fire1.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/sawnoff_fire1.ogg new file mode 100644 index 0000000..8bd1601 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_sawnoff/sawnoff_fire1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/weapons/zs_scar/scar_fire1.ogg b/gamemodes/zombiesurvival/content/sound/weapons/zs_scar/scar_fire1.ogg new file mode 100644 index 0000000..478dad0 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/weapons/zs_scar/scar_fire1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink1.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink1.ogg new file mode 100644 index 0000000..be0301b Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink2.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink2.ogg new file mode 100644 index 0000000..6a98b70 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink2.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink3.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink3.ogg new file mode 100644 index 0000000..be2e43c Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/drink3.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/eat1.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/eat1.ogg new file mode 100644 index 0000000..2d2f209 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/eat1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/eyeflash.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/eyeflash.ogg new file mode 100644 index 0000000..b6206f5 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/eyeflash.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/human_death_stinger.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/human_death_stinger.ogg new file mode 100644 index 0000000..767c4ed Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/human_death_stinger.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/nightmare_ambiance.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/nightmare_ambiance.ogg new file mode 100644 index 0000000..6a682c6 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/nightmare_ambiance.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/skilltree_ambiance.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/skilltree_ambiance.ogg new file mode 100644 index 0000000..98d9b4b Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/skilltree_ambiance.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc1.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc1.ogg new file mode 100644 index 0000000..08e8e7f Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc1.ogg differ diff --git a/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc2.ogg b/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc2.ogg new file mode 100644 index 0000000..82999e2 Binary files /dev/null and b/gamemodes/zombiesurvival/content/sound/zombiesurvival/ui/misc2.ogg differ diff --git a/gamemodes/zombiesurvival/entities/conv.js b/gamemodes/zombiesurvival/entities/conv.js new file mode 100644 index 0000000..6351351 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/conv.js @@ -0,0 +1,35 @@ +const fs = require('fs') + +var walkSync = function(dir, filelist) { + const files = fs.readdirSync(dir); + filelist = filelist || []; + files.forEach(function(file) { + if (fs.statSync(dir + '/' + file).isDirectory()) + filelist = walkSync(dir + '/' + file, filelist) + else + filelist.push(dir + '/' + file) + }) + return filelist +} + +const files = walkSync('./weapons') + +var contents +var replaced + +function replacer(s, a, b) { + replaced = true + return 'SWEP.Cone' + a + ' = ' + parseFloat(b) * 50 +} + +for (var i=0; i < files.length; i++) { + if (files[i].substr(-4) == '.lua') { + replaced = false + + contents = fs.readFileSync(files[i], {encoding: 'utf8'}).toString() + contents = contents.replace(/SWEP.Cone(M..) = ([0-9\.]+)/g, replacer) + + if (replaced) + fs.writeFileSync(files[i], contents) + } +} \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/effects/bloodstream.lua b/gamemodes/zombiesurvival/entities/effects/bloodstream.lua index e1a24f1..12989a0 100644 --- a/gamemodes/zombiesurvival/entities/effects/bloodstream.lua +++ b/gamemodes/zombiesurvival/entities/effects/bloodstream.lua @@ -32,7 +32,7 @@ local function CollideCallback(oldparticle, hitpos, hitnormal) local emitter = ParticleEmitter(pos) for i=1, num do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetLighting(true) particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(75, 150) + nhitnormal) particle:SetDieTime(3) @@ -48,7 +48,7 @@ local function CollideCallback(oldparticle, hitpos, hitnormal) particle:SetColor(255, 0, 0) particle:SetCollideCallback(CollideCallbackSmall) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Init(data) @@ -60,7 +60,7 @@ function EFFECT:Init(data) local emitter = ParticleEmitter(pos) for i=1, data:GetMagnitude() do local heading = (VectorRand():GetNormalized() * 3 + dir) / 4 - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos + heading) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos + heading) particle:SetVelocity(force * math.Rand(0.8, 1) * heading) particle:SetDieTime(math.Rand(3, 6)) particle:SetStartAlpha(200) @@ -76,7 +76,7 @@ function EFFECT:Init(data) particle:SetColor(255, 0, 0) particle:SetCollideCallback(CollideCallback) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/chemzombieexplode.lua b/gamemodes/zombiesurvival/entities/effects/chemzombieexplode.lua deleted file mode 100644 index 24650d7..0000000 --- a/gamemodes/zombiesurvival/entities/effects/chemzombieexplode.lua +++ /dev/null @@ -1,67 +0,0 @@ -function EFFECT:Init(data) - local pos = data:GetOrigin() - pos = pos + Vector(0, 0, 48) - - sound.Play("ambient/explosions/explode_9.wav", pos, 90, math.Rand(85, 95)) - - local emitter = ParticleEmitter(pos) - emitter:SetNearClip(40, 45) - for i=1, math.random(12, 15) do - local heading = VectorRand():GetNormalized() - local particle = emitter:Add("particle/smokestack", pos + heading * 16) - particle:SetVelocity(heading * 72) - particle:SetDieTime(math.Rand(1.7, 2.0)) - particle:SetStartAlpha(220) - particle:SetEndAlpha(0) - particle:SetStartSize(32) - particle:SetEndSize(4) - particle:SetColor(20, 100, 20) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-1, 1)) - end - for i=1, math.random(5, 8) do - local particle = emitter:Add("particle/smokestack", pos) - particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(48, 82)) - particle:SetDieTime(math.Rand(2.2, 3.6)) - particle:SetStartAlpha(220) - particle:SetEndAlpha(0) - particle:SetStartSize(8) - particle:SetEndSize(100) - particle:SetColor(0, 30, 0) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-1, 1)) - particle:SetAirResistance(10) - end - for i=1, math.random(17, 21) do - local particle = emitter:Add("effects/fire_cloud1", pos + VectorRand() * 32) - local dir = VectorRand():GetNormalized() - particle:SetVelocity(dir * math.Rand(500, 600)) - particle:SetDieTime(math.Rand(1.0, 1.25)) - particle:SetStartAlpha(220) - particle:SetEndAlpha(0) - particle:SetStartSize(60) - particle:SetEndSize(30) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-3, 3)) - particle:SetAirResistance(60) - particle:SetGravity(dir * math.Rand(-600, -500)) - end - for i=1, 2 do - local particle = emitter:Add("effects/fire_cloud1", pos) - particle:SetDieTime(math.Rand(0.3, 0.35)) - particle:SetStartAlpha(255) - particle:SetEndAlpha(0) - particle:SetStartSize(16) - particle:SetEndSize(300) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-30, 30)) - end - emitter:Finish() -end - -function EFFECT:Think() - return false -end - -function EFFECT:Render() -end diff --git a/gamemodes/zombiesurvival/entities/effects/corrupted_teleport.lua b/gamemodes/zombiesurvival/entities/effects/corrupted_teleport.lua new file mode 100644 index 0000000..e4cb9d9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/corrupted_teleport.lua @@ -0,0 +1,57 @@ +EFFECT.LifeTime = 0.25 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local ent = data:GetEntity() + + self.DieTime = RealTime() + self.LifeTime + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + for i=1, 16 do + local heading = VectorRand() + heading:Normalize() + + particle = emitter:Add("particle/smokesprites_0001", pos + heading * 8) + particle:SetDieTime(math.Rand(0.75, 1.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(8) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-14, 14)) + particle:SetColor(0, 120, 255) + particle:SetVelocity(heading * math.Rand(128, 256)) + particle:SetAirResistance(256) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + if ent == MySelf then + MySelf:EmitSound("ambient/machines/teleport1.wav", 75, 110, 0.8) + util.WhiteOut(1) + end +end + +function EFFECT:Think() + return RealTime() < self.DieTime +end + +local matGlow = Material("particle/smokesprites_0001") +local colGlow = Color(0, 255, 120) +function EFFECT:Render() + local pos = self.Entity:GetPos() + local delta = math.Clamp((self.DieTime - RealTime()) / self.LifeTime, 0, 1) + + colGlow.a = delta * 255 + + local size = 128 - delta * 92 + + render.SetMaterial(matGlow) + render.DrawQuadEasy(pos, Vector(0, 0, -1), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, 0, 1), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, -1, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, 1, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(-1, 0, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(1, 0, 0), size, size, colGlow) + render.DrawSprite(pos, size, size, colGlow) +end diff --git a/gamemodes/zombiesurvival/entities/effects/damagenumber.lua b/gamemodes/zombiesurvival/entities/effects/damagenumber.lua index b8984cc..0bf44df 100644 --- a/gamemodes/zombiesurvival/entities/effects/damagenumber.lua +++ b/gamemodes/zombiesurvival/entities/effects/damagenumber.lua @@ -1,7 +1,7 @@ EFFECT.LifeTime = 3 local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER -local TEXT_ALIGN_TOP = TEXT_ALIGN_TOP +local TEXT_ALIGN_BOTTOM = TEXT_ALIGN_BOTTOM local draw = draw local cam = cam @@ -16,11 +16,12 @@ hook.Add("PostDrawTranslucentRenderables", "DrawDamage", function() local curtime = CurTime() local ang = EyeAngles() - local right = ang:Right() ang:RotateAroundAxis(ang:Up(), -90) ang:RotateAroundAxis(ang:Forward(), 90) - --cam.IgnoreZ(true) + if GAMEMODE.DamageNumberThroughWalls then + cam.IgnoreZ(true) + end for _, particle in pairs(Particles) do if particle and curtime < particle.DieTime then @@ -30,13 +31,15 @@ hook.Add("PostDrawTranslucentRenderables", "DrawDamage", function() c.a = math.Clamp(particle.DieTime - curtime, 0, 1) * 220 - cam.Start3D2D(particle:GetPos(), ang, 0.1) - draw.SimpleText(particle.Amount, "ZS3D2DFont2", 0, 0, c, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP) + cam.Start3D2D(particle:GetPos(), ang, 0.1 * GAMEMODE.DamageNumberScale) + draw.SimpleText(particle.Amount, "ZS3D2DFont2", 0, 0, c, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) cam.End3D2D() end end - --cam.IgnoreZ(false) + if GAMEMODE.DamageNumberThroughWalls then + cam.IgnoreZ(false) + end if done then Particles = {} @@ -44,11 +47,11 @@ hook.Add("PostDrawTranslucentRenderables", "DrawDamage", function() end) local gravity = Vector(0, 0, -500) - function EFFECT:Init(data) local pos = data:GetOrigin() local amount = data:GetMagnitude() local Type = data:GetScale() + local velscal = GAMEMODE.DamageNumberSpeed local vel = VectorRand() vel.z = math.Rand(0.7, 0.98) @@ -64,16 +67,16 @@ function EFFECT:Init(data) particle:SetCollide(true) particle:SetBounce(0.7) particle:SetAirResistance(32) - particle:SetGravity(gravity) - particle:SetVelocity(math.Clamp(amount, 5, 50) * 4 * vel) + particle:SetGravity(gravity * (velscal ^ 2)) + particle:SetVelocity(math.Clamp(amount, 5, 50) * 4 * vel * velscal) particle.Amount = amount - particle.DieTime = CurTime() + 2 + particle.DieTime = CurTime() + 2 * GAMEMODE.DamageNumberLifetime particle.Type = Type table.insert(Particles, particle) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/death_doomcrab.lua b/gamemodes/zombiesurvival/entities/effects/death_doomcrab.lua new file mode 100644 index 0000000..1d4b869 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/death_doomcrab.lua @@ -0,0 +1,75 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + sound.Play("physics/body/body_medium_break"..math.random(2, 4)..".wav", pos, 77, math.Rand(90, 110)) + for i=0, math.random(2, 3) do + timer.Simple(i * math.Rand(0.1, 0.3), function() sound.Play("physics/flesh/flesh_squishy_impact_hard"..math.random(4)..".wav", pos, 77, math.Rand(90, 110)) end) + end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle, size, heading + + for i=1, 12 do + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(normal * 48 + VectorRand() * 32) + particle:SetDieTime(math.Rand(3.5, 4.5)) + particle:SetStartAlpha(110) + particle:SetEndAlpha(0) + particle:SetStartSize(200) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-2.5, 2.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(0, 0, 0) + end + + local grav = Vector(0, 0, 170) + for i=1, 24 do + particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(normal * -48 + VectorRand() * 64) + particle:SetGravity(-grav) + particle:SetDieTime(math.Rand(2, 2.5)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(13, 14)) + particle:SetEndSize(math.Rand(10, 12)) + particle:SetRoll(180) + particle:SetDieTime(3) + particle:SetColor(50, 50, 50) + particle:SetLighting(true) + end + + for i=1, 80 do + heading = VectorRand() + heading:Normalize() + + size = math.Rand(15, 25) + + particle = emitter:Add("particles/smokey", pos + heading * math.Rand(2, 64)) + particle:SetVelocity(heading * math.Rand(-128, 256)) + particle:SetDieTime(math.Rand(4.5, 6)) + particle:SetStartAlpha(60) + particle:SetEndAlpha(0) + particle:SetStartSize(size) + particle:SetEndSize(size) + particle:SetRollDelta(math.Rand(-1.5, 1.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(0, 0, 0) + particle:SetAirResistance(math.Rand(50, 200)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + util.Blood(pos, math.random(22, 26), Vector(0,0,1), 300) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/death_extinctioncrab.lua b/gamemodes/zombiesurvival/entities/effects/death_extinctioncrab.lua new file mode 100644 index 0000000..de301e8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/death_extinctioncrab.lua @@ -0,0 +1,77 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + sound.Play("physics/body/body_medium_break"..math.random(2, 4)..".wav", pos, 77, math.Rand(90, 110)) + for i=0, math.random(2, 3) do + timer.Simple(i * math.Rand(0.1, 0.3), function() sound.Play("physics/flesh/flesh_squishy_impact_hard"..math.random(4)..".wav", pos, 77, math.Rand(90, 110)) end) + end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle, size, heading + + for i=1, 12 do + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(normal * 48 + VectorRand() * 32) + particle:SetDieTime(math.Rand(3.5, 4.5)) + particle:SetStartAlpha(60) + particle:SetEndAlpha(0) + particle:SetStartSize(200) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-2.5, 2.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(160, 5, 0) + end + + local grav = Vector(0, 0, 170) + for i=1, 24 do + particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(normal * -48 + VectorRand() * 64) + particle:SetGravity(-grav) + particle:SetDieTime(math.Rand(2, 2.5)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(13, 14)) + particle:SetEndSize(math.Rand(10, 12)) + particle:SetRoll(180) + particle:SetDieTime(3) + particle:SetColor(50, 50, 50) + particle:SetLighting(true) + end + + for i=1, 80 do + heading = VectorRand() + heading:Normalize() + + size = math.Rand(10, 15) + + particle = emitter:Add("particle/rain", pos + heading * math.Rand(2, 64)) + particle:SetVelocity(heading * math.Rand(200, 550)) + particle:SetGravity(Vector(0, 0, -250)) + particle:SetDieTime(math.Rand(1, 1.5)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(size) + particle:SetEndSize(size) + particle:SetStartLength(size * 2) + particle:SetEndLength(size * 4.5) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(255, 120, 0) + particle:SetAirResistance(math.Rand(20, 30)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + util.Blood(pos, math.random(22, 26), Vector(0,0,1), 300) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/death_shade.lua b/gamemodes/zombiesurvival/entities/effects/death_shade.lua new file mode 100644 index 0000000..22dbaf4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/death_shade.lua @@ -0,0 +1,42 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + self.Pos = pos + local normal = effectdata:GetNormal() + + self.Alpha = 255 + self.Life = 0 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 30 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(1) + particle:SetColor(50,80,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(7) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 300) + particle:SetGravity(VectorRand() * 20 + Vector(0, 0, -300)) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + sound.Play("weapons/physcannon/energy_disintegrate4.wav", pos, 80, math.Rand(50, 65)) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 2 + self.Alpha = 255 * (1 - self.Life) + return (self.Life < 1) +end + +local glowmat = Material("sprites/glow04_noz") + +function EFFECT:Render() + render.SetMaterial(glowmat) + render.DrawSprite(self.Pos, 300, 300, Color(110, 150, 255, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/death_shadowlurker.lua b/gamemodes/zombiesurvival/entities/effects/death_shadowlurker.lua new file mode 100644 index 0000000..19defc1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/death_shadowlurker.lua @@ -0,0 +1,33 @@ +EFFECT.LifeTime = 1 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() + local ent = data:GetEntity() + + self.Entity:SetPos(pos) + self.Entity:SetAngles(normal:Angle()) + + if ent:IsValid() then + self.DieTime = CurTime() + self.LifeTime + self.Entity:SetModel(ent:GetModel()) + else + self.DieTime = 0 + end +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +function EFFECT:Render() + local delta = (self.DieTime - CurTime()) / self.LifeTime + + self.Entity:SetModelScale(2 - delta ^ 2, 0) + + render.SetBlend(delta) + render.SetColorModulation(0.05, 0.05, 0.05) + self.Entity:DrawModel() + render.SetColorModulation(1, 1, 1) + render.SetBlend(1) +end diff --git a/gamemodes/zombiesurvival/entities/effects/wraithdeath.lua b/gamemodes/zombiesurvival/entities/effects/death_wraith.lua similarity index 100% rename from gamemodes/zombiesurvival/entities/effects/wraithdeath.lua rename to gamemodes/zombiesurvival/entities/effects/death_wraith.lua diff --git a/gamemodes/zombiesurvival/entities/effects/decal_scorch.lua b/gamemodes/zombiesurvival/entities/effects/decal_scorch.lua new file mode 100644 index 0000000..9f7ef0c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/decal_scorch.lua @@ -0,0 +1,13 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() + + util.Decal("Scorch", pos + normal, pos - normal) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/dismemberment.lua b/gamemodes/zombiesurvival/entities/effects/dismemberment.lua index 4cf0052..1d9117d 100644 --- a/gamemodes/zombiesurvival/entities/effects/dismemberment.lua +++ b/gamemodes/zombiesurvival/entities/effects/dismemberment.lua @@ -19,6 +19,7 @@ BoneTranslates["models/zombie/classic.mdl"] = {["ValveBiped.Bip01_Head1"]="Valve BoneTranslates["models/zombie/poison.mdl"] = {["ValveBiped.Bip01_Head1"]="ValveBiped.Bip01_Spine4"} BoneTranslates["models/zombie/fast.mdl"] = {["ValveBiped.Bip01_Head1"]="ValveBiped.HC_BodyCube"} BoneTranslates["models/player/zombie_classic.mdl"] = {["ValveBiped.Bip01_Head1"]="ValveBiped.Bip01_Spine4"} +BoneTranslates["models/player/zombie_classic_hbfix.mdl"] = {["ValveBiped.Bip01_Head1"]="ValveBiped.Bip01_Spine4"} local function CollideCallback(particle, hitpos, hitnormal) if particle:GetDieTime() == 0 then return end @@ -93,7 +94,7 @@ function EFFECT:Render() emitter:SetPos(vBonePos) local vForward = aBoneAng:Forward() for i=1, math.random(0, 2) do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), vBonePos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), vBonePos) local force = math.min(1.5, delta) * math.Rand(175, 300) particle:SetVelocity(force * vForward + 0.2 * force * VectorRand()) particle:SetDieTime(math.Rand(2.25, 3)) @@ -111,7 +112,7 @@ function EFFECT:Render() particle:SetCollideCallback(CollideCallback) particle:SetLighting(true) end - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), vBonePos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), vBonePos) local vel = eRagdoll:GetVelocity() particle:SetVelocity(vel) particle:SetDieTime(math.Rand(0.5, 0.75)) @@ -132,6 +133,6 @@ function EFFECT:Render() end end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end diff --git a/gamemodes/zombiesurvival/entities/effects/doomball_skull.lua b/gamemodes/zombiesurvival/entities/effects/doomball_skull.lua new file mode 100644 index 0000000..ded7ab9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/doomball_skull.lua @@ -0,0 +1,54 @@ +EFFECT.LifeTime = 1 + +function EFFECT:Init(data) + self:SetAngles(Angle(0, math.Rand(0, 360), 0)) + self:SetModel("models/gibs/HGIBS.mdl") + self:SetModelScale(2, 0) + self:PhysicsInitSphere(4) + + self.LifeTime = math.Rand(3, 5) + self.DieTime = CurTime() + self.LifeTime + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(true) + phys:EnableGravity(false) + phys:EnableDrag(true) + phys:Wake() + phys:SetDragCoefficient(200) + phys:SetAngleDragCoefficient(9999999) + phys:SetVelocityInstantaneous((data:GetNormal() + VectorRand()):GetNormalized() * math.Rand(10, 40)) + end +end + +function EFFECT:Think() + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:AddVelocity(Vector(0, 0, 15 * FrameTime())) + end + + return CurTime() < self.DieTime +end + +local colGlow = Color(255, 0, 0) +local matGlow = Material("sprites/glow04_noz") +local vecEyeLeft = Vector(5, -3.5, 1) +local vecEyeRight = Vector(5, 3.5, 1) + +function EFFECT:Render() + local dt = math.Clamp((self.DieTime - CurTime()) / self.LifeTime, 0, 1) ^ 0.5 + + render.SetBlend(dt) + render.SetColorModulation(0.5, 0.5, 0.5) + + self:DrawModel() + + render.SetColorModulation(1, 1, 1) + render.SetBlend(1) + + colGlow.a = dt * 255 + render.SetMaterial(matGlow) + render.DrawSprite(self:LocalToWorld(vecEyeLeft), 8, 8, colGlow) + render.DrawSprite(self:LocalToWorld(vecEyeRight), 8, 8, colGlow) +end diff --git a/gamemodes/zombiesurvival/entities/effects/bonemeshexplode.lua b/gamemodes/zombiesurvival/entities/effects/explosion_bonemesh.lua similarity index 91% rename from gamemodes/zombiesurvival/entities/effects/bonemeshexplode.lua rename to gamemodes/zombiesurvival/entities/effects/explosion_bonemesh.lua index b28e9ff..6b5d4ee 100644 --- a/gamemodes/zombiesurvival/entities/effects/bonemeshexplode.lua +++ b/gamemodes/zombiesurvival/entities/effects/explosion_bonemesh.lua @@ -25,7 +25,7 @@ function EFFECT:Init(data) particle:SetLighting(true) for i = 1, math.random(100, 130) do - local particle = emitter:Add("particles/smokey", pos) + particle = emitter:Add("particles/smokey", pos) particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(128, 350)) particle:SetAirResistance(100) particle:SetDieTime(math.Rand(0.9, 2)) @@ -39,5 +39,5 @@ function EFFECT:Init(data) particle:SetLighting(true) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_chem.lua b/gamemodes/zombiesurvival/entities/effects/explosion_chem.lua new file mode 100644 index 0000000..f023fe4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_chem.lua @@ -0,0 +1,68 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local magnitude = data:GetMagnitude() + + sound.Play("ambient/explosions/explode_" .. math.random(8, 9) .. ".wav", pos, 70 + magnitude * 20, math.Rand(175, 180) - magnitude * 55) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local particle, heading + + for i=1, math.random(8, 11) do + heading = VectorRand() + heading:Normalize() + + particle = emitter:Add("particle/smokestack", pos + 16 * magnitude * heading) + particle:SetVelocity(72 * magnitude * heading) + particle:SetDieTime(math.Rand(1.3, 1.6)) + particle:SetStartAlpha(170) + particle:SetEndAlpha(0) + particle:SetStartSize(32 * magnitude) + particle:SetEndSize(4 * magnitude) + particle:SetColor(60, 140, 60) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-1, 1)) + end + + for i=1, math.random(3, 6) do + particle = emitter:Add("particle/smokestack", pos) + particle:SetVelocity(math.Rand(48, 82) * magnitude * VectorRand():GetNormalized()) + particle:SetDieTime(math.Rand(1.7, 1.8)) + particle:SetStartAlpha(150) + particle:SetEndAlpha(0) + particle:SetStartSize(8 * magnitude) + particle:SetEndSize(70 * magnitude) + particle:SetColor(20, 50, 20) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-1, 1)) + particle:SetAirResistance(10) + end + + for i=1, math.random(14, 18) do + heading = VectorRand() + heading:Normalize() + + particle = emitter:Add("effects/fire_cloud1", pos + heading * 16) + particle:SetVelocity(math.Rand(100, 200) * magnitude * heading) + particle:SetDieTime(math.Rand(0.45, 0.65)) + particle:SetStartAlpha(130) + particle:SetEndAlpha(0) + particle:SetStartSize(20 * magnitude) + particle:SetEndSize(10 * magnitude) + particle:SetColor(115, 255, 145) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetAirResistance(60) + particle:SetGravity(math.Rand(-50, -100) * magnitude * heading) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_cold.lua b/gamemodes/zombiesurvival/entities/effects/explosion_cold.lua new file mode 100644 index 0000000..2517859 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_cold.lua @@ -0,0 +1,48 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() + + local particle + + sound.Play("nox/scatterfrost.ogg", pos, 75, math.Rand(95, 115)) + sound.Play("ambient/wind/wind_hit"..math.random(3)..".wav", pos, 75, math.Rand(160, 180)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i=1, math.random(30, 50) do + particle = emitter:Add("particle/sparkles", pos) + particle:SetVelocity(VectorRand():GetNormal() * math.random(400,520)) + particle:SetAirResistance(math.random(400,600)) + particle:SetGravity(Vector(0,0,-45)) + particle:SetDieTime(math.Rand(3, 5)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(100) + particle:SetStartSize(1) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-6, 6)) + particle:SetColor(255,255,255) + end + for i=1, 16 do + particle = emitter:Add("particle/smokesprites_000"..math.random(9), pos) + particle:SetVelocity(VectorRand():GetNormal() * 140) + particle:SetDieTime(math.Rand(0.3, 0.6)) + particle:SetStartAlpha(math.Rand(90, 110)) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(90, 120)) + particle:SetRoll(math.Rand(-360, 360)) + particle:SetRollDelta(math.Rand(-4.5, 4.5)) + particle:SetColor(255, 255, 255) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_doomball.lua b/gamemodes/zombiesurvival/entities/effects/explosion_doomball.lua new file mode 100644 index 0000000..4a36460 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_doomball.lua @@ -0,0 +1,57 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + sound.Play("ambient/fire/gascan_ignite1.wav", pos, 75, math.Rand(50, 55)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 6 do + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(2, 4.5)) + particle:SetStartAlpha(30) + particle:SetEndAlpha(0) + particle:SetStartSize(200) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-5.5, 5.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(0, 0, 0) + end + + for i=1, 80 do + local heading = VectorRand() + heading:Normalize() + + local size = math.Rand(15, 25) + + local particle = emitter:Add("particles/smokey", pos + heading * math.Rand(2, 64)) + particle:SetVelocity(heading * math.Rand(-128, 256)) + particle:SetDieTime(math.Rand(3, 5.5)) + particle:SetStartAlpha(60) + particle:SetEndAlpha(0) + particle:SetStartSize(size) + particle:SetEndSize(size) + particle:SetRollDelta(math.Rand(-1.5, 1.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(0, 0, 0) + particle:SetAirResistance(math.Rand(50, 200)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + for i=1, 8 do + util.Effect("doomball_skull", effectdata) + end +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_emi.lua b/gamemodes/zombiesurvival/entities/effects/explosion_emi.lua new file mode 100644 index 0000000..826c9a9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_emi.lua @@ -0,0 +1,77 @@ +EFFECT.LifeTime = 0.5 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + self.Pos = pos + self.Normal = normal + self.DieTime = CurTime() + self.LifeTime + + sound.Play("ambient/fire/gascan_ignite1.wav", pos, 75, math.Rand(250, 255)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, math.random(70, 80) do + local heading = VectorRand() + heading:Normalize() + + local particle = emitter:Add("effects/spark", pos + heading * 8) + particle:SetVelocity(120 * heading) + particle:SetDieTime(math.Rand(0.5, 0.55)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(math.Rand(3, 4)) + particle:SetEndSize(0) + particle:SetColor(110, 110, 110) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetAirResistance(250) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local dlight = DynamicLight(0) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 255 + dlight.b = 255 + dlight.Brightness = 8 + dlight.Size = 300 + dlight.Decay = 1000 + dlight.DieTime = CurTime() + 1 + end +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local matRefract = Material("refract_ring") +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(215, 215, 215) +function EFFECT:Render() + local delta = (self.DieTime - CurTime()) / self.LifeTime + local basesize = 20 + basesize = basesize + basesize ^ (1.5 - delta) + + local pos = self.Pos + matRefract:SetFloat("$refractamount", (0.75 + math.abs(math.sin(CurTime() * 5)) * math.pi * 0.25) * delta) + render.SetMaterial(matRefract) + render.UpdateRefractTexture() + render.DrawSprite(pos, basesize, basesize) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + + basesize = basesize * 0.75 + + colGlow.a = delta * 255 + render.SetMaterial(matGlow) + render.DrawSprite(pos, basesize, basesize, colGlow) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_extinctionspore.lua b/gamemodes/zombiesurvival/entities/effects/explosion_extinctionspore.lua new file mode 100644 index 0000000..2a9cd8f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_extinctionspore.lua @@ -0,0 +1,57 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + sound.Play("ambient/fire/gascan_ignite1.wav", pos, 75, math.Rand(50, 55)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 5 do + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(1, 2)) + particle:SetStartAlpha(24) + particle:SetEndAlpha(0) + particle:SetStartSize(200) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(130, 0, 0) + end + + for i=1, 70 do + local heading = VectorRand() + heading:Normalize() + + local size = math.Rand(15, 25) + + local particle = emitter:Add("particles/smokey", pos + heading * math.Rand(2, 64)) + particle:SetVelocity(heading * math.Rand(-128, 256)) + particle:SetDieTime(math.Rand(1, 1.5)) + particle:SetStartAlpha(40) + particle:SetEndAlpha(0) + particle:SetStartSize(size) + particle:SetEndSize(size) + particle:SetRollDelta(math.Rand(-1.5, 1.5)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(220, 38, 0) + particle:SetAirResistance(math.Rand(50, 200)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + for i=1, 8 do + util.Effect("doomball_skull", effectdata) + end +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/fatexplosion.lua b/gamemodes/zombiesurvival/entities/effects/explosion_fat.lua similarity index 74% rename from gamemodes/zombiesurvival/entities/effects/fatexplosion.lua rename to gamemodes/zombiesurvival/entities/effects/explosion_fat.lua index 5001c50..1e1b717 100644 --- a/gamemodes/zombiesurvival/entities/effects/fatexplosion.lua +++ b/gamemodes/zombiesurvival/entities/effects/explosion_fat.lua @@ -4,13 +4,13 @@ function EFFECT:Init(data) sound.Play("physics/body/body_medium_break"..math.random(2, 4)..".wav", pos, 77, math.Rand(90, 110)) for i=0, math.random(2, 3) do - timer.SimpleEx(i * math.Rand(0.1, 0.3), sound.Play, "physics/flesh/flesh_squishy_impact_hard"..math.random(4)..".wav", pos, 77, math.Rand(90, 110)) + timer.Simple(i * math.Rand(0.1, 0.3), function() sound.Play("physics/flesh/flesh_squishy_impact_hard"..math.random(4)..".wav", pos, 77, math.Rand(90, 110)) end) end local emitter = ParticleEmitter(pos) for i=1, 12 do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(norm * 32 + VectorRand() * 16) particle:SetDieTime(math.Rand(1.5, 2.5)) particle:SetStartAlpha(200) @@ -23,7 +23,7 @@ function EFFECT:Init(data) particle:SetLighting(true) end - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(norm * 32) particle:SetDieTime(math.Rand(2.25, 3)) particle:SetStartAlpha(200) @@ -34,7 +34,7 @@ function EFFECT:Init(data) particle:SetColor(255, 255, 0) particle:SetLighting(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) util.Blood(pos, math.random(16, 22), Vector(0,0,1), 300) end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_fusordisc.lua b/gamemodes/zombiesurvival/entities/effects/explosion_fusordisc.lua new file mode 100644 index 0000000..2a6cc14 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_fusordisc.lua @@ -0,0 +1,77 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + local normal = effectdata:GetNormal() + + local particle + + sound.Play("weapons/physcannon/energy_disintegrate"..math.random(4, 5)..".wav", pos, 80, math.random(70, 90)) + sound.Play("weapons/physcannon/energy_sing_explosion2.wav", pos, 80, math.random(105, 120)) + + local emitter = ParticleEmitter(pos) + local emitter2 = ParticleEmitter(pos, true) + emitter:SetNearClip(24, 32) + emitter2:SetNearClip(24, 32) + + for i=1, 100 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.3) + particle:SetColor(50, 150, 255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(6) + particle:SetEndSize(6) + particle:SetStartLength(60) + particle:SetEndLength(60) + particle:SetVelocity(VectorRand():GetNormal() * 220) + end + for i=1, 160 do + particle = emitter:Add("effects/blueflare1", pos) + particle:SetDieTime(0.3) + particle:SetColor(50, 150, 255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(9) + particle:SetEndSize(9) + particle:SetVelocity(VectorRand():GetNormal() * 366) + end + for i=1, 12 do + particle = emitter:Add("particles/smokey", pos + Vector(math.Rand(-10, 10), math.Rand(-10, 10), math.Rand(0, 10))) + particle:SetVelocity(VectorRand():GetNormal() * 240) + particle:SetDieTime(math.Rand(0.3, 0.6)) + particle:SetStartAlpha(math.Rand(70, 90)) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(150, 160)) + particle:SetRoll(math.Rand(-360, 360)) + particle:SetRollDelta(math.Rand(-4.5, 4.5)) + particle:SetColor(50, 150, 255) + end + local ringstart = pos + normal * -3 + for i=1, 3 do + particle = emitter2:Add("effects/select_ring", ringstart) + particle:SetDieTime(0.1 + i * 0.1) + particle:SetColor(55, 155, 255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(50) + particle:SetAngles(normal:Angle()) + particle = emitter2:Add("effects/select_ring", ringstart) + particle:SetDieTime(0.2 + i * 0.1) + particle:SetColor(55, 155, 255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(70) + particle:SetAngles(normal:Angle()) + end + + emitter:Finish() + emitter2:Finish() +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_rocket.lua b/gamemodes/zombiesurvival/entities/effects/explosion_rocket.lua new file mode 100644 index 0000000..27d50de --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_rocket.lua @@ -0,0 +1,83 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + Vector(0, 0, 2) + + self.Start = pos + self.StartTime = CurTime() + + self.Alpha = 255 + self.Life = 0 + + sound.Play("ambient/explosions/explode_"..math.random(1,5)..".wav", pos, 80, math.random(135, 160)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(32, 48) + + for i=1, 30 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(1) + particle:SetColor(255,220,190) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 350) + particle:SetGravity(Vector(0,0,-600)) + particle:SetCollide(true) + particle:SetBounce(0.5) + end + + for i=1, 12 do + local particle = emitter:Add("effects/fire_cloud1", pos) + particle:SetDieTime(0.5) + particle:SetColor(235,210,160) + particle:SetStartAlpha(178) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(45) + particle:SetVelocity(VectorRand():GetNormal() * 150) + end + + for i=1, 7 do + local particle = emitter:Add("sprites/flamelet"..math.random(1, 4), pos) + particle:SetVelocity(VectorRand():GetNormal() * 110) + particle:SetDieTime(math.Rand(0.5, 0.6)) + particle:SetStartAlpha(220) + particle:SetEndAlpha(0) + particle:SetStartSize(48) + particle:SetEndSize(1) + particle:SetRoll(math.Rand(0, 360)) + particle:SetColor(255, 230, 150) + particle:SetRollDelta(math.Rand(-3, 3)) + end + + for i=1, 20 do + local particle = emitter:Add("effects/fire_embers"..math.random(1, 3), pos) + particle:SetVelocity(VectorRand():GetNormal() * 250) + particle:SetDieTime(math.Rand(1.25, 1.5)) + particle:SetStartAlpha(130) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 19)) + particle:SetEndSize(1) + particle:SetRoll(math.Rand(0, 359)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetAirResistance(50) + particle:SetCollide(true) + particle:SetBounce(0.3) + particle:SetGravity(Vector(0,0,-400)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 4 + self.Alpha = 255 * (1 - self.Life) + return self.Life < 1 +end + +local glowmat = Material("sprites/glow04_noz") + +function EFFECT:Render() + render.SetMaterial(glowmat) + render.DrawSprite(self.Start, 400, 400, Color(255, 210, 170, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_shadeshield.lua b/gamemodes/zombiesurvival/entities/effects/explosion_shadeshield.lua new file mode 100644 index 0000000..891e826 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_shadeshield.lua @@ -0,0 +1,30 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + local normal = effectdata:GetNormal() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 50 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(1) + particle:SetColor(50,90,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(11) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 150) + particle:SetGravity(VectorRand() * 20 + Vector(0, 0, -400)) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_shockcore.lua b/gamemodes/zombiesurvival/entities/effects/explosion_shockcore.lua new file mode 100644 index 0000000..c5a2fca --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_shockcore.lua @@ -0,0 +1,86 @@ +EFFECT.LifeTime = 0.45 + +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + local normal = effectdata:GetNormal() + + pos = pos + normal + + self.Pos = pos + self.Normal = normal + self.DieTime = CurTime() + self.LifeTime + + local particle + + sound.Play("weapons/physcannon/energy_disintegrate"..math.random(4, 5)..".wav", pos, 80, math.random(70, 90)) + sound.Play("weapons/physcannon/energy_sing_explosion2.wav", pos, 80, math.random(105, 120)) + + local emitter = ParticleEmitter(pos) + local emitter2 = ParticleEmitter(pos, true) + emitter:SetNearClip(24, 32) + emitter2:SetNearClip(24, 32) + + for i=1, 100 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.4) + particle:SetColor(75, 110, 255) + particle:SetStartAlpha(185) + particle:SetEndAlpha(0) + particle:SetStartSize(6) + particle:SetEndSize(6) + particle:SetStartLength(0) + particle:SetEndLength(90) + particle:SetVelocity(VectorRand():GetNormal() * 220) + end + local ringstart = pos + normal * -3 + for i=1, 3 do + particle = emitter2:Add("effects/select_ring", ringstart) + particle:SetDieTime(0.1 + i * 0.1) + particle:SetColor(75, 115, 255) + particle:SetStartAlpha(185) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(110) + particle:SetAngles(normal:Angle()) + particle = emitter2:Add("effects/select_ring", ringstart) + particle:SetDieTime(0.2 + i * 0.1) + particle:SetColor(75, 115, 255) + particle:SetStartAlpha(185) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(120) + particle:SetAngles(normal:Angle()) + end + + emitter:Finish() + emitter2:Finish() +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local matRefract = Material("refract_ring") +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(75, 115, 255) +function EFFECT:Render() + local delta = (self.DieTime - CurTime()) / self.LifeTime + local basesize = 48 + basesize = basesize + basesize ^ (1.5 - delta) + + local pos = self.Pos + matRefract:SetFloat("$refractamount", (10.75 + math.abs(math.sin(CurTime() * 5)) * math.pi * 0.25) * delta) + render.SetMaterial(matRefract) + render.UpdateRefractTexture() + render.DrawSprite(pos, basesize, basesize) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + + basesize = basesize * 0.75 + + colGlow.a = delta * 255 + render.SetMaterial(matGlow) + render.DrawSprite(pos, basesize, basesize, colGlow) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_wispball.lua b/gamemodes/zombiesurvival/entities/effects/explosion_wispball.lua new file mode 100644 index 0000000..15ca421 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_wispball.lua @@ -0,0 +1,104 @@ +EFFECT.LifeTime = 0.5 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + self.Pos = pos + self.Normal = normal + self.DieTime = CurTime() + self.LifeTime + + sound.Play("weapons/physcannon/energy_sing_explosion2.wav", pos, 75, math.Rand(150, 160)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, math.random(120, 160) do + local heading = VectorRand() + heading:Normalize() + + local particle = emitter:Add("effects/spark", pos + heading * 8) + particle:SetVelocity(420 * heading) + particle:SetDieTime(math.Rand(0.5, 0.85)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(math.Rand(3, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetAirResistance(250) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local dlight = DynamicLight(0) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 255 + dlight.b = 255 + dlight.Brightness = 8 + dlight.Size = 300 + dlight.Decay = 1000 + dlight.DieTime = CurTime() + 1 + end + + if MySelf:IsValid() then + local eyepos = MySelf:EyePos() + local dist = eyepos:Distance(pos) + if dist < 200 and WorldVisible(eyepos, pos) then + local power = 1 - dist / 800 + + local dir = pos - eyepos + dir:Normalize() + power = power - (1 - math.max(0, EyeVector():Dot(dir))) / 2 + + if MySelf:Team() ~= TEAM_HUMAN then + power = power / 3 + end + + if not TrueVisible(eyepos, pos) then + power = power * 0.66 + end + + local visionaltermul = MySelf.VisionAlterDurationMul or 1 + if power > 0.5 then + --MySelf:SetDSP(35) + util.WhiteOut(power * 4 * visionaltermul, 2 * visionaltermul) + elseif power > 0 then + util.WhiteOut(power * 4 * visionaltermul) + end + end + end +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local matRefract = Material("refract_ring") +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(255, 255, 255) +function EFFECT:Render() + local delta = (self.DieTime - CurTime()) / self.LifeTime + local basesize = 48 + basesize = basesize + basesize ^ (1.5 - delta) + + local pos = self.Pos + matRefract:SetFloat("$refractamount", (0.75 + math.abs(math.sin(CurTime() * 5)) * math.pi * 0.25) * delta) + render.SetMaterial(matRefract) + render.UpdateRefractTexture() + render.DrawSprite(pos, basesize, basesize) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + + basesize = basesize * 0.75 + + colGlow.a = delta * 255 + render.SetMaterial(matGlow) + render.DrawSprite(pos, basesize, basesize, colGlow) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) +end diff --git a/gamemodes/zombiesurvival/entities/effects/explosion_wispdeath.lua b/gamemodes/zombiesurvival/entities/effects/explosion_wispdeath.lua new file mode 100644 index 0000000..0822515 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/explosion_wispdeath.lua @@ -0,0 +1,113 @@ +EFFECT.LifeTime = 7 + +EFFECT.NextEmit = 0 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local normal = data:GetNormal() * -1 + + pos = pos + normal + + self.Pos = pos + self.Normal = normal + self.DieTime = CurTime() + self.LifeTime + + sound.Play("weapons/physcannon/energy_sing_explosion2.wav", pos, 75, math.Rand(25, 35)) + + util.ScreenShake(pos, 5, 5, 1, 300) + + local dlight = DynamicLight(0) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 255 + dlight.b = 255 + dlight.Brightness = 8 + dlight.Size = 500 + dlight.Decay = 2000 + dlight.DieTime = CurTime() + self.LifeTime + end + + if MySelf:IsValid() then + local eyepos = MySelf:EyePos() + local dist = eyepos:Distance(pos) + if dist < 400 and WorldVisible(eyepos, pos) then + local power = 1 - dist / 800 + + local dir = pos - eyepos + dir:Normalize() + power = power - (1 - math.max(0, EyeVector():Dot(dir))) / 3 + + if MySelf:Team() ~= TEAM_HUMAN then + power = power / 3 + end + + if not TrueVisible(eyepos, pos) then + power = power * 0.66 + end + + if MySelf:Team() ~= TEAM_UNDEAD then + power = math.max(power, 0.4) + end + + if power > 0.5 then + MySelf:SetDSP(36) + end + + local visionaltermul = MySelf.VisionAlterDurationMul or 1 + util.WhiteOut(power * 8 * visionaltermul, 2 * visionaltermul) + end + end +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local matRefract = Material("refract_ring") +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(255, 255, 255) +function EFFECT:Render() + local pos = self.Pos + local delta = (self.DieTime - CurTime()) / self.LifeTime + local basesize = 64 + basesize = basesize + basesize ^ (1.5 - delta) + + if CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.05 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local heading = VectorRand() + heading:Normalize() + + local particle = emitter:Add("effects/spark", pos + heading * 8) + particle:SetVelocity(420 * heading) + particle:SetDieTime(math.Rand(0.5, 0.85)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(math.Rand(3, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetAirResistance(250) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + + matRefract:SetFloat("$refractamount", (0.75 + math.abs(math.sin(CurTime() * 5)) * math.pi * 0.25) * delta) + render.SetMaterial(matRefract) + render.UpdateRefractTexture() + render.DrawSprite(pos, basesize, basesize) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, color_white, 0) + + basesize = basesize * 1.25 + + colGlow.a = delta * 255 + render.SetMaterial(matGlow) + render.DrawSprite(pos, basesize, basesize, colGlow) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) + render.DrawQuadEasy(pos, self.Normal, basesize, basesize, colGlow, 0) +end diff --git a/gamemodes/zombiesurvival/entities/effects/floatingscore.lua b/gamemodes/zombiesurvival/entities/effects/floatingscore.lua index 96bbc59..ca5abf8 100644 --- a/gamemodes/zombiesurvival/entities/effects/floatingscore.lua +++ b/gamemodes/zombiesurvival/entities/effects/floatingscore.lua @@ -5,19 +5,9 @@ function EFFECT:Init(data) self.Seed = math.Rand(0, 10) - local pos = data:GetOrigin() - local amount = math.Round(data:GetMagnitude()) - - self.Pos = pos - local flag = math.Round(data:GetScale()) or 0 - if flag == FM_LOCALKILLOTHERASSIST then - self.Amount = amount.." (assisted)" - elseif flag == FM_LOCALASSISTOTHERKILL then - self.Amount = amount.." (assist)" - else - self.Amount = amount - end - self.ColID = flag + self.Pos = data:GetOrigin() + self.Amount = math.Round(data:GetMagnitude(), 2) + self.Flag = math.Round(data:GetScale()) or 0 self.DeathTime = CurTime() + self.LifeTime end @@ -27,23 +17,56 @@ function EFFECT:Think() return CurTime() < self.DeathTime end + +local cam_IgnoreZ = cam.IgnoreZ +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local draw_SimpleText = draw.SimpleText +local math_Clamp = math.Clamp +local math_sin = math.sin +local math_floor = math.floor +local EyeAngles = EyeAngles +local tostring = tostring +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER +local TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT +local TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT + local cols = {} cols[0] = Color(190, 190, 220, 255) cols[1] = Color(255, 255, 10, 255) cols[2] = Color(255, 10, 10, 255) -local col2 = Color(0, 0, 0, 255) function EFFECT:Render() - local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime - local col = cols[self.ColID] or cols[0] + local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime + local flag = self.Flag + local col = cols[flag] or cols[0] col.a = delta * 240 - col2.a = col.a + local ang = EyeAngles() local right = ang:Right() ang:RotateAroundAxis(ang:Up(), 270) ang:RotateAroundAxis(ang:Forward(), 90) - cam.IgnoreZ(true) - cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) - draw.SimpleText(self.Amount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) - cam.End3D2D() - cam.IgnoreZ(false) + + cam_IgnoreZ(true) + cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) + local amount = self.Amount + local flooramount = math_floor(amount) + if amount == flooramount then + if flag == 0 then + draw_SimpleText(amount, "ZS3D2DFont2Big", 0, 0, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + else + draw_SimpleText(amount, "ZS3D2DFont2Big", 0, 0, col, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) + draw_SimpleText(flag == FM_LOCALKILLOTHERASSIST and " (assisted)" or flag == FM_LOCALASSISTOTHERKILL and " (assist)" or "", "ZS3D2DFont2", 0, 0, col, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) + end + else + draw_SimpleText(flooramount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_RIGHT) + local righttext + if flag == 0 then + righttext = tostring(amount - flooramount):sub(2) + else + righttext = tostring(amount - flooramount):sub(2)..(flag == FM_LOCALKILLOTHERASSIST and " (assisted)" or flag == FM_LOCALASSISTOTHERKILL and " (assist)" or "") + end + draw_SimpleText(righttext, "ZS3D2DFont2", 2, 8, col, TEXT_ALIGN_LEFT) + end + cam_End3D2D() + cam_IgnoreZ(false) end diff --git a/gamemodes/zombiesurvival/entities/effects/floatingscore_com.lua b/gamemodes/zombiesurvival/entities/effects/floatingscore_com.lua index 76d7091..0b3e324 100644 --- a/gamemodes/zombiesurvival/entities/effects/floatingscore_com.lua +++ b/gamemodes/zombiesurvival/entities/effects/floatingscore_com.lua @@ -5,11 +5,8 @@ function EFFECT:Init(data) self.Seed = math.Rand(0, 10) - local pos = data:GetOrigin() - local amount = math.Round(data:GetMagnitude()) - - self.Pos = pos - self.Amount = amount + self.Pos = data:GetOrigin() + self.Amount = math.Round(data:GetMagnitude(), 2) self.DeathTime = CurTime() + self.LifeTime end @@ -19,19 +16,39 @@ function EFFECT:Think() return CurTime() < self.DeathTime end +local cam_IgnoreZ = cam.IgnoreZ +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local draw_SimpleText = draw.SimpleText +local math_Clamp = math.Clamp +local math_sin = math.sin +local math_floor = math.floor +local EyeAngles = EyeAngles +local tostring = tostring +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER +local TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT +local TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT + local col = Color(255, 255, 0, 255) -local col2 = Color(0, 0, 0, 255) function EFFECT:Render() - local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime + local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime col.a = delta * 240 - col2.a = col.a + local ang = EyeAngles() local right = ang:Right() ang:RotateAroundAxis(ang:Up(), -90) ang:RotateAroundAxis(ang:Forward(), 90) - cam.IgnoreZ(true) - cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) - draw.SimpleText(self.Amount.." point"..(self.Amount ~= 1 and "s" or ""), "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) - cam.End3D2D() - cam.IgnoreZ(false) + + cam_IgnoreZ(true) + cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) + local amount = self.Amount + local flooramount = math_floor(amount) + if amount == flooramount then + draw_SimpleText(amount.." point"..(amount ~= 1 and "s" or ""), "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) + else + draw_SimpleText(flooramount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_RIGHT) + draw_SimpleText(tostring(amount - flooramount):sub(2).." points", "ZS3D2DFont2", 2, 8, col, TEXT_ALIGN_LEFT) + end + cam_End3D2D() + cam_IgnoreZ(false) end diff --git a/gamemodes/zombiesurvival/entities/effects/floatingscore_heal.lua b/gamemodes/zombiesurvival/entities/effects/floatingscore_heal.lua index 596a7a4..6cd08ff 100644 --- a/gamemodes/zombiesurvival/entities/effects/floatingscore_heal.lua +++ b/gamemodes/zombiesurvival/entities/effects/floatingscore_heal.lua @@ -5,11 +5,8 @@ function EFFECT:Init(data) self.Seed = math.Rand(0, 10) - local pos = data:GetOrigin() - local amount = math.Round(data:GetMagnitude()) - - self.Pos = pos - self.Amount = amount + self.Pos = data:GetOrigin() + self.Amount = math.Round(data:GetMagnitude(), 2) self.DeathTime = CurTime() + self.LifeTime end @@ -19,19 +16,39 @@ function EFFECT:Think() return CurTime() < self.DeathTime end +local cam_IgnoreZ = cam.IgnoreZ +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local draw_SimpleText = draw.SimpleText +local math_Clamp = math.Clamp +local math_sin = math.sin +local math_floor = math.floor +local EyeAngles = EyeAngles +local tostring = tostring +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER +local TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT +local TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT + local col = Color(30, 255, 30, 255) -local col2 = Color(0, 0, 0, 255) function EFFECT:Render() - local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime + local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime col.a = delta * 240 - col2.a = col.a + local ang = EyeAngles() local right = ang:Right() ang:RotateAroundAxis(ang:Up(), -90) ang:RotateAroundAxis(ang:Forward(), 90) - cam.IgnoreZ(true) - cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) - draw.SimpleText(self.Amount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) - cam.End3D2D() - cam.IgnoreZ(false) + + cam_IgnoreZ(true) + cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) + local amount = self.Amount + local flooramount = math_floor(amount) + if amount == flooramount then + draw_SimpleText(amount.." HP", "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) + else + draw_SimpleText(flooramount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_RIGHT) + draw_SimpleText(tostring(amount - flooramount):sub(2).." HP", "ZS3D2DFont2", 2, 8, col, TEXT_ALIGN_LEFT) + end + cam_End3D2D() + cam_IgnoreZ(false) end diff --git a/gamemodes/zombiesurvival/entities/effects/floatingscore_rep.lua b/gamemodes/zombiesurvival/entities/effects/floatingscore_rep.lua new file mode 100644 index 0000000..ce0123c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/floatingscore_rep.lua @@ -0,0 +1,54 @@ +EFFECT.LifeTime = 3 + +function EFFECT:Init(data) + self:SetRenderBounds(Vector(-64, -64, -64), Vector(64, 64, 64)) + + self.Seed = math.Rand(0, 10) + + self.Pos = data:GetOrigin() + self.Amount = math.Round(data:GetMagnitude(), 2) + + self.DeathTime = CurTime() + self.LifeTime +end + +function EFFECT:Think() + self.Pos.z = self.Pos.z + FrameTime() * 32 + return CurTime() < self.DeathTime +end + +local cam_IgnoreZ = cam.IgnoreZ +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local draw_SimpleText = draw.SimpleText +local math_Clamp = math.Clamp +local math_sin = math.sin +local math_floor = math.floor +local EyeAngles = EyeAngles +local tostring = tostring +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER +local TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT +local TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT + +local col = Color(60, 190, 245, 255) +function EFFECT:Render() + local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime + col.a = delta * 240 + + local ang = EyeAngles() + local right = ang:Right() + ang:RotateAroundAxis(ang:Up(), 270) + ang:RotateAroundAxis(ang:Forward(), 90) + + cam_IgnoreZ(true) + cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2) + local amount = self.Amount + local flooramount = math_floor(amount) + if amount == flooramount then + draw_SimpleText(amount.." HP", "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER) + else + draw_SimpleText(flooramount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_RIGHT) + draw_SimpleText(tostring(amount - flooramount):sub(2).." HP", "ZS3D2DFont2", 2, 8, col, TEXT_ALIGN_LEFT) + end + cam_End3D2D() + cam_IgnoreZ(false) +end diff --git a/gamemodes/zombiesurvival/entities/effects/floatingscore_und.lua b/gamemodes/zombiesurvival/entities/effects/floatingscore_und.lua index 515e370..7ca6b93 100644 --- a/gamemodes/zombiesurvival/entities/effects/floatingscore_und.lua +++ b/gamemodes/zombiesurvival/entities/effects/floatingscore_und.lua @@ -1,10 +1,11 @@ -local messages = {"MUNCH!", -"BRAIN GET!", -"+1!", -"JOIN US!", -"ONE OF US!", -"BUTT MANGLED!", -"CHOMP!" +local messages = { + "MUNCH!", + "BRAIN GET!", + "+1!", + "JOIN US!", + "ONE OF US!", + "BUTT MANGLED!", + "CHOMP!" } EFFECT.LifeTime = 3 @@ -14,10 +15,9 @@ function EFFECT:Init(data) self.Seed = math.Rand(0, 10) - local pos = data:GetOrigin() - local amount = math.Round(data:GetMagnitude()) + self.Pos = data:GetOrigin() - self.Pos = pos + local amount = math.Round(data:GetMagnitude()) if amount > 1 then self.Message = amount.." BRAINS!" else @@ -32,19 +32,30 @@ function EFFECT:Think() return CurTime() < self.DeathTime end +local cam_IgnoreZ = cam.IgnoreZ +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local draw_SimpleText = draw.SimpleText +local math_Clamp = math.Clamp +local math_sin = math.sin +local EyeAngles = EyeAngles +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER + local col = Color(40, 255, 40, 255) local col2 = Color(0, 0, 0, 255) function EFFECT:Render() - local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime + local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime col.a = delta * 240 col2.a = col.a + local ang = EyeAngles() local right = ang:Right() ang:RotateAroundAxis(ang:Up(), -90) ang:RotateAroundAxis(ang:Forward(), 90) - cam.IgnoreZ(true) - cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.24 + 0.09) / 2) - draw.SimpleText(self.Message, "ZS3D2DFont2", 0, -21, col, TEXT_ALIGN_CENTER) - cam.End3D2D() - cam.IgnoreZ(false) + + cam_IgnoreZ(true) + cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.24 + 0.09) / 2) + draw_SimpleText(self.Message, "ZS3D2DFont2", 0, 0, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam_End3D2D() + cam_IgnoreZ(false) end diff --git a/gamemodes/zombiesurvival/entities/effects/gib_player.lua b/gamemodes/zombiesurvival/entities/effects/gib_player.lua index d93601f..ffda3cd 100644 --- a/gamemodes/zombiesurvival/entities/effects/gib_player.lua +++ b/gamemodes/zombiesurvival/entities/effects/gib_player.lua @@ -29,11 +29,11 @@ function EFFECT:Init(data) emitter:SetNearClip(24, 32) for boneid = 1, ent:GetBoneCount() - 1 do - local pos, ang = ent:GetBonePositionMatrixed(boneid) + local pos = ent:GetBonePositionMatrixed(boneid) if pos and pos ~= basepos then for i=1, math.random(1, 3) do local heading = (VectorRand():GetNormalized() + up + dir * 2) / 4 - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos + heading) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos + heading) particle:SetVelocity(speed * math.Rand(0.5, 1) * heading) particle:SetDieTime(math.Rand(3, 6)) particle:SetStartAlpha(200) @@ -51,7 +51,7 @@ function EFFECT:Init(data) end for i=1, 4 do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(math.Rand(0.5, 4) * (VectorRand():GetNormalized() + dir)) particle:SetDieTime(math.Rand(0.75, 2)) particle:SetStartAlpha(230) @@ -66,7 +66,7 @@ function EFFECT:Init(data) end end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/gore_blast.lua b/gamemodes/zombiesurvival/entities/effects/gore_blast.lua new file mode 100644 index 0000000..474e05b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/gore_blast.lua @@ -0,0 +1,83 @@ +local function CollideCallback(oldparticle, hitpos, hitnormal) + if oldparticle:GetDieTime() == 0 then return end + oldparticle:SetDieTime(0) + + local pos = hitpos + hitnormal + + util.Decal("Blood", pos, hitpos - hitnormal) +end + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = Vector(0, 0, 1) + + local emitter = ParticleEmitter(pos) + + for i=1, 15 do + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(norm * 275 + VectorRand() * 100) + particle:SetGravity(Vector(0,0,-450)) + particle:SetDieTime(math.Rand(1.5, 2.5)) + particle:SetStartAlpha(220) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 18)) + particle:SetEndSize(math.Rand(20, 24)) + particle:SetRoll(math.random(360)) + particle:SetRollDelta(math.random(-2, 2)) + particle:SetColor(255, 0, 0) + particle:SetLighting(true) + end + + for i=1, 64 do + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(VectorRand():GetNormalized() * 600) + particle:SetDieTime(math.Rand(0.18, 0.24)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(60) + particle:SetStartSize(math.Rand(12, 18)) + particle:SetEndSize(math.Rand(8, 12)) + particle:SetRoll(math.random(360)) + particle:SetRollDelta(math.random(-8, 8)) + particle:SetStartLength(12) + particle:SetEndLength(42) + particle:SetColor(255, 0, 0) + particle:SetCollide(true) + particle:SetCollideCallback(CollideCallback) + end + + for i=1, 3 do + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(norm * 34) + particle:SetDieTime(math.Rand(0.3, 0.35)) + particle:SetStartAlpha(math.random(220, 250)) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(24, 26)) + particle:SetEndSize(math.Rand(145, 148)) + particle:SetRoll(math.random(360)) + particle:SetRollDelta(math.random(-5, 5)) + particle:SetColor(255, 0, 0) + particle:SetLighting(true) + end + + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(norm * 34) + particle:SetDieTime(math.Rand(1.5, 2)) + particle:SetStartAlpha(220) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(28, 32)) + particle:SetEndSize(math.Rand(56, 64)) + particle:SetRoll(math.random(360)) + particle:SetColor(255, 0, 0) + particle:SetLighting(true) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + util.Blood(pos, math.random(16, 22), Vector(0,0,1), 300) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/headcrab_dust.lua b/gamemodes/zombiesurvival/entities/effects/headcrab_dust.lua new file mode 100644 index 0000000..46d8f0d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/headcrab_dust.lua @@ -0,0 +1,29 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 24) + + for i=1, 2 do + local particle = emitter:Add("particles/smokey", pos + VectorRand():GetNormalized() * math.Rand(0.1, 6)) + particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(1, 16)) + particle:SetDieTime(math.Rand(1, 2.5)) + particle:SetStartAlpha(math.random(100, 140)) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(4, 12)) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-2.5, 2.5)) + particle:SetRoll(math.random(0, 360)) + particle:SetColor(255, 220, 50) + particle:SetLighting(true) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/headshot.lua b/gamemodes/zombiesurvival/entities/effects/headshot.lua index 6901e1f..b7b0589 100644 --- a/gamemodes/zombiesurvival/entities/effects/headshot.lua +++ b/gamemodes/zombiesurvival/entities/effects/headshot.lua @@ -1,9 +1,9 @@ function EFFECT:Init(data) local pos = data:GetOrigin() local norm = data:GetNormal() - local mag = data:GetMagnitude() + --local mag = data:GetMagnitude() local ent = data:GetEntity() - local scale = math.Round(data:GetScale()) + --local scale = math.Round(data:GetScale()) if ent:IsPlayer() then ent:Dismember(DISMEMBER_HEAD) @@ -14,7 +14,7 @@ function EFFECT:Init(data) local emitter = ParticleEmitter(pos) for i=1, 12 do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(norm * 32 + VectorRand() * 16) particle:SetDieTime(math.Rand(1.5, 2.5)) particle:SetStartAlpha(200) @@ -26,7 +26,7 @@ function EFFECT:Init(data) particle:SetColor(255, 0, 0) particle:SetLighting(true) end - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(norm * 32) particle:SetDieTime(math.Rand(2.25, 3)) particle:SetStartAlpha(200) @@ -36,7 +36,7 @@ function EFFECT:Init(data) particle:SetRoll(180) particle:SetColor(255, 0, 0) particle:SetLighting(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) util.Blood(pos, math.random(8, 10), Vector(0, 0, 1), 128) @@ -46,7 +46,7 @@ function EFFECT:Init(data) local dir = (norm * 2 + VectorRand()) / 3 dir:Normalize() - local ent = ClientsideModel("models/props_junk/Rock001a.mdl", RENDERGROUP_OPAQUE) + ent = ClientsideModel("models/props_junk/Rock001a.mdl", RENDERGROUP_OPAQUE) if ent:IsValid() then ent:SetMaterial("models/flesh") ent:SetModelScale(math.Rand(0.2, 0.5), 0) @@ -57,7 +57,8 @@ function EFFECT:Init(data) local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:SetMaterial("zombieflesh") - phys:ApplyForceOffset(ent:GetPos() + VectorRand() * 5, dir * math.Rand(300, 800)) + phys:SetVelocityInstantaneous(dir * math.Rand(50, 300)) + phys:AddAngleVelocity(VectorRand() * 3000) end SafeRemoveEntityDelayed(ent, math.Rand(6, 10)) diff --git a/gamemodes/zombiesurvival/entities/effects/hit_barb.lua b/gamemodes/zombiesurvival/entities/effects/hit_barb.lua new file mode 100644 index 0000000..c814f4f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_barb.lua @@ -0,0 +1,34 @@ +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local hitnormal = data:GetNormal() * -1 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 48) + + local grav = Vector(0, 0, -200) + for i = 1, math.random(60, 85) do + local particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(90, 130) + hitnormal * math.Rand(48, 198)) + particle:SetDieTime(math.Rand(1.2, 2)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(1, 2)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-15, 15)) + particle:SetColor(25, 25, 25) + particle:SetLighting(true) + particle:SetGravity(grav) + particle:SetCollide(true) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + sound.Play("physics/metal/sawblade_stick"..math.random(3)..".wav", pos, 74, math.random(199, 210)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_charon.lua b/gamemodes/zombiesurvival/entities/effects/hit_charon.lua new file mode 100644 index 0000000..9bafc60 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_charon.lua @@ -0,0 +1,42 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + self.Pos = pos + local normal = effectdata:GetNormal() + + self.Alpha = 255 + self.Life = 0 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 11 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(0.2) + particle:SetColor(190,210,250) + particle:SetStartAlpha(190) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(2) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 200) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(24) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + sound.Play("physics/metal/metal_sheet_impact_bullet"..math.random(2)..".wav", pos, 75, math.Rand(195, 215)) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 5 + self.Alpha = 255 * (1 - self.Life) + return (self.Life < 1) +end + +local glowmat = Material("sprites/glow04_noz") +function EFFECT:Render() + local pos = self.Pos + + render.SetMaterial(glowmat) + render.DrawSprite(pos, 20, 20, Color(180, 210, 255, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/fleshhit.lua b/gamemodes/zombiesurvival/entities/effects/hit_flesh.lua similarity index 95% rename from gamemodes/zombiesurvival/entities/effects/fleshhit.lua rename to gamemodes/zombiesurvival/entities/effects/hit_flesh.lua index 2e90d4a..80614aa 100644 --- a/gamemodes/zombiesurvival/entities/effects/fleshhit.lua +++ b/gamemodes/zombiesurvival/entities/effects/hit_flesh.lua @@ -40,7 +40,7 @@ function EFFECT:Init(data) particle:SetCollideCallback(CollideCallback) particle:SetLighting(true) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) util.Decal("YellowBlood", pos + normal, pos - normal) diff --git a/gamemodes/zombiesurvival/entities/effects/hit_frost.lua b/gamemodes/zombiesurvival/entities/effects/hit_frost.lua new file mode 100644 index 0000000..9af255e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_frost.lua @@ -0,0 +1,46 @@ +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end + +local function CollideCallback(particle, hitpos, hitnormal) + if particle:GetDieTime() == 0 then return end + particle:SetDieTime(0) + + if math.random(3) == 3 then + sound.Play("physics/glass/glass_impact_bullet"..math.random(4)..".wav", hitpos, 50, math.Rand(135, 155)) + end + + if math.random(3) == 3 then + util.Decal("Impact.Glass", hitpos + hitnormal, hitpos - hitnormal) + end +end + +function EFFECT:Init(data) + local pos = data:GetOrigin() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(28, 32) + local grav = Vector(0, 0, -200) + for i=1, math.random(4, 7) do + local particle = emitter:Add("particle/sparkles", pos) + particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(16, 64)) + particle:SetDieTime(math.Rand(1.1, 1.5)) + particle:SetStartAlpha(150) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 3)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-1, 1)) + particle:SetCollide(true) + particle:SetGravity(grav) + particle:SetCollideCallback(CollideCallback) + particle:SetColor(140, 175, 205) + particle:SetLighting(false) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + sound.Play("physics/glass/glass_impact_bullet"..math.random(4)..".wav", pos, 80, math.Rand(165, 170)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_glass.lua b/gamemodes/zombiesurvival/entities/effects/hit_glass.lua new file mode 100644 index 0000000..6ec33d5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_glass.lua @@ -0,0 +1,102 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() * -1 + + local particle, dir, ang, heading, RandDarkness, Size + + sound.Play("physics/glass/glass_sheet_break"..math.random(3)..".wav", pos, 70, math.Rand(95, 105)) + sound.Play("ambient/fire/ignite.wav", pos, 80, math.Rand(80, 90)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i=1, math.random(12, 18) do + Size = math.Rand(2, 4) + RandDarkness = math.Rand(0.8, 1.0) + dir = (norm * 2 + VectorRand()) / 3 + dir:Normalize() + + particle = emitter:Add("particles/balloon_bit", pos) + particle:SetVelocity(dir * math.Rand(125, 200)) + particle:SetLifeTime(0) + particle:SetDieTime(math.Rand(3, 5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(100) + particle:SetStartSize(Size) + particle:SetEndSize(Size * 0.25) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + particle:SetGravity(Vector(0, 0, -400)) + particle:SetColor(230 * RandDarkness, 230 * RandDarkness, 230 * RandDarkness) + particle:SetCollide(true) + particle:SetAngleVelocity(Angle(math.Rand(-160, 160), math.Rand(-160, 160), math.Rand(-160, 160))) + particle:SetBounce(0.45) + end + + particle = emitter:Add("particle/smokestack", pos) + particle:SetDieTime(5) + particle:SetStartAlpha(225) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(150) + particle:SetColor(30, 30, 30) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + + for i=1, math.random(13, 16) do + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(VectorRand() * 90 + norm * 200) + particle:SetDieTime(math.Rand(3.5, 5.25)) + particle:SetStartAlpha(225) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(math.Rand(70, 92)) + particle:SetColor(40, 40, 40) + particle:SetRoll(math.Rand(0, 360)) + particle:SetAirResistance(32) + end + + ang = norm:Angle():Right():Angle() + local step = 360 / 32 + for i=1, 360, step do + ang:RotateAroundAxis(norm, step) + heading = ang:Forward() * 128 + + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(heading) + particle:SetGravity(heading * -0.25) + particle:SetDieTime(math.Rand(2.4, 4.78)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(92) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetAirResistance(16) + particle:SetColor(45, 45, 45) + end + + for i=1, 12 do + particle = emitter:Add("effects/fire_cloud1", pos) + particle:SetVelocity(norm * math.Rand(150, 190) + VectorRand():GetNormal() * math.Rand(180, 200)) + particle:SetDieTime(math.Rand(1.35, 1.6)) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(48) + particle:SetEndSize(4) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + particle:SetAirResistance(100) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + util.Decal("Scorch", pos + norm, pos - norm) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_healdart.lua b/gamemodes/zombiesurvival/entities/effects/hit_healdart.lua index 749faec..81eec03 100644 --- a/gamemodes/zombiesurvival/entities/effects/hit_healdart.lua +++ b/gamemodes/zombiesurvival/entities/effects/hit_healdart.lua @@ -35,7 +35,7 @@ function EFFECT:Init(data) particle:SetAirResistance(100) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/hit_healdart2.lua b/gamemodes/zombiesurvival/entities/effects/hit_healdart2.lua new file mode 100644 index 0000000..bb424cc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_healdart2.lua @@ -0,0 +1,46 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() + local ent = data:GetEntity() + + if ent and ent:IsValid() then + ent:EmitSound("ambient/machines/steam_release_2.wav", 70, 255) + + if ent:IsPlayer() then + ent:EmitSound("weapons/crossbow/hitbod"..math.random(2)..".wav", 70, 140) + end + else + sound.Play("ambient/machines/steam_release_2.wav", pos, 70, 255) + end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i=1, 32 do + local ang = norm:Angle() + ang:RotateAroundAxis(ang:Up(), math.Rand(0, 360)) + ang:RotateAroundAxis(ang:Right(), math.Rand(-80, 80)) + + local particle = emitter:Add("particle/smokestack", pos) + particle:SetVelocity(ang:Forward() * math.Rand(4, 32)) + particle:SetDieTime(math.Rand(0.75, 1.25)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(6) + particle:SetColor(71, 127, 255) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-4, 4)) + particle:SetGravity(Vector(0, 0, -10)) + particle:SetAirResistance(100) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_ice.lua b/gamemodes/zombiesurvival/entities/effects/hit_ice.lua new file mode 100644 index 0000000..1ca1af3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_ice.lua @@ -0,0 +1,90 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() * -1 + + + sound.Play("physics/concrete/concrete_break"..math.random(2,3)..".wav", pos, 75, math.Rand(130, 140)) + sound.Play("physics/glass/glass_largesheet_break"..math.random(1, 3)..".wav", pos, 75, math.Rand(160, 180)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i=1, math.random(12, 18) do + local Size = math.Rand(3, 5) + local RandDarkness = math.Rand(0.8, 1.0) + local dir = (norm * 2 + VectorRand()) / 3 + dir:Normalize() + + particle = emitter:Add("particles/balloon_bit", pos + VectorRand() * 6) + particle:SetVelocity(dir * math.Rand(150, 250)) + particle:SetLifeTime(0) + particle:SetDieTime(math.Rand(3, 5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(100) + particle:SetStartSize(Size) + particle:SetEndSize(Size * 0.25) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + particle:SetGravity(Vector(0, 0, -400)) + particle:SetColor(145 * RandDarkness, 230 * RandDarkness, 255 * RandDarkness) + particle:SetCollide(true) + particle:SetAngleVelocity(Angle(math.Rand(-160, 160), math.Rand(-160, 160), math.Rand(-160, 160))) + particle:SetBounce(0.45) + end + for i=1, 6 do + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(VectorRand():GetNormal() * 190) + particle:SetDieTime(math.Rand(0.7, 0.85)) + particle:SetStartAlpha(math.Rand(50, 70)) + particle:SetStartSize(math.Rand(100,120)) + particle:SetEndSize(math.Rand(205, 210)) + particle:SetRoll(math.Rand(-360, 360)) + particle:SetRollDelta(math.Rand(-4.5, 4.5)) + particle:SetColor(255, 255, 255) + end + for i=1, 12 do + particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(VectorRand():GetNormal() * 240) + particle:SetDieTime(math.Rand(0.3, 0.6)) + particle:SetStartAlpha(math.Rand(90, 110)) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(160, 190)) + particle:SetRoll(math.Rand(-360, 360)) + particle:SetRollDelta(math.Rand(-4.5, 4.5)) + particle:SetColor(40, 160, 255) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local maxbound = Vector(3, 3, 3) + local minbound = maxbound * -1 + for i=1, math.random(6,8) do + local dir = (norm * 2 + VectorRand()) / 3 + dir:Normalize() + + local ent = ClientsideModel("models/props_junk/Rock001a.mdl", RENDERGROUP_OPAQUE) + if ent:IsValid() then + ent:SetModelScale(math.Rand(0.6, 0.9), 0) + ent:SetMaterial("models/shadertest/shader2") + ent:SetColor(Color(0, 150, 255, 255)) + ent:SetPos(pos + dir * 6) + ent:PhysicsInitBox(minbound, maxbound) + ent:SetCollisionBounds(minbound, maxbound) + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("rock") + phys:ApplyForceCenter(dir * math.Rand(200, 300)) + end + + SafeRemoveEntityDelayed(ent, math.Rand(6, 10)) + end + end +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_jugger.lua b/gamemodes/zombiesurvival/entities/effects/hit_jugger.lua new file mode 100644 index 0000000..c2e5b04 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_jugger.lua @@ -0,0 +1,42 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + self.Pos = pos + local normal = effectdata:GetNormal() + + self.Alpha = 255 + self.Life = 0 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 15 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(0.4) + particle:SetColor(255,70,40) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(2) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 70) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + sound.Play("physics/metal/metal_sheet_impact_bullet"..math.random(2)..".wav", pos, 80, math.Rand(135, 155)) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 3 + self.Alpha = 255 * (1 - self.Life) + return self.Life < 1 +end + +local glowmat = Material("sprites/glow04_noz") +function EFFECT:Render() + local pos = self.Pos + + render.SetMaterial(glowmat) + render.DrawSprite(pos, 20, 20, Color(255, 75, 40, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_shadestone.lua b/gamemodes/zombiesurvival/entities/effects/hit_shadestone.lua new file mode 100644 index 0000000..0b3b504 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_shadestone.lua @@ -0,0 +1,37 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() * -1 + + sound.Play("ambient/materials/rock4.wav", pos, 77, math.Rand(65, 85)) + sound.Play("physics/concrete/boulder_impact_hard" .. math.random(1,4) .. ".wav", pos, 77, math.Rand(85, 95)) + + local maxbound = Vector(3, 3, 3) + local minbound = maxbound * -1 + for i=1, 8 do + local dir = (norm * 2 + VectorRand()) / 3 + dir:Normalize() + + local ent = ClientsideModel("models/props_junk/Rock001a.mdl", RENDERGROUP_OPAQUE) + if ent:IsValid() then + ent:SetModelScale(math.Rand(0.5, 0.9), 0) + ent:SetPos(pos + dir * 6) + ent:PhysicsInitBox(minbound, maxbound) + ent:SetCollisionBounds(minbound, maxbound) + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("rock") + phys:ApplyForceOffset(ent:GetPos() + VectorRand() * 5, dir * math.Rand(-600, 600)) + end + + SafeRemoveEntityDelayed(ent, math.Rand(4, 8)) + end + end +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/spithit.lua b/gamemodes/zombiesurvival/entities/effects/hit_spit.lua similarity index 96% rename from gamemodes/zombiesurvival/entities/effects/spithit.lua rename to gamemodes/zombiesurvival/entities/effects/hit_spit.lua index 4aced29..41d0c71 100644 --- a/gamemodes/zombiesurvival/entities/effects/spithit.lua +++ b/gamemodes/zombiesurvival/entities/effects/hit_spit.lua @@ -42,7 +42,7 @@ function EFFECT:Init(data) particle:SetCollide(true) particle:SetCollideCallback(CollideCallback) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) util.Decal("Impact.AlienFlesh", pos + hitnormal, pos - hitnormal) diff --git a/gamemodes/zombiesurvival/entities/effects/hit_strengthdart.lua b/gamemodes/zombiesurvival/entities/effects/hit_strengthdart.lua new file mode 100644 index 0000000..8e3e541 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_strengthdart.lua @@ -0,0 +1,47 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local norm = data:GetNormal() + local ent = data:GetEntity() + + if ent and ent:IsValid() then + ent:EmitSound("ambient/machines/steam_release_2.wav", 70, 255) + + if ent:IsPlayer() then + ent:EmitSound("weapons/crossbow/hitbod"..math.random(2)..".wav", 70, 140) + end + else + sound.Play("ambient/machines/steam_release_2.wav", pos, 70, 255) + end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i=1, 32 do + local ang = norm:Angle() + ang:RotateAroundAxis(ang:Up(), math.Rand(0, 360)) + ang:RotateAroundAxis(ang:Right(), math.Rand(-80, 80)) + + local particle = emitter:Add("particle/smokestack", pos) + particle:SetVelocity(ang:Forward() * math.Rand(4, 32)) + particle:SetDieTime(math.Rand(0.75, 1.25)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(6) + particle:SetColor(255, 10, 10) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-4, 4)) + particle:SetGravity(Vector(0, 0, -10)) + particle:SetAirResistance(100) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end + diff --git a/gamemodes/zombiesurvival/entities/effects/hit_tithonus.lua b/gamemodes/zombiesurvival/entities/effects/hit_tithonus.lua new file mode 100644 index 0000000..13125a8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_tithonus.lua @@ -0,0 +1,40 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + self.Pos = pos + local normal = effectdata:GetNormal() + + self.Alpha = 255 + self.Life = 0 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 15 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(0.2) + particle:SetColor(40,255,70) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(2) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 150) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 3 + self.Alpha = 255 * (1 - self.Life) + return (self.Life < 1) +end + +local glowmat = Material("sprites/glow04_noz") +function EFFECT:Render() + local pos = self.Pos + + render.SetMaterial(glowmat) + render.DrawSprite(pos, 25, 25, Color(40, 255, 70, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/hit_zeus.lua b/gamemodes/zombiesurvival/entities/effects/hit_zeus.lua new file mode 100644 index 0000000..75c6f8a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/hit_zeus.lua @@ -0,0 +1,62 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + self.Pos = pos + local normal = effectdata:GetNormal() + + self.Alpha = 255 + self.Life = 0 + + sound.Play("ambient/office/zap1.wav", pos, 80, math.random(165, 180)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 15 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(0.5) + particle:SetColor(50,125,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(4) + particle:SetVelocity((normal + VectorRand()):GetNormal() * 700) + particle:SetGravity(VectorRand() * 20 + Vector(0, 0, -100)) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + for i=0,5 do + particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(47, 49)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(55, 136, 245) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + self.Life = self.Life + FrameTime() * 4 + self.Alpha = 255 * (1 - self.Life) + return self.Life < 1 +end + +local glowmat = Material("sprites/glow04_noz") +local matTrail = Material("trails/laser") +function EFFECT:Render() + local pos = self.Pos + + render.SetMaterial(glowmat) + render.DrawSprite(pos, 60, 60, Color(70, 140, 255, self.Alpha)) + + render.SetMaterial(matTrail) + for i=1, 8 do + local dir = VectorRand():GetNormal() + render.DrawBeam(pos, pos + dir * 30 * self.Alpha/255, 15, i, 3 + i, Color(70, 140, 250)) + end +end diff --git a/gamemodes/zombiesurvival/entities/effects/nailrepaired.lua b/gamemodes/zombiesurvival/entities/effects/nailrepaired.lua index f76caaa..f65a5ee 100644 --- a/gamemodes/zombiesurvival/entities/effects/nailrepaired.lua +++ b/gamemodes/zombiesurvival/entities/effects/nailrepaired.lua @@ -6,6 +6,7 @@ function EFFECT:Init(data) local norepair = data:GetMagnitude() == 0 local emitter = ParticleEmitter(pos) + for i=1, math.random(16, 24) do local particle = emitter:Add("sprites/glow04_noz", pos) particle:SetVelocity((norm + VectorRand()):GetNormalized() * math.Rand(8, 24)) @@ -24,6 +25,8 @@ function EFFECT:Init(data) particle:SetRoll(math.Rand(0, 360)) particle:SetRollDelta(math.Rand(-8, 8)) end + + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/redeem.lua b/gamemodes/zombiesurvival/entities/effects/redeem.lua index 19bbb04..e262904 100644 --- a/gamemodes/zombiesurvival/entities/effects/redeem.lua +++ b/gamemodes/zombiesurvival/entities/effects/redeem.lua @@ -22,7 +22,7 @@ function EFFECT:Init(data) particle:SetRollDelta(math.Rand(-32, 32)) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end function EFFECT:Think() diff --git a/gamemodes/zombiesurvival/entities/effects/shadedeflect.lua b/gamemodes/zombiesurvival/entities/effects/shadedeflect.lua index 9890a19..58791f2 100644 --- a/gamemodes/zombiesurvival/entities/effects/shadedeflect.lua +++ b/gamemodes/zombiesurvival/entities/effects/shadedeflect.lua @@ -1,4 +1,4 @@ -util.PrecacheModel("models/props_phx/construct/metal_dome360.mdl") +util.PrecacheModel("models/props/cs_italy/orange.mdl") EFFECT.LifeTime = 2 @@ -9,13 +9,36 @@ function EFFECT:Init(data) self.Offset = data:GetStart() self.Ent = data:GetEntity() - sound.Play("weapons/fx/rics/ric"..math.random(5)..".wav", pos, 68, math.Rand(120, 130)) + sound.Play("weapons/fx/rics/ric"..math.random(5)..".wav", pos, 68, math.Rand(150, 170)) - self.Entity:SetModel("models/props_phx/construct/metal_dome360.mdl") + self.Entity:SetModel("models/props/cs_italy/orange.mdl") self.Entity:SetMoveType(MOVETYPE_NONE) - self.Entity:SetModelScale(0.5, 0) + self.Entity:SetModelScale(2, 0) self.Entity:SetAngles(angles) + if self.Ent:IsValid() then + local offset = self.Ent:LocalToWorld(self.Offset) + + local emitter = ParticleEmitter(offset) + emitter:SetNearClip(24, 32) + + for i=1, 2 do + local particle = emitter:Add("sprites/glow04_noz", offset) + particle:SetDieTime(1) + particle:SetColor(90,130,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(15) + particle:SetVelocity((angles:Up() + VectorRand()):GetNormal() * 300) + particle:SetGravity(VectorRand() * 20 + Vector(0, 0, -400)) + particle:SetCollide(true) + particle:SetBounce(0.75) + particle:SetAirResistance(12) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + self.DieTime = CurTime() + self.LifeTime end diff --git a/gamemodes/zombiesurvival/entities/effects/sigil_teleport.lua b/gamemodes/zombiesurvival/entities/effects/sigil_teleport.lua new file mode 100644 index 0000000..7a3ab63 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/sigil_teleport.lua @@ -0,0 +1,57 @@ +EFFECT.LifeTime = 0.25 + +function EFFECT:Init(data) + local pos = data:GetOrigin() + local ent = data:GetEntity() + + self.DieTime = RealTime() + self.LifeTime + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + for i=1, 16 do + local heading = VectorRand() + heading:Normalize() + + particle = emitter:Add("sprites/light_glow02_add", pos + heading * 8) + particle:SetDieTime(math.Rand(0.75, 1.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(8) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-14, 14)) + particle:SetColor(0, 120, 255) + particle:SetVelocity(heading * math.Rand(128, 256)) + particle:SetAirResistance(256) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + if ent == MySelf then + MySelf:EmitSound("ambient/machines/teleport1.wav", 75, 110, 0.8) + util.WhiteOut(1) + end +end + +function EFFECT:Think() + return RealTime() < self.DieTime +end + +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(0, 120, 255) +function EFFECT:Render() + local pos = self.Entity:GetPos() + local delta = math.Clamp((self.DieTime - RealTime()) / self.LifeTime, 0, 1) + + colGlow.a = delta * 255 + + local size = 128 - delta * 92 + + render.SetMaterial(matGlow) + render.DrawQuadEasy(pos, Vector(0, 0, -1), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, 0, 1), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, -1, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(0, 1, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(-1, 0, 0), size, size, colGlow) + render.DrawQuadEasy(pos, Vector(1, 0, 0), size, size, colGlow) + render.DrawSprite(pos, size, size, colGlow) +end diff --git a/gamemodes/zombiesurvival/entities/effects/sigildestruction.lua b/gamemodes/zombiesurvival/entities/effects/sigildestruction.lua new file mode 100644 index 0000000..a5c1b7a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/sigildestruction.lua @@ -0,0 +1,50 @@ +local Models = { + Model("models/props_debris/concrete_chunk02a.mdl"), + Model("models/props_debris/concrete_chunk03a.mdl"), + Model("models/props_debris/concrete_chunk08a.mdl") +} + +local colRubble = Color(20, 20, 140) +function EFFECT:Init(data) + local origin = data:GetOrigin() + local maxs = Vector(16, 16, 72) + local mins = maxs * -1 + mins.z = 0 + local center = origin + (maxs + mins) / 2 + + sound.Play("ambient/materials/rock4.wav", center, 77, math.Rand(95, 105)) + sound.Play("physics/concrete/concrete_break2.wav", center, 77, math.Rand(110, 120)) + + for i = 1, 20 do + local pos = origin + Vector(math.Rand(mins.x, maxs.x), math.Rand(mins.y, maxs.y), math.Rand(mins.z, maxs.z)) + local dir = pos - center + VectorRand() + dir:Normalize() + + local ent = ClientsideModel(Models[math.random(#Models)], RENDERGROUP_TRANSLUCENT) + if ent:IsValid() then + --ent:SetModelScale(math.Rand(0.2, 0.5), 0) + ent:SetPos(pos) + --[[ent:PhysicsInitBox(minbound, maxbound) + ent:SetCollisionBounds(minbound, maxbound)]] + ent:PhysicsInit(SOLID_VPHYSICS) + + ent:SetRenderFX(kRenderFxDistort) + ent:SetColor(colRubble) + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("rock") + phys:ApplyForceOffset(ent:GetPos() + VectorRand() * 5, dir * math.Rand(100, 800)) + end + + SafeRemoveEntityDelayed(ent, math.Rand(25, 30)) + end + end +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_colossus.lua b/gamemodes/zombiesurvival/entities/effects/tracer_colossus.lua new file mode 100644 index 0000000..356b144 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_colossus.lua @@ -0,0 +1,116 @@ +-- Partially based on the Railgun from AS:S, and the Gluon + +EFFECT.LifeTime = 0.3 + +function EFFECT:GetDelta() + return math.Clamp(self.DieTime - CurTime(), 0, self.LifeTime) / self.LifeTime +end + +function EFFECT:Init(data) + self.StartPos = self:GetTracerShootPos(data:GetStart(), data:GetEntity(), data:GetAttachment()) + self.EndPos = data:GetOrigin() + self.HitNormal = data:GetNormal() * -1 + self.Color = Color(150,155,255) + self.LifeTime = 0.15 + 0.013 * ((self.StartPos - self.EndPos):Length() ^ 0.5) -- Keep the particle relatively constant speed + self.DieTime = CurTime() + self.LifeTime + + local emitter = ParticleEmitter(self.EndPos) + emitter:SetNearClip(24, 32) + + local r, g, b = self.Color.r, self.Color.g, self.Color.b + local randmin, randmax = -40, 40 + local normal = (self.EndPos - self.StartPos) + normal:Normalize() + for i = -100, self.EndPos:Distance(self.StartPos), 20 do + local pos = self.StartPos + normal * i + VectorRand():GetNormalized() * math.Rand(randmin, randmax) + local dietime = math.Rand(1, 2) + local startsize = 1 + math.Rand(0.5, 1.5) * 2 + local rolldelta = math.Rand(-16, 16) + local roll = math.Rand(0, 360) + local vel = math.Rand(192, 256) * normal + + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(dietime) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(startsize) + particle:SetRoll(roll) + particle:SetRollDelta(rolldelta) + particle:SetVelocity(vel * 4) + particle:SetGravity(vel * -7) + particle:SetAirResistance(20) + particle:SetColor(r, g, b) + end + + self.QuadPos = self.EndPos + self.HitNormal + + for i=1, 20 do + local particle = emitter:Add("effects/blueflare1", self.QuadPos) + local vel = VectorRand():GetNormal() * 160 + particle:SetDieTime(1.5) + particle:SetColor(130,200,230) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(11) + particle:SetEndSize(0) + particle:SetVelocity(vel) + particle:SetGravity(vel * -0.7) + end + + emitter:Finish() +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local matBeam2 = Material("trails/physbeam") +local matGlow = Material("effects/select_ring") +local matFlare = Material("sprites/glow04_noz") +function EFFECT:Render() + local delta = self:GetDelta() + if delta <= 0 then return end + self.Color.a = delta * 155 + + local startpos = self.StartPos + local endpos = self.QuadPos + + local size = delta * 50 + render.SetMaterial(matBeam2) + render.DrawBeam(startpos, endpos, size * 0.5, 1, 0, self.Color) + render.DrawBeam(startpos, endpos, size, 1, 0, self.Color) + + local texcoord = math.Rand( 0, 1 ) + + local distancevector = (startpos - endpos) + local dir = distancevector:Angle() + local dfwd = dir:Forward() + local dup = dir:Up() + local drgt = dir:Right() + local nlen = distancevector:Length() + local prevspinpos, prevspinpos2 = startpos, startpos + + for i = 0, nlen * (1 - delta), 32 do + local set = i - CurTime() * 7 + local spinbeamsize = (1 - delta) * 15 + + local basebeampos = startpos - dfwd * i + local spinbeampos = basebeampos + dup * math.sin(set) * spinbeamsize + drgt * math.cos(set) * spinbeamsize + local spinbeampos2 = basebeampos - dup * math.sin(set) * spinbeamsize - drgt * math.cos(set) * spinbeamsize + + render.DrawBeam(prevspinpos, spinbeampos, 4, texcoord + i, texcoord + 1 + i, Color(90, 90, 255, self.Color.a)) + render.DrawBeam(prevspinpos2, spinbeampos2, 4, texcoord + i, texcoord + 1 + i, Color(90, 90, 255, self.Color.a)) + + prevspinpos = spinbeampos + prevspinpos2 = spinbeampos2 + end + + local ringpos = startpos - (dfwd * (1 - delta) * nlen) + render.SetMaterial(matGlow) + render.DrawSprite(ringpos, 24, 24, self.Color) + render.SetMaterial(matFlare) + render.DrawSprite(ringpos, 150, 150, self.Color) + render.DrawSprite(ringpos, 20, 170, self.Color) + render.DrawSprite(ringpos, 220, 20, self.Color) + render.DrawSprite(self.QuadPos, 255-self.Color.a, 255-self.Color.a, self.Color) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_cosmos.lua b/gamemodes/zombiesurvival/entities/effects/tracer_cosmos.lua new file mode 100644 index 0000000..6745ab9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_cosmos.lua @@ -0,0 +1,41 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 9 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return self.Life < 1 +end + +local beammat = Material("trails/physbeam") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand(0, 1) + + local norm = (self.StartPos - self.EndPos) * self.Life + local nlen = norm:Length() + + local alpha = 1 - self.Life + + render.SetMaterial(beammat) + + for i = 0, 4 do + render.DrawBeam(self.StartPos, self.EndPos, 4, texcoord, texcoord + nlen / 128, Color(255, 190, 190, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 14, texcoord, texcoord + nlen / 128, Color(255, 190, 190, 170 * alpha)) + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 30, 30, Color(255, 190, 190, 148 * alpha)) + render.DrawSprite(self.EndPos, 30, 30, Color(255, 190, 190, 148 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_fusor.lua b/gamemodes/zombiesurvival/entities/effects/tracer_fusor.lua new file mode 100644 index 0000000..b7b6eca --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_fusor.lua @@ -0,0 +1,47 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 9 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return self.Life < 1 +end + +local beammat = Material("trails/laser") +local beam1mat = Material("trails/electric") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand(0, 1) + + local norm = (self.StartPos - self.EndPos) * self.Life + local nlen = norm:Length() + + local alpha = 1 - self.Life + + render.SetMaterial(beammat) + + for i = 0, 4 do + render.DrawBeam(self.StartPos, self.EndPos, 8, texcoord, texcoord + nlen / 128, Color(66, 190, 255, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 17, texcoord, texcoord + nlen / 128, Color(66, 190, 255, 170 * alpha)) + + render.SetMaterial(beam1mat) + for i = 1, 3 do + render.DrawBeam(self.StartPos + (VectorRand() * 6), self.EndPos + (VectorRand() * 6), 25, texcoord, texcoord + nlen / 128, Color(66, 160, 230, 170 * alpha)) + end + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 30, 30, Color(255, 190, 190, 148 * alpha)) + render.DrawSprite(self.EndPos, 30, 30, Color(255, 190, 190, 148 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_gluon.lua b/gamemodes/zombiesurvival/entities/effects/tracer_gluon.lua new file mode 100644 index 0000000..f598908 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_gluon.lua @@ -0,0 +1,60 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 6 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return self.Life < 1 +end + +local beammat = Material("trails/physbeam") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand( 0, 1 ) + + local norm = (self.StartPos - self.EndPos) * self.Life + local dir = (self.StartPos - self.EndPos):Angle() + local dfwd = dir:Forward() + local dup = dir:Up() + local drgt = dir:Right() + local nlen = norm:Length() + + local prevspinpos = self.StartPos + local alpha = 1 - self.Life + + render.SetMaterial(beammat) + for i = 0, nlen, 32 do + if i > 704 then break end -- Limit the range on the spin beam effect...otherwise might be expensive. + + local set = i - CurTime() * 15 + + local basebeampos = self.StartPos - dfwd * i + local spinbeampos = basebeampos + dup * math.sin(set) * 6 + drgt * math.cos(set) * 6 + + if i == 704 then spinbeampos = basebeampos end -- Tie the spin back into the main beam at the end of the spin beams + + render.DrawBeam(prevspinpos, spinbeampos, 10, texcoord + i, texcoord + nlen / 128 + i, Color(96, 150, 255, 255 * alpha)) + + prevspinpos = spinbeampos + end + + for i = 0, 4 do + render.DrawBeam(self.StartPos, self.EndPos, 6, texcoord, texcoord + nlen / 128, Color(120, 120, 255, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 18, texcoord, texcoord + nlen / 128, Color(150, 255, 255, 170 * alpha)) + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 50, 50, Color(90, 192, 255, 148 * alpha)) + render.DrawSprite(self.EndPos, 50, 50, Color(90, 192, 255, 148 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_healray.lua b/gamemodes/zombiesurvival/entities/effects/tracer_healray.lua new file mode 100644 index 0000000..b0a0bfc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_healray.lua @@ -0,0 +1,70 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 3 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return (self.Life < 1) +end + +local beammat = Material("trails/physbeam") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand(0, 1) + + local norm = (self.StartPos - self.EndPos) * self.Life + local nlen = norm:Length() + + local alpha = (1 - self.Life) * 0.2 + + render.SetMaterial(beammat) + + local vec = Vector(math.cos(CurTime() * 0.5) * 8, math.sin(CurTime() * 0.5) * 10, 0) + local cubicone = CosineInterpolation(self.StartPos - vec * 1, self.EndPos, 0.2) + local cubictwo = CosineInterpolation(cubicone, self.EndPos - vec * 1, 0.4) + + local cubiconenorm = (cubicone - cubictwo) + + local emitter = ParticleEmitter(self.StartPos) + emitter:SetNearClip(24, 32) + + for i=1, 2 do + local type = math.random(2) == 1 + + local particle = emitter:Add("effects/blueflare1", (type and cubicone or cubictwo) + norm * math.Rand(-1, 0)) + particle:SetDieTime(0.1) + particle:SetColor(150,255,130) + particle:SetStartAlpha(alpha * 255) + particle:SetEndAlpha(0) + particle:SetStartSize(16) + particle:SetEndSize(0) + particle:SetVelocity((type and cubiconenorm or norm) * -12 + VectorRand() * 6) + particle:SetGravity((type and cubiconenorm or norm) * (type and 30 or 21)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + for i = 0, 4 do + render.DrawBeam(self.StartPos, cubicone, 6, texcoord, texcoord + nlen / 128, Color(150, 255, 130, 255 * alpha)) + render.DrawBeam(cubicone, cubictwo, 6, texcoord, texcoord + nlen / 128, Color(150, 255, 130, 255 * alpha)) + render.DrawBeam(cubictwo, self.EndPos, 6, texcoord, texcoord + nlen / 128, Color(150, 255, 130, 255 * alpha)) + end + render.DrawBeam(self.StartPos, cubicone, 27, texcoord, texcoord + nlen / 128, Color(190, 255, 190, 170 * alpha)) + render.DrawBeam(cubicone, cubictwo, 27, texcoord, texcoord + nlen / 128, Color(190, 255, 190, 170 * alpha)) + render.DrawBeam(cubictwo, self.EndPos, 27, texcoord, texcoord + nlen / 128, Color(190, 255, 190, 170 * alpha)) + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 30, 30, Color(190, 255, 190, 148 * alpha)) + render.DrawSprite(self.EndPos, 30, 30, Color(190, 255, 190, 148 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_heph.lua b/gamemodes/zombiesurvival/entities/effects/tracer_heph.lua new file mode 100644 index 0000000..241167b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_heph.lua @@ -0,0 +1,46 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos(self.Position, self.WeaponEnt, self.Attachment) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 5 -- Effect should dissipate before the next one. + + return self.Life < 1 +end + +local beammat = Material("trails/laser") +local beam1mat = Material("trails/electric") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand(0, 1) + + local norm = (self.StartPos - self.EndPos) * self.Life + local nlen = norm:Length() + + local alpha = 1 - self.Life + + render.SetMaterial(beammat) + + for i = 1, 5 do + render.DrawBeam(self.StartPos, self.EndPos, 4, texcoord, texcoord + nlen / 128, Color(255, 160, 50, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 14, texcoord, texcoord + nlen / 128, Color(255, 160, 50, 170 * alpha)) + + render.SetMaterial(beam1mat) + for i = 1, 3 do + render.DrawBeam(self.StartPos + (VectorRand() * 6), self.EndPos + (VectorRand() * 6), 12, texcoord, texcoord + nlen / 128, Color(255, 160, 50, 170 * alpha)) + end + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 30, 30, Color(245, 140, 70, 158 * alpha)) + render.DrawSprite(self.EndPos, 30, 30, Color(245, 140, 70, 158 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_heph_alt.lua b/gamemodes/zombiesurvival/entities/effects/tracer_heph_alt.lua new file mode 100644 index 0000000..1ed7de8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_heph_alt.lua @@ -0,0 +1,31 @@ +EFFECT.DieTime = 0 + +function EFFECT:Init(data) + self.StartPos = data:GetStart() + self.EndPos = data:GetOrigin() + self.Dir = self.EndPos - self.StartPos + self.Entity:SetRenderBoundsWS(self.StartPos, self.EndPos) + + self.DieTime = CurTime() + 0.5 + + sound.Play("weapons/fx/rics/ric"..math.random(5)..".wav", self.StartPos, 73, math.random(140, 150)) +end + +function EFFECT:Think() + return CurTime() < self.DieTime +end + +local beammat = Material("trails/laser") +function EFFECT:Render() + local texcoord = math.Rand(0, 1) + local alpha = self.DieTime - CurTime() + local norm = (self.StartPos - self.EndPos) * alpha + local nlen = norm:Length() + + render.SetMaterial(beammat) + + for i = 1, 5 do + render.DrawBeam(self.StartPos, self.EndPos, 4, texcoord, texcoord + nlen / 128, Color(115, 210, 50, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 14, texcoord, texcoord + nlen / 128, Color(115, 210, 50, 170 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_higgs.lua b/gamemodes/zombiesurvival/entities/effects/tracer_higgs.lua new file mode 100644 index 0000000..93b1d48 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_higgs.lua @@ -0,0 +1,77 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 6 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return self.Life < 1 +end + +local beammat = Material("trails/smoke") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand( 0, 1 ) + + local norm = (self.StartPos - self.EndPos) * self.Life + local dir = (self.StartPos - self.EndPos):Angle() + local dfwd = dir:Forward() + local dup = dir:Up() + local drgt = dir:Right() + local nlen = norm:Length() + + local prevspinpos = self.StartPos + local alpha = 1 - self.Life + + local emitter = ParticleEmitter(self.EndPos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("effects/fleck_glass"..math.random(1, 3), self.EndPos - (self.EndPos - self.StartPos) * math.Rand(0, 1)) + local vel = VectorRand():GetNormal() * 160 + particle:SetDieTime(1) + particle:SetColor(0,0,0) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetVelocity(vel) + particle:SetGravity(vel * -1.7) + particle:SetRoll(math.random(360)) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + render.SetMaterial(beammat) + for i = 0, nlen, 32 do + if i > 704 then break end -- Limit the range on the spin beam effect...otherwise might be expensive. + + local set = i - CurTime() * 15 + + local basebeampos = self.StartPos - dfwd * i + local spinbeampos = basebeampos + dup * math.sin(set) * 6 + drgt * math.cos(set) * 6 + + if i == 704 then spinbeampos = basebeampos end -- Tie the spin back into the main beam at the end of the spin beams + + render.DrawBeam(prevspinpos, spinbeampos, 3, texcoord + i, texcoord + nlen / 128 + i, Color(150, 150, 150, 255 * alpha)) + + prevspinpos = spinbeampos + end + + for i = 0, 4 do + render.DrawBeam(self.StartPos, self.EndPos, 6, texcoord, texcoord + nlen / 128, Color(0, 0, 0, 200 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 2, texcoord, texcoord + nlen / 128, Color(125, 125, 125, 175 * alpha)) + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 50, 50, Color(160, 160, 160, 160 * alpha)) + render.DrawSprite(self.EndPos, 50, 50, Color(160, 160, 160, 148 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_muon.lua b/gamemodes/zombiesurvival/entities/effects/tracer_muon.lua new file mode 100644 index 0000000..9c0e188 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_muon.lua @@ -0,0 +1,76 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 6 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return self.Life < 1 +end + +local beammat = Material("trails/physbeam") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand( 0, 1 ) + + local norm = (self.StartPos - self.EndPos) * self.Life + local dir = (self.StartPos - self.EndPos):Angle() + local dfwd = dir:Forward() + local dup = dir:Up() + local drgt = dir:Right() + local nlen = norm:Length() + + local prevspinpos = self.StartPos + local alpha = 1 - self.Life + + local emitter = ParticleEmitter(self.EndPos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("effects/spark", self.EndPos - (self.EndPos - self.StartPos) * math.Rand(0, 1)) + local vel = VectorRand():GetNormal() * 120 + particle:SetDieTime(0.2) + particle:SetColor(150,140,250) + particle:SetStartAlpha(250) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetVelocity(vel) + particle:SetGravity(vel * -2.5) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + render.SetMaterial(beammat) + for i = 0, nlen, 32 do + if i > 704 then break end -- Limit the range on the spin beam effect...otherwise might be expensive. + + local set = i - CurTime() * 15 + + local basebeampos = self.StartPos - dfwd * i + local spinbeampos = basebeampos + dup * math.sin(set) * 6 + drgt * math.cos(set) * 6 + + if i == 704 then spinbeampos = basebeampos end -- Tie the spin back into the main beam at the end of the spin beams + + render.DrawBeam(prevspinpos, spinbeampos, 10, texcoord + i, texcoord + nlen / 128 + i, Color(175, 36, 192, 255 * alpha)) + + prevspinpos = spinbeampos + end + + for i = 0, 4 do + render.DrawBeam(self.StartPos, self.EndPos, 6, texcoord, texcoord + nlen / 128, Color(95, 95, 105, 255 * alpha)) + end + render.DrawBeam(self.StartPos, self.EndPos, 18, texcoord, texcoord + nlen / 128, Color(185, 23, 215, 250 * alpha)) + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 50, 50, Color(145, 120, 172, 178 * alpha)) + render.DrawSprite(self.EndPos, 50, 50, Color(145, 120, 172, 178 * alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_pcutter.lua b/gamemodes/zombiesurvival/entities/effects/tracer_pcutter.lua new file mode 100644 index 0000000..45218aa --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_pcutter.lua @@ -0,0 +1,38 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 10 -- Effect should dissipate before the next one. + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + + return (self.Life < 1) +end + +local beammat = Material("trails/laser") +local glowmat = Material("sprites/light_glow02_add") +function EFFECT:Render() + local texcoord = math.Rand( 0, 1 ) + + local norm = (self.StartPos - self.EndPos) * self.Life + local nlen = norm:Length() + local inv = 1 - self.Life + + render.SetMaterial(beammat) + for i = 0, 5 do + render.DrawBeam(self.StartPos, self.EndPos, (12 + i * 1) * inv, texcoord, texcoord + nlen / 128, Color(110, 185, 230, 180 * inv)) + end + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 15 * inv, 15 * inv, Color(100, 185, 232)) + render.DrawSprite(self.EndPos, 40 * inv, 40 * inv, Color(100, 185, 232)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/rico_trace.lua b/gamemodes/zombiesurvival/entities/effects/tracer_rico.lua similarity index 100% rename from gamemodes/zombiesurvival/entities/effects/rico_trace.lua rename to gamemodes/zombiesurvival/entities/effects/tracer_rico.lua diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_volt.lua b/gamemodes/zombiesurvival/entities/effects/tracer_volt.lua new file mode 100644 index 0000000..8fcc2ad --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_volt.lua @@ -0,0 +1,39 @@ +function EFFECT:Init( data ) + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + self.Alpha = 255 + self.Life = 0 + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 6 + self.Alpha = 255 * ( 1 - self.Life ) + return ( self.Life < 1 ) +end + +local beam1mat = Material("trails/electric") +local glowmat = Material("sprites/light_glow02_add") + +function EFFECT:Render() + if ( self.Alpha < 1 ) then return end + + local texcoord = math.Rand( 0, 1 ) + local norm = (self.StartPos - self.EndPos) * self.Life + self.Length = norm:Length() + + render.SetMaterial( beam1mat ) + for i = 1, 2 do + render.DrawBeam(self.StartPos + (VectorRand() * 2), self.EndPos + (VectorRand() * 3), 4, texcoord, texcoord + self.Length / 128, Color( 50, 255, 135, self.Alpha )) + end + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 20, 20, Color(50, 245, 235, self.Alpha)) + render.DrawSprite(self.EndPos, 15, 15, Color(50, 245, 235, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/tracer_zapper.lua b/gamemodes/zombiesurvival/entities/effects/tracer_zapper.lua new file mode 100644 index 0000000..1002bec --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/tracer_zapper.lua @@ -0,0 +1,53 @@ +function EFFECT:Init( data ) + local pos = data:GetStart() + + self.StartPos = pos + self.EndPos = data:GetOrigin() + + self.Alpha = 255 + self.Life = 0 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 9 do + local particle = emitter:Add("effects/blueflare1", pos) + particle:SetDieTime(0.8) + particle:SetColor(150,190,255) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 60) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + self:SetRenderBoundsWS( self.StartPos, self.EndPos ) +end + +function EFFECT:Think( ) + self.Life = self.Life + FrameTime() * 6 + self.Alpha = 255 * ( 1 - self.Life ) + return ( self.Life < 1 ) +end + +local beam1mat = Material("trails/electric") +local glowmat = Material("sprites/light_glow02_add") + +function EFFECT:Render() + if ( self.Alpha < 1 ) then return end + + local texcoord = math.Rand( 0, 1 ) + local norm = (self.StartPos - self.EndPos) * self.Life + self.Length = norm:Length() + + render.SetMaterial( beam1mat ) + for i = 1, 3 do + render.DrawBeam(self.StartPos, self.EndPos + (VectorRand() * 6), 12, texcoord, texcoord + self.Length / 128, Color( 255, 255, 255, self.Alpha )) + end + + render.SetMaterial(glowmat) + render.DrawSprite(self.StartPos, 130, 130, Color(150, 215, 255, self.Alpha)) + render.DrawSprite(self.EndPos, 50, 50, Color(170, 215, 255, self.Alpha)) +end diff --git a/gamemodes/zombiesurvival/entities/effects/weapon_shattered.lua b/gamemodes/zombiesurvival/entities/effects/weapon_shattered.lua new file mode 100644 index 0000000..1f42de0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/weapon_shattered.lua @@ -0,0 +1,44 @@ +function EFFECT:Init(data) + local pos = data:GetOrigin() + local ent = data:GetEntity() + if ent:IsValid() then + ent:EmitSound("physics/glass/glass_sheet_break3.wav") + end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(8, 16) + + local dir, size, brightness + local gravity = Vector(0, 0, -400) + + for i=1, 30 do + dir = VectorRand() + dir:Normalize() + size = math.Rand(1, 5) + brightness = math.Rand(0.8, 1.0) + + local particle = emitter:Add("particles/balloon_bit", pos + dir) + particle:SetVelocity(dir * math.Rand(48, 90)) + particle:SetDieTime(math.Rand(3, 5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(100) + particle:SetStartSize(size) + particle:SetEndSize(size / 4) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + particle:SetGravity(gravity) + particle:SetColor(230 * brightness, 240 * brightness, 255 * brightness) + particle:SetCollide(true) + particle:SetAngleVelocity(Angle(math.Rand(-160, 160), math.Rand(-160, 160), math.Rand(-160, 160))) + particle:SetBounce(0.9) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/gamemodes/zombiesurvival/entities/effects/zombie_battlecry.lua b/gamemodes/zombiesurvival/entities/effects/zombie_battlecry.lua new file mode 100644 index 0000000..60245d6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/effects/zombie_battlecry.lua @@ -0,0 +1,53 @@ +function EFFECT:Init(effectdata) + local pos = effectdata:GetOrigin() + local normal = effectdata:GetNormal() + + local emitter = ParticleEmitter(pos, true) + emitter:SetNearClip(24, 32) + local emitter2 = ParticleEmitter(pos) + emitter2:SetNearClip(24, 32) + + + for i=1,3 do + local particle = emitter:Add("effects/select_ring", pos) + particle:SetDieTime(0.1 + i * 0.1) + particle:SetColor(255,35,0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(220) + particle:SetAngles(normal:Angle()) + particle = emitter:Add("effects/select_ring", pos) + particle:SetDieTime(0.2 + i * 0.1) + particle:SetColor(255,35,0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(290) + particle:SetAngles(normal:Angle()) + end + for i=1,100 do + local particle = emitter2:Add("effects/splash2", pos) + particle:SetDieTime(0.4) + particle:SetColor(255,35,0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(4) + particle:SetStartLength(30) + particle:SetEndLength(30) + particle:SetVelocity(VectorRand():GetNormal() * math.random(450,600)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + emitter2:Finish() emitter2 = nil collectgarbage("step", 64) + +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end + diff --git a/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/cl_init.lua new file mode 100644 index 0000000..38bcc5a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/cl_init.lua @@ -0,0 +1,29 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModelScale(self:GetModelScale(), 0) + self:SetMaterial("models/spawn_effect2") + + self.AmbientSound = CreateSound(self, ")weapons/physcannon/superphys_hold_loop.wav") + self.AmbientSound:PlayEx(0.5, 60) + + self:GetOwner().ShadeControl = self +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + local owner = self:GetOwner() + if owner.ShadeControl == self then + owner.ShadeControl = nil + end +end + +function ENT:DrawTranslucent() + render.SetBlend(0.5) + self:DrawModel() + render.SetBlend(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/init.lua b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/init.lua new file mode 100644 index 0000000..7fb93e2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/init.lua @@ -0,0 +1,59 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetSolid(SOLID_NONE) + self:SetMoveType(MOVETYPE_NONE) + self:SetMaterial("models/spawn_effect2") +end + +function ENT:AttachTo(ent) + self:SetModel(ent:GetModel()) + self:SetModelScale(ent:GetModelScale()+0.03, 0) + self:SetSkin(ent:GetSkin() or 0) + self:SetPos(ent:GetPos()) + self:SetAngles(ent:GetAngles()) + self:SetAlpha(ent:GetAlpha()) + self:SetParent(ent) + + self.ObjectPosition = ent:GetPos() + Vector(0, 0, 37.5) +end + +local ShadowParams = {secondstoarrive = 0.05, maxangular = 15, maxangulardamp = 1, maxspeed = 100, maxspeeddamp = 1000, dampfactor = 0.65, teleportdistance = 0} +function ENT:Think() + local owner = self:GetOwner() + if owner:IsValid() and owner:IsPlayer() and owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Frost Shade" then + local ent = self:GetParent() + if ent:IsValid() then + local eyepos = owner:EyePos() + if eyepos:DistToSqr(ent:NearestPoint(eyepos)) <= 160000 then --400^2 + local phys = ent:GetPhysicsObject() + if phys:IsValid() and phys:IsMoveable() and phys:GetMass() <= 300 then + local ct = CurTime() + + local eyeangles = owner:EyeAngles() + eyeangles:RotateAroundAxis(eyeangles:Right(), 90) + + local frametime = ct - (self.LastThink or ct) + self.LastThink = ct + + ent.DisableControlUntil = CurTime() + 2 + + phys:Wake() + + ShadowParams.pos = (self.ObjectPosition or ent:GetPos()) + VectorRand():GetNormalized() * math.Rand(-24, 24) + ShadowParams.angle = self:GetParent():GetClass() == "projectile_shadeice" and eyeangles or AngleRand() + ShadowParams.deltatime = frametime + phys:ComputeShadowControl(ShadowParams) + + ent:SetPhysicsAttacker(owner) + + self:NextThink(CurTime()) + return true + end + end + end + end + + self:Remove() +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/shared.lua b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_frostshadecontrol/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/env_mediccloud/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/cl_init.lua new file mode 100644 index 0000000..b094ca1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/cl_init.lua @@ -0,0 +1,82 @@ +INC_CLIENT() + +ENT.NextEmit = 0 +ENT.DoEmit = false + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "items/medcharge4.wav") +end + +function ENT:Think() + if self.DoEmit then + self.DoEmit = false + + self:EmitSound("ambient/machines/thumper_dust.wav", 70, 120) + end + + self.AmbientSound:PlayEx(0.70, 80 + CurTime() % 1) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + local time = CurTime() + local pos = self:GetPos() + --pos.z = pos.z + 32 + + local dlight = DynamicLight(self:EntIndex()) + if dlight then + dlight.Pos = pos + dlight.r = 30 + dlight.g = 255 + dlight.b = 30 + dlight.Brightness = 8 + dlight.Size = self.Radius / 2 + dlight.Decay = self.Radius * 2 + dlight.DieTime = time + 0.75 + end + + if time < self.NextEmit then return end + self.NextEmit = time + 1 + self.DoEmit = true + + local offset, particle + local axis = AngleRand() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + for i=1, 180 do + axis.roll = axis.roll + 2 + offset = axis:Up() + + particle = emitter:Add("sprites/glow04_noz", pos + offset) + particle:SetVelocity(offset * math.Rand(500, 600)) + particle:SetColor(30, 225, 30) + particle:SetAirResistance(300) + particle:SetDieTime(math.Rand(1.25, 2.5)) + particle:SetStartAlpha(245) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(12, 15)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + --particle:SetCollide(true) + end + + for i=1, 20 do + particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(VectorRand() * 8) + particle:SetColor(60, 255, 60) + particle:SetDieTime(2) + particle:SetStartAlpha(0) + particle:SetEndAlpha(255) + particle:SetStartSize(24) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_mediccloud/init.lua b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/init.lua new file mode 100644 index 0000000..e45848b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/init.lua @@ -0,0 +1,37 @@ +INC_SERVER() + +ENT.TickTime = 1 +ENT.Ticks = 10 +ENT.HealPower = 2.5 + +function ENT:Initialize() + local owner = self:GetOwner() + + self:DrawShadow(false) + self.Ticks = math.floor(self.Ticks * (owner:IsValidLivingHuman() and owner.CloudTime or 1)) + + self:Fire("heal", "", self.TickTime) + self:Fire("kill", "", self.TickTime * self.Ticks + 0.01) +end + +function ENT:AcceptInput(name, activator, caller, arg) + if name ~= "heal" then return end + + self.Ticks = self.Ticks - 1 + + local healer = self:GetOwner() + if not healer:IsValidLivingHuman() then healer = self end + + local vPos = self:GetPos() + for _, ent in pairs(ents.FindInSphere(vPos, self.Radius * (healer.CloudRadius or 1))) do + if ent and ent:IsValidLivingHuman() and WorldVisible(vPos, ent:NearestPoint(vPos)) then + healer:HealPlayer(ent, self.HealPower, 0.5, true) + end + end + + if self.Ticks > 0 then + self:Fire("heal", "", self.TickTime) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_mediccloud/shared.lua b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/shared.lua new file mode 100644 index 0000000..83db192 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_mediccloud/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" + +ENT.Radius = 100 diff --git a/gamemodes/zombiesurvival/entities/entities/env_molotovflame/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/cl_init.lua new file mode 100644 index 0000000..83d3ef6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/cl_init.lua @@ -0,0 +1,63 @@ +INC_CLIENT() + +ENT.NextEmit = 0 +ENT.DoEmit = false + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "ambient/fire/fire_med_loop1.wav") +end + +function ENT:Think() + if self.DoEmit then + self.DoEmit = false + + self:EmitSound("ambient/machines/thumper_dust.wav", 70, 170) + end + + self.AmbientSound:PlayEx(0.80, 60 + CurTime() % 1) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + local time = CurTime() + local pos = self:GetPos() + + local dlight = DynamicLight(self:EntIndex()) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 190 + dlight.b = 30 + dlight.Brightness = 8 + dlight.Size = self.Radius / 2 + dlight.Decay = self.Radius * 2 + dlight.DieTime = time + 0.75 + end + + if time < self.NextEmit then return end + self.NextEmit = time + 0.65 + self.DoEmit = true + + local particle + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + for i=1, 75 do + local angler = AngleRand() + local dist = math.Rand(0, self.Radius) + particle = emitter:Add("effects/fire_cloud"..math.random(1, 2), pos + Vector(math.cos(angler.y) * dist, math.sin(angler.y) * dist, 0)) + particle:SetColor(255, 220, 140) + particle:SetDieTime(math.Rand(1.35, 1.7)) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(math.Rand(18, 24)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetCollide(true) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_molotovflame/init.lua b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/init.lua new file mode 100644 index 0000000..eb840c9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/init.lua @@ -0,0 +1,48 @@ +INC_SERVER() + +ENT.TickTime = 0.45 +ENT.Ticks = 12 +ENT.Damage = 7 + +function ENT:Initialize() + self:DrawShadow(false) + + self:Fire("burn", "", self.TickTime) + self:Fire("kill", "", self.TickTime * self.Ticks + 0.01) + + self:DropToFloor() +end + +function ENT:AcceptInput(name, activator, caller, arg) + if name ~= "burn" then return end + + self.Ticks = self.Ticks - 1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + local vPos = self:GetPos() + for _, ent in pairs(ents.FindInSphere(vPos, self.Radius)) do + if ent and (ent:IsValidLivingPlayer() and (ent:Team() == TEAM_UNDEAD or ent == owner)) and WorldVisible(vPos, ent:NearestPoint(vPos)) then + ent:Ignite(2) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(owner) + fire:SetPhysicsAttacker(owner) + fire.AttackerForward = owner + end + end + + if owner:IsValidLivingHuman() then + ent:AddLegDamage(7) + ent:TakeSpecialDamage(self.Damage, DMG_BURN, owner, self) + end + end + end + + if self.Ticks > 0 then + self:Fire("burn", "", self.TickTime) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_molotovflame/shared.lua b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/shared.lua new file mode 100644 index 0000000..74d3253 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_molotovflame/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" + +ENT.Radius = 75 diff --git a/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/cl_init.lua new file mode 100644 index 0000000..1e5596d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/cl_init.lua @@ -0,0 +1,64 @@ +INC_CLIENT() + +ENT.NextEmit = 0 +ENT.DoEmit = false + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "items/suitchargeno1.wav") +end + +function ENT:Think() + if self.DoEmit then + self.DoEmit = false + + self:EmitSound("npc/scanner/scanner_scan2.wav", 70, 50) + end + + self.AmbientSound:PlayEx(0.70, 60 + CurTime() % 1) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + local time = CurTime() + local pos = self:GetPos() + + if time < self.NextEmit then return end + self.NextEmit = time + 1 + self.DoEmit = true + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + for i=1, 95 do + local dir = VectorRand():GetNormalized() + particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(dir * 205) + particle:SetGravity(dir * -210) + particle:SetDieTime(0.7) + particle:SetColor(225,150,255) + particle:SetStartAlpha(80) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(15) + particle:SetCollide(false) + particle:SetBounce(0) + end + + for i=1, 30 do + local dir = VectorRand():GetNormalized() + particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(math.Rand(1.8, 2.5)) + particle:SetColor(145,155,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(15) + particle:SetEndSize(0) + particle:SetGravity(dir * -6) + particle:SetVelocity(dir * 5) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/init.lua b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/init.lua new file mode 100644 index 0000000..601101f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/init.lua @@ -0,0 +1,71 @@ +INC_SERVER() + +ENT.TickTime = 1 +ENT.Ticks = 10 +ENT.HealPower = 17.5 + +function ENT:Initialize() + local owner = self:GetOwner() + + self:DrawShadow(false) + self.Ticks = math.floor(self.Ticks * (owner:IsValidLivingHuman() and owner.CloudTime or 1)) + + self:Fire("heal", "", self.TickTime) + self:Fire("kill", "", self.TickTime * self.Ticks + 0.01) +end + +function ENT:AcceptInput(name, activator, caller, arg) + if name ~= "heal" then return end + + self.Ticks = self.Ticks - 1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + local pos = self:GetPos() + local totalheal = self.HealPower * (self:GetOwner().RepairRateMul or 1) + + for _, hitent in pairs(ents.FindInSphere(pos, self.Radius * (owner.CloudRadius or 1))) do + if not hitent:IsValid() or hitent == self or not WorldVisible(pos, hitent:NearestPoint(pos)) then + continue + end + + local healed = false + + if hitent:IsNailed() then + local oldhealth = hitent:GetBarricadeHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxBarricadeHealth() or hitent:GetBarricadeRepairs() <= 0.01 then continue end + + hitent:SetBarricadeHealth(math.min(hitent:GetMaxBarricadeHealth(), hitent:GetBarricadeHealth() + math.min(hitent:GetBarricadeRepairs(), totalheal))) + healed = hitent:GetBarricadeHealth() - oldhealth + hitent:SetBarricadeRepairs(math.max(hitent:GetBarricadeRepairs() - healed, 0)) + + elseif hitent.GetObjectHealth then + -- Taking the nil tr parameter for granted for now + if hitent.HitByWrench and hitent:HitByWrench(self, owner, nil) then continue end + + local oldhealth = hitent:GetObjectHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxObjectHealth() or hitent.m_LastDamaged and CurTime() < hitent.m_LastDamaged + 4 then continue end + + hitent:SetObjectHealth(math.min(hitent:GetMaxObjectHealth(), hitent:GetObjectHealth() + totalheal/2)) + healed = hitent:GetObjectHealth() - oldhealth + end + + if healed and owner:IsValidLivingHuman() then + hitent:EmitSound("npc/dog/dog_servo"..math.random(7, 8)..".wav", 70, math.random(100, 105)) + gamemode.Call("PlayerRepairedObject", owner, hitent, healed, self) + + local effectdata = EffectData() + effectdata:SetOrigin(hitent:GetPos()) + effectdata:SetNormal((self:GetPos() - hitent:GetPos()):GetNormalized()) + effectdata:SetMagnitude(1) + util.Effect("nailrepaired", effectdata, true, true) + end + end + + if self.Ticks > 0 then + self:Fire("heal", "", self.TickTime) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/shared.lua b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/shared.lua new file mode 100644 index 0000000..83db192 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_nanitecloud/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" + +ENT.Radius = 100 diff --git a/gamemodes/zombiesurvival/entities/entities/env_propbroken/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_propbroken/cl_init.lua index 5bff262..d648f58 100644 --- a/gamemodes/zombiesurvival/entities/entities/env_propbroken/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/env_propbroken/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 @@ -51,5 +51,5 @@ function ENT:Draw() particle:SetRoll(math.Rand(0, 360)) particle:SetRollDelta(math.Rand(-20, 20)) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/env_propbroken/init.lua b/gamemodes/zombiesurvival/entities/entities/env_propbroken/init.lua index 62a9fb9..97824d8 100644 --- a/gamemodes/zombiesurvival/entities/entities/env_propbroken/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/env_propbroken/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.DieTime = 0 diff --git a/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/cl_init.lua new file mode 100644 index 0000000..3ca086b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/cl_init.lua @@ -0,0 +1,78 @@ +INC_CLIENT() + +function ENT:DrawTranslucent() + local delta = math.max(0, self.DieTime - CurTime()) + local size = math.min(1, (0.75 - delta) * 3) + local normal = -self:GetUp() + + local icea + if size == 1 then + icea = delta * 2.2 + else + icea = 0.8 + self.Rotation = self.Rotation + FrameTime() * 520 + end + self:SetAngles(Angle(180, self.Rotation, 0)) + self:SetModelScale(size*0.7, 0) + + if render.SupportsVertexShaders_2_0() then + render.EnableClipping(true) + render.PushCustomClipPlane(normal, normal:Dot(self:GetPos())) + end + + render.SetBlend(icea) + self:DrawModel() + render.SetBlend(1) + + if render.SupportsVertexShaders_2_0() then + render.PopCustomClipPlane() + render.EnableClipping(false) + end +end + +function ENT:Initialize() + self:DrawShadow(false) + self.DieTime = CurTime() + 0.75 + self.Rotation = math.Rand(0, 360) + self:SetColor(Color(30, 150, 255, 255)) + self:SetMaterial("models/shadertest/shader2") + --ExplosiveEffect(self:GetPos(), 48, 100, DMGTYPE_ICE) + + self:EmitSound("physics/glass/glass_largesheet_break"..math.random(1, 3)..".wav", 70, math.random(160, 180)) + self:EmitSound("physics/glass/glass_largesheet_break"..math.random(1, 3)..".wav", 70, math.random(160, 180)) + + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(40, 48) + + local ang = Angle(0,0,0) + local up = Vector(0,0,1) + local pos = self:GetPos() + for i=1, 120 do + ang:RotateAroundAxis(up, 3) + local fwd = ang:Forward() + local particle = emitter:Add("particle/snow", pos + Vector(0, 0, 16) + fwd * 8) + particle:SetVelocity(fwd * 64) + particle:SetAirResistance(-64) + particle:SetDieTime(1.7) + particle:SetLifeTime(1) + particle:SetStartAlpha(60) + particle:SetEndAlpha(0) + particle:SetStartSize(10) + particle:SetEndSize(10) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + + particle = emitter:Add("particle/snow", pos) + particle:SetVelocity(fwd * 72 + Vector(0,0,32)) + particle:SetAirResistance(-128) + particle:SetDieTime(1.7) + particle:SetLifeTime(1) + particle:SetStartAlpha(60) + particle:SetEndAlpha(0) + particle:SetStartSize(12) + particle:SetEndSize(12) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/init.lua b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/init.lua new file mode 100644 index 0000000..c1b67be --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/init.lua @@ -0,0 +1,26 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModel("models/props_wasteland/rockcliff06d.mdl") + self:SetMaterial("models/shadertest/shader2") + self:SetColor(Color(30, 150, 255, 255)) + self:PhysicsInit(SOLID_NONE) + + self:Explode() + + self:Fire("kill", "", 0.75) +end + +function ENT:Explode() + local pos = self:GetPos() + local owner = self:GetOwner() + local rad = 36 + + for _, ent in pairs(util.BlastAlloc(self, owner, pos + Vector(0, 0, rad), rad)) do + if ent:IsValidLivingZombie() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + ent:TakeSpecialDamage(self.Damage or 113.4, DMG_DROWN, owner, self, pos) + ent:AddLegDamageExt(18, owner, self, SLOWTYPE_COLD) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/shared.lua b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/shared.lua new file mode 100644 index 0000000..ae3428d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/env_protrusionspike/shared.lua @@ -0,0 +1,11 @@ +ENT.Type = "anim" + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.IgnoreBullets = true +ENT.IgnoreMelee = true +ENT.IgnoreTraces = true + +util.PrecacheModel("models/props_wasteland/rockcliff06d.mdl") +util.PrecacheSound("physics/glass/glass_largesheet_break1.wav") +util.PrecacheSound("physics/glass/glass_largesheet_break2.wav") +util.PrecacheSound("physics/glass/glass_largesheet_break3.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/cl_init.lua index 35e5a60..7b7520a 100644 --- a/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/init.lua b/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/init.lua index 875fe29..81af518 100644 --- a/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/env_shadecontrol/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -28,7 +25,7 @@ function ENT:Think() local ent = self:GetParent() if ent:IsValid() then local eyepos = owner:EyePos() - if eyepos:Distance(ent:NearestPoint(eyepos)) <= 400 then + if eyepos:DistToSqr(ent:NearestPoint(eyepos)) <= 160000 then --400^2 local phys = ent:GetPhysicsObject() if phys:IsValid() and phys:IsMoveable() and phys:GetMass() <= 300 then local ct = CurTime() @@ -36,6 +33,8 @@ function ENT:Think() local frametime = ct - (self.LastThink or ct) self.LastThink = ct + ent.DisableControlUntil = CurTime() + 2 + phys:Wake() ShadowParams.pos = (self.ObjectPosition or ent:GetPos()) + VectorRand():GetNormalized() * math.Rand(-24, 24) diff --git a/gamemodes/zombiesurvival/entities/entities/fakedeath/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/fakedeath/cl_init.lua index eebe06b..7297435 100644 --- a/gamemodes/zombiesurvival/entities/entities/fakedeath/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/fakedeath/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -7,7 +7,7 @@ function ENT:Initialize() end function ENT:DrawTranslucent() - local cycle = math.Clamp((CurTime() - self.Created) * 0.8, 0, 1) * self:GetDeathSequenceLength() + local cycle = math.Clamp((CurTime() - self.Created) * 0.8, 0, 1) * self:GetDeathSequenceLength() + self:GetDeathSequenceStart() local sequence = self:GetDeathSequence() if cycle == 1 then diff --git a/gamemodes/zombiesurvival/entities/entities/fakedeath/init.lua b/gamemodes/zombiesurvival/entities/entities/fakedeath/init.lua index 440af06..d3a9d4f 100644 --- a/gamemodes/zombiesurvival/entities/entities/fakedeath/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/fakedeath/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("shared.lua") -AddCSLuaFile("cl_init.lua") - -include("shared.lua") +INC_SERVER() local ViewHullMins = Vector(-4, -4, -4) local ViewHullMaxs = Vector(4, 4, 4) diff --git a/gamemodes/zombiesurvival/entities/entities/fakedeath/shared.lua b/gamemodes/zombiesurvival/entities/entities/fakedeath/shared.lua index 12267ef..3338010 100644 --- a/gamemodes/zombiesurvival/entities/entities/fakedeath/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/fakedeath/shared.lua @@ -3,7 +3,8 @@ ENT.Type = "anim" AccessorFuncDT(ENT, "DeathSequence", "Int", 0) AccessorFuncDT(ENT, "DeathAngles", "Angle", 0) AccessorFuncDT(ENT, "DeathSequenceLength", "Float", 0) -AccessorFuncDT(ENT, "RemoveTime", "Float", 1) +AccessorFuncDT(ENT, "DeathSequenceStart", "Float", 1) +AccessorFuncDT(ENT, "RemoveTime", "Float", 2) function ENT:SharedInitialize() self:SetSolid(SOLID_NONE) diff --git a/gamemodes/zombiesurvival/entities/entities/func_arsenalzone.lua b/gamemodes/zombiesurvival/entities/entities/func_arsenalzone.lua new file mode 100644 index 0000000..23ee59d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/func_arsenalzone.lua @@ -0,0 +1,57 @@ +ENT.Type = "brush" + +function ENT:Initialize() + self:SetTrigger(true) + + if self.On == nil then self.On = true end +end + +function ENT:Think() +end + +function ENT:AcceptInput(name, caller, activator, arg) + name = string.lower(name) + if name == "seton" then + self.On = tonumber(arg) == 1 + return true + elseif name == "enable" then + self.On = true + return true + elseif name == "disable" then + self.On = false + return true + end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "enabled" then + self.On = tonumber(value) == 1 + end +end + +function ENT:Enter(ent) + ent.ArsenalZone = self +end + +function ENT:Leave(ent) + ent.ArsenalZone = nil +end + +function ENT:Touch(ent) + if not self.On and ent:IsPlayer() and ent.ArsenalZone == self then + self:Leave(ent) + end +end + +function ENT:StartTouch(ent) + if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_HUMAN and not ent.ArsenalZone then + self:Enter(ent) + end +end + +function ENT:EndTouch(ent) + if ent:IsPlayer() and ent.ArsenalZone == self then + self:Leave(ent) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/func_status.lua b/gamemodes/zombiesurvival/entities/entities/func_status.lua new file mode 100644 index 0000000..b152c62 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/func_status.lua @@ -0,0 +1,88 @@ +ENT.Type = "brush" + +ENT.TickTime = 0.5 + +function ENT:Initialize() + self:SetTrigger(true) + self:Fire("attack", "", self.TickTime) + + if self.On == nil then self.On = true end + if self.Status == nil then self.Status = "slow" end + if self.Linger == nil then self.Linger = false end + if self.Duration == nil then self.Duration = 5 end +end + +function ENT:Think() +end + +function ENT:AcceptInput(name, caller, activator, arg) + name = string.lower(name) + if name == "seton" then + self.On = tonumber(arg) == 1 + return true + elseif name == "enable" then + self.On = true + return true + elseif name == "disable" then + self.On = false + return true + elseif name == "attack" then + self:Fire("attack", "", self.TickTime) + + for k,v in pairs(player.GetAll()) do + if v:IsValidLivingHuman() and v.StatusZone == self then + if not IsValid(v["status_" .. self.Status]) then + v:GiveStatus(self.Status, self.Duration) + end + end + end + + return true + end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "enabled" then + self.On = tonumber(value) == 1 + elseif key == "status" then + local val = string.lower(value) + self.Status = (val == "slow" or val == "dimvision" or val == "enfeeble" or val == "frost") and val or "slow" + elseif key == "linger" then + self.Linger = tonumber(value) == 1 + elseif key == "duration" then + self.Duration = tonumber(value) + end +end + +function ENT:Enter(ent) + ent.StatusZone = self +end + +function ENT:Leave(ent) + if not self.Linger then + if IsValid(ent["status_" .. self.Status]) then + ent:RemoveStatus(self.Status) + end + end + + ent.StatusZone = nil +end + +function ENT:Touch(ent) + if not self.On and ent:IsPlayer() and ent.StatusZone == self then + self:Leave(ent) + end +end + +function ENT:StartTouch(ent) + if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_HUMAN and not ent.StatusZone then + self:Enter(ent) + end +end + +function ENT:EndTouch(ent) + if ent:IsPlayer() and ent.StatusZone == self then + self:Leave(ent) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/info_noskills.lua b/gamemodes/zombiesurvival/entities/entities/info_noskills.lua new file mode 100644 index 0000000..b385249 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/info_noskills.lua @@ -0,0 +1,5 @@ +ENT.Type = "point" + +function ENT:Initialize() + GAMEMODE.NoSkills = true +end diff --git a/gamemodes/zombiesurvival/entities/entities/info_sigilnode.lua b/gamemodes/zombiesurvival/entities/entities/info_sigilnode.lua new file mode 100644 index 0000000..02f7ac8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/info_sigilnode.lua @@ -0,0 +1,12 @@ +ENT.Type = "point" + +function ENT:Initialize() + if self.ForceSpawn == nil then self.ForceSpawn = false end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "forcespawn" then + self.ForceSpawn = tonumber(value) == 1 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/logic_brains/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_brains/init.lua index 79dfa66..d5e205d 100644 --- a/gamemodes/zombiesurvival/entities/entities/logic_brains/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/logic_brains/init.lua @@ -2,7 +2,7 @@ ENT.Base = "logic_points" ENT.Type = "point" function ENT:Add(pl, amount) - if pl and pl:IsValid() and pl:IsPlayer() and pl:Team() == TEAM_UNDEAD then + if pl and pl:IsValidZombie() then amount = math.Round(amount) if amount < 0 then pl:TakeBrains(-amount) diff --git a/gamemodes/zombiesurvival/entities/entities/logic_classunlock/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_classunlock/init.lua index a43d2c1..074eeee 100644 --- a/gamemodes/zombiesurvival/entities/entities/logic_classunlock/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/logic_classunlock/init.lua @@ -19,6 +19,11 @@ function ENT:AcceptInput(name, activator, caller, args) v.Locked = true v.Unlocked = false + net.Start("zs_classunlockstate") + net.WriteInt(k, 8) + net.WriteBool(v.Unlocked) + net.Broadcast() + if classname ~= "all" then for _, pl in pairs(player.GetAll()) do if pl:GetZombieClass() == k then @@ -39,6 +44,11 @@ function ENT:AcceptInput(name, activator, caller, args) if classname == "all" or string.lower(v.Name) == classname then v.Unlocked = true v.Locked = false + + net.Start("zs_classunlockstate") + net.WriteInt(k, 8) + net.WriteBool(v.Unlocked) + net.Broadcast() end end elseif name == "defaultclass" then diff --git a/gamemodes/zombiesurvival/entities/entities/logic_experience/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_experience/init.lua new file mode 100644 index 0000000..b7a5529 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/logic_experience/init.lua @@ -0,0 +1,29 @@ +ENT.Type = "point" + +function ENT:Initialize() +end + +function ENT:Think() +end + +function ENT:AcceptInput(name, activator, caller, args) + name = string.lower(name) + if name == "sethumanxpmulti" then + self:SetKeyValue("humanxpmulti", args) + + return true + elseif name == "setzombiexpmulti" then + self:SetKeyValue("zombiexpmulti", args) + + return true + end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "humanxpmulti" then + GAMEMODE.HumanXPMulti = math.max(0, tonumber(value)) or 1 + elseif key == "zombiexpmulti" then + GAMEMODE.ZombieXPMulti = math.max(0, tonumber(value)) or 1 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/logic_points/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_points/init.lua index e13cc24..2550b66 100644 --- a/gamemodes/zombiesurvival/entities/entities/logic_points/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/logic_points/init.lua @@ -1,9 +1,9 @@ ENT.Type = "point" function ENT:Add(pl, amount) - if pl and pl:IsValid() and pl:IsPlayer() and pl:Team() == TEAM_HUMAN then - amount = math.Round(amount) + if pl and pl:IsValidHuman() then if amount < 0 then + amount = math.Round(amount) pl:TakePoints(-amount) else pl:AddPoints(amount) @@ -12,7 +12,7 @@ function ENT:Add(pl, amount) end function ENT:Set(pl, amount) - if pl and pl:IsValid() and pl:IsPlayer() and pl:Team() == TEAM_HUMAN then + if pl and pl:IsValidHuman() then self:SetAmount(pl, amount) end end @@ -26,13 +26,13 @@ function ENT:GetAmount(pl) end function ENT:CallIf(pl, amount) - if pl and pl:IsValid() and pl:IsPlayer() then + if pl and pl:IsValidPlayer() then self:Input(pl:Team() == TEAM_HUMAN and self:GetAmount(pl) >= amount and "onconditionpassed" or "onconditionfailed", pl, self, amount) end end function ENT:CallIfNot(pl, amount) - if pl and pl:IsValid() and pl:IsPlayer() then + if pl and pl:IsValidPlayer() then self:Input(pl:Team() == TEAM_HUMAN and self:GetAmount(pl) >= amount and "onconditionfailed" or "onconditionpassed", pl, self, amount) end end diff --git a/gamemodes/zombiesurvival/entities/entities/logic_winreward/init.lua b/gamemodes/zombiesurvival/entities/entities/logic_winreward/init.lua new file mode 100644 index 0000000..efe2abb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/logic_winreward/init.lua @@ -0,0 +1,14 @@ +ENT.Type = "point" + +function ENT:Initialize() +end + +function ENT:Think() +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "winmulti" then + GAMEMODE.WinXPMulti = tonumber(value) or 1 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/point_propnocollide.lua b/gamemodes/zombiesurvival/entities/entities/point_propnocollide.lua index 1d6c497..633804c 100644 --- a/gamemodes/zombiesurvival/entities/entities/point_propnocollide.lua +++ b/gamemodes/zombiesurvival/entities/entities/point_propnocollide.lua @@ -5,7 +5,13 @@ AccessorFunc(ENT, "m_fExtraRadius", "ExtraRadius", FORCE_NUMBER) AccessorFunc(ENT, "m_iTeam", "Team", FORCE_NUMBER) AccessorFunc(ENT, "m_entProp", "Prop") +ENT.PushRamp = 2.5 + +ENT.PushPeak = 0 + function ENT:Initialize() + self.PushPeak = CurTime() + self.PushRamp + self:SetTimeOut(0) self:SetExtraRadius(8) self:SetProp(NULL) @@ -17,13 +23,16 @@ function ENT:SetProp(ent) if not IsValid(ent) then return end for _, e in pairs(ents.FindByClass(self:GetClass())) do - if e ~= self and e and e:IsValid() and e:GetProp() == ent then return end + if e ~= self and e and e:IsValid() and e:GetProp() == ent then + self.m_entProp = NULL + return + end end - local teamid = self:GetTeam() + --local teamid = self:GetTeam() local inrad = false for _, pl in pairs(ents.FindInSphere(ent:LocalToWorld(ent:OBBCenter()), ent:BoundingRadius() / 2 + self:GetExtraRadius())) do - if pl and pl:IsValid() and pl:IsPlayer() and pl:Alive() and (teamid == 0 or pl:Team() == teamid) then + if pl and pl:IsValidLivingPlayer() then --and (teamid == 0 or pl:Team() == teamid) then inrad = true break end @@ -32,9 +41,9 @@ function ENT:SetProp(ent) if not inrad then return end self.OldMaterial = ent:GetMaterial() - self.OldCollisionGroup = ent:GetCollisionGroup() + ent.PreHoldCollisionGroup = ent.PreHoldCollisionGroup or ent:GetCollisionGroup() - ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + ent:SetCollisionGroup(COLLISION_GROUP_WEAPON) ent:SetMaterial("models/spawn_effect") end @@ -46,8 +55,14 @@ function ENT:OnRemove() ent:SetMaterial(self.OldMaterial) end - if self.OldCollisionGroup then - ent:SetCollisionGroup(self.OldCollisionGroup) + for _, e in pairs(ents.FindByClass("status_human_holding")) do + if e:IsValid() and e:GetObject() == ent then + return + end + end + + if ent.PreHoldCollisionGroup then + ent:SetCollisionGroup(ent.PreHoldCollisionGroup) end end @@ -60,19 +75,21 @@ function ENT:Think() local pushout = false local timeout = self:GetTimeOut() > 0 and CurTime() >= self:GetTimeOut() - local teamid = self:GetTeam() + --local teamid = self:GetTeam() local rate = 900 * FrameTime() local center = ent:LocalToWorld(ent:OBBCenter()) + rate = rate * math.Clamp(1 - (self.PushPeak - CurTime()) / self.PushRamp, 0, 1) + for _, pl in pairs(ents.FindInSphere(center, ent:BoundingRadius() / 2 + self:GetExtraRadius())) do - if pl and pl:IsValid() and pl:IsPlayer() and pl:Alive() and (teamid == 0 or pl:Team() == teamid) then + if pl and pl:IsValidLivingHuman() or (pl:IsPlayer() and pl:Team() == TEAM_UNDEAD and pl:GetZombieClassTable().Boss) then pushout = true if timeout then if ent:IsBarricadeProp() and pl:Team() == TEAM_HUMAN then pl:SetBarricadeGhosting(true) end - else + elseif not pl:GetBarricadeGhosting() then local plpos = pl:LocalToWorld(pl:OBBCenter()) local diff = plpos - center diff.z = 0 diff --git a/gamemodes/zombiesurvival/entities/entities/point_worldhint/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/point_worldhint/cl_init.lua index 032dd62..5056f43 100644 --- a/gamemodes/zombiesurvival/entities/entities/point_worldhint/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/point_worldhint/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) @@ -19,14 +19,9 @@ function ENT:DrawHint() if range <= 0 then DrawWorldHint(self:GetHint(), pos) else - local dist = pos:Distance(eyepos) - if dist <= range then - --[[local fadeoff = range * 0.75 - if dist >= fadeoff then - DrawWorldHint(self:GetHint(), pos, 1 - (dist - fadeoff) / range) - else]] - DrawWorldHint(self:GetHint(), pos) - --end + local dist = pos:DistToSqr(eyepos) + if dist <= range * range then + DrawWorldHint(self:GetHint(), pos) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/point_worldhint/init.lua b/gamemodes/zombiesurvival/entities/entities/point_worldhint/init.lua index bad88d9..f3e73c6 100644 --- a/gamemodes/zombiesurvival/entities/entities/point_worldhint/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/point_worldhint/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/point_zombiespawngroup.lua b/gamemodes/zombiesurvival/entities/entities/point_zombiespawngroup.lua new file mode 100644 index 0000000..6089350 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/point_zombiespawngroup.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "point" + +function ENT:UpdateTransmitState() + return TRANSMIT_PVS +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/cl_init.lua index 631e84c..984f04a 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/cl_init.lua @@ -1,45 +1,54 @@ -include("shared.lua") +INC_CLIENT() -local matTrail = Material("Effects/laser1.vmt") -local colTrail = Color(255, 0, 0) +local matTrail = Material("trails/physbeam") +local colTrail = Color(255, 20, 20) +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") +local vector_origin = vector_origin function ENT:Draw() - self.Entity:DrawModel() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.6, 0.2, 0.2) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) - local vOffset = self.Entity:GetPos() + if self:GetVelocity():LengthSqr() > 100 then + self:SetAngles(self:GetVelocity():Angle()) + + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 15, 2, Color(250, 40, 40)) + render.DrawSprite(self:GetPos(), 2, 30, Color(250, 40, 40)) + end render.SetMaterial(matTrail) for i=1, #self.TrailPositions do if self.TrailPositions[i+1] then - render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 6, 1, 0, colTrail) + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 7, 1, 0, colTrail) end end end function ENT:Initialize() - self.Trailing = CurTime() + 0.25 + self.Trailing = CurTime() + 0.15 self.TrailPositions = {} + self.CreateTime = CurTime() end function ENT:Think() - if self.Entity:GetVelocity():Length() <= 0 and self.Trailing < CurTime() then - function self:Draw() self.Entity:DrawModel() end - function self:Think() end - else - table.insert(self.TrailPositions, 1, self.Entity:GetPos()) - if self.TrailPositions[23] then - table.remove(self.TrailPositions, 23) - end - local dist = 0 - local mypos = self.Entity:GetPos() - for i=1, #self.TrailPositions do - if self.TrailPositions[i]:Distance(mypos) > dist then - self.Entity:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) - dist = self.TrailPositions[i]:Distance(mypos) - end + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[18] then + table.remove(self.TrailPositions, 18) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) end end end - -function ENT:OnRemove() -end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/init.lua index 8d6427b..cea54ce 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/init.lua @@ -1,61 +1,136 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include('shared.lua') +INC_SERVER() function ENT:Initialize() self.Touched = {} - self.OriginalAngles = self:GetAngles() - - self:Fire("kill", "", 15) - + self.Damaged = {} + self:SetModel("models/Items/CrossbowRounds.mdl") self:PhysicsInit(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) self:SetTrigger(true) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(4) - phys:SetBuoyancyRatio(0.01) - phys:EnableDrag(false) - phys:Wake() - end - + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 15) self:EmitSound("weapons/crossbow/bolt_fly4.wav") end +local temp_pen_ents = {} +local temp_me = NULL +local function PenUpdate(ent) + if ent == temp_me or temp_pen_ents[ent] or ent:IsPlayer() and ent:Team() == TEAM_HUMAN then + return false + end + + return true +end + +function ENT:PhysicsUpdate(phys) + local vel = self.PreVel or phys:GetVelocity() + if self.PreVel then self.PreVel = nil end + + temp_me = self + temp_pen_ents = {} + + for i = 1, 5 do + if not self.NoColl then + local velnorm = vel:GetNormalized() + + local ahead = (vel:LengthSqr() * FrameTime()) / 1200 + local fwd = velnorm * ahead + local start = self:GetPos() - fwd + local side = vel:Angle():Right() * GAMEMODE.ProjectileThickness + + local proj_trace = {mask = MASK_SHOT, filter = PenUpdate} + + proj_trace.start = start - side + proj_trace.endpos = start - side + fwd + + local tr = util.TraceLine(proj_trace) + + proj_trace.start = start + side + proj_trace.endpos = start + side + fwd + + local tr2 = util.TraceLine(proj_trace) + local trs = {tr, tr2} + + for _, trace in pairs(trs) do + if trace.Hit and not self.Touched[trace.Entity] then + local ent = trace.Entity + + if ent:IsValidLivingZombie() or ent.ZombieConstruction then + self.Touched[trace.Entity] = trace + temp_pen_ents[trace.Entity] = true + end + + break + end + end + end + end +end + +function ENT:Think() + -- Do this out of the physics collide hook. + + if self.Done and not self.NoColl then + local data = self.PhysicsData + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS) + self:SetPos(data.HitPos) + self:SetAngles(data.HitNormal:Angle()) + + if self.ParentEnt then + self:SetParent(self.ParentEnt) + end + + local effectdata = EffectData() + effectdata:SetOrigin(data.HitPos) + effectdata:SetNormal(data.HitNormal) + util.Effect("hit_jugger", effectdata) + + self.NoColl = true + end + + self:NextThink(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + for ent, tr in pairs(self.Touched) do + if not self.Damaged[ent] then + self.Damaged[ent] = true + + local damage = (self.ProjDamage or 100) / (table.Count(self.Damaged) ^ 0.13) + + self:DealProjectileTraceDamage(damage, tr, owner) + ent:EmitSound(math.random(2) == 1 and "weapons/crossbow/hitbod"..math.random(2)..".wav" or "ambient/machines/slicer"..math.random(4)..".wav", 75, 150) + + util.Blood(ent:WorldSpaceCenter(), math.max(0, 30 - table.Count(self.Damaged) * 2), -self:GetForward(), math.Rand(100, 300), true) + + if ent.ZombieConstruction then + self:Fire("kill", "", 0) + end + end + end + return true +end + function ENT:PhysicsCollide(data, phys) - if self.Done then return end + if self.Done or data.HitEntity.ZombieConstruction then return end self.Done = true + self.PhysicsData = data self:Fire("kill", "", 8) - - phys:EnableMotion(false) - self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav") - - self:SetPos(data.HitPos) - self:SetAngles(data.HitNormal:Angle()) + self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav", 75, 60) local hitent = data.HitEntity if hitent and hitent:IsValid() then local hitphys = hitent:GetPhysicsObject() if hitphys:IsValid() and hitphys:IsMoveable() then - self:SetParent(hitent) + self.ParentEnt = hitent end end end - -function ENT:StartTouch(ent) - if self.Done or self.Touched[ent] or not ent:IsValid() then return end - - local owner = self:GetOwner() - if not owner:IsValid() then owner = self end - - if ent == owner or ent:IsPlayer() and (ent:Team() == self.Team or not ent:Alive()) then return end - - self.Touched[ent] = true - - ent:TakeDamage(100, owner, self) - ent:EmitSound("weapons/crossbow/hitbod"..math.random(2)..".wav") -end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/shared.lua index b1555d0..ac4dbbd 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_arrow/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow/shared.lua @@ -1,5 +1,9 @@ ENT.Type = "anim" +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end + util.PrecacheModel("models/Items/CrossbowRounds.mdl") util.PrecacheSound("weapons/crossbow/bolt_fly4.wav") util.PrecacheSound("physics/metal/sawblade_stick1.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/cl_init.lua new file mode 100644 index 0000000..b512ed0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/cl_init.lua @@ -0,0 +1,52 @@ +INC_CLIENT() + +local matTrail = Material("trails/physbeam") +local colTrail = Color(140, 190, 250) +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") +local vector_origin = vector_origin + +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.5, 0.7, 1) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + if self:GetVelocity():LengthSqr() > 100 then + self:SetAngles(self:GetVelocity():Angle()) + + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 11, 11, Color(140, 190, 250)) + end + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 3, 1, 0, colTrail) + end + end +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.15 + self.TrailPositions = {} +end + +function ENT:Think() + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[1] then + table.remove(self.TrailPositions, 12) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/init.lua new file mode 100644 index 0000000..cdbc77e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/init.lua @@ -0,0 +1,63 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/Items/CrossbowRounds.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:EmitSound("weapons/crossbow/bolt_fly4.wav", 75, 130) +end + +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(hitnormal) + util.Effect("hit_charon", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + if not self:HitFence(data, phys) then + self.HitData = data + end + + self:NextThink(CurTime()) +end + +function ENT:Think() + self:NextThink(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local tr = self.Touched + + self:DealProjectileTraceDamage(self.ProjDamage or 77, tr, owner) + + tr.Entity:EmitSound(math.random(2) == 1 and "weapons/crossbow/hitbod"..math.random(2)..".wav" or "ambient/machines/slicer"..math.random(4)..".wav", 75, 150) + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Explode() + self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav", 70, 250) + self:Remove() + elseif self.HitData then + self:Explode(self.HitData.HitPos, self.HitData.HitNormal) + self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav", 70, 250) + self:Remove() + end + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/shared.lua new file mode 100644 index 0000000..ac4dbbd --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_cha/shared.lua @@ -0,0 +1,13 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end + +util.PrecacheModel("models/Items/CrossbowRounds.mdl") +util.PrecacheSound("weapons/crossbow/bolt_fly4.wav") +util.PrecacheSound("physics/metal/sawblade_stick1.wav") +util.PrecacheSound("physics/metal/sawblade_stick2.wav") +util.PrecacheSound("physics/metal/sawblade_stick3.wav") +util.PrecacheSound("weapons/crossbow/hitbod1.wav") +util.PrecacheSound("weapons/crossbow/hitbod2.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/cl_init.lua new file mode 100644 index 0000000..83546c3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/cl_init.lua @@ -0,0 +1,48 @@ +INC_CLIENT() + +local matTrail = Material("trails/laser") +local matGlow = Material("sprites/light_glow02_add") +local vector_origin = vector_origin + +function ENT:Draw() + self:DrawModel() + local alt = self:GetDTBool(0) + local col = Color(250, alt and 230 or 178, alt and 170 or 70) + + if self:GetVelocity():LengthSqr() > 100 then + self:SetAngles(self:GetVelocity():Angle()) + + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 10, 10, col) + end + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + col.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 2, 1, 0, col) + end + end +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.15 + self.TrailPositions = {} +end + +function ENT:Think() + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[12] then + table.remove(self.TrailPositions, 12) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/init.lua new file mode 100644 index 0000000..a598b51 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/init.lua @@ -0,0 +1,126 @@ +INC_SERVER() + +function ENT:Initialize() + self.Touched = {} + self.Damaged = {} + + self:SetModel("models/Items/CrossbowRounds.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.5, 0) + self:SetTrigger(true) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 10) +end + +function ENT:PhysicsCollide(data, phys) + if self.Done or data.HitEntity.ZombieConstruction then return end + if not self:HitFence(data, phys) then + self.PhysicsData = data + self.Done = true + + self:Fire("kill", "", 4) + self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav", 75, 250) + + if hitent and hitent:IsValid() then + local hitphys = hitent:GetPhysicsObject() + if hitphys:IsValid() and hitphys:IsMoveable() then + self.ParentEnt = hitent + end + end + end +end + +function ENT:PhysicsUpdate(phys) + if not self.NoColl then + local vel = self.PreVel or phys:GetVelocity() + if self.PreVel then self.PreVel = nil end + + local velnorm = vel:GetNormalized() + + local ahead = (vel:LengthSqr() * FrameTime()) / 1200 + local fwd = velnorm * ahead + local start = self:GetPos() - fwd + local side = vel:Angle():Right() * GAMEMODE.ProjectileThickness + + local proj_trace = {mask = MASK_SHOT, filter = {self, team.GetPlayers(TEAM_HUMAN)}} + + proj_trace.start = start - side + proj_trace.endpos = start - side + fwd + + local tr = util.TraceLine(proj_trace) + + proj_trace.start = start + side + proj_trace.endpos = start + side + fwd + + local tr2 = util.TraceLine(proj_trace) + local trs = {tr, tr2} + + for _, trace in pairs(trs) do + if trace.Hit and not self.Touched[trace.Entity] then + local ent = trace.Entity + + if ent:IsValidLivingZombie() or ent.ZombieConstruction then + self.Touched[trace.Entity] = trace + end + + break + end + end + end +end + +function ENT:Think() + if self.Done and not self.NoColl then + local data = self.PhysicsData + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS) + self:SetPos(data.HitPos) + self:SetAngles(data.HitNormal:Angle()) + + if self.ParentEnt then + self:SetParent(self.ParentEnt) + end + + self.NoColl = true + end + + self:NextThink(CurTime()) + + -- Do this away from the StartTouch function. It has weird race condition issues I think. + if table.Count(self.Damaged) >= 3 then return end + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + local alt = self:GetDTBool(0) + + for ent, tr in pairs(self.Touched) do + if table.Count(self.Damaged) < 3 and not self.Damaged[ent] then + self.Damaged[ent] = true + + local damage = (self.ProjDamage or 81) / table.Count(self.Damaged) + + self:DealProjectileTraceDamage(damage, tr, owner) + ent:EmitSound(math.random(2) == 1 and "weapons/crossbow/hitbod"..math.random(2)..".wav" or "ambient/machines/slicer"..math.random(4)..".wav", 75, 180) + + if alt then + local status = ent:GiveStatus("zombiestrdebuff") + status.DieTime = CurTime() + 5 + status.Applier = owner + end + + util.Blood(ent:WorldSpaceCenter(), math.max(0, 20 - table.Count(self.Damaged) * 2), -self:GetForward(), math.Rand(100, 300), true) + + if ent.ZombieConstruction then + self:Fire("kill", "", 0) + end + end + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/shared.lua new file mode 100644 index 0000000..ac4dbbd --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_inq/shared.lua @@ -0,0 +1,13 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end + +util.PrecacheModel("models/Items/CrossbowRounds.mdl") +util.PrecacheSound("weapons/crossbow/bolt_fly4.wav") +util.PrecacheSound("physics/metal/sawblade_stick1.wav") +util.PrecacheSound("physics/metal/sawblade_stick2.wav") +util.PrecacheSound("physics/metal/sawblade_stick3.wav") +util.PrecacheSound("weapons/crossbow/hitbod1.wav") +util.PrecacheSound("weapons/crossbow/hitbod2.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/cl_init.lua new file mode 100644 index 0000000..4355c13 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/cl_init.lua @@ -0,0 +1,50 @@ +INC_CLIENT() + +local matTrail = Material("trails/laser") +local colTrail = Color(255, 255, 0) +local matGlow = Material("sprites/light_glow02_add") + +local vector_origin = vector_origin + +function ENT:Draw() + self:DrawModel() + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 6, 1, 0, colTrail) + end + end + + render.SetMaterial(matGlow) + local size = 5 + (CurTime() * 8.5 % 1) * 20 + render.DrawSprite(self:GetPos(), size, size, Color(250, 210, 70)) +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.25 + self.TrailPositions = {} +end + +function ENT:Think() + if self:GetVelocity() == vector_origin and self.Trailing < CurTime() then + function self:Draw() self.Entity:DrawModel() end + function self:Think() end + else + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[18] then + table.remove(self.TrailPositions, 18) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/init.lua new file mode 100644 index 0000000..9549872 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/init.lua @@ -0,0 +1,52 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/Items/CrossbowRounds.mdl") + self:SetModelScale(0.55, 0) + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:EmitSound("weapons/crossbow/bolt_fly4.wav", 75, 125) + + self:Fire("kill", "", 15) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + + self:NextThink(CurTime()) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local source = self:ProjectileDamageSource() + + util.BlastDamagePlayer(source, owner, hitpos, 56, self.ProjDamage * 0.4, DMG_ALWAYSGIB, 0.95) + local ent = self.HitData.HitEntity + if (ent:IsValidLivingZombie() and not ent:GetZombieClassTable().NeverAlive) or ent.ZombieConstruction then + ent:TakeSpecialDamage(self.ProjDamage * 0.65, DMG_GENERIC, owner, source, hitpos) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(hitnormal) + util.Effect("HelicopterMegaBomb", effectdata) + self:EmitSound(")weapons/explode3.wav", 80, 180) +end + +function ENT:Think() + if self.HitData then + self:Explode(self.HitData.HitPos, self.HitData.HitNormal) + self:EmitSound("physics/metal/sawblade_stick"..math.random(3)..".wav", 100, 240, 0.7, CHAN_AUTO) + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/shared.lua new file mode 100644 index 0000000..36ce717 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_mini/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/cl_init.lua new file mode 100644 index 0000000..5d1d1ac --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/cl_init.lua @@ -0,0 +1,54 @@ +INC_CLIENT() + +local matWhite = Material("models/debug/debugwhite") +local matGlow = Material("sprites/light_glow02_add") + +function ENT:Draw() + local alt = self:GetDTBool(0) + local alt2 = self:GetDTBool(1) + + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(alt2 and 0.2 or 0.8, 0.7, (alt or alt2) and 1 or 0.3) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + if self:GetVelocity():LengthSqr() > 100 then + self:SetAngles(self:GetVelocity():Angle()) + + render.SetMaterial(matGlow) + + local glowcol = Color(alt2 and 50 or 140, 120, (alt or alt2) and 100 or 50, 75) + + render.DrawSprite(self:GetPos(), 15, 3, glowcol) + render.DrawSprite(self:GetPos(), 3, 15, glowcol) + end +end + +function ENT:Initialize() +end + +function ENT:Think() +end + +function ENT:OnRemove() + local pos = self:GetPos() + local alt = self:GetDTBool(0) + local alt2 = self:GetDTBool(1) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + for i=0,30 do + local particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 45) + particle:SetDieTime(0.3) + particle:SetStartAlpha(160) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 6)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(alt and 200 or 150, 165, (alt or alt2) and 205 or 90) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/init.lua new file mode 100644 index 0000000..f493aea --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/init.lua @@ -0,0 +1,38 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/Items/CrossbowRounds.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.55, 0) + self:SetupGenericProjectile(true) + + self.TimeCreated = CurTime() +end + +function ENT:Think() + self:NextThink(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local airtime = CurTime() - self.TimeCreated + local dmgmul = math.Clamp(1 + airtime * 1.2, 1, 1.6) + local alt2 = self:GetDTBool(1) + + local tr = self.Touched + + self:DealProjectileTraceDamage((self.ProjDamage or 66) * (alt2 and dmgmul or 1), tr, owner) + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:EmitSound("weapons/crossbow/hitbod"..math.random(2)..".wav", 75, 80) + self:Remove() + elseif self.HitData then + self:Remove() + end + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/shared.lua new file mode 100644 index 0000000..3e48fb7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_sli/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_arrow_cha" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/cl_init.lua new file mode 100644 index 0000000..0f6956e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/cl_init.lua @@ -0,0 +1,77 @@ +INC_CLIENT() + +local matTrail = Material("trails/electric") +local colTrail = Color(70, 255, 255) +local matGlow = Material("sprites/light_glow02_add") + +local vector_origin = vector_origin + +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.5, 0.7, 1) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 3, 1, 0, colTrail) + end + end + + local velo = self:GetVelocity() + local heading = velo:GetNormal() * -1.3 + local pos = self:GetPos() + heading * -10 + for i=1, 8 do + local dir = (VectorRand() + heading):GetNormal() + render.DrawBeam(pos, pos + dir * 24, 8, i, 2 + i, Color(90, 120, 250)) + end + + if velo:LengthSqr() > 100 then + self:SetAngles(self:GetVelocity():Angle()) + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 95, 9, Color(60, 120, 250, 255)) + render.DrawSprite(pos, 9, 95, Color(60, 120, 250, 255)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 1 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 15) + particle:SetDieTime(0.2) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(10) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(45, 90, 255) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.25 + self.TrailPositions = {} +end + +function ENT:Think() + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[24] then + table.remove(self.TrailPositions, 24) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/init.lua new file mode 100644 index 0000000..904849b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/init.lua @@ -0,0 +1,81 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/Items/CrossbowRounds.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) + self.LastPhysicsUpdate = UnPredictedCurTime() + + self.NextShoot = CurTime() + 0.05 +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = UnPredictedCurTime() - self.LastPhysicsUpdate + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -400 + phys:AddVelocity(vecDown) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + + self:NextThink(CurTime()) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local source = self:ProjectileDamageSource() + + local ent = self.HitData.HitEntity + if ent:IsValidLivingZombie() and not ent:GetZombieClassTable().NeverAlive or ent.ZombieConstruction then + ent:TakeSpecialDamage((ent:GetStatus("shockdebuff") and 1.25 or 1) * (self.ProjDamage or 125) * 0.65, DMG_SHOCK, owner, source, hitpos) + ent:EmitSound("ambient/energy/zap1.wav", 70, 240, 0.7, CHAN_AUTO) + end + + if math.random(3) == 1 then + for _, pl in pairs(util.BlastAlloc(source, owner, hitpos, 60)) do + if pl:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", pl, owner) then + local status = pl:GiveStatus("shockdebuff") + status.DieTime = CurTime() + 7 + end + end + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(hitnormal) + util.Effect("hit_zeus", effectdata) +end + +function ENT:Think() + if CurTime() > self.NextShoot then + self.NextShoot = CurTime() + 1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + local phys = self:GetPhysicsObject() + local source = self:ProjectileDamageSource() + + self:FireBulletsLua(self:GetPos() + self:GetForward() * 1, phys:GetVelocity():GetNormalized(), 0, 1, self.ProjDamage * 0.45, owner, 0.01, "tracer_zapper", BulletCallback, nil, nil, nil, nil, source) + end + + if self.HitData then + self:Explode(self.HitData.HitPos, self.HitData.HitNormal) + self:EmitSound("weapons/physcannon/superphys_small_zap1.wav", 85, 90, 1, CHAN_AUTO) + self:Remove() + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/shared.lua new file mode 100644 index 0000000..ac486d3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_arrow_zea/shared.lua @@ -0,0 +1,13 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end + +util.PrecacheModel("models/Items/CrossbowRounds.mdl") +util.PrecacheSound("weapons/crossbow/bolt_fly4.wav") +util.PrecacheSound("physics/metal/sawblade_stick1.wav") +util.PrecacheSound("physics/metal/sawblade_stick2.wav") +util.PrecacheSound("physics/metal/sawblade_stick3.wav") +util.PrecacheSound("weapons/crossbow/hitbod1.wav") +util.PrecacheSound("weapons/crossbow/hitbod2.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_asmd/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/cl_init.lua new file mode 100644 index 0000000..9d4bf68 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/cl_init.lua @@ -0,0 +1,80 @@ +INC_CLIENT() + +local matGlow = Material("effects/splashwake1") +local matGlow2 = Material("sprites/glow04_noz") +local vector_origin = vector_origin + +function ENT:Draw() + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 2 do + particle = emitter:Add(matGlow2, pos) + particle:SetVelocity(VectorRand() * 25) + particle:SetDieTime(0.1) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(20) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(155, 100, 255) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow) + render.DrawSprite(pos, 55, 55, Color(100, 100, 255, 100)) + render.SetMaterial(matGlow2) + render.DrawSprite(pos, 65, 65, Color(155, 100, 255, 100)) + render.DrawSprite(pos, 45, 45, Color(255, 255, 255, 255)) + end +end + +function ENT:OnRemove() + local pos = self:GetPos() + + sound.Play("weapons/physcannon/energy_bounce1.wav", pos, 75, math.random(75, 80)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 19 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 25) + particle:SetDieTime(0.5) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(150, 125, 255) + end + for i=0,5 do + particle = emitter:Add(matGlow2, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(35, 40)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(225, 205, 255) + end + for i=1, 45 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.6) + particle:SetColor(100, 65, 255) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetStartLength(1) + particle:SetEndLength(5) + particle:SetVelocity(VectorRand():GetNormal() * 50) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_asmd/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/init.lua new file mode 100644 index 0000000..ac7d747 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/init.lua @@ -0,0 +1,73 @@ +INC_SERVER() + +function ENT:Initialize() + self.Bounces = 0 + + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(2, 0) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 10) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local source = self:ProjectileDamageSource() + local ent = self.HitData.HitEntity + util.BlastDamagePlayer(source, owner, self:GetPos(), 50, (self.ProjDamage or 52) * 0.2, DMG_ALWAYSGIB, 0.96) + if ent:IsValidLivingZombie() and not ent:GetZombieClassTable().NeverAlive then + ent:TakeSpecialDamage((self.ProjDamage or 49) * 0.9, DMG_GENERIC, owner, source, hitpos) + end + end +end + +function ENT:ExplodeAlt() + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local source = self:ProjectileDamageSource() + util.BlastDamagePlayer(source, owner, self:GetPos(), 124, (self.ProjDamage or 52) * 2.25, DMG_ALWAYSGIB, 0.96) + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:GetPos()) + effectdata:SetNormal(self:GetForward()) + util.Effect("explosion_shockcore", effectdata) + + self:Remove() +end + +function ENT:OnTakeDamage(dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker:IsValidLivingHuman() then + local inflictor = dmginfo:GetInflictor() + + if inflictor:IsValid() and dmginfo:GetDamageType() == DMG_GENERIC and inflictor.ASMD and attacker == self:GetOwner() then + self:ExplodeAlt() + end + end +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:Think() + if self.HitData then + self:Explode(self.HitData.HitPos, self.HitData.HitNormal) + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_asmd/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/shared.lua new file mode 100644 index 0000000..d3132e5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_asmd/shared.lua @@ -0,0 +1,6 @@ +ENT.Type = "anim" +ENT.AlwaysImpactBullets = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/cl_init.lua new file mode 100644 index 0000000..e6a7069 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/cl_init.lua @@ -0,0 +1,65 @@ +INC_CLIENT() + +ENT.NextEmit = 0 +ENT.Seed = 0 + +function ENT:Initialize() + self:SetModelScale(0.2, 0) + self:DrawShadow(false) + + self.Seed = math.Rand(0, 10) +end + +local matGlow = Material("effects/splash2") +local matSplay = Material("particles/smokey") +function ENT:Draw() + local type = self:GetDTInt(5) + local c = type == 0 and Color(120, 205, 60, 70) or type == 1 and Color(205, 120, 60, 70) or Color(70, 195, 235, 70) + self:SetColor(c) + render.SetBlend(0.7) + self:DrawModel() + render.SetBlend(1) + + local pos = self:GetPos() + local add = math.sin((CurTime() + self.Seed) * 3) * 2 + + render.SetMaterial(matSplay) + render.DrawSprite(pos, 12 - add, 18 + add, c) + render.SetMaterial(matGlow) + render.DrawSprite(pos, 18 + add, 18 - add, c) +end + +function ENT:OnRemove() + local pos = self:GetPos() + local type = self:GetDTInt(5) + local c = type == 0 and Color(120, 205, 60) or type == 1 and Color(205, 120, 60) or Color(70, 195, 235) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=1, 12 do + particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(0.4) + particle:SetColor(c.r, c.g, c.b) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(3) + particle:SetEndSize(0) + particle:SetCollide(true) + particle:SetGravity(Vector(0, 0, -300)) + particle:SetVelocity(VectorRand():GetNormal() * 120) + end + for i=0,5 do + particle = emitter:Add("sprites/light_glow02_add", pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(25) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(27, 29)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(c.r, c.g, c.b) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/init.lua new file mode 100644 index 0000000..2b8d8f9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/init.lua @@ -0,0 +1,119 @@ +INC_SERVER() + +ENT.NoNails = true + +function ENT:Initialize() + self:SetModel("models/combine_helicopter/helicopter_bomb01.mdl") + self:SetColor(Color(0, 255, 0)) + self:PhysicsInitSphere(3) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.2, 0) + self:DrawShadow(false) + self:SetupGenericProjectile(true) + self:SetMaterial("models/shadertest/shader2") + + self:SetUseType(SIMPLE_USE) + self:SetTimeCreated(CurTime()) + self.LastPhysicsUpdate = UnPredictedCurTime() + + self:Fire("kill", "", math.Rand(2.5, 3.5)) + self.PostOwner = self:GetOwner() --GetOwner sets to nil on remove +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = UnPredictedCurTime() - self.LastPhysicsUpdate + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -20 + phys:AddVelocity(vecDown) +end + +function ENT:OnRemove() + if not self.Exploded and not self.PickedUp then + self:Explode() + end +end + +function ENT:Think() + if self.Stuck and (not self.Stuck:IsValid() or self.Stuck:IsPlayer() and not self.Stuck:IsValidLivingZombie()) then + self:Explode() + end + if self.Exploded and not self.PickedUp then + self:Remove() + end + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity, self.PhysicsData.OurOldVelocity) + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + self:Explode() +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local type = self:GetDTInt(5) + self:EmitSound( + type == 0 and "npc/barnacle/barnacle_gulp2.wav" or + type == 1 and "ambient/fire/mtov_flame2.wav" or + "nox/scatterfrost.ogg", + 70, type == 2 and 230 or 120, 0.75, CHAN_WEAPON + 20 + ) + self:EmitSound("vehicles/airboat/pontoon_impact_hard1.wav", 65, 250, 0.5, CHAN_WEAPON + 21) + + local owner = self.PostOwner:IsValid() and self.PostOwner or self:GetOwner() + + if owner:IsValidLivingHuman() then + local source = self:ProjectileDamageSource() + local pos = self:GetPos() + local radius = 29 + + local function InflictInRadius(func) + for _, ent in pairs(util.BlastAlloc(source, owner, pos, radius * (owner.ExpDamageRadiusMul or 1))) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) then + func(ent) + end + end + end + + if type ~= 2 and math.random(type == 0 and 9 or 12) == 1 then + InflictInRadius(function(ent) + if type == 0 then + ent.Corrosion = CurTime() + elseif type == 1 then + ent:Ignite(5) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(owner) + fire:SetPhysicsAttacker(owner) + fire.AttackerForward = owner + end + end + end + end) + elseif type == 2 then + POINTSMULTIPLIER = 1.25 + + InflictInRadius(function(ent) + ent:AddLegDamageExt(4, owner, source, SLOWTYPE_COLD) + end) + end + + util.BlastDamagePlayer(source, owner, pos, radius, self.ProjDamage or 75, DMG_ALWAYSGIB, 0.5) + + if type == 2 then + POINTSMULTIPLIER = nil + end + end +end + +function ENT:PhysicsCollide(data, physobj) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/shared.lua new file mode 100644 index 0000000..c976e36 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_biorifle/shared.lua @@ -0,0 +1,12 @@ +ENT.Type = "anim" + +ENT.IgnoreBullets = true + +AccessorFuncDT(ENT, "HitTime", "Float", 0) +AccessorFuncDT(ENT, "TimeCreated", "Float", 1) + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +util.PrecacheModel("models/combine_helicopter/helicopter_bomb01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/cl_init.lua new file mode 100644 index 0000000..5d4fb07 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/cl_init.lua @@ -0,0 +1,50 @@ +INC_CLIENT() + +function ENT:Draw() + render.SetColorModulation(0.2, 0.2, 0.2) + self:DrawModel() + render.SetColorModulation(1, 1, 1) +end + +function ENT:OnRemove() + self:EmitSound("items/suitchargeok1.wav", 75, 80) + + local pos = self:GetPos() + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + for i = 1, 10 do + local axis = AngleRand() + for j=1, 40 do + axis.roll = axis.roll + 8 + offset = axis:Up() + + particle = emitter:Add("sprites/glow04_noz", pos + offset) + particle:SetVelocity(offset * math.Rand(300, 400)) + particle:SetGravity(Vector(0, 0, -300)) + particle:SetColor(255, 90, 90) + particle:SetAirResistance(200) + particle:SetDieTime(math.Rand(1.95, 2.5)) + particle:SetStartAlpha(205) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(6, 10)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetCollide(true) + end + + for j=1, 5 do + particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(VectorRand() * 8) + particle:SetColor(255, 60, 60) + particle:SetDieTime(2) + particle:SetStartAlpha(0) + particle:SetEndAlpha(255) + particle:SetStartSize(24) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + end + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/init.lua new file mode 100644 index 0000000..c4794dc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/init.lua @@ -0,0 +1,65 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_lab/labpart.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.42, 0) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(1) + phys:SetBuoyancyRatio(0.01) + phys:SetDamping(1.5, 4) + phys:EnableDrag(false) + phys:Wake() + end +end + +function ENT:Think() + if self.PhysicsData then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal) + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + self:Fire("kill", "", 0.01) + + local owner = self:GetOwner() + + hitpos = hitpos or self:GetPos() + if not hitnormal then + hitnormal = self:GetVelocity():GetNormalized() * -1 + end + + if owner:IsValidLivingHuman() then + for _, ent in pairs(ents.FindInSphere(hitpos, self.Radius * (owner.CloudRadius or 1))) do + if ent and ent:IsValidLivingHuman() and WorldVisible(hitpos, ent:NearestPoint(hitpos)) then + ent:SetBloodArmor(math.min(ent:GetBloodArmor() + 10 * ent.BloodarmorGainMul, ent.MaxBloodArmor)) + + local strstatus = ent:GiveStatus("strengthdartboost", 8 * (owner.CloudTime or 1)) + strstatus.Applier = owner + + local defstatus = ent:GiveStatus("medrifledefboost", 12 * (owner.CloudTime or 1)) + defstatus.Applier = owner + + net.Start("zs_buffby") + net.WriteEntity(owner) + net.WriteString("Bloodshot Bomb") + net.Send(ent) + end + end + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/shared.lua new file mode 100644 index 0000000..b92e642 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bloodshot/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +ENT.Radius = 75 + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/cl_init.lua new file mode 100644 index 0000000..b02bc8f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/cl_init.lua @@ -0,0 +1,24 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetModelScale(0.2, 0) + self:SetMaterial("models/props_combine/masterinterface01c") + self:DrawShadow(false) +end + +local matGlow = Material("sprites/glow04_noz") +function ENT:Draw() + local alt = self:GetDTBool(0) + local charge = self:GetCharge() + local c = Color(alt and 100 or 255 * charge, alt and 205 or 0 * charge, alt and 205 or 0 * charge) + self:SetColor(c) + self:DrawModel() + + local pos = self:GetPos() + local size = math.abs((self:GetCharge() == 1 and 1 or 0) * 34 * math.sin(CurTime() * 12)) + + render.SetMaterial(matGlow) + render.DrawSprite(pos, size, size, c) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/init.lua new file mode 100644 index 0000000..326a137 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/init.lua @@ -0,0 +1,192 @@ +INC_SERVER() + +ENT.NoNails = true + +function ENT:Initialize() + self:SetModel("models/combine_helicopter/helicopter_bomb01.mdl") + self:SetColor(Color(255, 0, 0)) + self:SetMaterial("models/props_combine/masterinterface01c") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.2, 0) + self:SetupGenericProjectile(true) + + self:SetTrigger(true) + self:DrawShadow(false) + self:SetUseType(SIMPLE_USE) + self:SetTimeCreated(CurTime()) + self.PostOwner = self:GetOwner() --GetOwner sets to nil on remove +end + +function ENT:OnRemove() + if not self.Exploded and not self.PickedUp then + self:Explode() + + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata) + if alt then + util.Effect("explosion_cold", effectdata) + end + end +end + +function ENT:Use(activator, caller) + if not self.Exploded and activator:Team() == TEAM_HUMAN and (activator == self:GetOwner() or not self:GetOwner():IsValid()) then + self.Exploded = true + self.PickedUp = true + + activator:GiveAmmo(1, "impactmine") + + net.Start("zs_ammopickup") + net.WriteUInt(1, 16) + net.WriteString("impactmine") + net.Send(activator) + + self:Remove() + end +end + +function ENT:Think() + if self.Stuck and (not self.Stuck:IsValid() or self.Stuck:IsPlayer() and not self.Stuck:IsValidLivingZombie()) then + self:Explode() + end + if self.Exploded and not self.PickedUp then + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata) + if alt then + util.Effect("explosion_cold", effectdata) + end + + self:Remove() + end + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity, self.PhysicsData.OurOldVelocity) + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + if self:GetHitTime() ~= 0 then return end + self:SetHitTime(CurTime()) + + vHitPos = vHitPos or self:GetPos() + vHitNormal = (vHitNormal or Vector(0, 0, -1)) * -1 + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Sleep() + end + + self:SetMoveType(MOVETYPE_NONE) + self:SetPos(vHitPos + vHitNormal) + + if eHitEntity:IsValid() then + self:SetSolid(SOLID_NONE) + self:AddEFlags(EFL_SETTING_UP_BONES) + self.Stuck = eHitEntity + + local followed = false + local bonecount = eHitEntity:GetBoneCount() + if bonecount and bonecount > 1 then + local boneindex = eHitEntity:NearestBone(vHitPos) + if boneindex and boneindex > 0 then + self:FollowBone(eHitEntity, boneindex) + self:SetPos(eHitEntity:GetBonePositionMatrixed(boneindex)) + followed = true + end + end + if not followed then + self:SetParent(eHitEntity) + end + end +end + +function ENT:StartTouch(ent) + if self:GetHitTime() ~= 0 or not ent:IsValid() then return end + + local owner = self:GetOwner() + + if ent == owner or not ent:IsValidLivingZombie() then return end + + self:SetHitTime(CurTime()) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Sleep() + end + + self:SetMoveType(MOVETYPE_NONE) + + if ent:IsValid() then + self:SetSolid(SOLID_NONE) + self:AddEFlags(EFL_SETTING_UP_BONES) + self.Stuck = ent + + local followed = false + local bonecount = ent:GetBoneCount() + if bonecount and bonecount > 1 then + local boneindex = ent:NearestBone(self:GetPos()) + if boneindex and boneindex > 0 then + self:FollowBone(ent, boneindex) + self:SetPos(ent:GetBonePositionMatrixed(boneindex)) + followed = true + end + end + if not followed then + self:SetParent(ent) + end + end +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local alt = self:GetDTBool(0) + local owner = self.PostOwner:IsValid() and self.PostOwner or self:GetOwner() + + if owner:IsValidLivingHuman() then + local source = self:ProjectileDamageSource() + local pos = self:GetPos() + local radius = 70 + if alt then + for _, ent in pairs(util.BlastAlloc(inflictor, owner, pos, radius * (owner.ExpDamageRadiusMul or 1))) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) then + ent:AddLegDamageExt(15 * self:GetCharge(), owner, inflictor, SLOWTYPE_COLD) + end + end + + POINTSMULTIPLIER = 1.25 + end + util.BlastDamagePlayer(source, owner, pos, radius, (self.ProjDamage or 75) * self:GetCharge(), DMG_ALWAYSGIB) + if alt then + POINTSMULTIPLIER = 1 + end + end +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) and dmginfo:GetDamage() >= 5 and bit.band(dmginfo:GetDamageType(), DMG_ACID) == 0 then + self:Explode() + end +end + +function ENT:PhysicsCollide(data, physobj) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/shared.lua new file mode 100644 index 0000000..674c690 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bomb_sticky/shared.lua @@ -0,0 +1,19 @@ +ENT.Type = "anim" + +ENT.IgnoreBullets = true +ENT.ChargeTime = 3 + +AccessorFuncDT(ENT, "HitTime", "Float", 0) +AccessorFuncDT(ENT, "TimeCreated", "Float", 1) + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() +end + +function ENT:GetCharge() + if self:GetTimeCreated() == 0 then return 0 end + + return math.Clamp(0.5 + (CurTime() - self:GetTimeCreated()) / self.ChargeTime / 2, 0, 1) +end + +util.PrecacheModel("models/combine_helicopter/helicopter_bomb01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/cl_init.lua index 3b904d3..395f0cf 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 @@ -10,13 +10,13 @@ end function ENT:Draw() self:DrawModel() - if CurTime() >= self.NextEmit and self:GetVelocity():Length() >= 16 then + if CurTime() >= self.NextEmit and self:GetVelocity():LengthSqr() >= 256 then self.NextEmit = CurTime() + 0.05 local emitter = ParticleEmitter(self:GetPos()) emitter:SetNearClip(16, 24) - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), self:GetPos()) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), self:GetPos()) particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(8, 16)) particle:SetDieTime(1) particle:SetStartAlpha(230) @@ -28,6 +28,6 @@ function ENT:Draw() particle:SetColor(255, 0, 0) particle:SetLighting(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/init.lua index 98f57f2..2d549dc 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bonemesh/init.lua @@ -1,25 +1,13 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.LifeTime = 3 function ENT:Initialize() self:SetModel("models/Gibs/HGIBS.mdl") - self:PhysicsInitSphere(13) + self:PhysicsInitSphere(10) --self:PhysicsInitSphere(13) self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) - self:SetModelScale(2.5, 0) - self:SetCustomCollisionCheck(true) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(20) - phys:SetBuoyancyRatio(0.002) - phys:EnableMotion(true) - phys:Wake() - end + self:SetModelScale(2, 0) --self:SetModelScale(2.5, 0) + self:SetupGenericProjectile(true) self:SetMaterial("models/flesh") @@ -28,8 +16,8 @@ function ENT:Initialize() end function ENT:Think() - if self.ExplodeTime <= CurTime() then - self:Explode() + if self.PhysicsData then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) end if self.DeathTime <= CurTime() then @@ -40,54 +28,38 @@ function ENT:Think() return true end -function ENT:Explode() +function ENT:Explode(hitpos, hitnormal, hitent) if self.Exploded then return end self.Exploded = true self.DeathTime = 0 - local pos = self:GetPos() local owner = self:GetOwner() if not owner:IsValid() then owner = self end - util.BlastDamageEx(self, owner, pos, 100, 15, DMG_SLASH) - local effectdata = EffectData() - effectdata:SetOrigin(pos) - util.Effect("bonemeshexplode", effectdata) + effectdata:SetOrigin(hitpos) + util.Effect("explosion_bonemesh", effectdata) - util.Blood(pos, 150, Vector(0, 0, 1), 300, true) + util.Blood(hitpos, 30, hitnormal, 300, true) - for i=1, 4 do - local ent = ents.CreateLimited("prop_playergib") - if ent:IsValid() then - ent:SetPos(pos + VectorRand() * 4) - ent:SetAngles(VectorRand():Angle()) - ent:SetGibType(math.random(3, #GAMEMODE.HumanGibs)) - ent:Spawn() - - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:SetVelocityInstantaneous(VectorRand():GetNormalized() * math.Rand(120, 620)) - phys:AddAngleVelocity(VectorRand() * 360) + for i = 1, 4 do + for _, pl in pairs(ents.FindInSphere(hitpos, 90)) do + if pl:IsValidLivingZombie() and not pl:GetStatus("zombie_regen") then + local zombieclasstbl = pl:GetZombieClassTable() + local ehp = zombieclasstbl.Boss and pl:GetMaxHealth() * 0.4 or pl:GetMaxHealth() * 1.25 + if pl:Health() <= ehp then + local status = pl:GiveStatus("zombie_regen") + if status and status:IsValid() then + status:SetHealLeft(75) + end + break + end end end end end function ENT:PhysicsCollide(data, physobj) - if 20 < data.Speed and 0.2 < data.DeltaTime then - self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 74, math.Rand(95, 105)) - end - - local ent = data.HitEntity - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() ~= TEAM_UNDEAD then - self.ExplodeTime = 0 - self:NextThink(CurTime()) - else - local normal = data.OurOldVelocity:GetNormalized() - local DotProduct = data.HitNormal:Dot(normal * -1) - - physobj:SetVelocityInstantaneous((2 * DotProduct * data.HitNormal + normal) * math.max(100, data.Speed) * 0.9) - end + self.PhysicsData = data + self:NextThink(CurTime()) end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bristle/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/cl_init.lua new file mode 100644 index 0000000..6e5108f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(240, 120, 30, 255)) +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.5, 0.6)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(36, 48)) + particle:SetLighting(true) + particle:SetColor(240, 120, 30) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bristle/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/init.lua new file mode 100644 index 0000000..a161a0d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/init.lua @@ -0,0 +1,82 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_wasteland/dockplank_chunk01d.mdl") + self:SetModelScale(0.3) + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetColor(Color(0, 255, 0, 255)) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 0.45) + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = (UnPredictedCurTime() - self.LastPhysicsUpdate) + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -75 + phys:AddVelocity(vecDown) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValid() then + if eHitEntity:IsPlayer() then + eHitEntity:TakeDamage(3, owner, self) + + local bleed = eHitEntity:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(8) + bleed.Damager = self:GetOwner() + end + if eHitEntity:Team() == TEAM_HUMAN then + local attach = eHitEntity:GetAttachment(1) + if attach and vHitPos:DistToSqr(attach.Pos) <= 324 then + eHitEntity:PlayEyePainSound() + local status = eHitEntity:GiveStatus("dimvision", 5) + if status then + status.EyeEffect = true + end + end + end + else + eHitEntity:TakeDamage(11, owner, self) + end + end +end + +function ENT:OnRemove() + local effectdata = EffectData() + effectdata:SetOrigin(self:GetPos()) + effectdata:SetNormal(self:GetVelocity():GetNormalized()) + util.Effect("hit_barb", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_bristle/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/shared.lua new file mode 100644 index 0000000..3965495 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_bristle/shared.lua @@ -0,0 +1,8 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end + +util.PrecacheModel("models/props_wasteland/dockplank_chunk01d.mdl") +util.PrecacheSound("npc/antlion_grub/squashed.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/cl_init.lua new file mode 100644 index 0000000..795e3f5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/cl_init.lua @@ -0,0 +1,54 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "ambient/gas/steam2.wav") +end + +function ENT:Think() + if not self:GetGasEmit() then return end + + self.AmbientSound:PlayEx(0.80, 250 + CurTime() % 1) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + render.SetColorModulation(0.35, 0.26, 0.41) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + + if not self:GetGasEmit() then return end + + local time = CurTime() + + if time < self.NextEmit then return end + self.NextEmit = time + 0.07 + + local particle + local pos = self:GetPos() + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + local vel = Vector(0, 0, 170) + for i=1, 7 do + local angler = AngleRand() + local dist = math.Rand(0, self.Radius) + particle = emitter:Add(math.random(2) == 1 and "particle/smokesprites_0003" or "particle/smokestack", pos) + particle:SetColor(110, 70, 110) + particle:SetVelocity(vel * math.Rand(0.5, 1) + Vector(math.cos(angler.y) * dist, math.sin(angler.y) * dist, 0)/1.21) + particle:SetGravity(vel * -0.95) + particle:SetDieTime(math.Rand(1.85, 2.4)) + particle:SetStartAlpha(math.random(150, 200)) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(math.Rand(11, 19)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetCollide(true) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/init.lua new file mode 100644 index 0000000..d821294 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/init.lua @@ -0,0 +1,66 @@ +INC_SERVER() + +ENT.TickTime = 0.6 +ENT.Ticks = 19 +ENT.Damage = 13 + +function ENT:Initialize() + self:SetModel("models/props_lab/labpart.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.42, 0) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(1) + phys:SetBuoyancyRatio(0.01) + phys:SetDamping(1.5, 4) + phys:EnableDrag(false) + phys:Wake() + end + + self:SetGasEmit(false) +end + +function ENT:Think() + if not self.Collided and self.PhysicsData then + self:Fire("corrode", "", self.TickTime) + self:Fire("kill", "", self.TickTime * self.Ticks + 0.01) + self:SetGasEmit(true) + + self.Collided = true + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end + +function ENT:AcceptInput(name, activator, caller, arg) + if name ~= "corrode" then return end + + self.Ticks = self.Ticks - 1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + local vPos = self:GetPos() + for _, ent in pairs(ents.FindInSphere(vPos, self.Radius)) do + if ent and (ent:IsValidLivingPlayer() and (ent:Team() == TEAM_UNDEAD or ent == owner)) and WorldVisible(vPos, ent:NearestPoint(vPos)) then + if owner:IsValidLivingHuman() then + ent.Corrosion = CurTime() + ent:EmitSound("player/pl_burnpain" .. math.random(1,3) .. ".wav", 65, math.random(60, 70)) + ent:TakeSpecialDamage(self.Damage, DMG_GENERIC, owner, self) + end + end + end + + if self.Ticks > 0 then + self:Fire("corrode", "", self.TickTime) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/shared.lua new file mode 100644 index 0000000..3b1bf41 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_corgasgrenade/shared.lua @@ -0,0 +1,15 @@ +ENT.Type = "anim" + +ENT.Radius = 75 + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end + +function ENT:SetGasEmit(emit) + self:SetDTBool(0, emit) +end + +function ENT:GetGasEmit() + return self:GetDTBool(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/cl_init.lua new file mode 100644 index 0000000..1c4c4d9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/cl_init.lua @@ -0,0 +1,44 @@ +INC_CLIENT() + +function ENT:Think() + if not self:GetGasEmit() then return end + + self.AmbientSound:PlayEx(0.80, 200 + CurTime() % 1) +end + +function ENT:Draw() + render.SetColorModulation(0.25, 0.46, 0.51) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + + if not self:GetGasEmit() then return end + + local time = CurTime() + + if time < self.NextEmit then return end + self.NextEmit = time + 0.07 + + local particle + local pos = self:GetPos() + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + local vel = Vector(0, 0, 170) + for i=1, 7 do + local angler = AngleRand() + local dist = math.Rand(0, self.Radius) + particle = emitter:Add(math.random(2) == 1 and "particle/smokesprites_0003" or "particle/smokestack", pos) + particle:SetColor(70, 120, 150) + particle:SetVelocity(vel * math.Rand(0.5, 1) + Vector(math.cos(angler.y) * dist, math.sin(angler.y) * dist, 0)/1.21) + particle:SetGravity(vel * -0.95) + particle:SetDieTime(math.Rand(1.85, 2.4)) + particle:SetStartAlpha(math.random(150, 200)) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(math.Rand(11, 19)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetCollide(true) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/init.lua new file mode 100644 index 0000000..0f36b0b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/init.lua @@ -0,0 +1,41 @@ +INC_SERVER() + +ENT.Ticks = 19 +ENT.Damage = 8 +ENT.LegDamage = 13 +ENT.PointsMultiplier = 1.25 + +function ENT:AcceptInput(name, activator, caller, arg) + if name ~= "corrode" then return end + + self.Ticks = self.Ticks - 1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + local vPos = self:GetPos() + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + + for _, ent in pairs(ents.FindInSphere(vPos, self.Radius)) do + if ent and (ent:IsValidLivingPlayer() and (ent:Team() == TEAM_UNDEAD or ent == owner)) and WorldVisible(vPos, ent:NearestPoint(vPos)) then + if owner:IsValidLivingHuman() then + ent:EmitSound("physics/glass/glass_impact_bullet"..math.random(4)..".wav", 70, 85) + ent:TakeSpecialDamage(self.Damage, DMG_DROWN, owner, self) + ent:AddLegDamageExt(self.LegDamage, owner, self, SLOWTYPE_COLD) + end + end + end + + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + if self.Ticks > 0 then + self:Fire("corrode", "", self.TickTime) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/shared.lua new file mode 100644 index 0000000..5ea9973 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_crygasgrenade/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_corgasgrenade" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_devourer/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/cl_init.lua new file mode 100644 index 0000000..9aebc8c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/cl_init.lua @@ -0,0 +1,95 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +local matTrail = Material("cable/rope") +local matGlow = Material("sprites/light_glow02_add") + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "npc/strider/strider_skewer1.wav") + self.Created = CurTime() +end + +function ENT:Think() + self.AmbientSound:PlayEx(1, 50 + math.min(1, CurTime() - self.Created) * 30) + + self:NextThink(CurTime()) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matWhite = Material("models/shiny") +local colGlow = Color(125, 10, 10, 120) +local colBeam = Color(75, 0, 0, 255) +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(1, 0.5, 0.3) + + local hooked = self:GetParent():IsValid() + + if hooked then + self:SetLocalPos(Vector(0, 0, -48)) + end + + self:DrawModel() + + if hooked then + self:SetLocalPos(vector_origin) + end + + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + local owner = self:GetOwner() + if not owner:IsValid() then return end + + local handpos + local hookpos = self:WorldSpaceCenter() + + if hooked then + hookpos.z = hookpos.z - 48 + end + + local boneid = (owner ~= LocalPlayer() or owner:ShouldDrawLocalPlayer()) and owner:LookupBone("ValveBiped.Bip01_R_Hand") + if boneid and boneid > 0 then + local p, a = owner:GetBonePositionMatrixed(boneid) + handpos = p + else + handpos = owner:WorldSpaceCenter() + end + + self:SetRenderBoundsWS(handpos, hookpos, 128) + + render.SetMaterial(matTrail) + render.DrawBeam(handpos, hookpos, 3, 4, 0, colBeam) + + render.SetMaterial(matGlow) + render.DrawSprite(hookpos, 35, 35, colGlow) + render.DrawSprite(handpos, 35, 35, colGlow) + + if CurTime() >= self.NextEmit and self:GetVelocity():LengthSqr() >= 256 then + self.NextEmit = CurTime() + 0.06 + + local emitter = ParticleEmitter(hookpos) + emitter:SetNearClip(16, 24) + + for i = 1, 3 do + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), hookpos) + particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(12, 22)) + particle:SetDieTime(2) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-25, 25)) + particle:SetGravity(Vector(0, 0, -100)) + particle:SetColor(150, 0, 0) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_devourer/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/init.lua new file mode 100644 index 0000000..94ef054 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/init.lua @@ -0,0 +1,79 @@ +INC_SERVER() + +local vector_origin = vector_origin + +function ENT:Initialize() + self:SetModel("models/gibs/HGIBS_rib.mdl") + self:PhysicsInitSphere(13) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(2.2, 0) + self:SetupGenericProjectile(false) + + self.DieTime = CurTime() + 1.1 + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +function ENT:PhysicsUpdate(phys) + if not self.InitVelocity then self.InitVelocity = self:GetVelocity() end + + local dt = (UnPredictedCurTime() - self.LastPhysicsUpdate) + self.LastPhysicsUpdate = UnPredictedCurTime() + + phys:AddVelocity(self.InitVelocity * dt * -1.8) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:SetCollisionGroup(COLLISION_GROUP_WORLD) + elseif self.DieTime < CurTime() then + self:Remove() + end +end + +function ENT:OnRemove() + local effectdata = EffectData() + effectdata:SetOrigin(self:GetPos()) + util.Effect("explosion_bonemesh", effectdata) +end + +function ENT:Hit(vHitPos, vHitNormal, ent) + if self.Exploded then return end + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if ent:IsValid() then + if (ent.BeingControlled or ent:IsValidLivingHuman()) and owner:IsPlayer() then + if ent:IsValidLivingHuman() then + self.Exploded = true + + ent:TakeSpecialDamage(8, DMG_GENERIC, owner, self) + ent:KnockDown() + + local status = ent:GiveStatus("devourer") + if status and status:IsValid() then + status:SetDamage(ent:HasTrinket("analgestic") and 5 or 15) + status:SetPuller(owner) + self:SetParent(status) + end + + self:GetPhysicsObject():SetVelocityInstantaneous(vector_origin) + else + local vel = owner:GetAimVector() * -2000 + ent:GetPhysicsObject():SetVelocity(vel) + end + end + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_devourer/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/shared.lua new file mode 100644 index 0000000..e0d54bc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_devourer/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end + +util.PrecacheModel("models/props_wasteland/rockgranite03b.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc/cl_init.lua new file mode 100644 index 0000000..e3c857f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc/cl_init.lua @@ -0,0 +1,32 @@ +INC_CLIENT() + +local matGlow = Material("sprites/glow04_noz") + +function ENT:Draw() + render.SetColorModulation(0, 0.608, 1) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 1 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.4) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(6) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(110, 210, 255) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function ENT:Initialize() + self:SetModelScale(0.3, 0) + self:DrawShadow(false) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc/init.lua new file mode 100644 index 0000000..e564654 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc/init.lua @@ -0,0 +1,63 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModelScale(0.3, 0) + self:DrawShadow(false) + self:SetModel("models/props_junk/sawblade001a.mdl") + self:PhysicsInitSphere(3) + self:SetMoveType(MOVETYPE_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 0.3) + + self.NextShoot = 0 + self.PostOwner = self:GetOwner() +end + +function ENT:Think() + if self.PhysicsData then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end +end + +function ENT:PhysicsCollide(data, physobj) + self.PhysicsData = data + self:NextThink(CurTime()) +end + +function ENT:OnRemove() + local hitpos = self.PhysicsData and self.PhysicsData.HitPos or self:GetPos() + local normal = self.PhysicsData and self.PhysicsData.HitNormal or Vector(0, 0, 1) + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(normal) + util.Effect("explosion_fusordisc", effectdata) + + local owner = self.PostOwner + if not owner:IsValidLivingHuman() then owner = self end + + local oldvel = self.PhysicsData and self.PhysicsData.OurOldVelocity or self:GetVelocity() + + local backvel = oldvel:GetNormalized() + local pos = self:GetPos() - backvel * 10 + local dmg = self.ProjDamage + local me = self:ProjectileDamageSource() + + for i = 1, 8 do + timer.Simple(i * 0.05, function() + backvel.z = backvel.z + 0.001 * i + backvel = backvel:GetNormalized() + + self:FireBulletsLua(pos, -backvel, 1, 1, dmg/2, owner, 0.01, "tracer_fusor", BulletCallback, nil, nil, nil, nil, me) + end) + end +end + +function ENT:Explode(hitpos, normal, hitent) + if self.Exploded then return end + self.Exploded = true + + self:Remove() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc/shared.lua new file mode 100644 index 0000000..3a09b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end + +util.PrecacheModel("models/props_junk/sawblade001a.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/cl_init.lua new file mode 100644 index 0000000..f2314ca --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/cl_init.lua @@ -0,0 +1,12 @@ +INC_CLIENT() + +function ENT:Draw() + render.SetColorModulation(0.65, 0.65, 0.65) + self:DrawModel() + render.SetColorModulation(1, 1, 1) +end + +function ENT:Initialize() + self:SetModelScale(0.3, 0) + self:DrawShadow(false) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/init.lua new file mode 100644 index 0000000..7d3242e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/init.lua @@ -0,0 +1,53 @@ +INC_SERVER() + +function ENT:Initialize() + self.Bounces = self.Secondary and 4 or 0 + + self:SetModel("models/props_junk/sawblade001a.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.25, 0) + self:SetMoveType(MOVETYPE_VPHYSICS) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 3) +end + +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + + if self.Bounces <= 3 and data.HitEntity and data.HitEntity:IsWorld() then + local normal = data.OurOldVelocity:GetNormalized() + phys:SetVelocityInstantaneous((2 * data.HitNormal * data.HitNormal:Dot(normal * -1) + normal) * 1500) + + self:EmitSound("physics/metal/sawblade_stick3.wav", 70, 250) + + self.Bounces = self.Bounces + 1 + else + self.HitData = data + end + + self:NextThink(CurTime()) +end + +function ENT:Think() + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + local tr = self.Touched + + self.Damaged = true + self:DealProjectileTraceDamage(self.ProjDamage or 77, tr, owner) + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Remove() + elseif self.HitData then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/shared.lua new file mode 100644 index 0000000..dc91243 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_disc_razor/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end + +util.PrecacheModel("models/props_junk/sawblade001a.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/cl_init.lua new file mode 100644 index 0000000..63e2f09 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/cl_init.lua @@ -0,0 +1,48 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(0, 230, 0, 255)) + self:SetMaterial("models/flesh") + + self.AmbientSound = CreateSound(self, "ambient/gas/steam_loop1.wav") + self.Created = CurTime() +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.75, 90 - math.min(2, CurTime() - self.Created) * 20) + + self:NextThink(CurTime()) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.1 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.8, 1)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 20)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(30, 255, 30) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/init.lua new file mode 100644 index 0000000..8952197 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/init.lua @@ -0,0 +1,75 @@ +INC_SERVER() + +function ENT:Initialize() + self.DeathTime = CurTime() + 30 + + self:SetModel("models/Roller.mdl") + self:SetMaterial("models/flesh") + self:SetColor(Color(0, 230, 0, 255)) + + self:PhysicsInitSphere(10) + self:SetSolid(SOLID_VPHYSICS) + + self:SetupGenericProjectile(false) + + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = UnPredictedCurTime() - self.LastPhysicsUpdate + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -100 + phys:AddVelocity(vecDown) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.DeathTime <= CurTime() then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("explosion_doomball", effectdata) + + -- Massive damage to drones and manhacks. + if eHitEntity and eHitEntity:IsValid() then + eHitEntity:TakeDamage(eHitEntity.BeingControlled and 200 or 25, owner, self) + + if eHitEntity.FizzleStatusAOE then return end + end + + for _, ent in pairs(util.BlastAlloc(self, owner, vHitPos, 128)) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + ent:GiveStatus("dimvision", 10) + local gt = ent:GiveStatus("enfeeble", 5) + if gt and gt:IsValid() then + gt.Applier = owner + end + ent:GiveStatus("slow", 5) + end + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/shared.lua new file mode 100644 index 0000000..3334048 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_doomcrab/shared.lua @@ -0,0 +1,8 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end + +util.PrecacheModel("models/props/cs_italy/orange.mdl") +util.PrecacheSound("npc/antlion_grub/squashed.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/cl_init.lua new file mode 100644 index 0000000..3062466 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/cl_init.lua @@ -0,0 +1,35 @@ +INC_CLIENT() + +local matGlow = Material("effects/splashwake1") +local matGlow2 = Material("sprites/glow04_noz") +local vector_origin = vector_origin + +function ENT:Draw() + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 6, 7, Color(55, 100, 255, 100)) + render.SetMaterial(matGlow2) + render.DrawSprite(self:GetPos(), 8, 8, Color(255, 255, 255, 255)) + end +end + +function ENT:OnRemove() + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 19 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 25) + particle:SetDieTime(0.5) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(100, 125, 255) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/init.lua new file mode 100644 index 0000000..0c875c2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/init.lua @@ -0,0 +1,51 @@ +INC_SERVER() + +ENT.PointsMultiplier = 1.25 + +function ENT:Initialize() + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.25, 0) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 1) +end + +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:Think() + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local tr = self.Touched + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + self:DealProjectileTraceDamage(self.ProjDamage or 19, tr, owner) + if tr.Entity:IsPlayer() then + tr.Entity:AddLegDamageExt(5.5, owner, source, SLOWTYPE_PULSE) + end + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Remove() + elseif self.HitData then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/shared.lua new file mode 100644 index 0000000..4c53290 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_drone_pulse/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi/cl_init.lua new file mode 100644 index 0000000..e2224d0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi/cl_init.lua @@ -0,0 +1,67 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:Initialize() + self:DrawShadow(false) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + + self.AmbientSound = CreateSound(self, "ambient/energy/force_field_loop1.wav") +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.2, math.max(60, 230 - EyePos():Distance(self:GetPos()) * 0.12)) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.8, 0.8, 0.8) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.ModelMaterialOverride(nil) + + local pos = self:GetPos() + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 34, 34) + + render.SetColorModulation(1, 1, 1) + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.075 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + local base_ang = (self:GetVelocity() * -1):Angle() + local ang = Angle() + for i=1, 2 do + ang:Set(base_ang) + ang:RotateAroundAxis(ang:Right(), math.Rand(-30, 30)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-30, 30)) + + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(2) + particle:SetVelocity(ang:Forward() * math.Rand(12, 14)) + particle:SetColor(210, 210, 210) + particle:SetAirResistance(24) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi/init.lua new file mode 100644 index 0000000..8b60430 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi/init.lua @@ -0,0 +1,63 @@ +INC_SERVER() + +ENT.SubProjectile = "projectile_emi_sub" + +function ENT:Initialize() + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.4) + self:SetupGenericProjectile(false) + + self:EmitSound("weapons/physcannon/energy_sing_flyby2.wav", 70, math.random(125, 135)) + self:Fire("kill", "", 1.3) + + self.NextShoot = 0 +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:Remove() + end + + if CurTime() > self.NextShoot then + self.NextShoot = CurTime() + 0.1 + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then owner = self end + + self:FireBulletsLua(self:GetPos() + self:GetForward() * 10, self:GetForward(), 5, 1, self.ProjDamage, owner, 0.01, "tracer_pcutter", BulletCallback, nil, nil, nil, nil, self) + end +end + +function ENT:OnRemove() + self:Hit(self:GetPos(), Vector(0, 0, 1), NULL) +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("explosion_emi", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi/shared.lua new file mode 100644 index 0000000..15fe75f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +util.PrecacheModel("models/Combine_Helicopter/helicopter_bomb01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/cl_init.lua new file mode 100644 index 0000000..de62359 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/cl_init.lua @@ -0,0 +1,70 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +local matGlow = Material("sprites/light_glow02_add") + +function ENT:Initialize() + self:DrawShadow(false) +end + +local matWhite = Material("models/debug/debugwhite") +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.ModelMaterialOverride(nil) + + local pos = self:GetPos() + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 32, 32) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + + for i=0, 1 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.2) + particle:SetStartAlpha(175) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(110, 110, 110) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function ENT:Think() +end +function ENT:OnRemove() + local pos = self:GetPos() + + sound.Play("weapons/physcannon/energy_sing_explosion2.wav", pos, 65, math.Rand(245, 250)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + + for i=0,4 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.4) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(34, 36)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(255, 255, 255) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/init.lua new file mode 100644 index 0000000..4141185 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/init.lua @@ -0,0 +1,45 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(4) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.55, 0) + self:SetupGenericProjectile(false) + + self:EmitSound("weapons/physcannon/energy_sing_flyby2.wav", 70, math.random(245, 255)) + self:Fire("kill", "", 5.75) + self.Creation = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local livetime = UnPredictedCurTime() - self.Creation + local vel = phys:GetVelocity() + + vecDown.x = vel.x * 0.95 + vecDown.y = vel.y * 0.95 + vecDown.z = (200 + livetime * -300) + math.sin(self.Rot + livetime * 10) * 250 + + phys:SetVelocityInstantaneous(vecDown) +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if owner:IsValidLivingHuman() then + local source = self:ProjectileDamageSource() + if eHitEntity and eHitEntity:IsValid() then + eHitEntity:TakeSpecialDamage((self.ProjDamage or 25) * (owner.ProjectileDamageMul or 1), DMG_DISSOLVE, owner, source, hitpos) + + util.BlastDamagePlayer(source, owner, vHitPos + vHitNormal, 67, self.ProjDamage/2, DMG_DISSOLVE) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/shared.lua new file mode 100644 index 0000000..8d5eefa --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_emi_sub/shared.lua @@ -0,0 +1,3 @@ +ENT.Base = "projectile_emi" + +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/cl_init.lua new file mode 100644 index 0000000..e9409f1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/cl_init.lua @@ -0,0 +1,48 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(255, 255, 0, 255)) + self:SetMaterial("models/flesh") + + self.AmbientSound = CreateSound(self, "ambient/gas/steam_loop1.wav") + self.Created = CurTime() +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.75, 90 - math.min(2, CurTime() - self.Created) * 20) + + self:NextThink(CurTime()) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.1 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.8, 1)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 20)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(255, 105, 0) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/init.lua new file mode 100644 index 0000000..326ba82 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/init.lua @@ -0,0 +1,74 @@ +INC_SERVER() + +function ENT:Initialize() + self.DeathTime = CurTime() + 30 + + self:SetModel("models/roller.mdl") + self:SetMaterial("models/flesh") + self:SetColor(Color(255, 255, 0, 255)) + + self:PhysicsInitSphere(10) + self:SetSolid(SOLID_VPHYSICS) + + self:SetupGenericProjectile(false) + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = UnPredictedCurTime() - self.LastPhysicsUpdate + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -100 + phys:AddVelocity(vecDown) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.DeathTime <= CurTime() then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("explosion_extinctionspore", effectdata) + + -- Massive damage to drones and manhacks. + if eHitEntity and eHitEntity:IsValid() then + eHitEntity:TakeDamage(eHitEntity.BeingControlled and 200 or 25, owner, self) + + if eHitEntity.FizzleStatusAOE then return end + end + + for _, ent in pairs(util.BlastAlloc(self, owner, vHitPos, 128)) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + ent:GiveStatus("sickness", 10) + local gt = ent:GiveStatus("enfeeble", 5) + if gt and gt:IsValid() then + gt.Applier = owner + end + ent:GiveStatus("frightened", 3) + end + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/shared.lua new file mode 100644 index 0000000..44b98c6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_extinctioncrab/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end + +util.PrecacheModel("models/roller.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flak/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flak/cl_init.lua new file mode 100644 index 0000000..1767670 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flak/cl_init.lua @@ -0,0 +1,52 @@ +INC_CLIENT() + +local matTrail = Material("trails/laser") +local colTrail = Color(255, 205, 120) +local matGlow2 = Material("sprites/glow04_noz") +local matWhite = Material("models/debug/debugwhite") +local vector_origin = vector_origin + +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.7, 0.5, 0.2) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow2) + render.DrawSprite(self:GetPos(), 10, 10, Color(255, 205, 100, 18)) + end + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 5, 1, 0, colTrail) + end + end +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.1 + self.TrailPositions = {} +end + +function ENT:Think() + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[1] then + table.remove(self.TrailPositions, 7) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flak/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flak/init.lua new file mode 100644 index 0000000..93b48b0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flak/init.lua @@ -0,0 +1,60 @@ +INC_SERVER() + +function ENT:Initialize() + self.Bounces = 0 + + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.05, 0) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 2) +end + +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + + if self.Bounces <= 1 and data.HitEntity and data.HitEntity:IsWorld() then + local normal = data.OurOldVelocity:GetNormalized() + phys:SetVelocityInstantaneous((2 * data.HitNormal * data.HitNormal:Dot(normal * -1) + normal) * 500) + + self:EmitSound("physics/metal/metal_box_impact_bullet3.wav", 65, 250) + + self.Bounces = self.Bounces + 1 + else + self.HitData = data + end + + self:NextThink(CurTime()) +end + +function ENT:Think() + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local tr = self.Touched + + self:DealProjectileTraceDamage((self.ProjDamage or 22)/(self.Bounces + 1), tr, owner) + util.Blood(tr.HitPos, math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Remove() + elseif self.HitData then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flak/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flak/shared.lua new file mode 100644 index 0000000..4c53290 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flak/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/cl_init.lua new file mode 100644 index 0000000..4c7a78b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/cl_init.lua @@ -0,0 +1,54 @@ +INC_CLIENT() + +local matGlow = Material("sprites/light_glow02_add") + +function ENT:Initialize() + self:SetModelScale(0.33, 0) + self:SetColor(Color(205, 135, 110)) + self:DrawShadow(false) +end + +function ENT:OnRemove() + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 25 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 275) + particle:SetDieTime(0.5) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(7, 9)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 155, 30) + end + for i=0,5 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(127, 129)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 175, 60) + end + for i=1, 75 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.6) + particle:SetColor(255, 130, 0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetStartLength(1) + particle:SetEndLength(15) + particle:SetVelocity(VectorRand():GetNormal() * 200) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/init.lua new file mode 100644 index 0000000..36c01e7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/init.lua @@ -0,0 +1,76 @@ +INC_SERVER() + +ENT.LifeTime = 3 +ENT.SubProjectile = "projectile_flak" +ENT.SubCallback = function(ent) end + +function ENT:Initialize() + self:SetModel("models/combine_helicopter/helicopter_bomb01.mdl") + self:SetColor(Color(205, 135, 110)) + self:PhysicsInitSphere(4) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.33, 0) + self:DrawShadow(false) + self:SetupGenericProjectile(true) + + self.ExplodeTime = CurTime() + self.LifeTime +end + +function ENT:Think() + if self.ExplodeTime <= CurTime() then + self:Explode(self:GetPos()) + end + if self.PhysicsData then + self:Explode(self:GetPos(), self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Explode(hitpos, hitnormal, hitent) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + hitnormal = hitnormal or Vector(0, 0, 1) + local upmulti = hitent and 1 or math.Clamp(-hitnormal.z, 0, 1) + + if owner:IsValidLivingHuman() then + local source = self:ProjectileDamageSource() + util.BlastDamagePlayer(source, owner, hitpos, 81, (self.ProjDamage or 27) * 4, DMG_ALWAYSGIB, 0.95) + end + + for i = 0, 6 do + local ent = ents.Create(self.SubProjectile) + if ent:IsValid() then + ent:SetPos(self:GetPos() - hitnormal * 12 * upmulti) + ent:SetAngles(self:GetAngles()) + ent:SetOwner(owner) + ent.ProjDamage = self.ProjDamage * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self.ProjSource + ent.Team = self.Team + + self.SubCallback(ent) + + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + local angle = Angle(0, 0, 0) + angle:RotateAroundAxis(angle:Up(), math.random(360)) + phys:SetVelocityInstantaneous(angle:Forward() * 175 + Vector(0, 0, 200) * upmulti - hitnormal * 90) + end + end + end + + self:EmitSound(")weapons/explode5.wav", 80, 110) + self:Remove() +end + +function ENT:PhysicsCollide(data, physobj) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/shared.lua new file mode 100644 index 0000000..4a9a968 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flakbomb/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +util.PrecacheModel("models/combine_helicopter/helicopter_bomb01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/cl_init.lua new file mode 100644 index 0000000..ec75c1d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/cl_init.lua @@ -0,0 +1,30 @@ +INC_CLIENT() + +ENT.NextTickSound = 0 +ENT.LastTickSound = 0 + +function ENT:Initialize() + self.DieTime = CurTime() + self.LifeTime +end + +function ENT:Think() + local curtime = CurTime() + + if curtime >= self.NextTickSound then + local delta = self.DieTime - curtime + + self.NextTickSound = curtime + math.max(0.15, delta * 0.25) + self.LastTickSound = curtime + self:EmitSound("npc/roller/mine/rmine_blip1.wav", 75, math.Clamp((1 - delta / self.LifeTime) * 220, 150, 220)) + end +end + +local matGlow = Material("sprites/glow04_noz") +function ENT:DrawTranslucent() + self:DrawModel() + + if math.abs(self.LastTickSound - CurTime()) >= 0.05 then return end + + render.SetMaterial(matGlow) + render.DrawSprite(self:LocalToWorld(Vector(0, 0, 4)), 12, 12, COLOR_CYAN) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/init.lua new file mode 100644 index 0000000..854e171 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/init.lua @@ -0,0 +1,68 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/weapons/w_eq_flashbang_thrown.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetMass(1) + phys:SetMaterial("metal") + end + + self.DieTime = CurTime() + self.LifeTime + self:NextThink(self.DieTime) +end + +function ENT:PhysicsCollide(data, phys) + if 20 < data.Speed and 0.25 < data.DeltaTime then + self:EmitSound("weapons/flashbang/grenade_hit1.wav") + end +end + +function ENT:Think() + if CurTime() >= self.DieTime then + self:Remove() + end +end + +function ENT:OnRemove() + self:Explode() +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + local pos = self:GetPos() + + for _, ent in pairs(ents.FindInSphere(pos, self.Radius)) do + if ent:IsValid() and ent:IsPlayer() and ent:Alive() and (ent:Team() == TEAM_UNDEAD or ent == owner) then + local eyepos = ent:EyePos() + if TrueVisibleFilters(pos, eyepos, self, ent) then + local eyevec = ent:GetAimVector() + local strength = (1 - eyepos:Distance(pos) / self.Radius) ^ 0.5 * (0.3 + math.Clamp((pos - eyepos):GetNormalized():Dot(eyevec), 0, 1) * 0.7) + + ent:AddLegDamage(strength) + local time = (0.5 + strength * 1.5) * (ent.VisionAlterDurationMul or 1) + ent:ScreenFade(SCREENFADE.IN, nil, time, time) + ent:SetDSP(36) + if strength > 0.4 then ent:GiveStatus("disorientation", time * 2) end + + if ent:Team() == TEAM_UNDEAD then + ent:TakeDamage(1, owner, self) + end + end + end + end + + self:EmitSound("weapons/flashbang/flashbang_explode2.wav") + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("HelicopterMegaBomb", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/shared.lua new file mode 100644 index 0000000..c89905d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_flashbomb/shared.lua @@ -0,0 +1,10 @@ +ENT.Type = "anim" + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.LifeTime = 1.5 +ENT.Radius = 510 + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/cl_init.lua new file mode 100644 index 0000000..966908a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(255, 255, 0, 255)) +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.4, 0.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(255, 255, 0) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/init.lua new file mode 100644 index 0000000..98b73df --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/init.lua @@ -0,0 +1,51 @@ +INC_SERVER() + +function ENT:Initialize() + self.DeathTime = CurTime() + 30 + + self:SetModel("models/props/cs_italy/orange.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetColor(Color(255, 255, 0, 255)) + self:SetupGenericProjectile(true) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.DeathTime <= CurTime() then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", eHitEntity, owner) then + eHitEntity:GiveStatus("slow", 5) + eHitEntity:AddLegDamage(2) + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_flesh", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/shared.lua new file mode 100644 index 0000000..9539e7a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulflesh/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/cl_init.lua new file mode 100644 index 0000000..bbba22b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/cl_init.lua @@ -0,0 +1,34 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(0, 125, 255, 255)) + self:SetMaterial("models/seagull/seagull") +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.4, 0.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(0, 125, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/init.lua new file mode 100644 index 0000000..b2dabba --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/init.lua @@ -0,0 +1,51 @@ +INC_SERVER() + +function ENT:Initialize() + self.DeathTime = CurTime() + 30 + + self:SetModel("models/props/cs_italy/orange.mdl") + self:SetMaterial("models/seagull/seagull") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetColor(Color(0, 125, 255, 255)) + self:SetupGenericProjectile(true) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.DeathTime <= CurTime() then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", eHitEntity, owner) then + eHitEntity:GiveStatus("frost", 5) + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_frost", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/shared.lua new file mode 100644 index 0000000..9539e7a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshchilled/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/cl_init.lua new file mode 100644 index 0000000..589fe64 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/cl_init.lua @@ -0,0 +1,34 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(120, 85, 195, 255)) + self:SetMaterial("models/seagull/seagull") +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.4, 0.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(190, 125, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/init.lua new file mode 100644 index 0000000..f10d0b4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/init.lua @@ -0,0 +1,24 @@ +INC_SERVER() + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", eHitEntity, owner) then + eHitEntity:GiveStatus("frost", 5) + eHitEntity:GiveStatus("dimvision", 3) + eHitEntity:AddArmDamage(18) + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_frost", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/shared.lua new file mode 100644 index 0000000..2a5ea30 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshfr/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_ghoulfleshchilled" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/cl_init.lua new file mode 100644 index 0000000..6436e52 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/cl_init.lua @@ -0,0 +1,34 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(200, 135, 165, 255)) + self:SetMaterial("models/seagull/seagull") +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.4, 0.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(200, 135, 165) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/init.lua new file mode 100644 index 0000000..4ae3842 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/init.lua @@ -0,0 +1,24 @@ +INC_SERVER() + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", eHitEntity, owner) then + eHitEntity:GiveStatus("slow", 5) + eHitEntity:GiveStatus("sickness", 5) + eHitEntity:AddLegDamage(6) + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_flesh", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/shared.lua new file mode 100644 index 0000000..2a5ea30 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshno/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_ghoulfleshchilled" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/cl_init.lua new file mode 100644 index 0000000..03d75c6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/cl_init.lua @@ -0,0 +1,34 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:SetColor(Color(255, 255, 145, 255)) + self:SetMaterial("models/seagull/seagull") +end + +function ENT:Draw() + self:DrawModel() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.025 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(math.Rand(0.4, 0.5)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(3, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetVelocity((self:GetVelocity():GetNormalized() * -1 + VectorRand():GetNormalized()):GetNormalized() * math.Rand(16, 48)) + particle:SetLighting(true) + particle:SetColor(190, 125, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/init.lua new file mode 100644 index 0000000..2da514d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/init.lua @@ -0,0 +1,22 @@ +INC_SERVER() + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", eHitEntity, owner) then + eHitEntity:GiveStatus("sickness", 10) + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_flesh", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/shared.lua new file mode 100644 index 0000000..2a5ea30 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_ghoulfleshpuke/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_ghoulfleshchilled" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/cl_init.lua new file mode 100644 index 0000000..cc69e27 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/cl_init.lua @@ -0,0 +1,69 @@ +INC_CLIENT() + +local matGlow = Material("sprites/light_glow02_add") + +function ENT:Initialize() + self:SetModelScale(0.2, 0) + self:SetColor(Color(255, 255, 100)) + self:DrawShadow(false) +end + +function ENT:OnRemove() + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 25 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 275) + particle:SetDieTime(0.5) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(7, 9)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 155, 30) + end + for i=1, 16 do + particle = emitter:Add("effects/fire_embers"..math.random(1, 3), pos) + particle:SetVelocity(VectorRand():GetNormal() * 250) + particle:SetDieTime(math.Rand(1.25, 1.5)) + particle:SetStartAlpha(130) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 19)) + particle:SetEndSize(1) + particle:SetRoll(math.Rand(0, 359)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetAirResistance(50) + particle:SetCollide(true) + particle:SetBounce(0.3) + particle:SetGravity(Vector(0,0,-400)) + end + for i=0,5 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(127, 129)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 175, 60) + end + for i=1, 75 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.6) + particle:SetColor(255, 130, 0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetStartLength(1) + particle:SetEndLength(15) + particle:SetVelocity(VectorRand():GetNormal() * 200) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/init.lua new file mode 100644 index 0000000..e2b897f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/init.lua @@ -0,0 +1,62 @@ +INC_SERVER() + +ENT.LifeTime = 3 + +function ENT:Initialize() + self:SetModel("models/combine_helicopter/helicopter_bomb01.mdl") + self:SetColor(Color(255, 255, 0)) + self:PhysicsInitSphere(3) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.2, 0) + self:DrawShadow(false) + self:SetupGenericProjectile(true) + + self.Bounces = 2 + self.ExplodeTime = CurTime() + self.LifeTime + self.Grace = CurTime() + 0.1 +end + +function ENT:Think() + if self.ExplodeTime <= CurTime() then + self:Explode(self:GetPos()) + end + if self.PhysicsData then + if self.Bounces <= 0 or self.PhysicsData.HitEntity:IsPlayer() or self.PhysicsData.HitEntity.ZombieConstruction then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + local phys = self.PhysicsData.PhysObject + if phys:IsValid() then + local hitnormal = self.PhysicsData.HitNormal + local vel = self.PhysicsData.OurOldVelocity + local normal = vel:GetNormalized() + phys:SetVelocityInstantaneous((2 * hitnormal * hitnormal:Dot(normal * -1) + normal) * vel:Length() * 0.8) + end + if CurTime() >= self.Grace then + self.Bounces = self.Bounces -1 + end + self.PhysicsData = nil + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Explode(hitpos, hitnormal, hitent) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + + if owner:IsValidLivingHuman() then + local source = self:ProjectileDamageSource() + util.BlastDamagePlayer(source, owner, hitpos, 81, self.ProjDamage or 29, DMG_ALWAYSGIB, 0.95) + end + + self:EmitSound(")weapons/explode5.wav", 80, 130) + self:Remove() +end + +function ENT:PhysicsCollide(data, physobj) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/shared.lua new file mode 100644 index 0000000..4a9a968 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_grenade_bouncy/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +util.PrecacheModel("models/combine_helicopter/helicopter_bomb01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/cl_init.lua new file mode 100644 index 0000000..c7052dc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/cl_init.lua @@ -0,0 +1,5 @@ +INC_CLIENT() + +function ENT:Draw() + self:DrawModel() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/init.lua new file mode 100644 index 0000000..006d93b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/init.lua @@ -0,0 +1,86 @@ +INC_SERVER() + +function ENT:Initialize() + self.Touched = {} + self.OriginalAngles = self:GetAngles() + + self:SetModel("models/props_junk/harpoon002a.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 30) + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(35, 45)) + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +function ENT:PhysicsUpdate(phys) + self.LastPhysicsUpdate = UnPredictedCurTime() + local vel = phys:GetVelocity() + phys:SetAngles(phys:GetVelocity():Angle()) + phys:SetVelocityInstantaneous(vel) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.OurOldVelocity, self.PhysicsData.HitEntity) + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Hit(vHitPos, vHitNormal, vel, hitent) + if self.Done then return end + self.Done = true + + local owner = self:GetOwner() + + if hitent and hitent:IsValid() and hitent:IsPlayer() then + hitent:AddLegDamage(30) + + local ent = ents.Create("prop_harpoon") + if ent:IsValid() then + ent:SetPos(vHitPos) + ent.BaseWeapon = self.BaseWeapon + ent.BleedPerTick = 2 + ent:Spawn() + ent:SetOwner(self:GetOwner()) + ent:SetParent(hitent) + ent:SetAngles(self:GetAngles()) + end + + hitent:TakeSpecialDamage(self.ProjDamage or 45, DMG_GENERIC, owner, self, self:GetPos()) + hitent:EmitSound("npc/strider/strider_skewer1.wav", 70, 112) + else + local ang = self:GetAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + local ent = ents.Create("prop_weapon") + if ent:IsValid() then + ent:SetWeaponType(self.BaseWeapon) + ent:SetPos(self:GetPos()) + ent:SetAngles(ang) + ent:Spawn() + + if owner:IsValidHuman() then + ent.NoPickupsTime = CurTime() + 15 + ent.NoPickupsOwner = self:GetOwner() + end + + local physob = ent:GetPhysicsObject() + if physob:IsValid() then + physob:Wake() + physob:SetVelocityInstantaneous(vel) + end + end + + self:EmitSound("physics/metal/metal_sheet_impact_bullet"..math.random(2)..".wav", 70, math.random(90, 95)) + end + + self:Remove() +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/shared.lua new file mode 100644 index 0000000..860eddc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon/shared.lua @@ -0,0 +1,13 @@ +ENT.Type = "anim" + +ENT.NoReviveFromKills = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end + +util.PrecacheModel("models/props_junk/harpoon002a.mdl") +util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav") +util.PrecacheSound("physics/metal/metal_sheet_impact_bullet1.wav") +util.PrecacheSound("physics/metal/metal_sheet_impact_bullet2.wav") +util.PrecacheSound("npc/strider/strider_skewer1.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/cl_init.lua new file mode 100644 index 0000000..f43a1d8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/cl_init.lua @@ -0,0 +1,59 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +local matTrail = Material("cable/rope") +local matGlow = Material("sprites/light_glow02_add") +function ENT:Draw() + if self:GetParent() ~= NULL then + self:SetLocalPos(Vector(0, 0, -30)) + end + self:DrawModel() + if self:GetParent() ~= NULL then + self:SetLocalPos(Vector(0, 0, 0)) + end + + local pos = self:GetPos() + --pos.z = pos.z + + render.SetMaterial(matTrail) + render.DrawBeam(pos, self:GetPuller():WorldSpaceCenter(), 3, 4, 0, Color(75, 0, 0, 255)) + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 35, 35, Color(125, 10, 10, 120)) + + if CurTime() >= self.NextEmit and self:GetVelocity():LengthSqr() >= 256 then + self.NextEmit = CurTime() + 0.06 + + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(16, 24) + + for i = 1, 3 do + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), self:GetPos()) + particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(12, 22)) + particle:SetDieTime(2) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-25, 25)) + particle:SetGravity(Vector(0, 0, -100)) + particle:SetColor(150, 0, 0) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end + +function ENT:Initialize() + self.AmbientSound = CreateSound(self, "npc/strider/strider_skewer1.wav") + self.Created = CurTime() +end + +function ENT:Think() + self.AmbientSound:PlayEx(1, 50 + math.min(1, CurTime() - self.Created) * 30) + + self:NextThink(CurTime()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/init.lua new file mode 100644 index 0000000..f894cde --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/init.lua @@ -0,0 +1,96 @@ +INC_SERVER() + +local vector_origin = vector_origin + +ENT.NextDamage = 0 +ENT.TicksLeft = 50 + +function ENT:Initialize() + self:SetModel("models/props_junk/harpoon002a.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) + + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(35, 45)) + + self:Fire("kill", "", 30) + self.DieTime = CurTime() + 3 + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +function ENT:PhysicsUpdate(phys) + if not self.InitVelocity then self.InitVelocity = self:GetVelocity() end + + local dt = (UnPredictedCurTime() - self.LastPhysicsUpdate) + self.LastPhysicsUpdate = UnPredictedCurTime() + + phys:AddVelocity(self.InitVelocity * dt * -0.6) +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner:IsValidLivingHuman() then + owner:Give(self.BaseWeapon) + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:GetPos()) + util.Effect("explosion_bonemesh", effectdata) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.OurOldVelocity, self.PhysicsData.HitEntity) + end + + local parent = self:GetParent() + if parent:IsValid() and parent:IsPlayer() then + if parent:IsValidLivingZombie() and not parent.SpawnProtection then + if CurTime() >= self.NextDamage then + self.NextDamage = CurTime() + 0.35 + + util.Blood((parent:NearestPoint(self:GetPos()) + parent:WorldSpaceCenter()) / 2, math.random(4, 9), Vector(0, 0, 1), 100) + parent:TakeSpecialDamage((self.ProjDamage or 35) * 0.222, DMG_SLASH, self:GetOwner(), self) + end + else + self:Remove() + end + end + + if self.Exploded and not self.ColChange then + self.ColChange = true + self:SetCollisionGroup(COLLISION_GROUP_WORLD) + end + + if self.DieTime < CurTime() then + self:Remove() + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Hit(vHitPos, vHitNormal, vel, hitent) + if self.Exploded then return end + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if hitent and hitent:IsValid() and hitent:IsPlayer() then + hitent:AddLegDamage(30) + + self.Exploded = true + + hitent:TakeSpecialDamage(self.ProjDamage or 35, DMG_GENERIC, owner, self, self:GetPos()) + hitent:EmitSound("npc/strider/strider_skewer1.wav", 70, 112) + + self.DieTime = CurTime() + 7 + + self:GetPhysicsObject():SetVelocityInstantaneous(vector_origin) + self:SetParent(hitent) + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/shared.lua new file mode 100644 index 0000000..3cf07a4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_harpoon_te/shared.lua @@ -0,0 +1,21 @@ +ENT.Type = "anim" + +ENT.NoReviveFromKills = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end + +function ENT:SetPuller(puller) + self:SetDTEntity(0, puller) +end + +function ENT:GetPuller() + return self:GetDTEntity(0) +end + +util.PrecacheModel("models/props_junk/harpoon002a.mdl") +util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav") +util.PrecacheSound("physics/metal/metal_sheet_impact_bullet1.wav") +util.PrecacheSound("physics/metal/metal_sheet_impact_bullet2.wav") +util.PrecacheSound("npc/strider/strider_skewer1.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/cl_init.lua index d4a89ee..b17c6c9 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 @@ -11,7 +11,7 @@ function ENT:Initialize() cmodel:SetMoveType(MOVETYPE_NONE) cmodel:SetParent(self) cmodel:SetOwner(self) - cmodel:SetModelScale(0.6, 0) + cmodel:SetModelScale(0.4, 0) cmodel:Spawn() self.CModel = cmodel @@ -26,9 +26,6 @@ end local matOverride = Material("models/shiny") function ENT:Draw() - --[[local parent = self:GetParent() - if parent == LocalPlayer() and parent:IsValid() and not parent:ShouldDrawLocalPlayer() then return end]] - local hittime = self:GetHitTime() if hittime == 0 then render.SetColorModulation(0, 1, 0) @@ -60,5 +57,5 @@ function ENT:Draw() particle:SetRollDelta(math.Rand(-10, 10)) particle:SetColor(30, 255, 30) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua index a43d199..c14d21c 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua @@ -1,25 +1,31 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") - -ENT.Heal = 3 +ENT.Heal = 5.1 +ENT.Gravity = true function ENT:Initialize() self:SetModel("models/Items/CrossbowRounds.mdl") - self:SetModelScale(0.5, 0) - self:PhysicsInit(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(3) - phys:SetBuoyancyRatio(0.002) - phys:EnableMotion(true) - phys:Wake() - end + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.3, 0) + self:SetupGenericProjectile(self.Gravity) self:Fire("kill", "", 30) + + if self:GetSeeked():IsValidLivingHuman() and self:GetOwner():IsValidLivingHuman() then + local owner = self:GetOwner() + local seeked = self:GetSeeked() + + local meforward = self:GetForward() + local angtoseek = (self:GetPos() - seeked:GetPos()):GetNormalized() + local dot = meforward:Dot(angtoseek) + + if dot > -0.35 or owner:GetPos():DistToSqr(seeked:GetPos()) > 700000 then + self:SetSeeked(NULL) + else + self:EmitSound("buttons/blip1.wav", 65, 150) + end + end end function ENT:Think() @@ -31,10 +37,51 @@ function ENT:Think() if parent:IsValid() and parent:IsPlayer() and not parent:Alive() then self:Remove() end + + if self:GetSeeked():IsValidLivingHuman() then + local target = self:GetSeeked() + + local targetpos = target:LocalToWorld(target:OBBCenter()) + local direction = (targetpos - self:GetPos()):GetNormal() + + self:SetAngles(direction:Angle()) + + local phys = self:GetPhysicsObject() + phys:SetVelocityInstantaneous(direction * 2000) + end + + self:NextThink(CurTime()) +end + +function ENT:DoRefund(owner) + if self.Refunded or not owner:IsSkillActive(SKILL_RECLAIMSOL) then return end + + self.Refunded = true + owner:GiveAmmo(3, "Battery") +end + +function ENT:AttachToPlayer(vHitPos, eHitEntity) + self:AddEFlags(EFL_SETTING_UP_BONES) + + local followed = false + local bonecount = eHitEntity:GetBoneCount() + if bonecount and bonecount > 1 then + local boneindex = eHitEntity:NearestBone(vHitPos) + if boneindex and boneindex > 0 then + self:FollowBone(eHitEntity, boneindex) + self:SetPos((eHitEntity:GetBonePositionMatrixed(boneindex) * 2 + vHitPos) / 3) + followed = true + end + end + if not followed then + self:SetParent(eHitEntity) + end + self:SetOwner(eHitEntity) end function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) if self:GetHitTime() ~= 0 then return end + self:SetHitTime(CurTime()) self:Fire("kill", "", 10) @@ -51,36 +98,26 @@ function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) self:SetPos(vHitPos + vHitNormal) if eHitEntity:IsValid() then - self:AddEFlags(EFL_SETTING_UP_BONES) - - local followed = false - local bonecount = eHitEntity:GetBoneCount() - if bonecount and bonecount > 1 then - local boneindex = eHitEntity:NearestBone(vHitPos) - if boneindex and boneindex > 0 then - self:FollowBone(eHitEntity, boneindex) - self:SetPos((eHitEntity:GetBonePositionMatrixed(boneindex) * 2 + vHitPos) / 3) - followed = true - end - end - if not followed then - self:SetParent(eHitEntity) - end - self:SetOwner(eHitEntity) + self:AttachToPlayer(vHitPos, eHitEntity) if eHitEntity:IsPlayer() and eHitEntity:Team() ~= TEAM_UNDEAD then - eHitEntity:GiveStatus("healdartboost").DieTime = CurTime() + 10 + local ehithp, ehitmaxhp = eHitEntity:Health(), eHitEntity:GetMaxHealth() - local oldhealth = eHitEntity:Health() - local newhealth = math.min(oldhealth + self.Heal, eHitEntity:GetMaxHealth()) - if oldhealth ~= newhealth then - eHitEntity:SetHealth(newhealth) - - if owner:IsPlayer() then - gamemode.Call("PlayerHealedTeamMember", owner, eHitEntity, newhealth - oldhealth, self) - end + if eHitEntity:IsSkillActive(SKILL_D_FRAIL) and ehithp >= ehitmaxhp * 0.25 then + owner:CenterNotify(COLOR_RED, translate.Format("frail_healdart_warning", eHitEntity:GetName())) + self:EmitSound("buttons/button8.wav", 70, math.random(115,128)) + self:DoRefund(owner) + elseif not (owner:IsSkillActive(SKILL_RECLAIMSOL) and ehithp >= ehitmaxhp) then + eHitEntity:GiveStatus("healdartboost", self.BuffDuration or 10) + owner:HealPlayer(eHitEntity, self.Heal) + else + self:DoRefund(owner) end + else + self:DoRefund(owner) end + else + self:DoRefund(owner) end self:SetAngles(vOldVelocity:Angle()) diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/shared.lua index b51b1f0..3e87fad 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/shared.lua @@ -1,3 +1,8 @@ ENT.Type = "anim" +function ENT:ShouldNotCollide(ent) + return ent:IsValidLivingHuman() and self:GetSeeked():IsValidLivingHuman() and self:GetSeeked() ~= ent +end + AccessorFuncDT(ENT, "HitTime", "Float", 0) +AccessorFuncDT(ENT, "Seeked", "Entity", 0) diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/cl_init.lua new file mode 100644 index 0000000..501efc4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/cl_init.lua @@ -0,0 +1,48 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_BOTH +ENT.LastPos = Vector(0, 0, 0) +ENT.NextTrace = 0 + +function ENT:Initialize() + self:SetRenderBounds(Vector(-self.Range, -self.Range, -self.Range), Vector(self.Range, self.Range, self.Range)) +end + +function ENT:Draw() + self:DrawModel() +end + +local matBeam = Material("effects/laser1") +local matGlow = Material("sprites/glow04_noz") +local colBeam = Color(80, 80, 255, 255) +local colAlt = Color(80, 255, 120, 255) +local COLOR_WHITE = color_white +local trace = {mask = MASK_SHOT} +function ENT:DrawTranslucent() + if not self:IsActive() then return end + + local alt = self:GetDTBool(0) + local beamcol = alt and colAlt or colBeam + + local pos = self:GetStartPos() + if CurTime() >= self.NextTrace then + self.NextTrace = CurTime() + 0.15 + + local forward = self:GetForward() + trace.start = pos + trace.endpos = pos + forward * (alt and 64 or self.Range) + trace.filter = self:GetCachedScanFilter() + + self.LastPos = util.TraceLine(trace).HitPos + end + + local hitpos = self.LastPos + render.SetMaterial(matBeam) + render.DrawBeam(pos, hitpos, 0.33, 0, 1, COLOR_WHITE) + render.DrawBeam(pos, hitpos, 1.3, 0, 1, beamcol) + render.SetMaterial(matGlow) + render.DrawSprite(pos, 2, 2, COLOR_WHITE) + render.DrawSprite(pos, 8, 8, beamcol) + render.DrawSprite(hitpos, 1, 1, COLOR_WHITE) + render.DrawSprite(hitpos, 4, 4, beamcol) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/init.lua new file mode 100644 index 0000000..cfe24e8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/init.lua @@ -0,0 +1,159 @@ +INC_SERVER() + +ENT.NoNails = true +ENT.m_IsImpactMine = true + +function ENT:Initialize() + self:SetModel("models/props_lab/tpplug.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.75, 0) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + + self:SetUseType(SIMPLE_USE) + + self.CreateTime = CurTime() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(0.1) + phys:SetBuoyancyRatio(0.002) + phys:EnableMotion(true) + phys:Wake() + end + + self:Fire("kill", "", 900) + + self.Charges = 11 +end + +function ENT:Use(activator, caller) + if not self.Exploded and activator:Team() == TEAM_HUMAN and (activator == self:GetOwner() or not self:GetOwner():IsValid()) then + self.Exploded = true + + activator:GiveAmmo(1, "impactmine") + + net.Start("zs_ammopickup") + net.WriteUInt(1, 16) + net.WriteString("impactmine") + net.Send(activator) + + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + if self:GetHitTime() ~= 0 or not eHitEntity:IsWorld() then return end + self:SetHitTime(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = (vHitNormal or Vector(0, 0, -1)) * -0.1 + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Sleep() + end + + self:SetMoveType(MOVETYPE_NONE) + self:SetPos(vHitPos + vHitNormal) + self:SetAngles(vHitNormal:Angle()) + + self:EmitSound("weapons/slam/mine_mode.wav", 60) +end + +local trace = {mask = MASK_SHOT} +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity, self.PhysicsData.OurOldVelocity) + end + + if self:IsActive() then + trace.start = self:GetPos() + trace.endpos = trace.start + self:GetForward() * self.Range + trace.filter = self:GetCachedScanFilter() + local ent = util.TraceLine(trace).Entity + if ent:IsValidLivingZombie() and ent:Health() > 0 then -- Maybe they died from another mine in the same spot... + self:Explode() + end + end + + local alt = self:GetDTBool(0) + + self:NextThink(CurTime() + (alt and 0.15 or 0.01)) + return true +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:RemoveEffect(self:GetPos()) + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end + +local function BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + local mine = dmginfo:GetInflictor() + local falloff = mine.Range ^ 2 * 0.5 + if ent:IsValid() then + if mine:GetStartPos():DistToSqr(tr.HitPos) > falloff then + dmginfo:SetDamage(math.max(1, dmginfo:GetDamage() * (1 - ((mine:GetStartPos():DistToSqr(tr.HitPos) - falloff) / falloff)))) + end + + local owner = dmginfo:GetInflictor():GetOwner() + if not owner:IsValidHuman() then + local humans = team.GetPlayers(TEAM_HUMAN) + if #humans > 0 then + owner = humans[math.random(#humans)] + + dmginfo:SetAttacker(owner) + end + end + end +end + +function ENT:RemoveEffect(pos) + util.ScreenShake(pos, 100, 5, 0.5, 100) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("HelicopterMegaBomb", effectdata, true, true) + + self:EmitSound("npc/roller/mine/rmine_tossed1.wav", 75, 200) + + self:Remove() +end + +function ENT:Explode() + if self.Exploded then return end + local alt = self:GetDTBool(0) + + local pos = self:GetStartPos() + if alt and self.Charges == 0 or not alt then + self.Exploded = true + + if self.Charges == 0 then + self:RemoveEffect(pos) + end + end + + self:FireBulletsLua(pos, self:GetForward(), 3, alt and 1 or 3, self.ProjDamage or 26.67, self:GetOwner(), 0.01, alt and "" or "AR2Tracer", BulletCallback, nil, nil, nil, nil, self) + + self:EmitSound(alt and "weapons/airboat/airboat_gun_energy2.wav" or "npc/scanner/cbot_energyexplosion1.wav", alt and 65 or 80, alt and 250 or 120) + + if not alt then + self:RemoveEffect(pos) + else + self.Charges = self.Charges - 1 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/shared.lua new file mode 100644 index 0000000..0106def --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine/shared.lua @@ -0,0 +1,35 @@ +ENT.Type = "anim" + +ENT.Range = 384 + +ENT.IgnoreBullets = true + +AccessorFuncDT(ENT, "HitTime", "Float", 0) + +function ENT:IsActive() + local hittime = self:GetHitTime() + return hittime > 0 and CurTime() >= hittime + 2 +end + +function ENT:GetStartPos() + return self:GetPos() + self:GetForward() * 9.25 +end + +function ENT:GetScanFilter() + local filter = team.GetPlayers(TEAM_HUMAN) + filter[#filter + 1] = self + filter = table.Add(filter, ents.FindByClass("prop_ffemitterfield")) + filter = table.Add(filter, ents.FindByClass("projectile_*")) + + return filter +end + +local NextCache = 0 +function ENT:GetCachedScanFilter() + if CurTime() < NextCache and self.CachedFilter then return self.CachedFilter end + + self.CachedFilter = self:GetScanFilter() + NextCache = CurTime() + 1 + + return self.CachedFilter +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/cl_init.lua new file mode 100644 index 0000000..3b71b29 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/cl_init.lua @@ -0,0 +1,32 @@ +INC_CLIENT() + +local matBeam = Material("effects/laser1") +local matGlow = Material("sprites/glow04_noz") +local colBeam = Color(255, 168, 40, 255) +local COLOR_WHITE = color_white +local trace = {mask = MASK_SHOT} +function ENT:DrawTranslucent() + if not self:IsActive() then return end + + local pos = self:GetStartPos() + if CurTime() >= self.NextTrace then + self.NextTrace = CurTime() + 0.15 + + local forward = self:GetUp() + trace.start = pos + trace.endpos = pos + forward * self.Range + trace.filter = self:GetCachedScanFilter() + + self.LastPos = util.TraceLine(trace).HitPos + end + + local hitpos = self.LastPos + render.SetMaterial(matBeam) + render.DrawBeam(pos, hitpos, 0.33, 0, 1, COLOR_WHITE) + render.DrawBeam(pos, hitpos, 1.3, 0, 1, colBeam) + render.SetMaterial(matGlow) + render.DrawSprite(pos, 2, 2, COLOR_WHITE) + render.DrawSprite(pos, 8, 8, colBeam) + render.DrawSprite(hitpos, 1, 1, COLOR_WHITE) + render.DrawSprite(hitpos, 4, 4, colBeam) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/init.lua new file mode 100644 index 0000000..890e6e8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/init.lua @@ -0,0 +1,124 @@ +INC_SERVER() + +ENT.NoNails = true +ENT.m_IsImpactMine = true + +function ENT:Initialize() + self:SetModel("models/props_c17/lamp_standard_off01.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.45, 0) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + + self:SetUseType(SIMPLE_USE) + + self.CreateTime = CurTime() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(0.1) + phys:SetBuoyancyRatio(0.002) + phys:EnableMotion(true) + phys:Wake() + end + + self:Fire("kill", "", 900) +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + if self:GetHitTime() ~= 0 or not eHitEntity:IsWorld() then return end + self:SetHitTime(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = (vHitNormal or Vector(0, 0, -1)) * -0.1 + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Sleep() + end + + local angle = vHitNormal:Angle() + angle:RotateAroundAxis(angle:Right(), -90) + + self:SetMoveType(MOVETYPE_NONE) + self:SetPos(vHitPos + vHitNormal) + self:SetAngles(angle) + + self:EmitSound("weapons/slam/mine_mode.wav", 60) +end + +local function BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + local mine = dmginfo:GetInflictor() + local falloff = mine.Range ^ 2 * 0.5 + if ent:IsValid() then + if mine:GetStartPos():DistToSqr(tr.HitPos) > falloff then + dmginfo:SetDamage(math.max(1, dmginfo:GetDamage() * (1 - ((mine:GetStartPos():DistToSqr(tr.HitPos) - falloff) / falloff)))) + end + + local owner = dmginfo:GetInflictor():GetOwner() + if not owner:IsValidLivingHuman() then + local humans = team.GetPlayers(TEAM_HUMAN) + if #humans > 0 then + owner = humans[math.random(#humans)] + + dmginfo:SetAttacker(owner) + end + end + + if ent:IsPlayer() and math.random(3) == 1 then + ent:Ignite(6) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(owner) + fire:SetPhysicsAttacker(owner) + fire.AttackerForward = owner + end + end + end + end +end + +local trace = {mask = MASK_SHOT} +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity, self.PhysicsData.OurOldVelocity) + end + + if self:IsActive() then + trace.start = self:GetPos() + trace.endpos = trace.start + self:GetUp() * self.Range + trace.filter = self:GetCachedScanFilter() + local ent = util.TraceLine(trace).Entity + if ent:IsValidLivingZombie() and ent:Health() > 0 then -- Maybe they died from another mine in the same spot... + self:Explode() + end + end + + self:NextThink(CurTime()) + return true +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local pos = self:GetStartPos() + + self:FireBulletsLua(pos, self:GetUp(), 3, 3, self.ProjDamage or 26.67, self:GetOwner(), 0.01, "AR2Tracer", BulletCallback, nil, nil, nil, nil, self) + + self:EmitSound("npc/roller/mine/rmine_tossed1.wav", 75, 160) + self:EmitSound("npc/scanner/cbot_energyexplosion1.wav", 80, 110, 0.5, CHAN_AUTO) + + util.ScreenShake(pos, 100, 5, 0.5, 100) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("HelicopterMegaBomb", effectdata, true, true) + + self:Remove() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/shared.lua new file mode 100644 index 0000000..82d0ec3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_impactmine_kin/shared.lua @@ -0,0 +1,5 @@ +ENT.Base = "projectile_impactmine" + +function ENT:GetStartPos() + return self:GetPos() + self:GetUp() * 5 +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/cl_init.lua new file mode 100644 index 0000000..42a5d97 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/cl_init.lua @@ -0,0 +1,53 @@ +INC_CLIENT() + +local matTrail = Material("trails/physbeam") +local colTrail = Color(230, 35, 45) +local matGlow = Material("sprites/light_glow02_add") + +local vector_origin = vector_origin + +function ENT:Draw() + render.SetBlend(0.4) + self:DrawModel() + render.SetBlend(1) + + render.SetMaterial(matTrail) + for i=1, #self.TrailPositions do + if self.TrailPositions[i+1] then + colTrail.a = 255 - 255 * (i/#self.TrailPositions) + + render.DrawBeam(self.TrailPositions[i], self.TrailPositions[i+1], 5, 1, 0, colTrail) + end + end + + local pos = self:GetPos() + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 5, 5, Color(230, 55, 35)) +end + +function ENT:Initialize() + self.Trailing = CurTime() + 0.25 + self.TrailPositions = {} +end + +function ENT:Think() + if self:GetVelocity() == vector_origin and self.Trailing < CurTime() then + function self:Draw() self.Entity:DrawModel() end + function self:Think() end + else + table.insert(self.TrailPositions, 1, self:GetPos()) + if self.TrailPositions[16] then + table.remove(self.TrailPositions, 16) + end + + local dist = 0 + local mypos = self:GetPos() + for i=1, #self.TrailPositions do + if self.TrailPositions[i]:DistToSqr(mypos) > dist then + self:SetRenderBoundsWS(self.TrailPositions[i], mypos, Vector(16, 16, 16)) + dist = self.TrailPositions[i]:DistToSqr(mypos) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/init.lua new file mode 100644 index 0000000..10913ec --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/init.lua @@ -0,0 +1,45 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_c17/trappropeller_lever.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) + + self:EmitSound("weapons/ar2/fire1.wav", 75, 210) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + hitpos = hitpos or self:GetPos() + hitnormal = hitnormal or self:GetForward() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local source = self:ProjectileDamageSource() + local target = self.HitData.HitEntity + + if target:IsValidLivingZombie() and not target:GetZombieClassTable().NeverAlive then + target:TakeSpecialDamage(self.ProjDamage or 47, DMG_BULLET, owner, source, hitpos) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(hitnormal) + util.Effect("hit_jugger", effectdata) +end + +function ENT:Think() + if self.HitData then + self:Explode(self.HitData.HitPos, self.HitData.HitNormal) + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/shared.lua new file mode 100644 index 0000000..77daf02 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_juggernaut/shared.lua @@ -0,0 +1,6 @@ +ENT.Type = "anim" +ENT.IgnoreBullets = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN or ent:IsProjectile() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/cl_init.lua new file mode 100644 index 0000000..edcf284 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/cl_init.lua @@ -0,0 +1,11 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +local matGlow = Material("sprites/light_glow02_add") +function ENT:DrawTranslucent() + self:DrawModel() + + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 64, 64, COLOR_GREEN) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/init.lua new file mode 100644 index 0000000..14277f9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/init.lua @@ -0,0 +1,25 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/healthvial.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 10) +end + +function ENT:OnRemove() + local ent = ents.Create("env_mediccloud") + if ent:IsValid() then + ent:SetPos(self.HitPos or self:GetPos()) + ent:SetOwner(self.Owner or self:GetOwner()) + ent:Spawn() + end +end + +function ENT:PhysicsCollide(data, phys) + self.HitPos = self:GetPos() --data.HitPos + data.HitNormal * 8 + self.Owner = self:GetOwner() + self:Fire("kill", "", 0.01) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/shared.lua new file mode 100644 index 0000000..b877a84 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_mediccloudbomb/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/cl_init.lua new file mode 100644 index 0000000..aee299f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/cl_init.lua @@ -0,0 +1,52 @@ +INC_CLIENT() + +function ENT:Initialize() + local alt = self:GetDTBool(0) + local cmodel = ClientsideModel("models/healthvial.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(-4, 0, 0))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(90, 0, 0))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(Color(alt and 255 or 75, 75, alt and 75 or 255)) + cmodel:SetParent(self) + cmodel:SetOwner(self) + cmodel:SetModelScale(0.4, 0) + cmodel:Spawn() + + self.CModel = cmodel + end +end + +local matOverride = Material("models/shiny") +function ENT:Draw() + local alt = self:GetDTBool(0) + render.SetColorModulation(alt and 1 or 0.3, 0.4, alt and 0.3 or 1) + render.ModelMaterialOverride(matOverride) + + self:DrawModel() + + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) + + if self:GetMoveType() == MOVETYPE_NONE or CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.01 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetVelocity(self:GetVelocity() * -0.1 + VectorRand() * 30) + particle:SetDieTime(0.35) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(alt and 255 or 90, 140, alt and 90 or 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/init.lua new file mode 100644 index 0000000..cabf953 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/init.lua @@ -0,0 +1,88 @@ +INC_SERVER() + +ENT.Heal = 10 +ENT.PointsMultiplier = 1.25 +ENT.Gravity = false + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + if self:GetHitTime() ~= 0 then return end + + self:SetHitTime(CurTime()) + + self:Fire("kill", "", 10) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = (vHitNormal or Vector(0, 0, -1)) * -1 + + self:SetSolid(SOLID_NONE) + self:SetMoveType(MOVETYPE_NONE) + + self:SetPos(vHitPos + vHitNormal) + + local alt = self:GetDTBool(0) + if eHitEntity:IsValid() then + self:AttachToPlayer(vHitPos, eHitEntity) + + if eHitEntity:IsPlayer() then + if eHitEntity:Team() == TEAM_UNDEAD then + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + eHitEntity:TakeSpecialDamage(self.ProjDamage or 60, DMG_GENERIC, owner, source, hitpos) + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + local status = eHitEntity:GiveStatus(alt and "zombiestrdebuff" or "zombiedartdebuff") + status.DieTime = CurTime() + (self.BuffDuration or 10) + status.Applier = owner + elseif eHitEntity:Team() == TEAM_HUMAN then + local ehithp, ehitmaxhp = eHitEntity:Health(), eHitEntity:GetMaxHealth() + + if eHitEntity:IsSkillActive(SKILL_D_FRAIL) and ehithp >= ehitmaxhp * 0.25 then + owner:CenterNotify(COLOR_RED, translate.Format("frail_healdart_warning", eHitEntity:GetName())) + self:EmitSound("buttons/button8.wav", 70, math.random(115,128)) + self:DoRefund(owner) + elseif not (owner:IsSkillActive(SKILL_RECLAIMSOL) and ehithp >= ehitmaxhp) then + local status = eHitEntity:GiveStatus(alt and "strengthdartboost" or "medrifledefboost", (alt and 1 or 2) * (self.BuffDuration or 10)) + status.Applier = owner + + owner:HealPlayer(eHitEntity, self.Heal) + + local txt = alt and "Strength Rifle" or "Medical Rifle" + + net.Start("zs_buffby") + net.WriteEntity(owner) + net.WriteString(txt) + net.Send(eHitEntity) + + net.Start("zs_buffwith") + net.WriteEntity(eHitEntity) + net.WriteString(txt) + net.Send(owner) + else + self:DoRefund(owner) + end + end + else + self:DoRefund(owner) + end + else + self:DoRefund(owner) + end + + self:SetAngles(vOldVelocity:Angle()) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + if eHitEntity:IsValid() then + effectdata:SetEntity(eHitEntity) + else + effectdata:SetEntity(NULL) + end + util.Effect(alt and "hit_strengthdart" or "hit_healdart2", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/shared.lua new file mode 100644 index 0000000..733b452 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_medicrifle/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_healdart" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/cl_init.lua new file mode 100644 index 0000000..5ad90aa --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/cl_init.lua @@ -0,0 +1,37 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.NextEmit = 0 + +local matGlow = Material("sprites/light_glow02_add") +function ENT:DrawTranslucent() + render.SetColorModulation(0.7, 0.2, 0.4) + self:DrawModel() + render.SetColorModulation(1, 1, 1) + + render.SetMaterial(matGlow) + render.DrawSprite(self:GetPos(), 64, 64, COLOR_CYAN) + + if CurTime() >= self.NextEmit then + local pos = self:GetPos() + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 10 do + local dir = VectorRand():GetNormalized() + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(math.Rand(1.3, 2.1)) + particle:SetColor(145,155,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(15) + particle:SetEndSize(0) + particle:SetGravity(dir * -6) + particle:SetVelocity(dir * 5) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + self.NextEmit = CurTime() + 0.09 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/init.lua new file mode 100644 index 0000000..c2f6136 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/init.lua @@ -0,0 +1,25 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/healthvial.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 10) +end + +function ENT:OnRemove() + local ent = ents.Create("env_nanitecloud") + if ent:IsValid() then + ent:SetPos(self.HitPos or self:GetPos()) + ent:SetOwner(self.Owner or self:GetOwner()) + ent:Spawn() + end +end + +function ENT:PhysicsCollide(data, phys) + self.HitPos = self:GetPos() --data.HitPos + data.HitNormal * 8 + self.Owner = self:GetOwner() + self:Fire("kill", "", 0.01) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/shared.lua new file mode 100644 index 0000000..b877a84 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nanitecloudbomb/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nova/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nova/cl_init.lua new file mode 100644 index 0000000..423efa6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nova/cl_init.lua @@ -0,0 +1,97 @@ +INC_CLIENT() + +local matGlow = Material("effects/splashwake1") +local matGlow2 = Material("sprites/glow04_noz") +local matWhite = Material("models/debug/debugwhite") +local vector_origin = vector_origin + +function ENT:Draw() + local alt = self:GetDTBool(0) + + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(1, alt and 1 or 0.5, 0.2) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + local pos = self:GetPos() + + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow2) + render.DrawSprite(pos, alt and 25 or 50, alt and 25 or 50, Color(255, alt and 180 or 100, 100, 10)) + render.SetMaterial(matGlow) + render.DrawSprite(pos, alt and 6 or 12, alt and 6 or 12, Color(255, alt and 180 or 10, 10)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 1 do + particle = emitter:Add(matGlow2, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.1) + particle:SetStartAlpha(alt and 65 or 125) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(255, alt and 180 or 100, 100) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end + +function ENT:OnRemove() + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + sound.Play("weapons/physcannon/energy_bounce1.wav", pos, 75, math.random(124, 135)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 19 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 75) + particle:SetDieTime(0.5) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 3)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, alt and 155 or 33, 20) + end + for i=0,5 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(24, 25)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 35, 20) + end + for i=1, 45 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.6) + particle:SetColor(255, alt and 150 or 35, 20) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetStartLength(1) + particle:SetEndLength(5) + particle:SetVelocity(VectorRand():GetNormal() * 100) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function ENT:Initialize() +end + +function ENT:Think() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nova/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nova/init.lua new file mode 100644 index 0000000..f899fdb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nova/init.lua @@ -0,0 +1,76 @@ +INC_SERVER() + +ENT.PointsMultiplier = 1.25 + +function ENT:Initialize() + self.Bounces = 0 + + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(self.Branch and 0.15 or 0.25, 0) + self:SetupGenericProjectile(false) + + self:Fire("kill", "", 3) + self.Creation = UnPredictedCurTime() +end + +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) + + if not self.Branch then return end + + local livetime = UnPredictedCurTime() - self.Creation + local vel = phys:GetVelocity() + local physang = vel:Angle() + local vr = physang:Right() * math.cos(CurTime() * 5) * (1 + livetime) * 3 * (self.ShotMarker == 0 and 1 or -1) + + local newvel = vel + vr + + phys:SetVelocityInstantaneous(newvel) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + + if self.Bounces <= 1 and data.HitEntity and data.HitEntity:IsWorld() then + local normal = data.OurOldVelocity:GetNormalized() + phys:SetVelocityInstantaneous((2 * data.HitNormal * data.HitNormal:Dot(normal * -1) + normal) * 700) + + self:EmitSound("ambient/levels/citadel/weapon_disintegrate3.wav", 70, 210) + + self.Bounces = self.Bounces + 1 + else + self.HitData = data + end + + self:NextThink(CurTime()) +end + +function ENT:Think() + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local tr = self.Touched + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + self:DealProjectileTraceDamage(self.ProjDamage or 77, tr, owner) + if tr.Entity:IsPlayer() then + tr.Entity:AddLegDamageExt(5.5, owner, source, SLOWTYPE_PULSE) + end + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Remove() + elseif self.HitData then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_nova/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_nova/shared.lua new file mode 100644 index 0000000..4c53290 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_nova/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/cl_init.lua index b05afc8..799e178 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 @@ -34,5 +34,5 @@ function ENT:Draw() particle:SetRollDelta(math.Rand(-4, 4)) particle:SetLighting(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/init.lua index 393cba6..de05f00 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_poisonflesh/init.lua @@ -1,10 +1,6 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") - -ENT.Damage = 5 -ENT.Type = "anim" +ENT.Damage = 4 function ENT:Initialize() self.DeathTime = CurTime() + 30 @@ -12,15 +8,7 @@ function ENT:Initialize() self:DrawShadow(false) self:PhysicsInitSphere(1) self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(4) - phys:SetBuoyancyRatio(0.002) - phys:EnableMotion(true) - phys:Wake() - end + self:SetupGenericProjectile(true) end function ENT:Think() @@ -51,7 +39,7 @@ function ENT:Explode(vHitPos, vHitNormal, eHitEntity) local effectdata = EffectData() effectdata:SetOrigin(vHitPos) effectdata:SetNormal(vHitNormal) - util.Effect("fleshhit", effectdata) + util.Effect("hit_flesh", effectdata) end function ENT:PhysicsCollide(data, phys) diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/cl_init.lua index fbebce0..c814e36 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 @@ -29,5 +29,5 @@ function ENT:Draw() particle:SetLighting(true) particle:SetColor(30, 255, 30) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/init.lua index 1b2dd7b..22ffff2 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_poisonspit/init.lua @@ -1,25 +1,23 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() - self.DeathTime = CurTime() + 30 - self:SetModel("models/props/cs_italy/orange.mdl") self:PhysicsInitSphere(1) self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) self:SetColor(Color(0, 255, 0, 255)) - self:SetCustomCollisionCheck(true) + self:SetupGenericProjectile(false) - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(4) - phys:SetBuoyancyRatio(0.002) - phys:EnableMotion(true) - phys:Wake() - end + self:Fire("kill", "", 0.45) + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + local dt = (UnPredictedCurTime() - self.LastPhysicsUpdate) + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -75 + phys:AddVelocity(vecDown) end function ENT:Think() @@ -27,7 +25,7 @@ function ENT:Think() self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) end - if self.DeathTime <= CurTime() then + if self.Exploded then self:Remove() end end @@ -35,7 +33,6 @@ end function ENT:Hit(vHitPos, vHitNormal, eHitEntity) if self.Exploded then return end self.Exploded = true - self.DeathTime = 0 local owner = self:GetOwner() if not owner:IsValid() then owner = self end @@ -44,16 +41,14 @@ function ENT:Hit(vHitPos, vHitNormal, eHitEntity) vHitNormal = vHitNormal or Vector(0, 0, 1) if eHitEntity:IsValid() then - eHitEntity:PoisonDamage(15, owner, self) + eHitEntity:PoisonDamage(9, owner, self) if eHitEntity:IsPlayer() and eHitEntity:Team() ~= TEAM_UNDEAD then local attach = eHitEntity:GetAttachment(1) - if attach then - if vHitPos:Distance(attach.Pos) <= 18 then - eHitEntity:PlayEyePoisonedSound() - local status = eHitEntity:GiveStatus("confusion") - if status then - status.EyeEffect = true - end + if attach and vHitPos:DistToSqr(attach.Pos) <= 324 then --18^2 + eHitEntity:PlayEyePainSound() + local status = eHitEntity:GiveStatus("dimvision", 5) + if status then + status.EyeEffect = true end end end @@ -62,7 +57,16 @@ function ENT:Hit(vHitPos, vHitNormal, eHitEntity) local effectdata = EffectData() effectdata:SetOrigin(vHitPos) effectdata:SetNormal(vHitNormal) - util.Effect("spithit", effectdata) + util.Effect("hit_spit", effectdata) +end + +function ENT:OnRemove() + if not self.Exploded then + local effectdata = EffectData() + effectdata:SetOrigin(self:GetPos()) + effectdata:SetNormal(self:GetVelocity():GetNormalized()) + util.Effect("hit_spit", effectdata) + end end function ENT:PhysicsCollide(data, phys) diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/cl_init.lua new file mode 100644 index 0000000..c57f788 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/cl_init.lua @@ -0,0 +1,49 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_BOTH + +function ENT:Initialize() + self.CreateTime = CurTime() + + local cmodel = ClientsideModel("models/props_c17/substation_circuitbreaker01a.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, 0, 7))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, 0))) + cmodel:SetColor(Color(255, 205, 175, 255)) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetParent(self) + cmodel:SetOwner(self) + cmodel:SetModelScale(0.02, 0) + cmodel:Spawn() + + self.CModel = cmodel + end +end + +function ENT:OnRemove() + if self.CModel and self.CModel:IsValid() then + self.CModel:Remove() + end +end + +function ENT:Draw() + self:DrawModel() +end + +local matGlow = Material("sprites/glow04_noz") +function ENT:DrawTranslucent() + local lightpos = self:GetPos() + self:GetUp() * 9 + + if self:GetExplodeTime() ~= 0 then + local size = (CurTime() * 8.5 % 1) * 24 + render.SetMaterial(matGlow) + render.DrawSprite(lightpos, size, size, Color(255, 50, 50, size * 5)) + render.DrawSprite(lightpos, size / 2, size / 2, Color(255, 50, 50, size * 15)) + elseif self.CreateTime + self.ArmTime < CurTime() then + local size = 4 + (CurTime() * 2 % 1) * 6 + render.SetMaterial(matGlow) + render.DrawSprite(lightpos, size, size, Color(50, 255, 50, size * 5)) + render.DrawSprite(lightpos, size / 2, size / 2, Color(50, 255, 50, size * 15)) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/init.lua new file mode 100644 index 0000000..2d3ffd5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/init.lua @@ -0,0 +1,130 @@ +INC_SERVER() + +function ENT:Initialize() + self.CreateTime = CurTime() + + self:SetModel("models/props_c17/oildrum001.mdl") + self:SetModelScale(0.16) + self:DrawShadow(false) + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + self:SetMaterial("models/props_canal/canal_bridge_railing_01c") + self:SetColor(Color(235, 205, 185, 255)) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetMass(1) + phys:SetMaterial("metal") + phys:SetDamping(0.5, 1) + end +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + if not self.Exploded then + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + local pos = self:GetPos() + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata) + + self:Remove() -- Destroy without explosive damage like mines. + end + end +end + +function ENT:PhysicsCollide(data, phys) + if 20 < data.Speed and 0.25 < data.DeltaTime then + self:EmitSound("physics/metal/metal_grenade_impact_soft"..math.random(1,3)..".wav", 75, 150) + end + + local normal = data.HitNormal + + if normal.z > -0.7 or (data.HitEntity and not data.HitEntity:IsWorld()) or self.Planted then + normal = data.OurOldVelocity:GetNormalized() + phys:SetVelocityInstantaneous((2 * data.HitNormal * data.HitNormal:Dot(normal * -1) + normal) * math.max(300, data.Speed) * 0.5) + + return + end + + self.Planted = true + self.PhysicsData = data + self:EmitSound("weapons/c4/c4_plant.wav", 85, 130) +end + +function ENT:Think() + if self.Exploded then + self:Remove() + return + end + + if self.Planted and not self.NoColl then + local data = self.PhysicsData + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS) + self:SetAngles(Angle(0, 0, 0)) + self:SetPos(data.HitPos) + + self.NoColl = true + end + + self:NextThink(CurTime() + 0.1) + + local owner = self:GetOwner() + if not owner:IsValidLivingHuman() then self:Remove() return end + + if self.CreateTime + self.ArmTime > CurTime() then return true end + + local pos = self:GetPos() + self:GetUp() * 2 + if self:GetExplodeTime() == 0 then + for k,v in pairs(ents.FindInSphere(pos, 90)) do + if v:IsValidLivingZombie() and not v:IsHeadcrab() then + local nearest = v:NearestPoint(pos) + if TrueVisibleFilters(pos, nearest, self, v) then + self:SetExplodeTime(CurTime() + self.ExplosionDelay) + self:EmitSound("npc/scanner/combat_scan2.wav") + + local phys = self:GetPhysicsObject() + phys:EnableMotion(true) + phys:AddVelocity(Vector(0, 0, 260)) + + break + end + end + end + elseif CurTime() >= self:GetExplodeTime() then + self:Explode() + end + + return true +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local pos = self:GetPos() + + util.BlastDamagePlayer(self, owner, pos, 335, 235, DMG_ALWAYSGIB) + + local effectdata = EffectData() + effectdata:SetOrigin(pos + Vector(0, 0, -1)) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 85, 100) + ParticleEffect("dusty_explosion_rockets", pos, angle_zero) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/shared.lua new file mode 100644 index 0000000..00c9363 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_proxymine/shared.lua @@ -0,0 +1,18 @@ +ENT.Type = "anim" + +ENT.ExplosionDelay = 0.7 +ENT.ArmTime = 8 + +ENT.NoPropDamageDuringWave0 = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end + +function ENT:SetExplodeTime(time) + self:SetDTFloat(0, time) +end + +function ENT:GetExplodeTime() + return self:GetDTFloat(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_purger/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_purger/cl_init.lua new file mode 100644 index 0000000..7f117c8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_purger/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() + +local matGlow = Material("effects/splashwake1") +local matGlow2 = Material("sprites/glow04_noz") +local vector_origin = vector_origin + +function ENT:Draw() + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 1 do + particle = emitter:Add(matGlow2, pos) + particle:SetVelocity(VectorRand() * 45) + particle:SetDieTime(0.15) + particle:SetStartAlpha(75) + particle:SetEndAlpha(0) + particle:SetStartSize(10) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(192, 255, 130) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow) + render.DrawSprite(pos, 15, 15, Color(100, 170, 70, 100)) + render.SetMaterial(matGlow2) + render.DrawSprite(pos, 35, 35, Color(155, 255, 100, 100)) + render.DrawSprite(pos, 25, 25, Color(255, 255, 255, 255)) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_purger/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_purger/init.lua new file mode 100644 index 0000000..8989a91 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_purger/init.lua @@ -0,0 +1,60 @@ +INC_SERVER() + +function ENT:Initialize() + self.Touched = {} + self.Damaged = {} + + self:Fire("kill", "", 0.7) + + self:SetModel("models/Items/CrossbowRounds.mdl") + self:PhysicsInitSphere(10) + self:SetSolid(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) +end + +function ENT:Think() + self:NextThink(CurTime()) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if table.Count(self.Damaged) >= 4 then return true end + + for ent, _ in pairs(self.Touched) do + if not self.Damaged[ent] and ent:IsValidLivingHuman() then + if ent:GetPoisonDamage() > 0 then + self.Damaged[ent] = true + owner:HealPlayer(ent, self.Heal, nil, nil, true) + end + + for _,v in ipairs(GAMEMODE.ResistableStatuses) do + if ent:GetStatus(v) then + self.Damaged[ent] = true + + ent:RemoveStatus(v, false, true) + owner:AddPoints(0.2) + end + end + end + end + return true +end + +function ENT:PhysicsCollide(data, phys) + if self.Done then return end + self.Done = true + + self:Fire("kill", "", 0.1) + self:EmitSound("ambient/machines/steam_release_2.wav", 70, 175) +end + +function ENT:StartTouch(ent) + if self.Touched[ent] or not ent:IsValid() then return end + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if ent == owner or not ent:IsPlayer() then return end + + self.Touched[ent] = true +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_purger/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_purger/shared.lua new file mode 100644 index 0000000..b8a7515 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_purger/shared.lua @@ -0,0 +1,6 @@ +ENT.Type = "anim" +ENT.Heal = 7 + +function ENT:ShouldNotCollide(ent) + return ent:IsProjectile() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_rocket/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/cl_init.lua new file mode 100644 index 0000000..595ed2d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/cl_init.lua @@ -0,0 +1,132 @@ +INC_CLIENT() + +local matGlow = Material("sprites/light_glow02_add") + +ENT.SmokeTimer = 0 + +function ENT:Draw() + self:DrawModel() + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + render.SetMaterial(matGlow) + render.DrawSprite(pos, alt and 30 or 100, alt and 30 or 100, Color(255,210,170)) +end + +function ENT:Initialize() + local alt = self:GetDTBool(0) + + self.AmbientSound = CreateSound(self, "Missile.Ignite") + self.AmbientSound:PlayEx(alt and 0.3 or 1, alt and 245 or 65) +end + +function ENT:Think() + local pos = self:GetPos() + local emitter = ParticleEmitter(pos) + local alt = self:GetDTBool(0) + emitter:SetNearClip(24, 32) + + if self.SmokeTimer < CurTime() then + self.SmokeTimer = CurTime() + (alt and 0.3 or 0.05) + + local particle = emitter:Add("effects/fire_cloud1", pos) + particle:SetVelocity(self:GetVelocity() * -0.4 + VectorRand() * 60) + particle:SetDieTime(0.5) + particle:SetStartAlpha(100) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(12, 19)) + particle:SetEndSize(5) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(240, 180, 120) + + particle = emitter:Add("particles/smokey", pos + VectorRand() * 10) + particle:SetDieTime(math.Rand(0.4, 0.6)) + particle:SetStartAlpha(math.Rand(110, 130)) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(math.Rand(20, 34)) + particle:SetRoll(math.Rand(0, 359)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(240, 190, 120) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + local dlight = DynamicLight(self:EntIndex()) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 190 + dlight.b = 130 + dlight.Brightness = 2 + dlight.Size = 150 + dlight.Decay = 300 + dlight.DieTime = CurTime() + 2 + end +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + if not alt then return end + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 25 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 275) + particle:SetDieTime(0.5) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(7, 9)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 155, 30) + end + for i=1, 16 do + particle = emitter:Add("effects/fire_embers"..math.random(1, 3), pos) + particle:SetVelocity(VectorRand():GetNormal() * 250) + particle:SetDieTime(math.Rand(1.25, 1.5)) + particle:SetStartAlpha(130) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(15, 19)) + particle:SetEndSize(1) + particle:SetRoll(math.Rand(0, 359)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetAirResistance(50) + particle:SetCollide(true) + particle:SetBounce(0.3) + particle:SetGravity(Vector(0,0,-400)) + end + for i=0,5 do + particle = emitter:Add(matGlow, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.3) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(127, 129)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(-0.8, 0.8)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(245, 175, 60) + end + for i=1, 75 do + particle = emitter:Add("effects/splash2", pos) + particle:SetDieTime(0.6) + particle:SetColor(255, 130, 0) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetStartLength(1) + particle:SetEndLength(15) + particle:SetVelocity(VectorRand():GetNormal() * 200) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_rocket/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/init.lua new file mode 100644 index 0000000..7f66b1a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/init.lua @@ -0,0 +1,57 @@ +INC_SERVER() + +function ENT:Initialize() + self.DieTime = CurTime() + 4 + + self:SetModel("models/weapons/w_missile_closed.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + + if self:GetDTBool(0) then + self:SetModelScale(0.4, 0) + end + + self:SetupGenericProjectile(false) +end + +function ENT:Think() + if self.PhysicsData then + self:Explode() + end + + if self.Exploded then + local pos = self:GetPos() + local alt = self:GetDTBool(0) + + if not alt then + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata) + util.Effect("explosion_rocket", effectdata) + else + self:EmitSound(")weapons/explode5.wav", 80, 130) + end + + self:Remove() + elseif self.DieTime <= CurTime() then + self:Explode() + end +end + +function ENT:Explode() + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if owner:IsValidHuman() then + local pos = self:GetPos() + + local source = self:ProjectileDamageSource() + util.BlastDamagePlayer(source, owner, pos, 85, self.ProjDamage, DMG_ALWAYSGIB, self.ProjTaper) + end +end + +function ENT:PhysicsCollide(data, phys) + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_rocket/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/shared.lua new file mode 100644 index 0000000..18223d0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_rocket/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +util.PrecacheModel("models/weapons/w_missile_closed.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/cl_init.lua new file mode 100644 index 0000000..27aa380 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/cl_init.lua @@ -0,0 +1,13 @@ +INC_CLIENT() + +function ENT:Initialize() + self:SetMaterial("models/shadertest/shader2") + self:SetColor(Color(0, 150, 255, 255)) + self:SetModelScale(0.3, 0) +end + +function ENT:DrawTranslucent() + render.SetBlend(0.95) + self:DrawModel() + render.SetBlend(1) +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/init.lua new file mode 100644 index 0000000..afaee73 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/init.lua @@ -0,0 +1,68 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_wasteland/rockcliff01g.mdl") + self:SetModelScale(0.3, 0) + self:SetMaterial("models/shadertest/shader2") + self:SetColor(Color(0, 150, 255, 255)) + self:PhysicsInitSphere(10) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + self:SetCustomCollisionCheck(true) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(20) + phys:EnableMotion(true) + phys:Wake() + end +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, hitent) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_ice", effectdata) + + if hitent:IsValid() and not hitent:IsPlayer() or (hitent:IsPlayer() and hitent:Team() ~= TEAM_UNDEAD) then + hitent:TakeSpecialDamage(44 * (hitent.PhysicsDamageTakenMul or 1), DMG_GENERIC, owner, self) + + if hitent.FizzleStatusAOE then return end + end + + for _, ent in pairs(util.BlastAlloc(self, owner, vHitPos, 110)) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + local nearest = ent:NearestPoint(vHitPos) + local scalar = ((110 - nearest:Distance(vHitPos)) / 110) + + ent:GiveStatus("frost", scalar * 6) + ent:AddLegDamageExt(18 * scalar, owner, self, SLOWTYPE_COLD) + end + end +end + +function ENT:PhysicsCollide(data, phys) + if self.Control:IsValid() then return end + + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/shared.lua new file mode 100644 index 0000000..b9c0e26 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shadeice/shared.lua @@ -0,0 +1,13 @@ +ENT.Type = "anim" + +ENT.IgnoreBullets = true +ENT.IgnoreMelee = true +ENT.IgnoreTraces = true + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD or ent:IsProjectile() +end + +util.PrecacheModel("models/props_wasteland/rockcliff01g.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/init.lua new file mode 100644 index 0000000..4a35392 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/init.lua @@ -0,0 +1,56 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_wasteland/rockgranite03b.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + self:SetCustomCollisionCheck(true) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(20) + phys:EnableMotion(true) + phys:Wake() + end +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:Remove() + end +end + +function ENT:Hit(vHitPos, vHitNormal, ent) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if ent:IsValid() then + if not ent:IsPlayer() or (ent:IsPlayer() and ent:Team() ~= TEAM_UNDEAD) then + ent:TakeSpecialDamage(66 * (ent.PhysicsDamageTakenMul or 1), DMG_GENERIC, owner, self) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("hit_shadestone", effectdata) + util.Effect("hit_stone", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if self.Control:IsValid() then return end + + self.PhysicsData = data + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/shared.lua new file mode 100644 index 0000000..d96b30d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_shaderock/shared.lua @@ -0,0 +1,11 @@ +ENT.Type = "anim" + +ENT.IgnoreBullets = true +ENT.IgnoreMelee = true +ENT.IgnoreTraces = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD or ent:IsProjectile() +end + +util.PrecacheModel("models/props_wasteland/rockgranite03b.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_stone/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_stone/cl_init.lua index 33dcc35..57d06eb 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_stone/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_stone/cl_init.lua @@ -1 +1 @@ -include("shared.lua") +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_stone/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_stone/init.lua index 236cd90..a005ff7 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_stone/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_stone/init.lua @@ -1,23 +1,12 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include('shared.lua') +INC_SERVER() function ENT:Initialize() self.DieTime = CurTime() + 30 self:SetModel("models/props_junk/rock001a.mdl") self:PhysicsInit(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) self:SetTrigger(true) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:SetMass(4) - phys:SetBuoyancyRatio(0.01) - phys:EnableDrag(false) - phys:Wake() - end + self:SetupGenericProjectile(true) end function ENT:Think() @@ -38,13 +27,13 @@ function ENT:PhysicsCollide(data, phys) end function ENT:StartTouch(ent) - if self.DieTime ~= 0 and ent:IsValid() and ent:IsPlayer() and ent:Alive() then + if self.DieTime ~= 0 and ent:IsValidLivingPlayer() then local owner = self:GetOwner() if not owner:IsValid() then owner = self end if ent ~= owner and ent:Team() ~= self.Team then ent:EmitSound("weapons/crossbow/hitbod"..math.random(2)..".wav") - ent:TakeSpecialDamage(self.Damage, DMG_CLUB, owner, self, nil, Vector(0, 0, 60000)) + ent:TakeSpecialDamage(self.Damage, DMG_CLUB, owner, self, nil) self:Explode() end end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_stone/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_stone/shared.lua index b53d255..9f68552 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_stone/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_stone/shared.lua @@ -1,3 +1,7 @@ ENT.Type = "anim" +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + ENT.Damage = 100 diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/cl_init.lua new file mode 100644 index 0000000..88a1cd3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/cl_init.lua @@ -0,0 +1,51 @@ +INC_CLIENT() + +function ENT:Initialize() + local alt = self:GetDTBool(0) + local cmodel = ClientsideModel("models/healthvial.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(-4, 0, 0))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(90, 0, 0))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetParent(self) + cmodel:SetColor(Color(alt and 50 or 255, 50, alt and 255 or 50)) + cmodel:SetOwner(self) + cmodel:SetModelScale(0.4, 0) + cmodel:Spawn() + + self.CModel = cmodel + end +end + +local matOverride = Material("models/shiny") +function ENT:Draw() + local alt = self:GetDTBool(0) + render.SetColorModulation(alt and 0.3 or 1, 0.4, alt and 1 or 0.4) + render.ModelMaterialOverride(matOverride) + + self:DrawModel() + + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) + + if self:GetMoveType() == MOVETYPE_NONE or CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.01 + + local pos = self:GetPos() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetDieTime(0.35) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 255)) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(alt and 50 or 255, 50, alt and 255 or 50) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/init.lua new file mode 100644 index 0000000..b8ba8c3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/init.lua @@ -0,0 +1,59 @@ +INC_SERVER() + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity, vOldVelocity) + if self:GetHitTime() ~= 0 then return end + self:SetHitTime(CurTime()) + + self:Fire("kill", "", 10) + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = (vHitNormal or Vector(0, 0, -1)) * -1 + + self:SetSolid(SOLID_NONE) + self:SetMoveType(MOVETYPE_NONE) + + self:SetPos(vHitPos + vHitNormal) + + local alt = self:GetDTBool(0) + if eHitEntity:IsValid() then + self:AttachToPlayer(vHitPos, eHitEntity) + + if eHitEntity:IsPlayer() and eHitEntity:Team() ~= TEAM_UNDEAD then + local strstatus = eHitEntity:GiveStatus(alt and "medrifledefboost" or "strengthdartboost", (alt and 2 or 1) * (self.BuffDuration or 10)) + strstatus.Applier = owner + + local txt = alt and "Defence Shot Gun" or "Strength Shot Gun" + + net.Start("zs_buffby") + net.WriteEntity(owner) + net.WriteString(txt) + net.Send(eHitEntity) + + net.Start("zs_buffwith") + net.WriteEntity(eHitEntity) + net.WriteString(txt) + net.Send(owner) + + eHitEntity:GiveStatus("healdartboost", (self.BuffDuration or 10)/2) + else + self:DoRefund(owner) + end + else + self:DoRefund(owner) + end + + self:SetAngles(vOldVelocity:Angle()) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + if eHitEntity:IsValid() then + effectdata:SetEntity(eHitEntity) + else + effectdata:SetEntity(NULL) + end + util.Effect(alt and "hit_healdart2" or "hit_strengthdart", effectdata) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/shared.lua new file mode 100644 index 0000000..733b452 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_strengthdart/shared.lua @@ -0,0 +1 @@ +ENT.Base = "projectile_healdart" diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/cl_init.lua new file mode 100644 index 0000000..21289f3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/cl_init.lua @@ -0,0 +1,34 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local time = CurTime() + + self:DrawModel() + + if time < self.NextEmit then return end + self.NextEmit = time + 0.05 + + local pos = self:WorldSpaceCenter() + local dir = VectorRand() + dir:Normalize() + dir = dir * math.Rand(1, 4) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(36, 44) + + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos + dir) + particle:SetVelocity(dir) + particle:SetDieTime(math.Rand(0.6, 0.9)) + particle:SetStartAlpha(255) + particle:SetEndAlpha(255) + particle:SetStartSize(math.Rand(2, 5)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-4, 4)) + particle:SetColor(255, 0, 0) + particle:SetLighting(true) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/init.lua new file mode 100644 index 0000000..fe06fbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/init.lua @@ -0,0 +1,50 @@ +INC_SERVER() + +function ENT:Initialize() + local modelid = math.random(#GAMEMODE.HumanGibs) + self:SetModel(GAMEMODE.HumanGibs[modelid]) + if 4 < modelid then + self:SetMaterial("models/flesh") + end + --self:PhysicsInitSphere(1) + self:PhysicsInit(SOLID_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + + self:Fire("kill", "", 10) +end + +function ENT:Think() + if self.PhysicsData then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end +end + +function ENT:Explode(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + self.DeathTime = 0 + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:WorldSpaceCenter() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + if eHitEntity:IsValid() then + eHitEntity:TakeSpecialDamage(4, DMG_CLUB, owner, self) + end + + self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav") + util.Blood(vHitPos + vHitNormal, 8, vHitNormal, 100, true) + + self:Remove() +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/shared.lua new file mode 100644 index 0000000..9539e7a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_throwngib/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/cl_init.lua new file mode 100644 index 0000000..300c04d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/cl_init.lua @@ -0,0 +1,51 @@ +INC_CLIENT() + +local matGlow = Material("effects/splashwake1") +local matGlow2 = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") +local vector_origin = vector_origin + +ENT.SmokeTimer = 0 + +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SetColorModulation(0.1, 0.9, 0.3) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(nil) + + local pos = self:GetPos() + + if self:GetVelocity() ~= vector_origin then + render.SetMaterial(matGlow) + render.DrawSprite(pos, 7, 7, Color(30, 155, 70)) + + render.SetMaterial(matGlow2) + render.DrawSprite(pos, 29, 6, Color(90, 255, 130)) + render.DrawSprite(pos, 3, 23, Color(90, 255, 130)) + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + local particle + for i=0, 1 do + particle = emitter:Add(matGlow2, pos) + particle:SetVelocity(VectorRand() * 5) + particle:SetDieTime(0.05) + particle:SetStartAlpha(175) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(0) + particle:SetRollDelta(math.Rand(-10, 10)) + particle:SetColor(50, 255, 110) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end + +function ENT:Initialize() +end + +function ENT:Think() +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/init.lua new file mode 100644 index 0000000..aceeea1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/init.lua @@ -0,0 +1,73 @@ +INC_SERVER() + +ENT.PointsMultiplier = 1.25 + +function ENT:Initialize() + self:Fire("kill", "", 2) + + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(2) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.2, 0) + self:SetupGenericProjectile(false) + self.LastPhysicsUpdate = UnPredictedCurTime() +end + +local vecDown = Vector() +function ENT:PhysicsUpdate(phys) + self:ProjectileTraceAhead(phys) + + local dt = UnPredictedCurTime() - self.LastPhysicsUpdate + self.LastPhysicsUpdate = UnPredictedCurTime() + + vecDown.z = dt * -200 + phys:AddVelocity(vecDown) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + + self:NextThink(CurTime()) +end + +function ENT:OnRemove() + local effectdata = EffectData() + effectdata:SetOrigin(self.HitData and self.HitData.HitPos or self:GetPos()) + effectdata:SetNormal(self.HitData and self.HitData.HitNormal or Vector(0, 0, 0)) + util.Effect("hit_tithonus", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if self.HitData then return end + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:Think() + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + if self.Touched and not self.Damaged then + self.Damaged = true + + local tr = self.Touched + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + self:DealProjectileTraceDamage(self.ProjDamage or 77, tr, owner) + if tr.Entity:IsPlayer() then + tr.Entity:AddLegDamageExt(5.5, owner, source, SLOWTYPE_PULSE) + end + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + util.Blood(tr.Entity:WorldSpaceCenter(), math.max(0, 15), -self:GetForward(), math.Rand(100, 300), true) + + self:Remove() + elseif self.HitData then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/shared.lua new file mode 100644 index 0000000..4c53290 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_tithonus/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() or ent:IsProjectile() or ent.ZombieConstruction +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_wispball/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/cl_init.lua new file mode 100644 index 0000000..01f87b0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/cl_init.lua @@ -0,0 +1,61 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:Initialize() + self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "ambient/energy/force_field_loop1.wav") +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.7, math.max(120, 230 - EyePos():Distance(self:GetPos()) * 0.12)) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") +function ENT:Draw() + render.ModelMaterialOverride(matWhite) + render.SuppressEngineLighting(true) + self:DrawModel() + render.SuppressEngineLighting(false) + render.ModelMaterialOverride(nil) + + local pos = self:GetPos() + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 64, 64) + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.075 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + local base_ang = (self:GetVelocity() * -1):Angle() + local ang = Angle() + for i=1, 6 do + ang:Set(base_ang) + ang:RotateAroundAxis(ang:Right(), math.Rand(-30, 30)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-30, 30)) + + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(2) + particle:SetVelocity(ang:Forward() * math.Rand(32, 64)) + particle:SetAirResistance(24) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_wispball/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/init.lua new file mode 100644 index 0000000..6354013 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/init.lua @@ -0,0 +1,52 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/dav0r/hoverball.mdl") + self:PhysicsInitSphere(1) + self:SetSolid(SOLID_VPHYSICS) + self:SetupGenericProjectile(false) + + self:EmitSound("weapons/physcannon/energy_sing_flyby2.wav", 70, math.random(125, 135)) + + self:Fire("kill", "", 1.75) +end + +function ENT:Think() + if self.PhysicsData then + self:Hit(self.PhysicsData.HitPos, self.PhysicsData.HitNormal, self.PhysicsData.HitEntity) + end + + if self.Exploded then + self:Remove() + end +end + +function ENT:OnRemove() + self:Hit(self:GetPos(), Vector(0, 0, 1), NULL) +end + +function ENT:Hit(vHitPos, vHitNormal, eHitEntity) + if self.Exploded then return end + self.Exploded = true + + local owner = self:GetOwner() + if not owner:IsValid() then owner = self end + + vHitPos = vHitPos or self:GetPos() + vHitNormal = vHitNormal or Vector(0, 0, 1) + + util.BlastDamagePlayer(self, owner, vHitPos + vHitNormal, 32, 4, DMG_DISSOLVE) + + local effectdata = EffectData() + effectdata:SetOrigin(vHitPos) + effectdata:SetNormal(vHitNormal) + util.Effect("explosion_wispball", effectdata) +end + +function ENT:PhysicsCollide(data, phys) + if not self:HitFence(data, phys) then + self.PhysicsData = data + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_wispball/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/shared.lua new file mode 100644 index 0000000..3250721 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_wispball/shared.lua @@ -0,0 +1,7 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end + +util.PrecacheModel("models/Combine_Helicopter/helicopter_bomb01.mdl") \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/cl_init.lua index d03674b..9445e1a 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextTickSound = 0 ENT.LastTickSound = 0 @@ -28,7 +28,7 @@ function ENT:Think() particle:SetRoll(math.Rand(-0.2, 0.2)) particle:SetColor(50, 50, 50) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end if curtime >= self.NextTickSound then diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/init.lua index 8e85cf9..8b3d23b 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self.DieTime = CurTime() + self.LifeTime @@ -9,7 +6,9 @@ function ENT:Initialize() self:SetModel("models/weapons/w_grenade.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() @@ -20,7 +19,7 @@ end function ENT:PhysicsCollide(data, phys) if 20 < data.Speed and 0.25 < data.DeltaTime then - self:EmitSound("physics/metal/metal_grenade_impact_hard"..math.random(1,3)..".wav") + self:EmitSound("physics/metal/metal_grenade_impact_hard"..math.random(3)..".wav") end end @@ -37,13 +36,17 @@ function ENT:Explode() self.Exploded = true local owner = self:GetOwner() - if owner:IsValid() and owner:IsPlayer() and owner:Team() == TEAM_HUMAN then + if owner:IsValidHuman() then local pos = self:GetPos() - util.BlastDamage2(self, owner, pos, self.GrenadeRadius or 256, self.GrenadeDamage or 256) + util.BlastDamagePlayer(self, owner, pos, self.GrenadeRadius or 256, self.GrenadeDamage or 256, DMG_ALWAYSGIB) local effectdata = EffectData() - effectdata:SetOrigin(pos) - util.Effect("Explosion", effectdata) + effectdata:SetOrigin(pos + Vector(0, 0, -1)) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 85, 100) + ParticleEffect("dusty_explosion_rockets", pos, angle_zero) end end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/shared.lua index 629f983..4ef22de 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsgrenade/shared.lua @@ -4,6 +4,10 @@ ENT.LifeTime = 2.5 ENT.NoPropDamageDuringWave0 = true +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() +end + util.PrecacheSound("physics/metal/metal_grenade_impact_hard1.wav") util.PrecacheSound("physics/metal/metal_grenade_impact_hard2.wav") util.PrecacheSound("physics/metal/metal_grenade_impact_hard3.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/cl_init.lua new file mode 100644 index 0000000..ed1eb2d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() + +ENT.SmokeTimer = 0 + +function ENT:Think() + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(24, 32) + + if self.SmokeTimer < CurTime() then + self.SmokeTimer = CurTime() + 0.02 + + local vOffset = self:GetPos() + + local particle = emitter:Add("sprites/flamelet"..math.random(1,4), vOffset) + particle:SetDieTime(0.5) + particle:SetStartSize(math.Rand(4, 7)) + particle:SetEndSize(2) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-5,5)) + + particle = emitter:Add("particle/smokestack", vOffset) + particle:SetDieTime(0.7) + particle:SetStartAlpha(225) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(16,18)) + particle:SetColor(30, 30, 30) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/init.lua new file mode 100644 index 0000000..7bde552 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/init.lua @@ -0,0 +1,71 @@ +INC_SERVER() + +function ENT:Initialize() + self:SetModel("models/props_junk/glassbottle01a.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetupGenericProjectile(true) + + self:Fire("kill", "", 30) +end + +function ENT:Think() + if self.PhysicsData then + self:Explode(self.PhysicsData.HitPos, self.PhysicsData.HitNormal) + end +end + +function ENT:PhysicsCollide(data, phys) + --if data.Speed >= 50 then + self.PhysicsData = data + self.Owner = self:GetOwner() + self:NextThink(CurTime()) + --end +end + +function ENT:OnRemove() + local ent = ents.Create("env_molotovflame") + if ent:IsValid() then + ent:SetPos(self.PhysicsData.HitPos or self:GetPos()) + ent:SetOwner(self.Owner or self:GetOwner()) + ent:Spawn() + ent:DropToFloor() + end +end + +function ENT:Explode(hitpos, hitnormal) + if self.Exploded then return end + self.Exploded = true + + self:Fire("kill", "", 0.01) + + local owner = self:GetOwner() + + hitpos = hitpos or self:GetPos() + if not hitnormal then + hitnormal = self:GetVelocity():GetNormalized() * -1 + end + + --hitpos = hitpos + hitnormal + + local effectdata = EffectData() + effectdata:SetOrigin(hitpos) + effectdata:SetNormal(hitnormal) + util.Effect("hit_glass", effectdata) + + if owner:IsValidHuman() then + for ent, dmg in pairs(util.BlastDamageExAlloc(self, owner, hitpos, 128, 60, DMG_SLASH)) do + if ent:IsValidLivingPlayer() and (ent:Team() == TEAM_UNDEAD or ent == owner) then + ent:Ignite(dmg / 7) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(owner) + fire:SetPhysicsAttacker(owner) + fire.AttackerForward = owner + end + end + end + end + end + + self:NextThink(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/shared.lua b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/shared.lua new file mode 100644 index 0000000..b877a84 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/projectile_zsmolotov/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/cl_init.lua index 39ac30b..148131a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -6,20 +6,6 @@ function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) end -function ENT:DrawHealthBar(percentage) - local y = -50 - local maxbarwidth = 560 - local barheight = 30 - local barwidth = maxbarwidth * percentage - local startx = maxbarwidth * -0.5 - - surface.SetDrawColor(0, 0, 0, 220) - surface.DrawRect(startx, y, maxbarwidth, barheight) - surface.SetDrawColor((1 - percentage) * 255, percentage * 255, 0, 220) - surface.DrawRect(startx + 4, y + 4, barwidth - 8, barheight - 8) - surface.DrawOutlinedRect(startx, y, maxbarwidth, barheight) -end - function ENT:Draw() if MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN then local percentage = math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1) @@ -31,26 +17,20 @@ function ENT:Draw() local vOffset = self:GetForward() * self:OBBMaxs().x local name local owner = self:GetObjectOwner() - if owner:IsValid() and owner:IsPlayer() and owner:Team() == TEAM_HUMAN then + if owner:IsValidHuman() then name = owner:Name() end self:DrawModel() cam.Start3D2D(vPos + vOffset, ang, 0.05) - self:DrawHealthBar(percentage) - if name then - draw.SimpleText(name, "ZS3D2DFont", 0, 0, COLOR_WHITE, TEXT_ALIGN_CENTER) - end + self:Draw3DHealthBar(percentage, name) cam.End3D2D() ang:RotateAroundAxis(ang:Right(), 180) cam.Start3D2D(vPos - vOffset, ang, 0.05) - self:DrawHealthBar(percentage) - if name then - draw.SimpleText(name, "ZS3D2DFont", 0, 0, COLOR_WHITE, TEXT_ALIGN_CENTER) - end + self:Draw3DHealthBar(percentage, name) cam.End3D2D() else self:DrawModel() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/init.lua index ff01823..d666f0c 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/init.lua @@ -1,12 +1,13 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") +ENT.StrictNoSkyCade = true function ENT:Initialize() self:SetModel("models/props_debris/wood_board05a.mdl") self:PhysicsInit(SOLID_VPHYSICS) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) @@ -45,10 +46,13 @@ end function ENT:OnTakeDamage(dmginfo) self:TakePhysicsDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + local attacker = dmginfo:GetAttacker() if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then self:ResetLastBarricadeAttacker(attacker, dmginfo) self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:EmitSound("physics/wood/wood_plank_break"..math.random(1,4)..".wav", 65) end end @@ -77,7 +81,7 @@ function ENT:AltUse(activator, tr) end function ENT:OnPackedUp(pl) - pl:GiveEmptyWeapon("weapon_zs_barricadekit") + --pl:GiveEmptyWeapon("weapon_zs_barricadekit") pl:GiveAmmo(1, "SniperRound") pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/shared.lua index 5cdc982..aa16862 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_aegisboard/shared.lua @@ -5,6 +5,7 @@ ENT.NoNails = true ENT.CanPackUp = true ENT.PackUpTime = 3 +ENT.IgnorePackTimeMul = true ENT.IsBarricadeObject = true @@ -35,8 +36,3 @@ end function ENT:HitByWrench(wep, owner, tr) return true end - -function ENT:CanBePackedBy(pl) - local owner = self:GetObjectOwner() - return not owner:IsValid() or owner == pl or owner:Team() ~= TEAM_HUMAN or gamemode.Call("PlayerIsAdmin", pl) -end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ammo/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ammo/cl_init.lua index 2be6653..fbf24fd 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ammo/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ammo/cl_init.lua @@ -1,3 +1,3 @@ -include("shared.lua") +INC_CLIENT() ENT.ColorModulation = Color(0.25, 1, 0.25) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua index 3ddb56d..a5d2b17 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ammo/init.lua @@ -1,12 +1,9 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.CleanupPriority = 2 function ENT:Initialize() - self.m_Health = 50 + self.ObjHealth = 50 self.IgnorePickupCount = self.IgnorePickupCount or false self.Forced = self.Forced or false self.NeverRemove = self.NeverRemove or false @@ -22,6 +19,7 @@ function ENT:Initialize() if phys:IsValid() then phys:SetMaterial("material") phys:EnableMotion(true) + phys:SetMass(45) phys:Wake() end @@ -49,14 +47,17 @@ function ENT:Use(activator, caller) if self.IgnoreUse then return end self:GiveToActivator(activator, caller) end + function ENT:GiveToActivator(activator, caller) - if activator:IsPlayer() and activator:Alive() and not activator:KeyDown(GAMEMODE.UtilityKey) and activator:Team() == TEAM_HUMAN and not self.Removing then + if activator:IsPlayer() and activator:Alive() and not activator:KeyDown(GAMEMODE.UtilityKey) and activator:Team() == TEAM_HUMAN and not self.Removing and not (self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator) then if self.IgnorePickupCount or (not self.PlacedInMap or not GAMEMODE.MaxAmmoPickups or (activator.AmmoPickups or 0) < GAMEMODE.MaxAmmoPickups or team.NumPlayers(TEAM_HUMAN) <= 1) then if self.PlacedInMap and GAMEMODE.WeaponRequiredForAmmo and team.NumPlayers(TEAM_HUMAN) > 1 then local hasweapon = false + local lowertype = string.lower(self:GetAmmoType()) for _, wep in pairs(activator:GetWeapons()) do - if wep.Primary and wep.Primary.Ammo and string.lower(wep.Primary.Ammo) == string.lower(self:GetAmmoType()) - or wep.Secondary and wep.Secondary.Ammo and string.lower(wep.Secondary.Ammo) == string.lower(self:GetAmmoType()) then + if wep.Primary and wep.Primary.Ammo and string.lower(wep.Primary.Ammo) == lowertype + or wep.Secondary and wep.Secondary.Ammo and string.lower(wep.Secondary.Ammo) == lowertype + or wep.ResupplyAmmoType and string.lower(wep.ResupplyAmmoType) == lowertype then hasweapon = true break end @@ -71,6 +72,11 @@ function ENT:GiveToActivator(activator, caller) activator:GiveAmmo(self:GetAmmo(), self:GetAmmoType()) + net.Start("zs_ammopickup") + net.WriteUInt(self:GetAmmo(), 16) + net.WriteString(self:GetAmmoType()) + net.Send(activator) + if self.PlacedInMap and not self.IgnorePickupCount then activator.AmmoPickups = (activator.AmmoPickups or 0) + 1 end @@ -128,8 +134,13 @@ function ENT:OnTakeDamage(dmginfo) if self.NeverRemove then return end self:TakePhysicsDamage(dmginfo) - self.m_Health = self.m_Health - dmginfo:GetDamage() - if self.m_Health <= 0 then + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end + + self.ObjHealth = self.ObjHealth - dmginfo:GetDamage() + if self.ObjHealth <= 0 then self:RemoveNextFrame() end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/cl_init.lua index c977071..defaada 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 128)) @@ -12,7 +12,7 @@ local colFlash = Color(30, 255, 30) function ENT:Draw() self:DrawModel() - if not MySelf:IsValid() then return end + if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then return end local owner = self:GetObjectOwner() @@ -24,13 +24,15 @@ function ENT:Draw() draw.SimpleText(translate.Get("arsenal_crate"), "ZS3D2DFont2", 0, 0, COLOR_GRAY, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1)) + if MySelf:Team() == TEAM_HUMAN and GAMEMODE:PlayerCanPurchase(MySelf) then colFlash.a = math.abs(math.sin(CurTime() * 5)) * 255 - draw.SimpleText(translate.Get("purchase_now"), "ZS3D2DFont2Small", 0, -64, colFlash, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP) + draw.SimpleText(translate.Get("purchase_now"), "ZS3D2DFont2", 0, 32, colFlash, TEXT_ALIGN_CENTER) end if owner:IsValid() and owner:IsPlayer() then - draw.SimpleText("("..owner:ClippedName()..")", "ZS3D2DFont2Small", 0, 64, owner == MySelf and COLOR_BLUE or COLOR_GRAY, TEXT_ALIGN_CENTER) + draw.SimpleText("("..owner:ClippedName()..")", "ZS3D2DFont2Small", 0, 120, owner == MySelf and COLOR_LBLUE or COLOR_GRAY, TEXT_ALIGN_CENTER) end cam.End3D2D() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/init.lua index caac16e..de6554c 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() local function RefreshCrateOwners(pl) for _, ent in pairs(ents.FindByClass("prop_arsenalcrate")) do @@ -18,12 +15,14 @@ function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) end - self:SetMaxObjectHealth(200) + self:SetMaxObjectHealth(400) self:SetObjectHealth(self:GetMaxObjectHealth()) end @@ -57,6 +56,10 @@ function ENT:SetObjectHealth(health) if health <= 0 and not self.Destroyed then self.Destroyed = true + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + local ent = ents.Create("prop_physics") if ent:IsValid() then ent:SetModel(self:GetModel()) @@ -75,6 +78,8 @@ end function ENT:OnTakeDamage(dmginfo) self:TakePhysicsDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + local attacker = dmginfo:GetAttacker() if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then self:ResetLastBarricadeAttacker(attacker, dmginfo) @@ -87,10 +92,11 @@ function ENT:Use(activator, caller) if not self.NoTakeOwnership and not self:GetObjectOwner():IsValid() and ishuman then self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) end if gamemode.Call("PlayerCanPurchase", activator) then - activator:SendLua("GAMEMODE:OpenPointsShop()") + activator:SendLua("GAMEMODE:OpenArsenalMenu()") elseif ishuman then activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "you_cant_purchase_now")) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/shared.lua index f3729d7..bb5d1d4 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_arsenalcrate/shared.lua @@ -12,19 +12,7 @@ function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) if health <= 0 and not self.Destroyed then self.Destroyed = true - - local ent = ents.Create("prop_physics") - if ent:IsValid() then - ent:SetModel(self:GetModel()) - ent:SetMaterial(self:GetMaterial()) - ent:SetAngles(self:GetAngles()) - ent:SetPos(self:GetPos()) - ent:SetSkin(self:GetSkin() or 0) - ent:SetColor(self:GetColor()) - ent:Spawn() - ent:Fire("break", "", 0) - ent:Fire("kill", "", 0.1) - end + self:FakePopBreak() end end @@ -51,8 +39,3 @@ end function ENT:ClearObjectOwner() self:SetObjectOwner(NULL) end - -function ENT:CanBePackedBy(pl) - local owner = self:GetObjectOwner() - return not owner:IsValid() or owner == pl or owner:Team() ~= TEAM_HUMAN or gamemode.Call("PlayerIsAdmin", pl) -end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_baseoutlined.lua b/gamemodes/zombiesurvival/entities/entities/prop_baseoutlined.lua index 4297906..868980b 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_baseoutlined.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_baseoutlined.lua @@ -4,7 +4,7 @@ ENT.Type = "anim" if not CLIENT then return end -ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.RenderGroup = RENDERGROUP_BOTH ENT.ColorModulation = Color(1, 0.5, 1) ENT.Seed = 0 @@ -13,61 +13,101 @@ function ENT:Initialize() self.Seed = math.Rand(0, 10) end +function ENT:DrawPreciseModel(ble, cmod) + if self.PropWeapon and not self.ShowBaseModel then + render.SetBlend(0) + end + self:DrawModel() + if self.PropWeapon and not self.ShowBaseModel then + render.SetBlend(1) + end + if self.RenderModels and not self.NoDrawSubModels then + self:RenderModels(ble, cmod) + end +end + local matWireframe = Material("models/wireframe") local matWhite = Material("models/debug/debugwhite") function ENT:DrawTranslucent() if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then - self:DrawModel() + self:DrawPreciseModel() return end - local time = (CurTime() * 1.5 + self.Seed) % 2 + local mul = self.QualityTier and (self.QualityTier + 1) or 1 + local time = (CurTime() * 1.5*mul + self.Seed) % 2/mul - self:DrawModel() + self:DrawPreciseModel() - if time <= 1 and EyePos():Distance(self:GetPos()) <= 1024 then - self.NoDrawSubModels = true + if time > 1 then return end - local oldscale = self:GetModelScale() - local normal = self:GetUp() - local rnormal = normal * -1 - local mins = self:OBBMins() - local dist = self:OBBMaxs().z - mins.z - mins.x = 0 - mins.y = 0 - local pos = self:LocalToWorld(mins) + local eyepos = EyePos() + local pos = self:GetPos() + local dist = eyepos:DistToSqr(pos) - self:SetModelScale(oldscale * 1.01, 0) + if dist > 1048576 then return end--or (self.PropWeapon and not self.ShowBaseModel) then return end -- 1024^2 - if render.SupportsVertexShaders_2_0() then - render.EnableClipping(true) - render.PushCustomClipPlane(normal, normal:Dot(pos + dist * time * normal)) - render.PushCustomClipPlane(rnormal, rnormal:Dot(pos + dist * time * 1.25 * normal)) - end + --self.NoDrawSubModels = true - render.SetColorModulation(self.ColorModulation.r, self.ColorModulation.g, self.ColorModulation.b) - render.SuppressEngineLighting(true) + local oldscale = self:GetModelScale() + local normal = self:GetUp() + local rnormal = normal * -1 + local mins = self:OBBMins() + local mdist = self:OBBMaxs().z - mins.z + mins.x = 0 + mins.y = 0 + local minpos = self:LocalToWorld(mins) - render.SetBlend(0.15) - render.ModelMaterialOverride(matWhite) - self:DrawModel() + self:SetModelScale(oldscale * 1.01, 0) - render.SetBlend(0.4) - render.ModelMaterialOverride(matWireframe) - self:DrawModel() - - render.ModelMaterialOverride(0) - render.SuppressEngineLighting(false) - render.SetBlend(1) - render.SetColorModulation(1, 1, 1) - - if render.SupportsVertexShaders_2_0() then - render.PopCustomClipPlane() - render.PopCustomClipPlane() - render.EnableClipping(false) - end - self:SetModelScale(oldscale, 0) - - self.NoDrawSubModels = false + if render.SupportsVertexShaders_2_0() then + render.EnableClipping(true) + render.PushCustomClipPlane(normal, normal:Dot(minpos + mdist * time * normal)) + render.PushCustomClipPlane(rnormal, rnormal:Dot(minpos + mdist * time * (1 + 0.25 * mul) * normal)) end + + local qcol = {self.ColorModulation.r, self.ColorModulation.g, self.ColorModulation.b} + if self.QualityTier then + local customcols = self.BranchData and self.BranchData.Colors and self.BranchData.Colors[self.QualityTier] + + if customcols then + qcol = {customcols.r/255, customcols.g/255, customcols.b/255} + else + local qcolt = GAMEMODE.WeaponQualityColors[self.QualityTier][self.Branch and 2 or 1] + qcol = {qcolt.r/255, qcolt.g/255, qcolt.b/255} + end + end + render.SetColorModulation(unpack(qcol)) + render.SuppressEngineLighting(true) + + render.SetBlend(0.1 + 0.05 * mul) + render.ModelMaterialOverride(matWhite) + if MySelf:IsSkillActive(SKILL_SCAVENGER) then + cam.IgnoreZ(true) + end + self:DrawPreciseModel(0.1 + 0.05 * mul, qcol) + + render.SetBlend(0.05 + 0.1 * mul) + render.ModelMaterialOverride(matWireframe) + self:DrawPreciseModel(0.05 + 0.1 * mul, qcol) + + cam.IgnoreZ(false) + + render.ModelMaterialOverride(0) + render.SuppressEngineLighting(false) + render.SetBlend(1) + render.SetColorModulation(1, 1, 1) + + if render.SupportsVertexShaders_2_0() then + render.PopCustomClipPlane() + render.PopCustomClipPlane() + render.EnableClipping(false) + end + self:SetModelScale(oldscale, 0) + + --self.NoDrawSubModels = false +end + +function ENT:Draw() + self:DrawTranslucent() end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_blocker/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_blocker/cl_init.lua index 33dcc35..57d06eb 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_blocker/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_blocker/cl_init.lua @@ -1 +1 @@ -include("shared.lua") +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_blocker/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_blocker/init.lua index 8e0662c..e5f60c5 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_blocker/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_blocker/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:SetModel("models/props_wasteland/medbridge_post01.mdl") diff --git a/gamemodes/zombiesurvival/entities/entities/prop_camera/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_camera/cl_init.lua new file mode 100644 index 0000000..2f0a163 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_camera/cl_init.lua @@ -0,0 +1,28 @@ +INC_CLIENT() + +function ENT:SetObjectHealth(health) + self:SetDTFloat(3, health) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) +end + +local render_SetBlend = render.SetBlend +function ENT:Draw() + if FROM_CAMERA == self then return end + + local lp = LocalPlayer() + if lp:IsValid() and lp:Team() == TEAM_UNDEAD then + local dist = EyePos():DistToSqr(self:GetPos()) + if dist > 15000 then return end + + render_SetBlend(math.Clamp(1 - dist / 7500, 0, 1)) + + self:DrawModel() + + render_SetBlend(1) + else + self:DrawModel() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_camera/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_camera/init.lua new file mode 100644 index 0000000..5596cf1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_camera/init.lua @@ -0,0 +1,97 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModel("models/props_c17/light_domelight02_off.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_WORLD) + self:SetUseType(SIMPLE_USE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Wake() + end + + self:SetMaxObjectHealth(self.MaxHealth) + self:SetObjectHealth(self:GetMaxObjectHealth()) + + local ent = ents.Create("prop_hitbox_camera") + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:SetOwner(self) + ent:SetParent(self) + ent:Spawn() + + self:DeleteOnRemove(ent) + self.Hitbox = ent + end +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(3, health) + + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + self:EmitSound("npc/manhack/gib.wav") + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetPos(self:WorldSpaceCenter()) + ent:SetAngles(self:GetAngles()) + ent:SetModel("models/manhack.mdl") + ent:Spawn() + + ent:Fire("break") + ent:Fire("kill", "", 0.05) + end + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + self:Remove() + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, "camera") + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + + self:Remove() +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:ResetLastBarricadeAttacker(attacker, dmginfo) + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + end +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTInt(1, health) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) + if self.HitBox then + self.HitBox:SetObjectOwner(ent) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_camera/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_camera/shared.lua new file mode 100644 index 0000000..56c2b2b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_camera/shared.lua @@ -0,0 +1,26 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_OPAQUE + +ENT.SWEP = "weapon_zs_camera" +ENT.MaxHealth = 75 + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true +ENT.IgnoreBullets = true + +ENT.CanPackUp = true +ENT.PackUpTime = 1 + +ENT.AlwaysGhostable = true + +function ENT:GetObjectHealth() + return self:GetDTFloat(3) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTInt(1) +end + +function ENT:GetObjectOwner() + return self:GetDTEntity(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/cl_init.lua index 0f53872..782c3e1 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/cl_init.lua @@ -1,12 +1,13 @@ -include("shared.lua") +INC_CLIENT() ENT.Seed = 0 ENT.Tall = 0 ENT.Blocked = false function ENT:Initialize() - local dist = math.max(16, GAMEMODE.DynamicSpawnDist) * 2 + local dist = math.max(16, GAMEMODE.CreeperNestDist) * 2 + self:SetModelScale(0.2, 0) self:SetRenderBounds(Vector(-dist, -dist, -dist), Vector(dist, dist, dist)) self:ManipulateBoneScale(0, self.ModelScale) @@ -21,6 +22,7 @@ function ENT:Initialize() self.FloorModel:Spawn() self.FloorModel:ManipulateBoneScale(0, Vector(0.01, 0.01, 0.01)) self.FloorModel:SetMaterial("models/flesh") + self.FloorModel:SetSolid(SOLID_NONE) end self.Seed = math.Rand(0, 10) @@ -46,7 +48,7 @@ function ENT:Think() local blocked = false local nearest = self:GetPos() for _, human in pairs(team.GetPlayers(TEAM_HUMAN)) do - if util.SkewedDistance(human:GetPos(), nearest, 2.75) <= GAMEMODE.DynamicSpawnDist then + if util.SkewedDistance(human:GetPos(), nearest, 2.75) <= GAMEMODE.CreeperNestDist then blocked = true break end @@ -81,9 +83,6 @@ ENT.NextEmit = 0 local gravParticle = Vector(0, 0, -200) local matFlesh = Material("models/flesh") local matWireframe = Material("models/wireframe") -local matBeam = Material("Effects/laser1", "smooth") -local r, g = 0, 0 -local colRing = Color(0, 0, 0, 255) function ENT:Draw() local curtime = CurTime() + self.Seed local a = math.abs(math.sin(curtime)) ^ 3 @@ -92,46 +91,18 @@ function ENT:Draw() local floormodel = self.FloorModel local fmvalid = floormodel:IsValid() - if MySelf:IsValid() and MySelf:Team() == TEAM_UNDEAD and built then - local frametime = FrameTime() * 500 - local ringtime = (curtime / 2 % 1) ^ 0.5 - local ringsize = ringtime * GAMEMODE.DynamicSpawnDist - local beamsize = ringtime * 20 - local up = self:GetUp() - local ang = self:GetForward():Angle() - ang.yaw = curtime * 360 % 360 - local ringpos = self:GetPos() + up * 16 - local blocked = self.Blocked - local a = (1 - ringtime) * 0.8 - - r = math.Approach(r, blocked and 255 or 0, frametime) - g = math.Approach(g, blocked and 0 or 255, frametime) - colRing.r = r * a - colRing.g = g * a - - render.SetMaterial(matBeam) - render.StartBeam(19) - for i=1, 19 do - render.AddBeam(ringpos + ang:Forward() * ringsize, beamsize, beamsize, colRing) - ang:RotateAroundAxis(up, 20) - end - render.EndBeam() - end - if built then render.ModelMaterialOverride(matFlesh) - --if fmvalid then floormodel:SetNoDraw(false) end else render.ModelMaterialOverride(matWireframe) render.SetColorModulation(self.Tall, 0, 0) - --if fmvalid then floormodel:SetNoDraw(true) end end if fmvalid then floormodel:ManipulateBoneScale(0, Vector(hscale * 1.1 + 0.05, hscale * 1.1 + 0.05, 0.02 * self.Tall)) end - self:ManipulateBoneScale(0, Vector(hscale, hscale, (0.1 - a * 0.005) * self.Tall)) + self:ManipulateBoneScale(0, Vector(hscale * 5, hscale * 5, (0.5 - a * 0.025) * self.Tall)) self:DrawModel() render.SetColorModulation(1, 1, 1) @@ -149,7 +120,7 @@ function ENT:Draw() emitter:SetNearClip(16, 24) for i=0, math.Rand(0, 1) ^ 0.5 * 10 do - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetGravity(gravParticle) particle:SetDieTime(math.Rand(4, 6)) particle:SetVelocity(Angle(math.Rand(-85, -70), math.Rand(0, 360), 0):Forward() * math.Rand(100, 200)) @@ -163,5 +134,5 @@ function ENT:Draw() particle:SetCollide(true) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/init.lua index 16d7ac9..d4119f9 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/init.lua @@ -1,20 +1,19 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextDecay = 0 ENT.BuildsThisTick = 0 +ENT.ZombieConstruction = true function ENT:Initialize() self:SetModel("models/props_wasteland/antlionhill.mdl") - self:PhysicsInitBox(Vector(-20, -20, 0), Vector(20, 20, 40)) - self:SetCollisionBounds(Vector(-20, -20, 0), Vector(20, 20, 40)) + self:PhysicsInitBox(Vector(-18, -18, 0), Vector(18, 18, 36)) + self:SetCollisionBounds(Vector(-18, -18, 0), Vector(18, 18, 36)) + self:SetSolid(SOLID_VPHYSICS) + self:SetModelScale(0.2, 0) self:SetUseType(SIMPLE_USE) - --self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) self:SetCustomCollisionCheck(true) - self:CollisionRulesChanged() + self:CollisionRulesChanged() --self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) self:ManipulateBoneScale(0, self.ModelScale) @@ -36,10 +35,12 @@ function ENT:BuildUp() self.BuildsThisTick = 0 end + if self:GetNestLastDamaged() + 1 > CurTime() then return end + if self.BuildsThisTick < 3 then self.BuildsThisTick = self.BuildsThisTick + 1 - self:SetNestHealth(math.min(self:GetNestHealth() + FrameTime() * self:GetNestMaxHealth() * 0.025, self:GetNestMaxHealth())) + self:SetNestHealth(math.min(self:GetNestHealth() + FrameTime() * self:GetNestMaxHealth() * 0.1, self:GetNestMaxHealth())) end end @@ -58,32 +59,46 @@ function ENT:Think() end function ENT:OnTakeDamage(dmginfo) - if self:GetNestHealth() <= 0 then return end + if self:GetNestHealth() <= 0 or dmginfo:GetDamage() <= 0 then return end local attacker = dmginfo:GetAttacker() if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then - local owner = self.Owner + local owner = self:GetNestOwner() if attacker:GetZombieClassTable().Name ~= "Flesh Creeper" then return end - if owner and owner:IsValid() and owner:Team() == TEAM_UNDEAD and owner ~= attacker and not attacker:IsAdmin() and owner:GetZombieClassTable().Name == "Flesh Creeper" and owner:Alive() and owner:GetPos():Distance(self:GetPos()) <= 768 then - attacker:CenterNotify(COLOR_RED, translate.ClientFormat(attacker, "x_has_built_this_nest_and_is_still_around", owner)) + if owner and owner:IsValidZombie() and owner ~= attacker and not attacker:IsAdmin() and owner:GetZombieClassTable().Name == "Flesh Creeper" and owner:Alive() and owner:GetPos():DistToSqr(self:GetPos()) <= 589824 then --768^2 + attacker:CenterNotify(COLOR_RED, translate.ClientFormat(attacker, "x_has_built_this_nest_and_is_still_around", owner:Name())) return end - if #ents.FindByClass(self:GetClass()) == 1 and not attacker:IsAdmin() and owner ~= attacker then + -- Disabled. Small maps can be limited to 1 nest due to their layout and it can result in an indestructible nest that hampers zombie progress. + --[[if #ents.FindByClass(self:GetClass()) == 1 and not attacker:IsAdmin() and owner ~= attacker then attacker:CenterNotify(COLOR_RED, translate.ClientGet(attacker, "no_other_nests")) return - end + end]] end - self:SetNestHealth(self:GetNestHealth() - dmginfo:GetDamage()) + local damage = dmginfo:GetDamage() * (dmginfo:GetInflictor().FlyingControllable and 0.3 or 1) + if self:GetNestBuilt() and attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + local points = damage / self:GetNestMaxHealth() * 5 + + attacker.PointQueue = attacker.PointQueue + points + + local pos = self:GetPos() + pos.z = pos.z + 32 + + attacker.LastDamageDealtPos = pos + attacker.LastDamageDealtTime = CurTime() + end + + self:SetNestHealth(self:GetNestHealth() - damage) self:SetNestLastDamaged(CurTime()) if self:GetNestHealth() <= 0 then if self:GetNestBuilt() and attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then - attacker:AddPoints(5) + --attacker:AddPoints(5) attacker.NestsDestroyed = attacker.NestsDestroyed + 1 end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/shared.lua index b24440f..774e01a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_creepernest/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_creepernest/shared.lua @@ -1,15 +1,18 @@ ENT.Type = "anim" -ENT.MaxHealth = 100 +ENT.MaxHealth = 350 -ENT.ModelScale = Vector(0.2, 0.2, 0.1) +ENT.ModelScale = Vector(1, 1, 0.5) ENT.m_NoNailUnfreeze = true ENT.NoNails = true +ENT.IsCreeperNest = true + AccessorFuncDT(ENT, "NestHealth", "Float", 0) AccessorFuncDT(ENT, "NestBuilt", "Bool", 0) AccessorFuncDT(ENT, "NestLastDamaged", "Float", 1) +AccessorFuncDT(ENT, "NestOwner", "Entity", 0) function ENT:SetNestBuilt(b) self:SetDTBool(0, b) @@ -17,7 +20,7 @@ function ENT:SetNestBuilt(b) end function ENT:ShouldNotCollide(ent) - return ent:IsPlayer() and (not self:GetNestBuilt() or ent:Team() == TEAM_UNDEAD) + return ent:IsPlayer() --and (not self:GetNestBuilt() or ent:Team() == TEAM_UNDEAD) end function ENT:GetNestMaxHealth() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/cl_init.lua new file mode 100644 index 0000000..33f73c6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/cl_init.lua @@ -0,0 +1,6 @@ +INC_CLIENT() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetNoDraw(true) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/init.lua new file mode 100644 index 0000000..85c9238 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/init.lua @@ -0,0 +1,37 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetNoDraw(true) + + self:PhysicsInitBox(self.BoxMin, self.BoxMax) + + self:SetCustomCollisionCheck(true) + self:CollisionRulesChanged() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + self:GetParent():OnPackedUp(pl) +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + local parent = self:GetParent() + if parent and parent:IsValid() then + parent:SetObjectHealth(parent:GetObjectHealth() - dmginfo:GetDamage()) + parent:ResetLastBarricadeAttacker(attacker, dmginfo) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/shared.lua new file mode 100644 index 0000000..44737b7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_deployablehitbox/shared.lua @@ -0,0 +1,31 @@ +ENT.Type = "anim" + +ENT.IgnoreMelee = true +ENT.IgnoreBullets = true +ENT.IgnoreTraces = true + +ENT.CanPackUp = true + +ENT.BoxMin = Vector(-8, -8, 0) +ENT.BoxMax = Vector(8, 8, 8) + +function ENT:ShouldNotCollide(ent) + if ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValid() and owner:IsHuman() then return true end + end + + local colgroup = ent:GetCollisionGroup() + if colgroup == COLLISION_GROUP_PLAYER or colgroup == COLLISION_GROUP_WEAPON or colgroup == COLLISION_GROUP_NONE then + return true + end + + return false +end + +function ENT:GetObjectOwner() + local parent = self:GetParent() + if parent:IsValid() then return parent:GetObjectOwner() end + + return NULL +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_detpack/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_detpack/cl_init.lua index 6dafcb9..10162f4 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_detpack/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_detpack/cl_init.lua @@ -1,7 +1,11 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_BOTH +function ENT:Initialize() + self.CreateTime = CurTime() +end + function ENT:Draw() self:DrawModel() end @@ -9,13 +13,20 @@ end local matGlow = Material("sprites/glow04_noz") local colBlue = Color(100, 100, 255) function ENT:DrawTranslucent() - local lightpos = self:GetPos() + self:GetUp() * 8 - self:GetRight() * 2 + local lightpos = self:GetPos() + self:GetUp() * 9 - self:GetRight() * 2 + local armed = self.CreateTime + self.ArmTime < CurTime() if self:GetExplodeTime() == 0 then - if self:GetOwner():IsValid() then + if self:GetOwner():IsValid() and armed then render.SetMaterial(matGlow) render.DrawSprite(lightpos, 16, 16, COLOR_GREEN) - render.DrawSprite(lightpos, 4, 4, COLOR_DARKGREEN) + render.DrawSprite(lightpos, 4, 4, COLOR_WHITE) + elseif self:GetOwner():IsValid() then + local size = (CurTime() * 2.5 % 1) * 8 + + render.SetMaterial(matGlow) + render.DrawSprite(lightpos, size, size, COLOR_YELLOW) + render.DrawSprite(lightpos, size / 4, size / 4, COLOR_WHITE) else render.SetMaterial(matGlow) render.DrawSprite(lightpos, 16, 16, colBlue) @@ -25,6 +36,6 @@ function ENT:DrawTranslucent() local size = (CurTime() * 2.5 % 1) * 24 render.SetMaterial(matGlow) render.DrawSprite(lightpos, size, size, COLOR_RED) - render.DrawSprite(lightpos, size / 4, size / 4, COLOR_DARKRED) + render.DrawSprite(lightpos, size / 4, size / 4, COLOR_WHITE) end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_detpack/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_detpack/init.lua index 0865707..3a4ca6e 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_detpack/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_detpack/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() local function RefreshDetpackOwners(pl) for _, ent in pairs(ents.FindByClass("prop_detpack")) do @@ -16,6 +13,8 @@ hook.Add("OnPlayerChangedTeam", "Detpack.OnPlayerChangedTeam", RefreshDetpackOwn ENT.NextBlip = 0 function ENT:Initialize() + self.CreateTime = CurTime() + self:SetModel("models/weapons/w_c4_planted.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) @@ -36,6 +35,8 @@ end function ENT:OnTakeDamage(dmginfo) self:TakePhysicsDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + if not self.Exploded and dmginfo:GetDamage() >= 9 then local attacker = dmginfo:GetAttacker() if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then @@ -63,14 +64,22 @@ function ENT:Explode() self.Exploded = true local owner = self:GetOwner() - if owner:IsValid() and owner:IsPlayer() and owner:Team() == TEAM_HUMAN then + if owner:IsValidHuman() then local pos = self:GetPos() - util.BlastDamage2(self, owner, pos, 320, 600) + util.BlastDamagePlayer(self, owner, pos, 256, 480, DMG_ALWAYSGIB) local effectdata = EffectData() effectdata:SetOrigin(pos) - util.Effect("Explosion", effectdata) + effectdata:SetNormal(self:GetUp() * -1) + util.Effect("decal_scorch", effectdata) + + for i=1, 3 do + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 75 + i * 5, 100) + end + for i=1, 2 do + ParticleEffect("dusty_explosion_rockets", pos, angle_zero) + end end end @@ -99,3 +108,9 @@ function ENT:OnPackedUp(pl) self:Remove() end + +function ENT:SetExplodeTime(time) + if self.CreateTime + self.ArmTime > CurTime() then return end + + self:SetDTFloat(0, time) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_detpack/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_detpack/shared.lua index 544e39a..56582db 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_detpack/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_detpack/shared.lua @@ -1,18 +1,15 @@ ENT.Type = "anim" ENT.CanPackUp = true -ENT.PackUpTime = 4 +ENT.PackUpTime = 2 ENT.m_NoNailUnfreeze = true ENT.NoNails = true ENT.NoPropDamageDuringWave0 = true -ENT.ExplosionDelay = 1 - -function ENT:SetExplodeTime(time) - self:SetDTFloat(0, time) -end +ENT.ExplosionDelay = 1.5 +ENT.ArmTime = 10 function ENT:GetExplodeTime() return self:GetDTFloat(0) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone/cl_init.lua index 1f880b2..6f7e916 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_drone/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone/cl_init.lua @@ -1,11 +1,14 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 72)) - self.AmbientSound = CreateSound(self, "npc/scanner/scanner_combat_loop1.wav") + self.AmbientSound = CreateSound(self, "npc/scanner/scanner_scan_loop2.wav") self.AmbientSound:Play() + local sound = "npc/attack_helicopter/aheli_weapon_fire_loop3.wav" + self.ShootingSound = CreateSound(self, sound) + self.PixVis = util.GetPixelVisibleHandle() hook.Add("CreateMove", self, self.CreateMove) @@ -13,101 +16,121 @@ function ENT:Initialize() hook.Add("CalcView", self, self.CalcView) end -ENT.NextEmit = 0 -local smokegravity = Vector(0, 0, 64) function ENT:Think() - self.AmbientSound:PlayEx(0.5, math.Clamp(90 + self:GetVelocity():Length() * 0.4, 90, 160)) + self.AmbientSound:PlayEx(0.5, math.Clamp(75 + self:GetVelocity():Length() * 0.5, 75, 150)) - if CurTime() >= self.NextEmit then - local perc = math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 255) - if perc < 0.5 then - self.NextEmit = CurTime() + 0.05 + perc * math.Rand(0.05, 0.25) - - local sat = perc * 90 - - local emitter = ParticleEmitter(pos) - emitter:SetNearClip(16, 24) - - local particle = emitter:Add("particles/smokey", pos) - particle:SetStartAlpha(180) - particle:SetEndAlpha(0) - particle:SetStartSize(0) - particle:SetEndSize(math.Rand(10, 24)) - particle:SetVelocity(self:GetVelocity() * 0.7 + VectorRand():GetNormalized() * math.Rand(4, 24)) - particle:SetGravity(smokegravity) - particle:SetDieTime(math.Rand(0.8, 1.6)) - particle:SetAirResistance(150) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-2, 2)) - particle:SetCollide(true) - particle:SetBounce(0.2) - particle:SetColor(sat, sat, sat) - - emitter:Finish() + if self:GetObjectOwner():IsValid() and self:GetAmmo() > 0 then + if self:IsFiring() then + self.ShootingSound:PlayEx(1, 120 + math.cos(CurTime())) + else + self.ShootingSound:Stop() end + else + self.ShootingSound:Stop() end end function ENT:OnRemove() self.AmbientSound:Stop() + self.ShootingSound:Stop() end function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) end -local colLight = Color(255, 0, 0) local colWhite = Color(255, 255, 255) -local colHealth = Color(255, 255, 255) +local colLight = Color(255, 255, 255) +local matBeam = Material("effects/laser1") +local matGlow = Material("sprites/glow04_noz") local matLight = Material("sprites/light_ignorez") +local normalvec = Vector(0, 0, 26) +local spreadvec = Vector(40, 40, 0) + function ENT:DrawTranslucent() - self:DrawModel() + self:CalculateFireAngles() - local lp = LocalPlayer() - local owner = self:GetOwner() + local owner = self:GetObjectOwner() + if not owner:IsValid() then return end - if lp:IsValid() and lp:Team() == TEAM_HUMAN and owner:IsValid() and owner:IsPlayer() then - local ang = EyeAngles() - ang.pitch = 0 - local right = ang:Right() - ang:RotateAroundAxis(ang:Up(), 270) - ang:RotateAroundAxis(ang:Forward(), 90) - cam.Start3D2D(self:LocalToWorld(Vector(0, 0, 26)), ang, 0.025) - draw.SimpleTextBlurry(owner:Name(), "ZS3D2DFont", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP) - local perc = math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1) - colHealth.r = 255 - colHealth.g = perc ^ 0.3 * 255 - colHealth.b = perc * 255 - draw.SimpleTextBlurry(math.ceil(perc * 100), "ZS3D2DFontBig", 0, 0, colHealth, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) - cam.End3D2D() + local lp = MySelf + local camera = owner == lp and self:BeingControlled() + + if not camera then + local alpha = self:TransAlphaToMe() + render.SetBlend(alpha) + self:DrawModel() + render.SetBlend(1) end + local ammo = self:GetAmmo() + local epos = self:GetRedLightPos() - local LightNrm = self:GetRedLightAngles():Forward() + local LightNrm = self:GetForward() local ViewNormal = epos - EyePos() local Distance = ViewNormal:Length() ViewNormal:Normalize() local ViewDot = math.min(1, ViewNormal:Dot( LightNrm * -1 ) + 0.25) - if ViewDot > 0 then - if owner:IsValid() and owner:IsPlayer() then - local vcol = owner:GetPlayerColor() - if vcol then - if vcol == vector_origin then - vcol.x = 1 vcol.y = 1 vcol.z = 1 - end - vcol:Normalize() - vcol = vcol * 2.55 - colLight.r = math.Clamp(vcol.r * 100, 0, 255) - colLight.g = math.Clamp(vcol.g * 100, 0, 255) - colLight.b = math.Clamp(vcol.b * 100, 0, 255) - end - end + local ang = self:GetGunAngles() + local tr = util.TraceLine({start = epos, endpos = epos + ang:Forward() * self.GunRange * (owner.DroneGunRangeMul or 1), mask = MASK_SHOT, filter = self.ScanFilter}) + local rate = FrameTime() * 1024 + if tr.Hit then + colLight.r = math.Approach(colLight.r, 50, rate) + colLight.g = math.Approach(colLight.g, 255, rate) + colLight.b = math.Approach(colLight.b, 255, rate) + else + colLight.r = math.Approach(colLight.r, 255, rate) + colLight.g = math.Approach(colLight.g, 20, rate) + colLight.b = math.Approach(colLight.b, 20, rate) + end + + if not camera then + render.SetMaterial(matBeam) + render.DrawBeam(epos, tr.HitPos, 1, 0, 1, COLOR_WHITE) + render.DrawBeam(epos, tr.HitPos, 4, 0, 1, colLight) + end + + colLight.a = camera and 30 or 255 + render.SetMaterial(matGlow) + render.DrawSprite(tr.HitPos + tr.HitNormal * 2, camera and 12 or 4, camera and 12 or 4, COLOR_WHITE) + render.DrawSprite(tr.HitPos + tr.HitNormal * 2, camera and 35 or 10, camera and 35 or 10, colLight) + + if camera then + render.DrawSprite(tr.HitPos + tr.HitNormal * 2, 25, 1, COLOR_WHITE) + render.DrawSprite(tr.HitPos + tr.HitNormal * 2, 1, 25, COLOR_WHITE) + end + + if lp:IsValid() and lp:Team() == TEAM_HUMAN and owner:IsValid() and owner:IsPlayer() then + local adjvec = epos + spreadvec * ang:Forward() + adjvec.z = adjvec.z + 15 + ang = lp:EyeAngles() + ang.pitch = 0 + ang:RotateAroundAxis(ang:Up(), 270) + ang:RotateAroundAxis(ang:Forward(), 90) + cam.Start3D2D(camera and adjvec or self:LocalToWorld(normalvec), ang, 0.03) + cam.IgnoreZ(camera) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 150, 0.85, -150) + + if ammo > 0 then + draw.SimpleTextBlurry("["..ammo.." / "..self.MaxAmmo.."]", "ZS3D2DFontSmall", 0, 180, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + else + draw.SimpleTextBlurry(translate.Get("empty"), "ZS3D2DFontSmall", 0, 180, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + cam.IgnoreZ(false) + cam.End3D2D() + end + + if ViewDot > 0 then local LightPos = epos + LightNrm * 5 render.SetMaterial(matLight) - local Visibile = util.PixelVisible( LightPos, 16, self.PixVis ) + local Visibile = util.PixelVisible( LightPos, 16, self.PixVis ) if not Visibile then return end @@ -124,7 +147,7 @@ function ENT:DrawTranslucent() end function ENT:CreateMove(cmd) - if self:GetOwner() ~= LocalPlayer() then return end + if self:GetObjectOwner() ~= MySelf then return end if not self:BeingControlled() then return end @@ -146,23 +169,15 @@ function ENT:CreateMove(cmd) end function ENT:ShouldDrawLocalPlayer(pl) - if self:GetOwner() ~= LocalPlayer() then return end + if self:GetObjectOwner() ~= MySelf then return end if self:BeingControlled() then return true end end -local ViewHullMins = Vector(-4, -4, -4) -local ViewHullMaxs = Vector(4, 4, 4) function ENT:CalcView(pl, origin, angles, fov, znear, zfar) - if self:GetOwner() ~= pl then return end + if self:GetObjectOwner() ~= pl or not self:BeingControlled() then return end - if not self:BeingControlled() then return end - - local filter = player.GetAll() - filter[#filter + 1] = self - local tr = util.TraceHull({start = self:GetPos(), endpos = self:GetPos() + angles:Forward() * -48, mask = MASK_SHOT, filter = filter, mins = ViewHullMins, maxs = ViewHullMaxs}) - - return {origin = tr.HitPos + tr.HitNormal * 3} + return {origin = self:GetCameraPosition(angles)} end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone/init.lua index 527629a..a0524cf 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_drone/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextWaterDamage = 0 @@ -9,14 +6,18 @@ function ENT:Initialize() self:SetModel("models/combine_scanner.mdl") self:SetUseType(SIMPLE_USE) + self:PhysicsInitBox(Vector(-30, -17, -14.15), Vector(18.29, 11.86, 15)) self:PhysicsInit(SOLID_VPHYSICS) + local phys = self:GetPhysicsObject() if phys:IsValid() then + phys:SetMaterial("metal") phys:SetMass(75) phys:EnableDrag(false) phys:EnableMotion(true) phys:Wake() phys:SetBuoyancyRatio(0.8) + phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) local Constraint = ents.Create("phys_keepupright") Constraint:SetAngles(Angle(0, 0, 0)) @@ -29,7 +30,7 @@ function ENT:Initialize() self:StartMotionController() - self:SetMaxObjectHealth(100) + self:SetMaxObjectHealth(self.MaxHealth) self:SetObjectHealth(self:GetMaxObjectHealth()) self.LastThink = CurTime() @@ -37,22 +38,59 @@ function ENT:Initialize() self:SetSequence(2) self:SetPlaybackRate(1) self:UseClientSideAnimation(true) - - --[[local ent = ents.Create("fhb") - if ent:IsValid() then - ent:SetPos(self:GetPos()) - ent:SetAngles(self:GetAngles()) - ent:SetParent(self) - ent:SetOwner(self) - ent.Size = 9 - ent:Spawn() - end]] - + self:SetCustomCollisionCheck(true) self:CollisionRulesChanged() hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) end +function ENT:SetupPlayerSkills() + local owner = self:GetObjectOwner() + local newmaxhealth = self.MaxHealth + local currentmaxhealth = self:GetMaxObjectHealth() + local defaults = scripted_ents.Get(self:GetClass()) + local maxspeed = defaults.MaxSpeed + local acceleration = defaults.Acceleration + local carrymass = defaults.CarryMass + local loaded = false + + if owner:IsValid() then + newmaxhealth = newmaxhealth * (owner.ControllableHealthMul or 1) + maxspeed = maxspeed * owner:GetTotalAdditiveModifier("ControllableSpeedMul", "DroneSpeedMul") + acceleration = acceleration * (owner.ControllableHandlingMul or 1) + carrymass = carrymass * (owner.DroneCarryMassMul or 1) + loaded = owner:IsSkillActive(SKILL_LOADEDHULL) + end + + newmaxhealth = math.ceil(newmaxhealth) + + self:SetMaxObjectHealth(newmaxhealth) + self:SetObjectHealth(self:GetObjectHealth() / currentmaxhealth * newmaxhealth) + + self.MaxSpeed = maxspeed + self.Acceleration = acceleration + self.CarryMass = carrymass + + if loaded then + if not IsValid(self.LoadedProp) then + local ent = ents.Create("prop_dynamic_override") + if ent:IsValid() then + ent:SetModel("models/props_junk/propane_tank001a.mdl") + ent:SetModelScale(0.65, 0) + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(Vector(-5, 0, -6.5)) + ent:SetLocalAngles(Angle(-40, 0, 0)) + ent:Spawn() + + self.LoadedProp = ent + end + end + elseif IsValid(self.LoadedProp) then + self.LoadedProp:Remove() + end +end + function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) @@ -62,30 +100,46 @@ function ENT:SetObjectHealth(health) end function ENT:OnTakeDamage(dmginfo) - --if dmginfo:GetDamageType() ~= DMG_CRUSH and not self._AllowDamage then return end + if dmginfo:GetDamage() <= 0 then return end local attacker = dmginfo:GetAttacker() - if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then - self:TakePhysicsDamage(dmginfo) + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end - self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:TakePhysicsDamage(dmginfo) - --self:EmitSound("npc/scanner/scanner_pain"..math.random(2)..".wav", 0.65, math.Rand(120, 130)) - self:EmitSound("npc/manhack/gib.wav") + if dmginfo:GetDamageType() == DMG_ACID then + dmginfo:SetDamage(dmginfo:GetDamage() * 2) + end - local effectdata = EffectData() - effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) - effectdata:SetNormal(VectorRand():GetNormalized()) - effectdata:SetMagnitude(4) - effectdata:SetScale(1.33) - util.Effect("sparks", effectdata) + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + + self:EmitSound("npc/scanner/scanner_pain"..math.random(2)..".wav", 65, math.Rand(120, 130)) + + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) + effectdata:SetNormal(VectorRand():GetNormalized()) + effectdata:SetMagnitude(4) + effectdata:SetScale(1.33) + util.Effect("sparks", effectdata) +end + +function ENT:Use(activator, caller) + if not activator:IsPlayer() or activator:Team() ~= TEAM_HUMAN or not self:GetObjectOwner():IsValid() or activator:GetInfo("zs_nousetodeposit") ~= "0" then return end + + local ammotype = self.AmmoType + local curammo = self:GetAmmo() + + local togive = math.min(GAMEMODE.AmmoCache[ammotype], activator:GetAmmoCount(ammotype), self.MaxAmmo - curammo) + if togive > 0 then + self:SetAmmo(curammo + togive) + activator:RemoveAmmo(togive, ammotype) + activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) + self:EmitSound("npc/turret_floor/click1.wav") end end -function ENT:Use(pl) - if pl == self:GetOwner() and pl:Team() == TEAM_HUMAN and pl:Alive() and self:GetVelocity():Length() <= self.HoverSpeed then - self:OnPackedUp(pl) - end +function ENT:AltUse(activator, tr) + self:PackUp(activator) end function ENT:PhysicsCollide(data, phys) @@ -94,10 +148,11 @@ function ENT:PhysicsCollide(data, phys) end function ENT:OnPackedUp(pl) - pl:GiveEmptyWeapon("weapon_zs_drone") - pl:GiveAmmo(1, "drone") + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, self.DeployableAmmo) pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + pl:GiveAmmo(self:GetAmmo(), self.AmmoType) self:Remove() end @@ -105,11 +160,11 @@ end function ENT:PhysicsSimulate(phys, frametime) phys:Wake() - local owner = self:GetOwner() - if not owner:IsValid() then return SIM_NOTHING end + local owner = self:GetObjectOwner() + if not owner:IsValid() or self.DisableControlUntil and CurTime() < self.DisableControlUntil then return SIM_NOTHING end local vel = phys:GetVelocity() - local movedir = Vector() + local movedir = Vector(0, 0, 0) local eyeangles = owner:SyncAngles() local aimangles = owner:EyeAngles() @@ -132,6 +187,10 @@ function ENT:PhysicsSimulate(phys, frametime) if owner:KeyDown(IN_GRENADE1) then movedir = movedir - Vector(0, 0, 0.5) end + local angdiff = math.AngleDifference(eyeangles.yaw, phys:GetAngles().yaw) + if math.abs(angdiff) > 4 then + phys:AddAngleVelocity(Vector(0, 0, math.Clamp(angdiff, -64, 64) * frametime * 100 - phys:GetAngleVelocity().z * 0.95)) + end end if movedir == vector_origin then @@ -161,7 +220,8 @@ function ENT:PhysicsSimulate(phys, frametime) phys:EnableGravity(false) phys:SetAngleDragCoefficient(20000) phys:SetVelocityInstantaneous(vel) - phys:AddAngleVelocity(Vector(0, 0, math.Clamp(math.AngleDifference(eyeangles.yaw, phys:GetAngles().yaw), -32, 32) * frametime * 3)) + + self:SetPhysicsAttacker(owner) return SIM_NOTHING end @@ -170,15 +230,79 @@ function ENT:Destroy() if self.Destroyed then return end self.Destroyed = true - self:EmitSound("npc/manhack/gib.wav") + local pos = self:LocalToWorld(self:OBBCenter()) + + self:EmitSound("npc/scanner/scanner_explode_crash2.wav") local effectdata = EffectData() - effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) - util.Effect("HelicopterMegaBomb", effectdata, true, true) + effectdata:SetOrigin(pos) effectdata:SetNormal(Vector(0, 0, 1)) effectdata:SetMagnitude(5) effectdata:SetScale(1.5) util.Effect("sparks", effectdata) + + local owner = self:GetObjectOwner() + if owner:IsValidLivingHuman() and owner:IsSkillActive(SKILL_LOADEDHULL) then + effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 100, 100) + ParticleEffect("dusty_explosion_rockets", pos, angle_zero) + + util.BlastDamagePlayer(self, owner, pos, 128, 225, DMG_ALWAYSGIB) + else + util.Effect("HelicopterMegaBomb", effectdata, true, true) + end + + local amount = math.floor(self:GetAmmo() * 0.5) + while amount > 0 do + local todrop = math.min(amount, 50) + amount = amount - todrop + local ent = ents.Create("prop_ammo") + if ent:IsValid() then + local heading = VectorRand():GetNormalized() + ent:SetAmmoType(self.AmmoType) + ent:SetAmmo(todrop) + ent:SetPos(pos + heading * 4) + ent:SetAngles(VectorRand():Angle()) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:ApplyForceOffset(heading * math.Rand(8000, 32000), pos) + end + end + end +end + +function ENT:BulletCallback(tr, dmginfo) + local ent = tr.Entity + if not ent or not ent:IsValid() then return end + + if ent:IsValidZombie() then + ent:AddLegDamage(4.5) + end +end + +function ENT:FireTurret(src, dir) + if self:GetNextFire() <= CurTime() then + local curammo = self:GetAmmo() + if curammo > 0 then + local owner = self:GetObjectOwner() + + self:SetNextFire(CurTime() + 0.15) + self:SetAmmo(curammo - 1) + + owner:LagCompensation(true) + self:FireBulletsLua(src, dir, 5, 1, 16.5, owner, nil, "AR2Tracer", self.BulletCallback, nil, nil, self.GunRange, nil, self) + owner:LagCompensation(false) + else + self:SetNextFire(CurTime() + 2) + self:EmitSound("npc/turret_floor/die.wav") + end + end end ENT.PhysDamageImmunity = 0 @@ -187,6 +311,10 @@ function ENT:Think() if not self.CreatedDebris then self.CreatedDebris = true + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + local ent = ents.Create("prop_physics") if ent:IsValid() then ent:SetPos(self:GetPos()) @@ -207,7 +335,7 @@ function ENT:Think() return end - local owner = self:GetOwner() + local owner = self:GetObjectOwner() if owner:IsValid() then self:SetPhysicsAttacker(owner) @@ -220,14 +348,27 @@ function ENT:Think() return end + self:CalculateFireAngles() + + if self:GetAmmo() > 0 then + if self:BeingControlled() and owner:KeyDown(IN_ATTACK) then + if not self:IsFiring() then self:SetFiring(true) end + self:FireTurret(self:GetRedLightPos(), self:GetGunAngles():Forward()) + else + self:SetFiring(false) + end + end + if self:WaterLevel() >= 2 and CurTime() >= self.NextWaterDamage then self.NextWaterDamage = CurTime() + 0.2 self:TakeDamage(10) end + self:NextThink(CurTime()) + local data = self.HitData - if not data then return end + if not data then return true end self.HitData = nil local ent = data.HitEntity @@ -238,22 +379,50 @@ function ENT:Think() end end - local dir = (self:GetPos() - data.HitPos):GetNormalized() - if data.Speed > self.HoverSpeed then local phys = self:GetPhysicsObject() if phys:IsValid() then - phys:AddVelocity(dir * 50) + local dir = self:GetPos() - data.HitPos + dir:Normalize() + phys:AddVelocity(dir * 20) end end - if data.Speed >= self.MaxSpeed * 0.75 and ent and ent:IsWorld() and CurTime() >= self.PhysDamageImmunity then + if ((not owner:IsSkillActive(SKILL_STABLEHULL) and data.Speed >= self.MaxSpeed * 0.75) or (self.LastShadeLaunch and self.LastShadeLaunch + 2 > CurTime())) and + ent and ent:IsWorld() and CurTime() >= self.PhysDamageImmunity then self:TakeDamage(math.Clamp(data.Speed * 0.11, 0, 40)) end + + return true end function ENT:SetupPlayerVisibility(pl) - if pl ~= self:GetOwner() then return end + if pl ~= self:GetObjectOwner() then return end AddOriginToPVS(self:GetPos()) + AddOriginToPVS(self:GetPos() + pl:GetAimVector() * 1024) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + + if health <= 0 and not self.Destroyed then + self.Destroyed = true + end +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(1, health) +end + +function ENT:SetNextFire(tim) + self:SetDTFloat(2, tim) +end + +function ENT:SetAmmo(ammo) + self:SetDTInt(0, ammo) +end + +function ENT:SetFiring(onoff) + self:SetDTBool(0, onoff) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone/shared.lua index badbf36..43d3bbb 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_drone/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone/shared.lua @@ -3,31 +3,53 @@ ENT.RenderGroup = RENDERGROUP_TRANSLUCENT ENT.m_NoNailUnfreeze = true ENT.NoNails = true +ENT.CanPackUp = true +ENT.PackUpTime = 0.25 ENT.WrenchRepairMultiplier = 0.666 +ENT.MaxAmmo = 450 -ENT.Acceleration = 110 -ENT.MaxSpeed = 160 -ENT.HoverSpeed = 64 -ENT.HoverHeight = 58 -ENT.HoverForce = 64 -ENT.TurnSpeed = 45 +ENT.FirePitch = 0 +ENT.FireYaw = 0 + +ENT.Acceleration = 170 +ENT.MaxSpeed = 180 +ENT.HoverSpeed = 40 +ENT.HoverHeight = 92 +ENT.HoverForce = 128 +ENT.TurnSpeed = 55 ENT.IdleDrag = 0.25 +ENT.MaxHealth = 190 +ENT.GunRange = 275 +ENT.CarryMass = 80 + +ENT.IgnoreBullets = true + +ENT.PounceWeakness = 2 +ENT.IsShadeGrabbable = true +ENT.FlyingControllable = true +ENT.NoBlockExplosions = true + +ENT.DeployableAmmo = "drone" +ENT.SWEP = "weapon_zs_drone" +ENT.AmmoType = "smg1" + +AccessorFuncDT(ENT, "ObjectOwner", "Entity", 0) + function ENT:ShouldNotCollide(ent) + if not ent.ChargeTime and ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValidHuman() then + return true + end + end + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN end -function ENT:SetObjectHealth(health) - self:SetDTFloat(0, health) - - if health <= 0 and not self.Destroyed then - self.Destroyed = true - end -end - function ENT:BeingControlled() - local owner = self:GetOwner() + local owner = self:GetObjectOwner() if owner:IsValid() then local wep = owner:GetActiveWeapon() return wep:IsValid() and wep:GetClass() == "weapon_zs_dronecontrol" and wep:GetDTBool(0) @@ -36,22 +58,105 @@ function ENT:BeingControlled() return false end -function ENT:GetObjectHealth() - return self:GetDTFloat(0) +local M_Player = FindMetaTable("Player") +local P_Team = M_Player.Team +local temp_attacker +local function ManualTraceFilter(ent) + if ent == temp_attacker or getmetatable(ent) == M_Player and P_Team(ent) == TEAM_HUMAN or ent.FHB or ent.IsCreeperNest then + return false + end + + return true end -function ENT:SetMaxObjectHealth(health) - self:SetDTFloat(1, health) +function ENT:GetTraceFilter() + temp_attacker = self + return ManualTraceFilter +end + +local trace_manual = {mask = MASK_SHOT, filter = ManualTraceFilter} +function ENT:GetManualTrace() + local owner = self:GetObjectOwner() + local start = self:GetCameraPosition() + + trace_manual.start = start + trace_manual.endpos = start + owner:GetAimVector() * (self.GunRange * (owner.DroneGunRangeMul or 1)) + + temp_attacker = self + + return util.TraceLine(trace_manual) +end + +function ENT:GetLocalAnglesToPos(pos) + return self:WorldToLocalAngles(self:GetAnglesToPos(pos)) +end + +function ENT:GetAnglesToPos(pos) + return (pos - self:GetRedLightPos()):Angle() +end + +function ENT:CalculateFireAngles() + local owner = self:GetObjectOwner() + if not owner:IsValid() or self:GetMaterial() ~= "" then + self.FireYaw = math.Approach(self.FireYaw, 0, FrameTime() * 60) + self.FirePitch = math.Approach(self.FirePitch, 15, FrameTime() * 30) + return + end + + if owner:IsValidPlayer() and owner:GetActiveWeapon():IsValid() and owner:GetActiveWeapon():GetClass() == "weapon_zs_dronecontrol" then + local ang = self:GetLocalAnglesToPos(self:GetManualTrace().HitPos) + self.FireYaw = math.Clamp(math.NormalizeAngle(ang.yaw), -80, 80) + self.FirePitch = math.Clamp(math.NormalizeAngle(ang.pitch), -45, 37.5) + end +end + +function ENT:GetGunAngles() + local ang = self:GetAngles() + ang:RotateAroundAxis(ang:Right(), -self.FirePitch) + ang:RotateAroundAxis(ang:Up(), self.FireYaw) + return ang +end + +function ENT.ScanFilter(ent) + return not (ent:IsPlayer() or ent.ScanFilter or ent.GetNestMaxHealth) +end + +local trace_cam = {mask = MASK_VISIBLE, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} +function ENT:GetCameraPosition(angles) + local owner = self:GetObjectOwner() + if owner:IsValidPlayer() then + angles = angles or owner:EyeAngles() + trace_cam.start = self:GetPos() + trace_cam.endpos = self:GetRedLightPos() + trace_cam.filter = self.ScanFilter + local tr = util.TraceHull(trace_cam) + + return tr.HitPos + tr.HitNormal * 3 + end + + return self:GetRedLightPos() +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(0) end function ENT:GetMaxObjectHealth() return self:GetDTFloat(1) end +function ENT:GetNextFire() + return self:GetDTFloat(2) +end + +function ENT:GetAmmo() + return self:GetDTInt(0) +end + +function ENT:IsFiring() + return self:GetDTBool(0) +end + function ENT:GetRedLightPos() return self:LocalToWorld(Vector(3, 0, 13.75)) end - -function ENT:GetRedLightAngles() - return self:GetAngles() -end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/cl_init.lua new file mode 100644 index 0000000..c0357f4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/cl_init.lua @@ -0,0 +1,130 @@ +INC_CLIENT() + +function ENT:Initialize() + self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 72)) + + self.AmbientSound = CreateSound(self, "npc/combine_gunship/dropship_engine_distant_loop1.wav") + self.AmbientSound:Play() + + self.PixVis = util.GetPixelVisibleHandle() + + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + hook.Add("CalcView", self, self.CalcView) +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.25, math.Clamp(125 + self:GetVelocity():Length() * 0.5, 150, 250)) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) +end + +local colWhite = Color(255, 255, 255) +local colLight = Color(255, 255, 255) +local matLight = Material("sprites/light_ignorez") +local normalvec = Vector(0, 0, 26) +local spreadvec = Vector(40, 40, 0) + +function ENT:DrawTranslucent() + local owner = self:GetObjectOwner() + if not owner:IsValid() then return end + + local lp = MySelf + local camera = owner == lp and self:BeingControlled() + + if not camera then + local alpha = self:TransAlphaToMe() + render.SetBlend(alpha) + self:DrawModel() + render.SetBlend(1) + end + + local epos = self:GetRedLightPos() + local LightNrm = self:GetForward() + local ViewNormal = epos - EyePos() + local Distance = ViewNormal:Length() + ViewNormal:Normalize() + local ViewDot = math.min(1, ViewNormal:Dot( LightNrm * -1 ) + 0.25) + + local ang = LightNrm + + if lp:IsValid() and lp:Team() == TEAM_HUMAN and owner:IsValid() and owner:IsPlayer() then + local adjvec = epos + spreadvec * ang + adjvec.z = adjvec.z + 15 + ang = lp:EyeAngles() + ang.pitch = 0 + ang:RotateAroundAxis(ang:Up(), 270) + ang:RotateAroundAxis(ang:Forward(), 90) + cam.Start3D2D(camera and adjvec or self:LocalToWorld(normalvec), ang, 0.03) + cam.IgnoreZ(camera) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 150, 0.85, -150) + + cam.IgnoreZ(false) + cam.End3D2D() + end + + if ViewDot > 0 then + local LightPos = epos + LightNrm * 5 + + render.SetMaterial(matLight) + local Visibile = util.PixelVisible( LightPos, 16, self.PixVis ) + + if not Visibile then return end + + local Size = math.Clamp(Distance * Visibile * ViewDot, 25, 250) + + Distance = math.Clamp(Distance, 32, 800) + local Alpha = math.Clamp((1000 - Distance) * Visibile * ViewDot, 0, 120) + colLight.a = Alpha + colWhite.a = Alpha + + render.DrawSprite(LightPos, Size, Size, colLight, Visibile * ViewDot) + render.DrawSprite(LightPos, Size*0.4, Size*0.4, colWhite, Visibile * ViewDot) + end +end + +function ENT:CreateMove(cmd) + if self:GetObjectOwner() ~= MySelf then return end + + if not self:BeingControlled() then return end + + local buttons = cmd:GetButtons() + + cmd:ClearMovement() + + if bit.band(buttons, IN_JUMP) ~= 0 then + buttons = buttons - IN_JUMP + buttons = buttons + IN_BULLRUSH + end + + if bit.band(buttons, IN_DUCK) ~= 0 then + buttons = buttons - IN_DUCK + buttons = buttons + IN_GRENADE1 + end + + cmd:SetButtons(buttons) +end + +function ENT:ShouldDrawLocalPlayer(pl) + if self:GetObjectOwner() ~= MySelf then return end + + if self:BeingControlled() then + return true + end +end + +function ENT:CalcView(pl, origin, angles, fov, znear, zfar) + if self:GetObjectOwner() ~= pl or not self:BeingControlled() then return end + + return {origin = self:GetCameraPosition(angles)} +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/init.lua new file mode 100644 index 0000000..7f304e8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/init.lua @@ -0,0 +1,441 @@ +INC_SERVER() + +ENT.NextWaterDamage = 0 + +function ENT:Initialize() + self:SetModel("models/shield_scanner.mdl") + self:SetUseType(SIMPLE_USE) + + self:PhysicsInitBox(Vector(-30, -17, -14.15), Vector(18.29, 11.86, 15)) + self:PhysicsInit(SOLID_VPHYSICS) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("metal") + phys:SetMass(75) + phys:EnableDrag(false) + phys:EnableMotion(true) + phys:Wake() + phys:SetBuoyancyRatio(0.8) + phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) + + local Constraint = ents.Create("phys_keepupright") + Constraint:SetAngles(Angle(0, 0, 0)) + Constraint:SetKeyValue("angularlimit", 2) + Constraint:SetPhysConstraintObjects(phys, phys) + Constraint:Spawn() + Constraint:Activate() + self:DeleteOnRemove(Constraint) + end + + self:StartMotionController() + + self:SetMaxObjectHealth(self.MaxHealth) + self:SetObjectHealth(self:GetMaxObjectHealth()) + + self.LastThink = CurTime() + + self:ResetSequence(5) + self:SetPlaybackRate(1) + self:UseClientSideAnimation(true) + self:SetCustomCollisionCheck(true) + self:CollisionRulesChanged() + + hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) +end + +function ENT:SetupPlayerSkills() + local owner = self:GetObjectOwner() + local newmaxhealth = self.MaxHealth + local currentmaxhealth = self:GetMaxObjectHealth() + local defaults = scripted_ents.Get(self:GetClass()) + local maxspeed = defaults.MaxSpeed + local acceleration = defaults.Acceleration + local loaded = false + + if owner:IsValid() then + newmaxhealth = newmaxhealth * (owner.ControllableHealthMul or 1) + maxspeed = maxspeed * owner:GetTotalAdditiveModifier("ControllableSpeedMul", "DroneSpeedMul") + acceleration = acceleration * (owner.ControllableHandlingMul or 1) + loaded = owner:IsSkillActive(SKILL_LOADEDHULL) + end + + newmaxhealth = math.ceil(newmaxhealth) + + self:SetMaxObjectHealth(newmaxhealth) + self:SetObjectHealth(self:GetObjectHealth() / currentmaxhealth * newmaxhealth) + + self.MaxSpeed = maxspeed + self.Acceleration = acceleration + + if loaded then + if not IsValid(self.LoadedProp) then + local ent = ents.Create("prop_dynamic_override") + if ent:IsValid() then + ent:SetModel("models/props_junk/propane_tank001a.mdl") + ent:SetModelScale(0.65, 0) + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(Vector(-5, 0, -6.5)) + ent:SetLocalAngles(Angle(-40, 0, 0)) + ent:Spawn() + + self.LoadedProp = ent + end + end + elseif IsValid(self.LoadedProp) then + self.LoadedProp:Remove() + end +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + + if health <= 0 then + self:Destroy() + end +end + +function ENT:OnRemove() + self:RestoreGrappledEntityProperties() +end + +function ENT:RestoreGrappledEntityProperties() + local ent = self.GrappledEnt + if IsValid(ent) and ent._OriginalMass then + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(ent._OriginalMass) + phys:ClearGameFlag(FVPHYSICS_PLAYER_HELD) + phys:ClearGameFlag(FVPHYSICS_NO_IMPACT_DMG) + phys:ClearGameFlag(FVPHYSICS_NO_NPC_IMPACT_DMG) + ent._OriginalMass = nil + + local owner = self:GetObjectOwner() + if owner:IsValidPlayer() then + ent:SetPhysicsAttacker(owner) + end + end + end +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end + + self:TakePhysicsDamage(dmginfo) + + if dmginfo:GetDamageType() == DMG_ACID then + dmginfo:SetDamage(dmginfo:GetDamage() * 2) + end + + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + + self:EmitSound("npc/scanner/scanner_pain"..math.random(2)..".wav", 65, math.Rand(120, 130)) + + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) + effectdata:SetNormal(VectorRand():GetNormalized()) + effectdata:SetMagnitude(4) + effectdata:SetScale(1.33) + util.Effect("sparks", effectdata) +end + +function ENT:Use(activator, caller) +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:PhysicsCollide(data, phys) + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, self.DeployableAmmo) + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + + self:Remove() +end + +function ENT:PhysicsSimulate(phys, frametime) + phys:Wake() + + local owner = self:GetObjectOwner() + if not owner:IsValid() or self.DisableControlUntil and CurTime() < self.DisableControlUntil then return SIM_NOTHING end + + local vel = phys:GetVelocity() + local movedir = Vector(0, 0, 0) + local eyeangles = owner:SyncAngles() + local aimangles = owner:EyeAngles() + + if self:BeingControlled() then + if owner:KeyDown(IN_FORWARD) then + movedir = movedir + aimangles:Forward() + end + if owner:KeyDown(IN_BACK) then + movedir = movedir - aimangles:Forward() + end + if owner:KeyDown(IN_MOVERIGHT) then + movedir = movedir + aimangles:Right() + end + if owner:KeyDown(IN_MOVELEFT) then + movedir = movedir - aimangles:Right() + end + if owner:KeyDown(IN_BULLRUSH) then + movedir = movedir + Vector(0, 0, 0.5) + end + if owner:KeyDown(IN_GRENADE1) then + movedir = movedir - Vector(0, 0, 0.5) + end + local angdiff = math.AngleDifference(eyeangles.yaw, phys:GetAngles().yaw) + if math.abs(angdiff) > 4 then + phys:AddAngleVelocity(Vector(0, 0, math.Clamp(angdiff, -64, 64) * frametime * 100 - phys:GetAngleVelocity().z * 0.95)) + end + end + + if movedir == vector_origin then + vel = vel * (1 - frametime * self.IdleDrag) + else + movedir:Normalize() + + vel = vel + frametime * self.Acceleration * math.Clamp((self:GetObjectHealth() / self:GetMaxObjectHealth() + 1) / 2, 0.5, 1) * movedir + end + + if vel:Length() > self.MaxSpeed then + vel:Normalize() + vel = vel * self.MaxSpeed + end + + if movedir == vector_origin and vel:Length() <= self.HoverSpeed then + local trace = {mask = MASK_HOVER, filter = self} + trace.start = self:GetPos() + trace.endpos = trace.start + Vector(0, 0, self.HoverHeight * -2) + local tr = util.TraceLine(trace) + + local hoverdir = (trace.start - tr.HitPos):GetNormalized() + local hoverfrac = (0.5 - tr.Fraction) * 2 + vel = vel + frametime * hoverfrac * self.HoverForce * hoverdir + end + + phys:EnableGravity(false) + phys:SetAngleDragCoefficient(20000) + phys:SetVelocityInstantaneous(vel) + + self:SetPhysicsAttacker(owner) + + return SIM_NOTHING +end + +function ENT:Destroy() + if self.Destroyed then return end + self.Destroyed = true + + local pos = self:LocalToWorld(self:OBBCenter()) + + self:EmitSound("npc/scanner/scanner_explode_crash2.wav") + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0, 0, 1)) + effectdata:SetMagnitude(5) + effectdata:SetScale(1.5) + util.Effect("sparks", effectdata) + + local owner = self:GetObjectOwner() + if owner:IsValidLivingHuman() and owner:IsSkillActive(SKILL_LOADEDHULL) then + effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 100, 100) + ParticleEffect("dusty_explosion_rockets", pos, angle_zero) + + util.BlastDamagePlayer(self, owner, pos, 128, 225, DMG_ALWAYSGIB) + else + util.Effect("HelicopterMegaBomb", effectdata, true, true) + end +end + +ENT.GrappledEnt = nil +local carryclasses = {"prop_ammo", "prop_weapon", "prop_invitem", "prop_physics", "prop_physics_multiplayer", "func_physbox"} +function ENT:RopeAttach() + if CurTime() < self:GetNextFire() then return end + self:SetNextFire(CurTime() + 0.5) + + if self:IsGrappling() then + constraint.RemoveConstraints(self, "Rope") + self:EmitSound("npc/scanner/scanner_scan1.wav") + self:RestoreGrappledEntityProperties() + self:SetGrappling(false) + self.GrappledEnt = nil + + return + end + + local owner = self:GetObjectOwner() + local start = self:GetCameraPosition() + local filter = self:GetTraceFilter() + local tr = util.TraceLine({start = start, endpos = start + owner:EyeAngles():Forward() * 128, mask = MASK_SOLID, filter = filter}) + + local ropetraceent = tr.Entity + if tr.Hit and ropetraceent and ropetraceent:IsValid() then + local entclass = ropetraceent:GetClass() + if table.HasValue(carryclasses, entclass) then + local phys = ropetraceent:GetPhysicsObject() + if phys:IsValid() and phys:GetMass() <= self.CarryMass and phys:IsMoveable() and not phys:HasGameFlag(FVPHYSICS_PLAYER_HELD) and (ropetraceent:OBBMins():Length() + ropetraceent:OBBMaxs():Length() < CARRY_DRAG_VOLUME or ropetraceent.NoVolumeCarryCheck) and not constraint.HasConstraints(ropetraceent) then + local rope = constraint.Rope(self, ropetraceent, 0, tr.PhysicsBone, vector_origin, WorldToLocal(tr.HitPos, angle_zero, ropetraceent:GetPos(), ropetraceent:GetAngles()), 0, 140, 2000, 1.5, "cable/rope.vmt", false) + if not rope then + return + end + self.GrappleCheckTime = CurTime() + 2 + self.GrappledEnt = ropetraceent + self.GrappleRope = rope + self:EmitSound("ambient/machines/catapult_throw.wav") + self:SetGrappling(true) + + ropetraceent._OriginalMass = ropetraceent._OriginalMass or phys:GetMass() + phys:SetMass(2) + phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) + phys:AddGameFlag(FVPHYSICS_NO_NPC_IMPACT_DMG) + phys:AddGameFlag(FVPHYSICS_PLAYER_HELD) + end + end + else + self:EmitSound("npc/scanner/scanner_scan4.wav", 55) + end +end + +ENT.PhysDamageImmunity = 0 +ENT.GrappleCheckTime = 0 +function ENT:Think() + if self.Destroyed then + if not self.CreatedDebris then + self.CreatedDebris = true + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:SetModel(self:GetModel()) + ent:Spawn() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(self:GetVelocity()) + end + + ent:Fire("break") + ent:Fire("kill", "", 0.05) + end + end + + self:Remove() + return + end + + local owner = self:GetObjectOwner() + if owner:IsValid() then + self:SetPhysicsAttacker(owner) + if IsValid(self.GrappledEnt) then + self.GrappledEnt:SetPhysicsAttacker(owner) + end + + if not owner:Alive() or owner:Team() ~= TEAM_HUMAN then + self:Destroy() + return + end + else + self:Destroy() + return + end + + if self:BeingControlled() and owner:KeyDown(IN_ATTACK) then + self:RopeAttach() + end + + if self.GrappleCheckTime <= CurTime() and self:IsGrappling() then + if not IsValid(self.GrappledEnt) or not IsValid(self.GrappleRope) then + constraint.RemoveConstraints(self, "Rope") + self:EmitSound("npc/scanner/scanner_alert1.wav") + self:SetGrappling(false) + self:RestoreGrappledEntityProperties() + self.GrappledEnt = nil + self.GrappleRope = nil + end + self.GrappleCheckTime = CurTime() + 2 + end + + if self:WaterLevel() >= 2 and CurTime() >= self.NextWaterDamage then + self.NextWaterDamage = CurTime() + 0.2 + + self:TakeDamage(10) + end + + self:NextThink(CurTime()) + + local data = self.HitData + if not data then return true end + self.HitData = nil + + local ent = data.HitEntity + if ent and ent:IsValid() then + local physattacker = ent:GetPhysicsAttacker() + if physattacker:IsValid() and physattacker:Team() == TEAM_HUMAN then + self.PhysDamageImmunity = CurTime() + 0.5 + end + end + + if data.Speed > self.HoverSpeed then + local phys = self:GetPhysicsObject() + if phys:IsValid() then + local dir = self:GetPos() - data.HitPos + dir:Normalize() + phys:AddVelocity(dir * 20) + end + end + + if ((not owner:IsSkillActive(SKILL_STABLEHULL) and data.Speed >= self.MaxSpeed * 0.75) or (self.LastShadeLaunch and self.LastShadeLaunch + 2 > CurTime())) and + ent and ent:IsWorld() and CurTime() >= self.PhysDamageImmunity then + self:TakeDamage(math.Clamp(data.Speed * 0.11, 0, 40)) + end + + return true +end + +function ENT:SetupPlayerVisibility(pl) + if pl ~= self:GetObjectOwner() then return end + + AddOriginToPVS(self:GetPos()) + AddOriginToPVS(self:GetPos() + pl:GetAimVector() * 1024) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + + if health <= 0 and not self.Destroyed then + self.Destroyed = true + end +end + +function ENT:SetNextFire(tim) + self:SetDTFloat(2, tim) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(1, health) +end + +function ENT:SetGrappling(onoff) + self:SetDTBool(1, onoff) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/shared.lua new file mode 100644 index 0000000..9c8f0ad --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_hauler/shared.lua @@ -0,0 +1,112 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true +ENT.CanPackUp = true +ENT.PackUpTime = 0.25 + +ENT.WrenchRepairMultiplier = 0.666 + +ENT.FirePitch = 0 +ENT.FireYaw = 0 + +ENT.Acceleration = 350 +ENT.MaxSpeed = 400 +ENT.HoverSpeed = 40 +ENT.HoverHeight = 92 +ENT.HoverForce = 128 +ENT.TurnSpeed = 90 +ENT.IdleDrag = 0.25 + +ENT.MaxHealth = 190 +ENT.CarryMass = 150 + +ENT.IgnoreBullets = true + +ENT.PounceWeakness = 2 +ENT.IsShadeGrabbable = true +ENT.FlyingControllable = true +ENT.NoBlockExplosions = true + +ENT.DeployableAmmo = "drone_hauler" +ENT.SWEP = "weapon_zs_drone_hauler" + +AccessorFuncDT(ENT, "ObjectOwner", "Entity", 0) + +function ENT:ShouldNotCollide(ent) + if not ent.ChargeTime and ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValidHuman() then + return true + end + end + + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +function ENT:BeingControlled() + local owner = self:GetObjectOwner() + if owner:IsValid() then + local wep = owner:GetActiveWeapon() + return wep:IsValid() and wep:GetClass() == "weapon_zs_dronecontrol" and wep:GetDTBool(0) + end + + return false +end + +local M_Player = FindMetaTable("Player") +local P_Team = M_Player.Team +local temp_attacker +local function ManualTraceFilter(ent) + if ent == temp_attacker or getmetatable(ent) == M_Player and P_Team(ent) == TEAM_HUMAN or ent.FHB or ent.IsCreeperNest then + return false + end + + return true +end + +function ENT:GetTraceFilter() + temp_attacker = self + return ManualTraceFilter +end + +function ENT.ScanFilter(ent) + return not (ent:IsPlayer() or ent.ScanFilter or ent.GetNestMaxHealth) +end + +local trace_cam = {mask = MASK_VISIBLE, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} +function ENT:GetCameraPosition(angles) + local owner = self:GetObjectOwner() + if owner:IsValidPlayer() then + angles = angles or owner:EyeAngles() + trace_cam.start = self:GetPos() + trace_cam.endpos = self:GetRedLightPos() + trace_cam.filter = self.ScanFilter + local tr = util.TraceHull(trace_cam) + + return tr.HitPos + tr.HitNormal * 3 + end + + return self:GetRedLightPos() +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(0) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(1) +end + +function ENT:GetNextFire() + return self:GetDTFloat(2) +end + +function ENT:IsGrappling() + return self:GetDTBool(1) +end + +function ENT:GetRedLightPos() + return self:LocalToWorld(Vector(2, -6, 2)) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/cl_init.lua new file mode 100644 index 0000000..b80c944 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/cl_init.lua @@ -0,0 +1,58 @@ +INC_CLIENT() + +function ENT:Initialize() + self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 72)) + + self.AmbientSound = CreateSound(self, "npc/scanner/scanner_scan_loop2.wav") + self.AmbientSound:Play() + + self.PixVis = util.GetPixelVisibleHandle() + + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + hook.Add("CalcView", self, self.CalcView) + + local ent, matrix = ClientsideModel("models/weapons/w_IRifle.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(150, 150, 150)) + + matrix = Matrix() + matrix:Scale(Vector(0.9, 0.65, 0.65)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunAttachment = ent + end +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.5, math.Clamp(75 + self:GetVelocity():Length() * 0.5, 75, 150)) +end + +function ENT:DrawTranslucent() + local atch = self.GunAttachment + if atch and atch:IsValid() then + local ang = self:GetGunAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + atch:SetPos(self:GetRedLightPos() + ang:Forward() * -12 + ang:Right() * 1 + ang:Up() * -5) + atch:SetAngles(ang) + + atch:SetNoDraw(self:GetObjectOwner() == MySelf and self:BeingControlled()) + end + + self.BaseClass.DrawTranslucent(self) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + if self.GunAttachment and self.GunAttachment:IsValid() then + self.GunAttachment:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/init.lua new file mode 100644 index 0000000..8a69c9d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/init.lua @@ -0,0 +1,44 @@ +INC_SERVER() + +ENT.Projectile = "projectile_drone_pulse" + +function ENT:FireTurret(src, dir) + if self:GetNextFire() <= CurTime() then + local curammo = self:GetAmmo() + if curammo > 0 then + self:SetNextFire(CurTime() + 0.36) + self:SetAmmo(curammo - 2) + + self:PlayShootSound() + + local owner = self:GetObjectOwner() + local angle = dir:Angle() + + local ent = ents.Create(self.Projectile) + if ent:IsValid() then + ent:SetAngles(angle) + ent:SetOwner(owner) + ent:SetPos(src + angle:Forward() * 5) + ent.ProjDamage = 22 * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + + ent.Team = owner:Team() + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + phys:SetVelocityInstantaneous(angle:Forward() * 470 * (owner.ProjectileSpeedMul or 1)) + end + end + else + self:SetNextFire(CurTime() + 2) + self:EmitSound("npc/turret_floor/die.wav") + end + end +end + +function ENT:PlayShootSound() + self:EmitSound("weapons/zs_rail/rail.wav", 70, math.random(238, 243), 0.86, CHAN_AUTO) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/shared.lua new file mode 100644 index 0000000..637aef0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_drone_pulse/shared.lua @@ -0,0 +1,5 @@ +ENT.Base = "prop_drone" + +ENT.DeployableAmmo = "pulse_cutter" +ENT.SWEP = "weapon_zs_drone_pulse" +ENT.AmmoType = "pulse" diff --git a/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_animations.lua b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_animations.lua new file mode 100644 index 0000000..de0e995 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_animations.lua @@ -0,0 +1,185 @@ +function ENT:RenderModels(ble, cmod) + if not self.WElements then return end + + if not self.wRenderOrder then + self.wRenderOrder = {} + for k, v in pairs( self.WElements ) do + if (v.type == "Model") then + table.insert(self.wRenderOrder, 1, k) + elseif (v.type == "Sprite" or v.type == "Quad") then + table.insert(self.wRenderOrder, k) + end + end + end + + for k, name in pairs( self.wRenderOrder ) do + local v = self.WElements[name] + if (!v) then self.wRenderOrder = nil break end + if (v.hide) then continue end + + local pos, ang + + if (v.bone) then + pos, ang = self:GetBoneOrientation( self.WElements, v ) + else + pos, ang = self:GetBoneOrientation( self.WElements, v, "ValveBiped.Bip01_R_Hand" ) + end + + if (!pos) then continue end + + local model = v.modelEnt + local sprite = v.spriteMaterial + + if (v.type == "Model" and IsValid(model)) then + model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + model:SetAngles(ang) + --model:SetModelScale(v.size) + local matrix = Matrix() + local multi = cmod and 1.02 or 1 + matrix:Scale(v.size * multi) + model:EnableMatrix( "RenderMultiply", matrix ) + + if (v.material == "") then + model:SetMaterial("") + elseif (model:GetMaterial() != v.material) then + model:SetMaterial( v.material ) + end + + if (v.skin and v.skin != model:GetSkin()) then + model:SetSkin(v.skin) + end + + if (v.bodygroup) then + for k, v in ipairs( v.bodygroup ) do + if (model:GetBodygroup(k) != v) then + model:SetBodygroup(k, v) + end + end + end + + if (v.surpresslightning) then + render.SuppressEngineLighting(true) + end + + if not cmod then + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) + else + render.SetColorModulation(unpack(cmod)) + end + if not ble then + render.SetBlend(v.color.a/255) + else + render.SetBlend(ble) + end + model:DrawModel() + render.SetBlend(1) + render.SetColorModulation(1, 1, 1) + + if (v.surpresslightning) then + render.SuppressEngineLighting(false) + end + elseif (v.type == "Sprite" and sprite) then + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + render.SetMaterial(sprite) + render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) + elseif (v.type == "Quad" and v.draw_func) then + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + cam.Start3D2D(drawpos, ang, v.size) + v.draw_func( self ) + cam.End3D2D() + end + end +end + +function ENT:GetBoneOrientation( basetab, tab, bone_override ) + local bone, pos, ang + if (tab.rel and tab.rel != "") then + + local v = basetab[tab.rel] + + if (!v) then return end + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. + pos, ang = self:GetBoneOrientation( basetab, v ) + + if (!pos) then return end + + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + else + + bone = self:LookupBone(bone_override or tab.bone) + + if (!bone) then return end + + pos, ang = Vector(0,0,0), Angle(0,0,0) + local m = self:GetBoneMatrix(bone) + if (m) then + pos, ang = m:GetTranslation(), m:GetAngles() + end + end + + return pos, ang +end + +function ENT:CreateModels( tab ) + if (!tab) then return end + + for k, v in pairs( tab ) do + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then + + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) + if (IsValid(v.modelEnt)) then + v.modelEnt:SetPos(self:GetPos()) + v.modelEnt:SetAngles(self:GetAngles()) + v.modelEnt:SetParent(self) + v.modelEnt:SetNoDraw(true) + v.createdModel = v.model + else + v.modelEnt = nil + end + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then + + local name = v.sprite.."-" + local params = { ["$basetexture"] = v.sprite } + -- make sure we create a unique name based on the selected options + local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } + for i, j in pairs( tocheck ) do + if (v[j]) then + params["$"..j] = 1 + name = name.."1" + else + name = name.."0" + end + end + + v.createdSprite = v.sprite + v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) + end + end +end + +function ENT:RemoveModels() + if (self.WElements) then + for k, v in pairs( self.WElements ) do + if (IsValid( v.modelEnt )) then + v.modelEnt:Remove() + v.modelEnt = nil + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_init.lua new file mode 100644 index 0000000..dd7be28 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/cl_init.lua @@ -0,0 +1,39 @@ +INC_CLIENT() +include("cl_animations.lua") + +function ENT:DrawTranslucent() + if not self.ShowBaseModel then + render.SetBlend(0) + end + self:DrawModel() + if not self.ShowBaseModel then + render.SetBlend(1) + end + if self.RenderModels and not self.NoDrawSubModels then + self:RenderModels(ble, cmod) + end +end + +function ENT:Think() + local class = self:GetWeaponType() + if class ~= self.LastWeaponType then + self.LastWeaponType = class + + self:RemoveModels() + + local weptab = weapons.Get(class) + if weptab then + local showmdl = weptab.ShowWorldModel or not self:LookupBone("ValveBiped.Bip01_R_Hand") and not weptab.NoDroppedWorldModel + self.ShowBaseModel = weptab.ShowWorldModel == nil and true or showmdl + + if weptab.WElements then + self.WElements = table.FullCopy(weptab.WElements) + self:CreateModels(self.WElements) + end + end + end +end + +function ENT:OnRemove() + self:RemoveModels() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/init.lua new file mode 100644 index 0000000..22a3fe0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/init.lua @@ -0,0 +1,30 @@ +INC_SERVER() +AddCSLuaFile("cl_animations.lua") + +function ENT:Initialize() + local weptab = weapons.Get(self:GetWeaponType()) + if weptab and not weptab.BoxPhysicsMax then + self:PhysicsInit(SOLID_VPHYSICS) + end + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("material") + phys:EnableMotion(not self.Restrained) + phys:SetMass(25) + phys:Wake() + end + + self:Fire("kill", "", 3) +end + +function ENT:SetupPhysics(weptab) + if weptab.BoxPhysicsMax then + self:PhysicsInitBox(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) + self:SetCollisionBounds(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/shared.lua new file mode 100644 index 0000000..f622e04 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_fakeweapon/shared.lua @@ -0,0 +1,35 @@ +ENT.Type = "anim" + +ENT.NoNails = true +ENT.IgnoreTraces = true + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:HumanHoldable(pl) + return false +end + +function ENT:SetWeaponType(class) + local weptab = weapons.Get(class) + if weptab then + if weptab.FakeWorldModel then + self:SetModel(weptab.FakeWorldModel) + elseif weptab.WorldModel then + self:SetModel(weptab.WorldModel) + end + + if SERVER then + self:SetupPhysics(weptab) + end + + if weptab.ModelScale then + self:SetModelScale(weptab.ModelScale, 0) + end + end + + self:SetDTString(0, class) +end + +function ENT:GetWeaponType() + return self:GetDTString(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/cl_init.lua index 33dcc35..b5c901e 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/cl_init.lua @@ -1 +1,42 @@ -include("shared.lua") +INC_CLIENT() + +function ENT:Initialize() + self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 128)) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) +end + +local vOffset = Vector(-1, 0, 8) +local aOffset = Angle(180, 90, 90) + +function ENT:RenderInfo(pos, ang, owner) + local ammo = self:GetAmmo() + + cam.Start3D2D(pos, ang, 0.075) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + + if ammo > 0 then + draw.SimpleTextBlurry("["..ammo.." / "..self.MaxAmmo.."]", "ZS3D2DFontSmall", 0, 120, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + else + draw.SimpleTextBlurry(translate.Get("empty"), "ZS3D2DFontSmall", 0, 120, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name) + cam.End3D2D() +end + +function ENT:Draw() + self:DrawModel() + + if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then return end + + local owner = self:GetObjectOwner() + local ang = self:LocalToWorldAngles(aOffset) + + self:RenderInfo(self:LocalToWorld(vOffset), ang, owner) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/init.lua index b959e6e..9cde6ed 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/init.lua @@ -1,14 +1,22 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") - -ENT.m_Health = 150 +local function RefreshFFOwners(pl) + for _, ent in pairs(ents.FindByClass("prop_ffemitter")) do + if ent:IsValid() and ent:GetObjectOwner() == pl then + ent:SetObjectOwner(NULL) + end + end +end +hook.Add("PlayerDisconnected", "ForceField.PlayerDisconnected", RefreshFFOwners) +hook.Add("OnPlayerChangedTeam", "ForceField.OnPlayerChangedTeam", RefreshFFOwners) function ENT:Initialize() self:SetModel("models/props_lab/lab_flourescentlight002b.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) + self:SetCollisionGroup(COLLISION_GROUP_WORLD) + + self:CollisionRulesChanged() local phys = self:GetPhysicsObject() if phys:IsValid() then @@ -20,11 +28,16 @@ function ENT:Initialize() if ent:IsValid() then self.Field = ent - ent:SetPos(self:GetPos() + self:GetForward() * 48) + ent:SetPos(self:GetPos() + self:GetForward() * 48 + self:GetUp() * -26) ent:SetAngles(self:GetAngles()) ent:SetOwner(self) ent:Spawn() + + ent:SetEmitter(self) end + + self:SetMaxObjectHealth(150) + self:SetObjectHealth(self:GetMaxObjectHealth()) end function ENT:OnRemove() @@ -33,24 +46,63 @@ function ENT:OnRemove() end end +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) + util.Effect("Explosion", effectdata, true, true) + end +end + function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + self:TakePhysicsDamage(dmginfo) - if not self.Destroyed then - local attacker = dmginfo:GetAttacker() - if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then - if attacker.LifeBarricadeDamage ~= nil and self:HumanNearby() then - attacker:AddLifeBarricadeDamage(dmginfo:GetDamage()) - end + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:ResetLastBarricadeAttacker(attacker, dmginfo) + end +end - self.m_Health = self.m_Health - dmginfo:GetDamage() - if self.m_Health <= 0 then - self.Destroyed = true - local effectdata = EffectData() - effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) - util.Effect("Explosion", effectdata, true, true) +function ENT:Use(activator, caller) + if self.Destroyed or not activator:IsPlayer() or activator:Team() ~= TEAM_HUMAN or self:GetMaterial() ~= "" then return end + + if self:GetObjectOwner():IsValid() then + if activator:GetInfo("zs_nousetodeposit") == "0" then + local curammo = self:GetAmmo() + local togive = math.min(math.min(15, activator:GetAmmoCount("pulse")), self.MaxAmmo - curammo) + if togive > 0 then + self:SetAmmo(curammo + togive) + activator:RemoveAmmo(togive, "pulse") + activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) + self:EmitSound("npc/scanner/combat_scan1.wav", 60, 250) end end + else + self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) end end @@ -62,7 +114,8 @@ function ENT:OnPackedUp(pl) pl:GiveEmptyWeapon("weapon_zs_ffemitter") pl:GiveAmmo(1, "slam") - pl:PushPackedItem(self:GetClass(), self.m_Health) + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + pl:GiveAmmo(self:GetAmmo(), "pulse") self:Remove() end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/shared.lua index 981423f..4234811 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitter/shared.lua @@ -1,14 +1,29 @@ ENT.Type = "anim" ENT.CanPackUp = true -ENT.PackUpTime = 5 +ENT.PackUpTime = 2 +ENT.MaxAmmo = 300 -- 10 minutes of repair time when fully loaded. + +ENT.WrenchRepairMultiplier = 0.5 ENT.m_NoNailUnfreeze = true ENT.NoNails = true -ENT.IsBarricadeObject = true +ENT.IsBarricadeObject = false ENT.AlwaysGhostable = true +function ENT:GetObjectHealth() + return self:GetDTFloat(0) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(1, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(1) +end + function ENT:SetObjectOwner(owner) self:SetDTEntity(0, owner) end @@ -16,3 +31,11 @@ end function ENT:GetObjectOwner() return self:GetDTEntity(0) end + +function ENT:SetAmmo(ammo) + self:SetDTInt(0, ammo) +end + +function ENT:GetAmmo() + return self:GetDTInt(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/cl_init.lua index 60559a1..3afeb63 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -7,31 +7,54 @@ function ENT:Initialize() self:DrawShadow(false) - self.AmbientSound = CreateSound(self, "ambient/machines/combine_shield_touch_loop1.wav") - self.AmbientSound:PlayEx(0.1, 100) + self.AmbientSound = CreateSound(self, "ambient/machines/combine_shield_loop3.wav") + self.AmbientSound:PlayEx(0.3, 150) end function ENT:Think() - self.AmbientSound:PlayEx(0.1, 100 + RealTime() % 1) + local emitter = self:GetEmitter() + if emitter:IsValid() and emitter.GetAmmo and emitter:GetAmmo() > 1 then + self.AmbientSound:PlayEx(0.3, 150 + RealTime() % 1) + else + self.AmbientSound:Stop() + end end function ENT:OnRemove() self.AmbientSound:Stop() end -local matRefract = Material("models/spawn_effect") -local matGlow = Material("Models/props_combine/combine_fenceglow") +local materialp = {} +materialp["$refractamount"] = 0.01 +materialp["$colortint"] = "[1.0 1.3 1.9]" +materialp["$SilhouetteColor"] = "[2.1 3.5 5.0]" +materialp["$BlurAmount"] = 0.001 +materialp["$SilhouetteThickness"] = 0.5 +materialp["$normalmap"] = "effects/combineshield/comshieldwall" +local matRefract = CreateMaterial("forcefieldxd","Aftershock_dx9", materialp) +local matGlow = Material("models/shiny") function ENT:DrawTranslucent() + local emitter = self:GetEmitter() + if not (emitter and emitter:IsValid() and emitter.GetAmmo) then return end + if emitter:GetAmmo() < 1 then return end + + local lowammo = emitter:GetAmmo() < 30 + render.SuppressEngineLighting(true) render.ModelMaterialOverride(matGlow) - render.SetBlend(0.05 + math.max(0, math.cos(CurTime())) ^ 4 * 0.01) + local red = 1 - math.Clamp((CurTime() - self:GetLastDamaged()) * 3, 0, 1) + local redadj = math.min(1, red + (lowammo and 1 or 0)) + + render.SetColorModulation(redadj, 0.6 - redadj, 1 - redadj) + render.SetBlend(0.007 + redadj * 0.05 + math.max(0, math.cos(CurTime())) ^ 4 * 0.007) self:DrawModel() + render.SetColorModulation(1, 1, 1) if render.SupportsPixelShaders_2_0() then render.UpdateRefractTexture() - matRefract:SetFloat("$refractamount", 0.0125 + math.sin(CurTime() * 2) ^ 2 * 0.0025) + matRefract:SetFloat("$refractamount", 0.005 + (0.01 * red)) render.SetBlend(1) @@ -40,7 +63,9 @@ function ENT:DrawTranslucent() else render.SetBlend(1) end - + + render.SetColorModulation(1, 1, 1) + render.ModelMaterialOverride(0) render.SuppressEngineLighting(false) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/init.lua index 430d663..a4088ff 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/init.lua @@ -1,15 +1,12 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) self:SetModel("models/props_junk/TrashDumpster02b.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) - self:SetCustomCollisionCheck(true) + self:SetCustomCollisionCheck(true) self:SetCollisionGroup(COLLISION_GROUP_PASSABLE_DOOR) local phys = self:GetPhysicsObject() @@ -18,3 +15,32 @@ function ENT:Initialize() phys:Wake() end end + +function ENT:OnTakeDamage(dmginfo) + local inflictor = dmginfo:GetInflictor():IsValid() and dmginfo:GetInflictor() or dmginfo:GetAttacker() + if dmginfo:GetDamage() <= 0 or not inflictor:IsProjectile() then return end + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + local emitter = self:GetEmitter() + if emitter and emitter:IsValid() and emitter.GetAmmo and emitter:GetAmmo() > 0 then + self:SetLastDamaged(CurTime()) + self:EmitSound("ambient/energy/weld2.wav", 65, 255, 0.6) + + local ammousage = (dmginfo:GetDamage() / 10) + (emitter.CarryOver or 0) + local floor = math.floor(ammousage) + local owner = emitter:GetObjectOwner() + + emitter.CarryOver = ammousage - floor + emitter:SetAmmo(math.max(emitter:GetAmmo() - floor, 0)) + + if owner:IsValidLivingHuman() then + owner:AddPoints(dmginfo:GetDamage() * 0.02) + + if emitter:GetAmmo() == 0 then + owner:SendDeployableOutOfAmmoMessage(emitter) + end + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/shared.lua index 0182cdf..b43a9ff 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_ffemitterfield/shared.lua @@ -5,7 +5,30 @@ ENT.PackUpTime = 3 ENT.m_NoNailUnfreeze = true ENT.NoNails = true +ENT.IgnoreBullets = true +ENT.IgnoreMelee = true +ENT.IgnoreTraces = true +ENT.FizzleStatusAOE = true + +AccessorFuncDT(ENT, "Emitter", "Entity", 0) +AccessorFuncDT(ENT, "LastDamaged", "Float", 0) function ENT:ShouldNotCollide(ent) - return not ent:IsPlayer() and not ent:IsProjectile() + if ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValid() then + if owner:IsHuman() then + return true + elseif self:GetEmitter():IsValid() and self:GetEmitter().GetAmmo and self:GetEmitter():GetAmmo() < 1 then + return true + end + end + end + + local colgroup = ent:GetCollisionGroup() + if colgroup == COLLISION_GROUP_PLAYER or colgroup == COLLISION_GROUP_WEAPON or colgroup == COLLISION_GROUP_NONE then + return true + end + + return false end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua index 87f3add..e829212 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua @@ -1,22 +1,29 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 +ENT.VScreen = Vector(0, -2, 45) +ENT.ScanPitch = 100 +ENT.ScanSound = "npc/turret_wall/turret_loop1.wav" function ENT:Initialize() self.BeamColor = Color(0, 255, 0, 255) - self.ScanningSound = CreateSound(self, "npc/turret_wall/turret_loop1.wav") + self.ScanningSound = CreateSound(self, self.ScanSound) self.ShootingSound = CreateSound(self, "npc/combine_gunship/gunship_weapon_fire_loop6.wav") local size = self.SearchDistance + 32 local nsize = -size self:SetRenderBounds(Vector(nsize, nsize, nsize * 0.25), Vector(size, size, size * 0.25)) + + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + hook.Add("CalcView", self, self.CalcView) end function ENT:Think() if self:GetObjectOwner():IsValid() and self:GetAmmo() > 0 and self:GetMaterial() == "" then - self.ScanningSound:PlayEx(0.55, 100 + math.sin(CurTime())) - if self:IsFiring() or self:GetTarget():IsValid() then + self.ScanningSound:PlayEx(0.55, self.ScanPitch + math.sin(CurTime())) + if self.PlayLoopingShootSound and (self:IsFiring() or self:GetTarget():IsValid()) then self.ShootingSound:PlayEx(1, 100 + math.cos(CurTime())) else self.ShootingSound:Stop() @@ -44,13 +51,20 @@ local cam_Start3D2D = cam.Start3D2D local cam_End3D2D = cam.End3D2D local smokegravity = Vector(0, 0, 200) local aScreen = Angle(0, 270, 60) -local vScreen = Vector(0, -2, 45) function ENT:Draw() self:CalculatePoseAngles() self:SetPoseParameter("aim_yaw", self.PoseYaw) self:SetPoseParameter("aim_pitch", self.PosePitch) + local owner = self:GetObjectOwner() + + if owner == MySelf and self:GetManualControl() then return end + + local alpha = self:TransAlphaToMe() + + render.SetBlend(alpha) self:DrawModel() + render.SetBlend(1) local healthpercent = self:GetObjectHealth() / self:GetMaxObjectHealth() @@ -78,16 +92,17 @@ function ENT:Draw() particle:SetCollide(true) particle:SetBounce(0.2) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end - local owner = self:GetObjectOwner() + if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then return end + local ammo = self:GetAmmo() local flash = math.sin(CurTime() * 15) > 0 local wid, hei = 128, 92 local x = wid / 2 - cam_Start3D2D(self:LocalToWorld(vScreen), self:LocalToWorldAngles(aScreen), 0.075) + cam_Start3D2D(self:LocalToWorld(self.VScreen), self:LocalToWorldAngles(aScreen), 0.075) surface_SetDrawColor(0, 0, 0, 160) surface_DrawRect(0, 0, wid, hei) @@ -102,26 +117,26 @@ function ENT:Draw() surface_DrawRect(8, hei - 8, wid - 16, 8) if owner:IsValid() and owner:IsPlayer() then - draw_SimpleText(owner:ClippedName(), "DefaultFont", x, 10, owner == MySelf and COLOR_BLUE or COLOR_WHITE, TEXT_ALIGN_CENTER) + draw_SimpleText(owner:ClippedName(), "DefaultFont", x, 10, owner == MySelf and COLOR_LBLUE or COLOR_WHITE, TEXT_ALIGN_CENTER) end draw_SimpleText(translate.Format("integrity_x", math.ceil(healthpercent * 100)), "DefaultFontBold", x, 25, COLOR_WHITE, TEXT_ALIGN_CENTER) if flash and self:GetManualControl() then draw_SimpleText(translate.Get("manual_control"), "DefaultFont", x, 40, COLOR_YELLOW, TEXT_ALIGN_CENTER) end - + if ammo > 0 then draw_SimpleText("["..ammo.." / "..self.MaxAmmo.."]", "DefaultFontBold", x, 55, COLOR_WHITE, TEXT_ALIGN_CENTER) elseif flash then draw_SimpleText(translate.Get("empty"), "DefaultFontBold", x, 55, COLOR_RED, TEXT_ALIGN_CENTER) end - draw_SimpleText("CH. "..self:GetChannel().." / "..GAMEMODE.MaxChannels[self:GetClass()], "DefaultFontSmall", x, 70, COLOR_WHITE, TEXT_ALIGN_CENTER) + draw_SimpleText("CH. "..self:GetChannel().." / "..GAMEMODE.MaxChannels["turret"], "DefaultFontSmall", x, 70, COLOR_WHITE, TEXT_ALIGN_CENTER) cam_End3D2D() end -local matBeam = Material("effects/laser1") +local matBeam = Material("trails/laser") local matGlow = Material("sprites/glow04_noz") function ENT:DrawTranslucent() if self:GetMaterial() ~= "" then return end @@ -129,14 +144,16 @@ function ENT:DrawTranslucent() local lightpos = self:LightPos() local ang = self:GetGunAngles() + local alpha = self:TransAlphaToMe() local colBeam = self.BeamColor - local hasowner = self:GetObjectOwner():IsValid() + local owner = self:GetObjectOwner() + local hasowner = owner:IsValid() local hasammo = self:GetAmmo() > 0 local manualcontrol = self:GetManualControl() - local tr = util.TraceLine({start = lightpos, endpos = lightpos + ang:Forward() * (manualcontrol and 4096 or self.SearchDistance), mask = MASK_SHOT, filter = self:GetCachedScanFilter()}) + local tr = util.TraceLine({start = lightpos, endpos = lightpos + ang:Forward() * (manualcontrol and 4096 or self.SearchDistance * (hasowner and owner.TurretRangeMul or 1)), mask = MASK_SHOT, filter = self:GetCachedScanFilter()}) if not hasowner then local rate = FrameTime() * 512 @@ -162,16 +179,78 @@ function ENT:DrawTranslucent() if hasowner and hasammo then render.SetMaterial(matBeam) - render.DrawBeam(lightpos, tr.HitPos, 1, 0, 1, COLOR_WHITE) - render.DrawBeam(lightpos, tr.HitPos, 4, 0, 1, colBeam) + if alpha > 0.5 then + render.DrawBeam(lightpos, tr.HitPos, 1 * self.ModelScale, 0, 1, COLOR_WHITE) + end + render.DrawBeam(lightpos, tr.HitPos, 4 * self.ModelScale, 0, 1, colBeam) render.SetMaterial(matGlow) - render.DrawSprite(lightpos, 4, 4, COLOR_WHITE) - render.DrawSprite(lightpos, 16, 16, colBeam) + if alpha > 0.5 then + render.DrawSprite(lightpos, 4 * self.ModelScale, 4 * self.ModelScale, COLOR_WHITE) + end + render.DrawSprite(lightpos, 16 * self.ModelScale, 16 * self.ModelScale, colBeam) render.DrawSprite(tr.HitPos, 2, 2, COLOR_WHITE) render.DrawSprite(tr.HitPos, 8, 8, colBeam) else render.SetMaterial(matGlow) - render.DrawSprite(lightpos, 4, 4, COLOR_WHITE) - render.DrawSprite(lightpos, 16, 16, colBeam) + render.DrawSprite(lightpos, 4 * self.ModelScale, 4 * self.ModelScale, COLOR_WHITE) + render.DrawSprite(lightpos, 16 * self.ModelScale, 16 * self.ModelScale, colBeam) end end + +function ENT:SetTarget(ent) + if ent:IsValid() then + self:SetTargetReceived(CurTime()) + else + self:SetTargetLost(CurTime()) + end + + self:SetDTEntity(0, ent) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) +end + +function ENT:CreateMove(cmd) + if self:GetObjectOwner() ~= MySelf then return end + + if not self:GetManualControl() then return end + + local buttons = cmd:GetButtons() + + cmd:ClearMovement() + + if bit.band(buttons, IN_JUMP) ~= 0 then + buttons = buttons - IN_JUMP + buttons = buttons + IN_BULLRUSH + end + + if bit.band(buttons, IN_DUCK) ~= 0 then + buttons = buttons - IN_DUCK + buttons = buttons + IN_GRENADE1 + end + + cmd:SetButtons(buttons) +end + +function ENT:ShouldDrawLocalPlayer(pl) + if self:GetObjectOwner() ~= MySelf then return end + + if self:GetManualControl() then + return true + end +end + +local trace_cam = {mask = MASK_VISIBLE, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} +function ENT:CalcView(pl, origin, angles, fov, znear, zfar) + if self:GetObjectOwner() ~= pl or not self:GetManualControl() then return end + + local filter = player.GetAll() + filter[#filter + 1] = self + trace_cam.start = self:ShootPos() + trace_cam.endpos = trace_cam.start + trace_cam.filter = filter + local tr = util.TraceHull(trace_cam) + + return {origin = tr.HitPos + tr.HitNormal * 3, angles = angles} +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/init.lua index c597133..b0d722a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/init.lua @@ -1,12 +1,12 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.LastHitSomething = 0 +ENT.TurretDeployableAmmo = "thumper" +ENT.LastHitPeriod = 0.5 +ENT.Hitbox = "prop_hitbox_gunturret" local function RefreshTurretOwners(pl) - for _, ent in pairs(ents.FindByClass("prop_gunturret")) do + for _, ent in pairs(ents.FindByClass("prop_gunturret*")) do if ent:IsValid() and ent:GetObjectOwner() == pl then ent:ClearObjectOwner() ent:ClearTarget() @@ -18,8 +18,9 @@ hook.Add("OnPlayerChangedTeam", "GunTurret.OnPlayerChangedTeam", RefreshTurretOw function ENT:Initialize() self:SetModel("models/Combine_turrets/Floor_turret.mdl") + self:SetModelScale(self.ModelScale or 1, 0) self:PhysicsInit(SOLID_VPHYSICS) - + self:SetCollisionGroup(COLLISION_GROUP_WORLD) self:SetUseType(SIMPLE_USE) local phys = self:GetPhysicsObject() @@ -30,8 +31,43 @@ function ENT:Initialize() end self:SetAmmo(self.DefaultAmmo) - self:SetMaxObjectHealth(250) + self:SetMaxObjectHealth(self.MaxHealth) self:SetObjectHealth(self:GetMaxObjectHealth()) + self:SetScanSpeed(1) + self:SetScanMaxAngle(1) + + local ent = ents.Create(self.Hitbox) + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:SetOwner(self) + ent:SetParent(self) + ent:Spawn() + + self:DeleteOnRemove(ent) + self.Hitbox = ent + self:SetTurretHitbox(ent) + end + + self:SetupPlayerSkills() + + hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) +end + +function ENT:SetupPlayerSkills() + local owner = self:GetObjectOwner() + local scanspeed = 1 + local scanangle = 1 + + if owner:IsValid() then + scanspeed = scanspeed * (owner.TurretScanSpeedMul or 1) + scanangle = scanangle * (owner.TurretScanAngleMul or 1) + end + + self:SetScanSpeed(scanspeed) + self:SetScanMaxAngle(scanangle) + + self:SetupDeployableSkillHealth("TurretHealthMul") end function ENT:SetObjectHealth(health) @@ -45,6 +81,10 @@ function ENT:SetObjectHealth(health) effectdata:SetOrigin(pos) util.Effect("Explosion", effectdata, true, true) + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + local amount = math.ceil(self:GetAmmo() * 0.5) while amount > 0 do local todrop = math.min(amount, 50) @@ -52,7 +92,7 @@ function ENT:SetObjectHealth(health) local ent = ents.Create("prop_ammo") if ent:IsValid() then local heading = VectorRand():GetNormalized() - ent:SetAmmoType("smg1") + ent:SetAmmoType(self.AmmoType) ent:SetAmmo(todrop) ent:SetPos(pos + heading * 8) ent:SetAngles(VectorRand():Angle()) @@ -67,55 +107,39 @@ function ENT:SetObjectHealth(health) end end -local tempknockback -function ENT:StartBulletKnockback() - tempknockback = {} -end - -function ENT:EndBulletKnockback() - tempknockback = nil -end - -function ENT:DoBulletKnockback(scale) - for ent, prevvel in pairs(tempknockback) do - local curvel = ent:GetVelocity() - ent:SetVelocity(curvel * -1 + (curvel - prevvel) * scale + prevvel) - end -end - +local TEMPTURRET local function BulletCallback(attacker, tr, dmginfo) local ent = tr.Entity if ent:IsValid() then - if ent:IsPlayer() then - if ent:Team() == TEAM_UNDEAD and tempknockback then - if attacker:GetTarget() == ent then - attacker.LastHitSomething = CurTime() - end - tempknockback[ent] = ent:GetVelocity() - end - else - local phys = ent:GetPhysicsObject() - if ent:GetMoveType() == MOVETYPE_VPHYSICS and phys:IsValid() and phys:IsMoveable() then - ent:SetPhysicsAttacker(attacker) - end + if TEMPTURRET:GetTarget() == ent and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then + TEMPTURRET.LastHitSomething = CurTime() end - dmginfo:SetAttacker(attacker:GetObjectOwner()) - dmginfo:SetInflictor(attacker) + dmginfo:SetInflictor(TEMPTURRET) end end +function ENT:PlayShootSound() + -- Handled by the looping sound. +end + function ENT:FireTurret(src, dir) if self:GetNextFire() <= CurTime() then local curammo = self:GetAmmo() - if curammo > 0 then - self:SetNextFire(CurTime() + 0.1) - self:SetAmmo(curammo - 1) + local owner = self:GetObjectOwner() + local twinvolley = self:GetManualControl() and owner:IsSkillActive(SKILL_TWINVOLLEY) + if curammo > (twinvolley and 1 or 0) then + self:SetNextFire(CurTime() + self.FireDelay * (twinvolley and 1.5 or 1)) + self:SetAmmo(curammo - (twinvolley and 2 or 1)) - self:StartBulletKnockback() - self:FireBullets({Num = 1, Src = src, Dir = dir, Spread = Vector(0.05, 0.05, 0), Tracer = 1, Force = 1, Damage = 12, Callback = BulletCallback}) - self:DoBulletKnockback(0.04) - self:EndBulletKnockback() + if self:GetAmmo() == 0 then + owner:SendDeployableOutOfAmmoMessage(self) + end + + self:PlayShootSound() + + TEMPTURRET = self + self:FireBulletsLua(src, dir, self.Spread, self.NumShots * (twinvolley and 2 or 1), self.Damage, self:GetObjectOwner(), nil, nil, BulletCallback, nil, nil, nil, nil, self) else self:SetNextFire(CurTime() + 2) self:EmitSound("npc/turret_floor/die.wav") @@ -147,15 +171,14 @@ function ENT:Think() if self:IsFiring() then self:SetFiring(false) end local target = self:GetTarget() if target:IsValid() then - if self:IsValidTarget(target) and CurTime() < self.LastHitSomething + 0.5 then - local shootpos = self:ShootPos() - self:FireTurret(shootpos, (self:GetTargetPos(target) - shootpos):GetNormalized()) + if self:IsValidTarget(target) and CurTime() < self.LastHitSomething + self.LastHitPeriod then + self:FireTurret(self:ShootPos(), (self:GetTargetPos(target) - self:ShootPos()):GetNormalized()) else self:ClearTarget() self:EmitSound("npc/turret_floor/deploy.wav") end else - local target = self:SearchForTarget() + target = self:SearchForTarget() if target then self:SetTarget(target) self:SetTargetReceived(CurTime()) @@ -171,22 +194,32 @@ function ENT:Think() return true end +function ENT:SetupPlayerVisibility(pl) + if pl ~= self:GetObjectOwner() then return end + + AddOriginToPVS(self:GetPos()) + AddOriginToPVS(self:GetPos() + pl:GetAimVector() * 1024) +end + function ENT:Use(activator, caller) if self.Removing or not activator:IsPlayer() or self:GetMaterial() ~= "" then return end if activator:Team() == TEAM_HUMAN then if self:GetObjectOwner():IsValid() then - local curammo = self:GetAmmo() - local togive = math.min(math.min(15, activator:GetAmmoCount("smg1")), self.MaxAmmo - curammo) - if togive > 0 then - self:SetAmmo(curammo + togive) - activator:RemoveAmmo(togive, "smg1") - activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) - self:EmitSound("npc/turret_floor/click1.wav") - --gamemode.Call("PlayerRepairedObject", activator, self, togive * 1.5, self) + if activator:GetInfo("zs_nousetodeposit") == "0" then + local curammo = self:GetAmmo() + local togive = math.min(15, activator:GetAmmoCount(self.AmmoType), self.MaxAmmo - curammo) + if togive > 0 then + self:SetAmmo(curammo + togive) + activator:RemoveAmmo(togive, self.AmmoType) + activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) + self:EmitSound("npc/turret_floor/click1.wav") + --gamemode.Call("PlayerRepairedObject", activator, self, togive * 1.5, self) + end end else self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) if not activator:HasWeapon("weapon_zs_gunturretcontrol") then activator:Give("weapon_zs_gunturretcontrol") end @@ -199,11 +232,11 @@ function ENT:AltUse(activator, tr) end function ENT:OnPackedUp(pl) - pl:GiveEmptyWeapon("weapon_zs_gunturret") - pl:GiveAmmo(1, "thumper") + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, self.TurretDeployableAmmo) pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) - pl:GiveAmmo(self:GetAmmo(), "smg1") + pl:GiveAmmo(self:GetAmmo(), self.AmmoType) self:Remove() end @@ -211,9 +244,94 @@ end function ENT:OnTakeDamage(dmginfo) self:TakePhysicsDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + local attacker = dmginfo:GetAttacker() if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then self:ResetLastBarricadeAttacker(attacker, dmginfo) self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) end end + +local tabSearch = {mask = MASK_SHOT} +function ENT:SearchForTarget() + local shootpos = self:ShootPos() + local owner = self:GetObjectOwner() + + tabSearch.start = shootpos + tabSearch.endpos = shootpos + self:GetGunAngles():Forward() * self.SearchDistance * (owner.TurretRangeMul or 1) + tabSearch.filter = self:GetCachedScanFilter() + local tr = util.TraceLine(tabSearch) + local ent = tr.Entity + if ent and ent:IsValid() and self:IsValidTarget(ent) then + return ent + end +end + +function ENT:SetAmmo(ammo) + self:SetDTInt(0, ammo) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTInt(1, health) +end + +function ENT:SetChannel(channel) + self:SetDTInt(2, channel) +end + +function ENT:SetFiring(onoff) + self:SetDTBool(0, onoff) +end + +function ENT:SetScanMaxAngle(angle) + self:SetDTFloat(5, angle) +end + +function ENT:SetScanSpeed(speed) + self:SetDTFloat(4, speed) +end + +function ENT:SetNextFire(tim) + self:SetDTFloat(2, tim) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end + +function ENT:ClearTarget() + self:SetTarget(NULL) +end + +function ENT:SetTargetReceived(tim) + self:SetDTFloat(0, tim) +end + +function ENT:SetTargetLost(tim) + self:SetDTFloat(1, tim) +end + +function ENT:SetTarget(ent) + if ent:IsValid() then + self:SetTargetReceived(CurTime()) + self.LastHitSomething = CurTime() + else + self:SetTargetLost(CurTime()) + end + + self:SetDTEntity(0, ent) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) + if self.HitBox then + self.HitBox:SetObjectOwner(ent) + end + + self:SetupPlayerSkills() +end + +function ENT:SetTurretHitbox(ent) + self:SetDTEntity(2, ent) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua index 3d76aae..1d7b78d 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua @@ -1,10 +1,20 @@ ENT.Type = "anim" ENT.RenderGroup = RENDERGROUP_BOTH +ENT.SWEP = "weapon_zs_gunturret" + +ENT.AmmoType = "smg1" +ENT.FireDelay = 0.1 +ENT.NumShots = 1 +ENT.Damage = 9.6 +ENT.PlayLoopingShootSound = true +ENT.Spread = 2 ENT.SearchDistance = 768 ENT.MinimumAimDot = 0.5 ENT.DefaultAmmo = 0 --250 ENT.MaxAmmo = 1000 +ENT.MaxHealth = 150 +ENT.ModelScale = 1 ENT.NoReviveFromKills = true @@ -13,14 +23,14 @@ ENT.PoseYaw = 0 ENT.m_NoNailUnfreeze = true ENT.NoNails = true +ENT.IgnoreBullets = true ENT.CanPackUp = true -ENT.IsBarricadeObject = true ENT.AlwaysGhostable = true -local NextCache = 0 -local CachedFilter = {} +local HITGROUP_HEAD = HITGROUP_HEAD +local MASK_SOLID = MASK_SOLID function ENT:GetLocalAnglesToTarget(target) return self:WorldToLocalAngles(self:GetAnglesToTarget(target)) @@ -39,38 +49,62 @@ function ENT:GetAnglesToPos(pos) end function ENT:IsValidTarget(target) - return target:IsPlayer() and target:Team() == TEAM_UNDEAD and target:Alive() and self:GetForward():Dot(self:GetAnglesToTarget(target):Forward()) >= self.MinimumAimDot and TrueVisible(self:ShootPos(), self:GetTargetPos(target), self) + return target:IsPlayer() and target:Team() == TEAM_UNDEAD and target:Alive() and not target:GetZombieClassTable().NoTurretTarget and not target:GetStatus("zombiespawnbuff") + and self:GetForward():Dot(self:GetAnglesToTarget(target):Forward()) >= self.MinimumAimDot + and TrueVisibleFilters(self:ShootPos(), self:GetTargetPos(target), self, self.Hitbox) end +local M_Player = FindMetaTable("Player") +local P_Team = M_Player.Team +local temp_attacker +local temp_hb +local function ManualTraceFilter(ent) + if ent == temp_attacker or ent == temp_hb or getmetatable(ent) == M_Player and P_Team(ent) == TEAM_HUMAN then + return false + end + + return true +end + +local trace_manual = {mask = MASK_SHOT, filter = ManualTraceFilter} function ENT:GetManualTrace() local owner = self:GetObjectOwner() - local filter = owner:GetMeleeFilter() - table.insert(filter, self) - return owner:TraceLine(4096, MASK_SOLID, filter) + local start = self:ShootPos() + + trace_manual.start = start + trace_manual.endpos = start + owner:GetAimVector() * self.SearchDistance * (owner.TurretRangeMul or 1) + + temp_attacker = self + temp_hb = self:GetTurretHitbox() + + return util.TraceLine(trace_manual) end function ENT:CalculatePoseAngles() + local deltatime = FrameTime() + local owner = self:GetObjectOwner() if not owner:IsValid() or self:GetAmmo() <= 0 or self:GetMaterial() ~= "" then - self.PoseYaw = math.Approach(self.PoseYaw, 0, FrameTime() * 60) - self.PosePitch = math.Approach(self.PosePitch, 15, FrameTime() * 30) + self.PoseYaw = math.Approach(self.PoseYaw, 0, deltatime * 60) + self.PosePitch = math.Approach(self.PosePitch, 15, deltatime * 30) return end if self:GetManualControl() then local ang = self:GetLocalAnglesToPos(self:GetManualTrace().HitPos) - self.PoseYaw = math.Approach(self.PoseYaw, math.Clamp(math.NormalizeAngle(ang.yaw), -60, 60), FrameTime() * 140) - self.PosePitch = math.Approach(self.PosePitch, math.Clamp(math.NormalizeAngle(ang.pitch), -15, 15), FrameTime() * 140) + self.PoseYaw = math.Approach(self.PoseYaw, math.Clamp(math.NormalizeAngle(ang.yaw), -60, 60), deltatime * 140) + self.PosePitch = math.Approach(self.PosePitch, math.Clamp(math.NormalizeAngle(ang.pitch), -15, 15), deltatime * 140) else local target = self:GetTarget() + local angm = self:GetScanMaxAngle() if target:IsValid() then local ang = self:GetLocalAnglesToTarget(target) - self.PoseYaw = math.Approach(self.PoseYaw, math.Clamp(math.NormalizeAngle(ang.yaw), -60, 60), FrameTime() * 140) - self.PosePitch = math.Approach(self.PosePitch, math.Clamp(math.NormalizeAngle(ang.pitch), -15, 15), FrameTime() * 100) + self.PoseYaw = math.Approach(self.PoseYaw, math.Clamp(math.NormalizeAngle(ang.yaw), -60 * angm, 60 * angm), deltatime * 140) + self.PosePitch = math.Approach(self.PosePitch, math.Clamp(math.NormalizeAngle(ang.pitch), -15 * angm, 15 * angm), deltatime * 100) else - local ct = CurTime() - self.PoseYaw = math.Approach(self.PoseYaw, math.sin(ct) * 45, FrameTime() * 60) - self.PosePitch = math.Approach(self.PosePitch, math.cos(ct * 1.4) * 15, FrameTime() * 30) + local ct = CurTime() * self:GetScanSpeed() + self.PoseYaw = math.Approach(self.PoseYaw, math.sin(ct) * 45 * angm, deltatime * 60) + self.PosePitch = math.Approach(self.PosePitch, math.cos(ct * 1.4) * 15 * angm, deltatime * 30) end end end @@ -78,48 +112,43 @@ end function ENT:GetScanFilter() local filter = team.GetPlayers(TEAM_HUMAN) filter[#filter + 1] = self + filter[#filter + 1] = self:GetTurretHitbox() + for _, pl in pairs(team.GetPlayers(TEAM_UNDEAD)) do + if pl:GetZombieClassTable().NoTurretTarget then + filter[#filter + 1] = pl + end + end + -- TODO: Cache this, should be relatively okay right now with just 1 second caches though. + table.Add(filter, ents.FindByClass("prop_ffemitterfield")) return filter end --- Getting all of some team is straining every frame when there's 5 or so turrets. I could probably use CONTENTS_TEAM* if I knew what they did. +-- Getting all of some team is straining every frame when there's 5 or so turrets. +local NextCache = 0 function ENT:GetCachedScanFilter() - if CurTime() < NextCache and CachedFilter then return CachedFilter end + if CurTime() < NextCache and self.CachedFilter then return self.CachedFilter end - CachedFilter = self:GetScanFilter() + self.CachedFilter = self:GetScanFilter() NextCache = CurTime() + 1 - return CachedFilter -end - -local tabSearch = {mask = MASK_SHOT} -function ENT:SearchForTarget() - local shootpos = self:ShootPos() - - tabSearch.start = shootpos - tabSearch.endpos = shootpos + self:GetGunAngles():Forward() * self.SearchDistance - tabSearch.filter = self:GetCachedScanFilter() - local tr = util.TraceLine(tabSearch) - local ent = tr.Entity - if ent and ent:IsValid() and self:IsValidTarget(ent) then - return ent - end + return self.CachedFilter end function ENT:GetTargetPos(target) if not (target:IsPlayer() and target:GetZombieClassTable().NoHead) then local boneid = target:GetHitBoxBone(HITGROUP_HEAD, 0) if boneid and boneid > 0 then - local p, a = target:GetBonePosition(boneid) - if pl then - return p + local bp = target:GetBonePositionMatrixed(boneid) + if bp then + return bp end end end - return target:LocalToWorld(target:OBBCenter()) + return target:WorldSpaceCenter() end -function ENT:HumanHoldable(pl) +function ENT:HumanHoldable() return true end @@ -155,34 +184,14 @@ function ENT:GetGunAngles() return ang end -function ENT:SetAmmo(ammo) - self:SetDTInt(0, ammo) -end - function ENT:GetAmmo() return self:GetDTInt(0) end -function ENT:SetTarget(ent) - if ent:IsValid() then - self:SetTargetReceived(CurTime()) - if SERVER then - self.LastHitSomething = CurTime() - end - else - self:SetTargetLost(CurTime()) - end - self:SetDTEntity(0, ent) -end - function ENT:GetObjectHealth() return self:GetDTFloat(3) end -function ENT:SetMaxObjectHealth(health) - self:SetDTInt(1, health) -end - function ENT:GetMaxObjectHealth() return self:GetDTInt(1) end @@ -191,56 +200,36 @@ function ENT:GetChannel() return self:GetDTInt(2) end -function ENT:SetChannel(channel) - self:SetDTInt(2, channel) -end - function ENT:GetTarget() return self:GetDTEntity(0) end -function ENT:SetObjectOwner(ent) - self:SetDTEntity(1, ent) -end - function ENT:GetObjectOwner() return self:GetDTEntity(1) end -function ENT:ClearObjectOwner() - self:SetObjectOwner(NULL) -end - -function ENT:ClearTarget() - self:SetTarget(NULL) -end - -function ENT:SetTargetReceived(tim) - self:SetDTFloat(0, tim) +function ENT:GetTurretHitbox() + return self:GetDTEntity(2) end function ENT:GetTargetReceived() return self:GetDTFloat(0) end -function ENT:SetTargetLost(tim) - self:SetDTFloat(1, tim) -end - function ENT:GetTargetLost() return self:GetDTFloat(1) end -function ENT:SetNextFire(tim) - self:SetDTFloat(2, tim) -end - function ENT:GetNextFire() return self:GetDTFloat(2) end -function ENT:SetFiring(onoff) - self:SetDTBool(0, onoff) +function ENT:GetScanSpeed() + return self:GetDTFloat(4) +end + +function ENT:GetScanMaxAngle() + return self:GetDTFloat(5) end function ENT:IsFiring() @@ -251,7 +240,7 @@ function ENT:GetManualControl() local owner = self:GetObjectOwner() if owner:IsValid() and owner:Alive() and owner:Team() == TEAM_HUMAN then local wep = owner:GetActiveWeapon() - if wep:IsValid() and wep:GetClass() == "weapon_zs_gunturretcontrol" and wep.GetTurret and wep:GetTurret() == self and not wep:GetDTBool(0) then + if wep:IsValid() and wep:GetClass() == "weapon_zs_gunturretcontrol" and wep.GetTurret and wep:GetTurret() == self and wep:GetDTBool(0) then return true end end @@ -259,11 +248,6 @@ function ENT:GetManualControl() return false end -function ENT:CanBePackedBy(pl) - local owner = self:GetObjectOwner() - return not owner:IsValid() or owner == pl or owner:Team() ~= TEAM_HUMAN or gamemode.Call("PlayerIsAdmin", pl) -end - util.PrecacheSound("npc/turret_floor/die.wav") util.PrecacheSound("npc/turret_floor/active.wav") util.PrecacheSound("npc/turret_floor/deploy.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret_assault.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_assault.lua new file mode 100644 index 0000000..9c10b2b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_assault.lua @@ -0,0 +1,162 @@ +AddCSLuaFile() + +ENT.Base = "prop_gunturret" + +ENT.SWEP = "weapon_zs_gunturret_assault" + +ENT.AmmoType = "ar2" +ENT.FireDelay = 0.17 +ENT.NumShots = 1 +ENT.Damage = 21 +ENT.PlayLoopingShootSound = false +ENT.Spread = 2 +ENT.MaxAmmo = 500 +ENT.MaxHealth = 225 + +if CLIENT then + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + local ent = ClientsideModel("models/weapons/w_rif_aug.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(70, 70, 70)) + + matrix = Matrix() + matrix:Scale(Vector(1.1, 0.9, 0.9)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunAttachment = ent + end + + ent = ClientsideModel("models/weapons/w_rif_aug.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(70, 70, 70)) + + matrix = Matrix() + matrix:Scale(Vector(1.1, 0.9, 0.9)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunAttachment2 = ent + end + + ent = ClientsideModel("models/props_trainstation/trainstation_ornament002.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(100, 100, 100)) + + matrix = Matrix() + matrix:Scale(Vector(0.65, 0.65, 1.5)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunBase = ent + end + + ent = ClientsideModel("models/props_wasteland/buoy01.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(100, 100, 100)) + + matrix = Matrix() + matrix:Scale(Vector(0.25, 0.15, 0.7)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunBase2 = ent + end +end + +function ENT:DrawTranslucent() + local nodrawattachs = self:TransAlphaToMe() < 0.4 + + local atch = self.GunAttachment + if atch and atch:IsValid() then + local ang = self:GetGunAngles() + local gunpos = self:ShootPos() + ang:Forward() * 4 + ang:Right() * 4 + ang:RotateAroundAxis(ang:Forward(), 45) + + atch:SetPos(gunpos) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + atch = self.GunAttachment2 + if atch and atch:IsValid() then + local ang = self:GetGunAngles() + local gunpos = self:ShootPos() + ang:Forward() * 4 + ang:Right() * 4 + ang:RotateAroundAxis(ang:Forward(), -45) + + atch:SetPos(gunpos) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + atch = self.GunBase + if atch and atch:IsValid() then + local ang = self:GetAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + atch:SetPos(self:GetPos()) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + atch = self.GunBase2 + if atch and atch:IsValid() then + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + self.BaseClass.DrawTranslucent(self) +end + +function ENT:OnRemove() + if self.GunAttachment and self.GunAttachment:IsValid() then + self.GunAttachment:Remove() + end + + if self.GunAttachment2 and self.GunAttachment2:IsValid() then + self.GunAttachment2:Remove() + end + + if self.GunBase and self.GunBase:IsValid() then + self.GunBase:Remove() + end + + if self.GunBase2 and self.GunBase2:IsValid() then + self.GunBase2:Remove() + end + + self.ScanningSound:Stop() + self.ShootingSound:Stop() +end + +end + +function ENT:PlayShootSound() + self:EmitSound("weapons/galil/galil-1.wav", 70, 125, 0.75, CHAN_AUTO) + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 70, 145, 0.55, CHAN_WEAPON) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret_buckshot.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_buckshot.lua new file mode 100644 index 0000000..a5f91cd --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_buckshot.lua @@ -0,0 +1,62 @@ +AddCSLuaFile() + +ENT.Base = "prop_gunturret" + +ENT.SWEP = "weapon_zs_gunturret_buckshot" + +ENT.AmmoType = "buckshot" +ENT.FireDelay = 0.85 +ENT.NumShots = 7 +ENT.Damage = 6.35 +ENT.PlayLoopingShootSound = false +ENT.Spread = 5 +ENT.SearchDistance = 225 +ENT.MaxAmmo = 200 + +if CLIENT then + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + local ent = ClientsideModel("models/weapons/w_shotgun.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:Spawn() + self.GunAttachment = ent + end +end + +function ENT:DrawTranslucent() + local nodrawattachs = self:TransAlphaToMe() < 0.4 + + local atch = self.GunAttachment + if atch and atch:IsValid() then + local ang = self:GetGunAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + atch:SetPos(self:ShootPos() + ang:Forward() * -8) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + self.BaseClass.DrawTranslucent(self) +end + +function ENT:OnRemove() + if self.GunAttachment and self.GunAttachment:IsValid() then + self.GunAttachment:Remove() + end + + self.ScanningSound:Stop() + self.ShootingSound:Stop() +end + +end + +function ENT:PlayShootSound() + self:EmitSound("Weapon_Shotgun.NPC_Single") +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/cl_init.lua new file mode 100644 index 0000000..296e04e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/cl_init.lua @@ -0,0 +1,106 @@ +INC_CLIENT() + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + local ent, matrix = ClientsideModel("models/weapons/w_rocket_launcher.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(150, 150, 150)) + + matrix = Matrix() + matrix:Scale(Vector(0.9, 2, 2)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunAttachment = ent + end + + ent = ClientsideModel("models/props_trainstation/trainstation_ornament002.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(100, 100, 100)) + + matrix = Matrix() + matrix:Scale(Vector(0.65, 0.65, 1.5)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunBase = ent + end + + ent = ClientsideModel("models/props_wasteland/buoy01.mdl") + if ent:IsValid() then + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(vector_origin) + ent:SetLocalAngles(angle_zero) + ent:SetMaterial("phoenix_storms/torpedo") + ent:SetColor(Color(100, 100, 100)) + + matrix = Matrix() + matrix:Scale(Vector(0.25, 0.15, 0.7)) + ent:EnableMatrix("RenderMultiply", matrix) + + ent:Spawn() + self.GunBase2 = ent + end +end + +function ENT:DrawTranslucent() + local nodrawattachs = self:TransAlphaToMe() < 0.4 + + local atch = self.GunAttachment + if atch and atch:IsValid() then + local ang = self:GetGunAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + atch:SetPos(self:ShootPos() + ang:Forward() * -8 + ang:Right() * 1 + ang:Up() * -5) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + atch = self.GunBase + if atch and atch:IsValid() then + local ang = self:GetAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + atch:SetPos(self:GetPos()) + atch:SetAngles(ang) + + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + atch = self.GunBase2 + if atch and atch:IsValid() then + atch:SetNoDraw(nodrawattachs or self:GetObjectOwner() == MySelf and self:GetManualControl()) + end + + self.BaseClass.DrawTranslucent(self) +end + +function ENT:OnRemove() + if self.GunAttachment and self.GunAttachment:IsValid() then + self.GunAttachment:Remove() + end + + if self.GunBase and self.GunBase:IsValid() then + self.GunBase:Remove() + end + + if self.GunBase2 and self.GunBase2:IsValid() then + self.GunBase2:Remove() + end + + self.ScanningSound:Stop() + self.ShootingSound:Stop() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/init.lua new file mode 100644 index 0000000..d7fbdea --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/init.lua @@ -0,0 +1,49 @@ +INC_SERVER() + +ENT.LastHitPeriod = 4 + +function ENT:FireTurret(src, dir) + if self:GetNextFire() <= CurTime() then + local curammo = self:GetAmmo() + local owner = self:GetObjectOwner() + local twinvolley = self:GetManualControl() and owner:IsSkillActive(SKILL_TWINVOLLEY) + if curammo > (twinvolley and 1 or 0) then + self:SetNextFire(CurTime() + self.FireDelay * (twinvolley and 1.5 or 1)) + self:SetAmmo(curammo - (twinvolley and 2 or 1)) + + if self:GetAmmo() == 0 then + owner:SendDeployableOutOfAmmoMessage(self) + end + + self:PlayShootSound() + + local angle = dir:Angle() + for i = 1, self.NumShots * (twinvolley and 2 or 1) do + local ent = ents.Create("projectile_rocket") + if ent:IsValid() then + ent:SetPos(src) + ent:SetAngles(angle) + ent:SetOwner(owner) + ent.ProjDamage = self.Damage * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + ent.ProjTaper = 0.95 + + ent.Team = owner:Team() + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + angle:RotateAroundAxis(angle:Forward(), math.Rand(0, 360)) + angle:RotateAroundAxis(angle:Up(), math.Rand(-self.Spread, self.Spread)) + phys:SetVelocityInstantaneous(angle:Forward() * 900 * (owner.ProjectileSpeedMul or 1)) + end + end + end + else + self:SetNextFire(CurTime() + 2) + self:EmitSound("npc/turret_floor/die.wav") + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/shared.lua new file mode 100644 index 0000000..fe44aa0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret_rocket/shared.lua @@ -0,0 +1,17 @@ +ENT.Base = "prop_gunturret" + +ENT.SWEP = "weapon_zs_gunturret_rocket" + +ENT.AmmoType = "impactmine" +ENT.FireDelay = 2 +ENT.NumShots = 1 +ENT.Damage = 97 +ENT.PlayLoopingShootSound = false +ENT.Spread = 0.75 +ENT.MaxAmmo = 30 +ENT.MaxHealth = 225 + +function ENT:PlayShootSound() + self:EmitSound("weapons/stinger_fire1.wav", 80, math.random(148, 153), 0.8) + self:EmitSound("weapons/grenade_launcher1.wav", 80, math.random(86, 92), 0.7, CHAN_WEAPON + 20) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_harpoon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/cl_init.lua new file mode 100644 index 0000000..c7052dc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/cl_init.lua @@ -0,0 +1,5 @@ +INC_CLIENT() + +function ENT:Draw() + self:DrawModel() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_harpoon/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/init.lua new file mode 100644 index 0000000..00e8893 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/init.lua @@ -0,0 +1,54 @@ +INC_SERVER() + +ENT.NextDamage = 0 +ENT.TicksLeft = 10 + +function ENT:Initialize() + self:SetModel("models/props_junk/harpoon002a.mdl") + self:SetSolid(SOLID_NONE) + self:SetMoveType(MOVETYPE_NONE) + self:AddEFlags(EFL_SETTING_UP_BONES) +end + +function ENT:Think() + local parent = self:GetParent() + if parent:IsValid() and parent:IsPlayer() then + if parent:Alive() and parent:Team() == TEAM_UNDEAD and self.TicksLeft >= 1 and not parent.SpawnProtection then + if CurTime() >= self.NextDamage then + self.NextDamage = CurTime() + 0.35 + self.TicksLeft = self.TicksLeft - 1 + + util.Blood((parent:NearestPoint(self:GetPos()) + parent:WorldSpaceCenter()) / 2, math.random(4, 9), Vector(0, 0, 1), 100) + parent:TakeSpecialDamage(self.BleedPerTick, DMG_SLASH, self:GetOwner(), self) + end + else + local ang = self:GetAngles() + ang:RotateAroundAxis(ang:Up(), 180) + + local ent = ents.Create("prop_weapon") + if ent:IsValid() then + ent:SetWeaponType(self.BaseWeapon) + ent:SetPos(self:GetPos()) + ent:SetAngles(ang) + ent:Spawn() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + ent.NoPickupsTime = CurTime() + 15 + ent.NoPickupsOwner = self:GetOwner() + end + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:AddAngleVelocity(VectorRand() * 120) + phys:SetVelocityInstantaneous(Vector(0, 0, 200)) + end + end + + self:Remove() + end + else + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_harpoon/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/shared.lua new file mode 100644 index 0000000..2bb7b93 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_harpoon/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" + +ENT.NoReviveFromKills = true diff --git a/gamemodes/zombiesurvival/entities/entities/prop_hitbox_camera.lua b/gamemodes/zombiesurvival/entities/entities/prop_hitbox_camera.lua new file mode 100644 index 0000000..d94b739 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_hitbox_camera.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "prop_deployablehitbox" + +ENT.BoxMin = Vector(-8, -8, 0) +ENT.BoxMax = Vector(8, 8, 8) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_hitbox_gunturret.lua b/gamemodes/zombiesurvival/entities/entities/prop_hitbox_gunturret.lua new file mode 100644 index 0000000..7572cf6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_hitbox_gunturret.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "prop_deployablehitbox" + +ENT.BoxMin = Vector(-20, -16, 0) +ENT.BoxMax = Vector(24, 16, 64) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_animations.lua b/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_animations.lua new file mode 100644 index 0000000..daaea05 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_animations.lua @@ -0,0 +1,185 @@ +function ENT:RenderModels(ble, cmod) + if not self.WElements then return end + + if not self.wRenderOrder then + self.wRenderOrder = {} + for k, v in pairs( self.WElements ) do + if (v.type == "Model") then + table.insert(self.wRenderOrder, 1, k) + elseif (v.type == "Sprite" or v.type == "Quad") then + table.insert(self.wRenderOrder, k) + end + end + end + + for k, name in pairs( self.wRenderOrder ) do + local v = self.WElements[name] + if (!v) then self.wRenderOrder = nil break end + if (v.hide) then continue end + + local pos, ang + + if (v.bone) then + pos, ang = self:GetBoneOrientation( self.WElements, v ) + else + pos, ang = self:GetBoneOrientation( self.WElements, v, "ValveBiped.Bip01_R_Hand" ) + end + + if (!pos) then continue end + + local model = v.modelEnt + local sprite = v.spriteMaterial + + if (v.type == "Model" and IsValid(model)) then + model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + model:SetAngles(ang) + --model:SetModelScale(v.size) + local matrix = Matrix() + local multi = cmod and 1.02 or 1 + matrix:Scale(v.size * multi) + model:EnableMatrix( "RenderMultiply", matrix ) + + if (v.material == "") then + model:SetMaterial("") + elseif (model:GetMaterial() != v.material) then + model:SetMaterial( v.material ) + end + + if (v.skin and v.skin != model:GetSkin()) then + model:SetSkin(v.skin) + end + + if (v.bodygroup) then + for k, v in ipairs( v.bodygroup ) do + if (model:GetBodygroup(k) != v) then + model:SetBodygroup(k, v) + end + end + end + + if (v.surpresslightning) then + render.SuppressEngineLighting(true) + end + + if not cmod then + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) + else + render.SetColorModulation(unpack(cmod)) + end + if not ble then + render.SetBlend(v.color.a/255) + else + render.SetBlend(ble) + end + model:DrawModel() + render.SetBlend(1) + render.SetColorModulation(1, 1, 1) + + if (v.surpresslightning) then + render.SuppressEngineLighting(false) + end + elseif (v.type == "Sprite" and sprite) then + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + render.SetMaterial(sprite) + render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) + elseif (v.type == "Quad" and v.draw_func) then + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + cam.Start3D2D(drawpos, ang, v.size) + v.draw_func( self ) + cam.End3D2D() + end + end + end + +function ENT:GetBoneOrientation( basetab, tab, bone_override ) + local bone, pos, ang + if (tab.rel and tab.rel != "") then + + local v = basetab[tab.rel] + + if (!v) then return end + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. + pos, ang = self:GetBoneOrientation( basetab, v ) + + if (!pos) then return end + + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z + ang:RotateAroundAxis(ang:Up(), v.angle.y) + ang:RotateAroundAxis(ang:Right(), v.angle.p) + ang:RotateAroundAxis(ang:Forward(), v.angle.r) + + else + + bone = self:LookupBone(bone_override or tab.bone) + + if (!bone) then return end + + pos, ang = Vector(0,0,0), Angle(0,0,0) + local m = self:GetBoneMatrix(bone) + if (m) then + pos, ang = m:GetTranslation(), m:GetAngles() + end + end + + return pos, ang +end + +function ENT:CreateModels( tab ) + if (!tab) then return end + + for k, v in pairs( tab ) do + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then + + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) + if (IsValid(v.modelEnt)) then + v.modelEnt:SetPos(self:GetPos()) + v.modelEnt:SetAngles(self:GetAngles()) + v.modelEnt:SetParent(self) + v.modelEnt:SetNoDraw(true) + v.createdModel = v.model + else + v.modelEnt = nil + end + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then + + local name = v.sprite.."-" + local params = { ["$basetexture"] = v.sprite } + -- make sure we create a unique name based on the selected options + local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } + for i, j in pairs( tocheck ) do + if (v[j]) then + params["$"..j] = 1 + name = name.."1" + else + name = name.."0" + end + end + + v.createdSprite = v.sprite + v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) + end + end +end + +function ENT:RemoveModels() + if (self.WElements) then + for k, v in pairs( self.WElements ) do + if (IsValid( v.modelEnt )) then + v.modelEnt:Remove() + v.modelEnt = nil + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_init.lua new file mode 100644 index 0000000..a3145d2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_invitem/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() +include("cl_animations.lua") + +ENT.ColorModulation = Color(1, 0.5, 0) + +function ENT:Think() + local itype = self:GetInventoryItemType() + if itype ~= self.LastInvItemType then + self.LastInvItemType = itype + + self:RemoveModels() + + local invdata = GAMEMODE.ZSInventoryItemData[itype] + local droppedeles = invdata.DroppedEles + + if invdata then + --local showmdl = --weptab.ShowWorldModel or not self:LookupBone("ValveBiped.Bip01_R_Hand") and not weptab.NoDroppedWorldModel + self.ShowBaseModel = not istable(droppedeles)--weptab.ShowWorldModel == nil and true or showmdl + + if istable(droppedeles) then + self.WElements = table.FullCopy(droppedeles) + self:CreateModels(self.WElements) + end + + self.ColorModulation = self.ColorModulation + self.PropWeapon = true + end + end +end + +function ENT:OnRemove() + self:RemoveModels() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_invitem/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_invitem/init.lua new file mode 100644 index 0000000..8f6b1b1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_invitem/init.lua @@ -0,0 +1,95 @@ +INC_SERVER() +AddCSLuaFile("cl_animations.lua") + +ENT.CleanupPriority = 1 + +function ENT:Initialize() + self.ObjHealth = 200 + self.Forced = self.Forced or false + self.NeverRemove = self.NeverRemove or false + self.Restrained = self.Restrained or false + + self:PhysicsInit(SOLID_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + + self:SetUseType(SIMPLE_USE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("material") + phys:EnableMotion(not self.Restrained) + phys:SetMass(45) + phys:Wake() + end + + self:ItemCreated() +end + +function ENT:Use(activator, caller) + self:GiveToActivator(activator, caller) +end + +function ENT:GiveToActivator(activator, caller) + if not activator:IsPlayer() + or not activator:Alive() + or activator:Team() ~= TEAM_HUMAN + or self.Removing + or (activator:KeyDown(GAMEMODE.UtilityKey) and not self.Forced) + or self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator then + + return + end + + local itype = self:GetInventoryItemType() + if not itype then + return + end + + local itypecat = GAMEMODE:GetInventoryItemType(itype) + if itypecat == INVCAT_TRINKETS and activator:HasInventoryItem(itype) then + activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "you_already_have_this_trinket")) + return + end + + activator:AddInventoryItem(itype) + + net.Start("zs_invitem") + net.WriteString(itype) + net.Send(activator) + + if not self.NeverRemove then self:RemoveNextFrame() end +end + +function ENT:KeyValue(key, value) + key = string.lower(key) + if key == "invitemtype" then + self:SetInventoryItemType(value) + elseif key == "neverremove" then + self.NeverRemove = tonumber(value) == 1 + end +end + +function ENT:AcceptInput(name, activator, caller, arg) + name = string.lower(name) + if name == "givetoactivator" then + self.Forced = true + self:GiveToActivator(activator,caller) + return true + end +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + if self.NeverRemove then return end + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end + + self.ObjHealth = self.ObjHealth - dmginfo:GetDamage() + if self.ObjHealth <= 0 then + self:RemoveNextFrame() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_invitem/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_invitem/shared.lua new file mode 100644 index 0000000..683c3d2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_invitem/shared.lua @@ -0,0 +1,27 @@ +ENT.Type = "anim" +ENT.Base = "prop_baseoutlined" + +ENT.NoNails = true + +function ENT:HumanHoldable(pl) + return pl:KeyDown(GAMEMODE.UtilityKey) +end + +function ENT:SetInventoryItemType(type) + local invdata = GAMEMODE.ZSInventoryItemData[type] + + if not invdata then return end + local droppedeles = invdata.DroppedEles + + -- String or based on grenade for override + self:SetModel(istable(droppedeles) and "models/weapons/w_grenade.mdl" or droppedeles) + self:PhysicsInit(SOLID_VPHYSICS) + + self:SetDTString(0, type) + + return true +end + +function ENT:GetInventoryItemType() + return self:GetDTString(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack/cl_init.lua index 124930d..6176498 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 72)) @@ -56,7 +56,7 @@ function ENT:Think() particle:SetBounce(0.2) particle:SetColor(sat, sat, sat) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end @@ -78,29 +78,30 @@ end local colLight = Color(255, 0, 0) local colWhite = Color(255, 255, 255) -local colHealth = Color(255, 255, 255) local matLight = Material("sprites/light_ignorez") function ENT:DrawTranslucent() + + local alpha = self:TransAlphaToMe() + render.SetBlend(alpha) self:DrawModel() - self:DrawSubModel() + render.SetBlend(1) - local lp = LocalPlayer() - local owner = self:GetOwner() + local lp = MySelf + local owner = self:GetObjectOwner() if lp:IsValid() and lp:Team() == TEAM_HUMAN and owner:IsValid() and owner:IsPlayer() then local ang = EyeAngles() ang.pitch = 0 - local right = ang:Right() + ang:RotateAroundAxis(ang:Up(), 270) ang:RotateAroundAxis(ang:Forward(), 90) - cam.Start3D2D(self:LocalToWorld(Vector(0, 0, 16)), ang, 0.025) - draw.SimpleTextBlurry(owner:Name(), "ZS3D2DFont", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP) - local perc = math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1) - colHealth.r = 255 - colHealth.g = perc ^ 0.3 * 255 - colHealth.b = perc * 255 - draw.SimpleTextBlurry(math.ceil(perc * 100), "ZS3D2DFontBig", 0, 0, colHealth, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) + cam.Start3D2D(self:LocalToWorld(Vector(0, 0, 16)), ang, 0.03) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 150, 0.85, -150) cam.End3D2D() end @@ -146,7 +147,7 @@ function ENT:DrawTranslucent() end function ENT:CreateMove(cmd) - if self:GetOwner() ~= LocalPlayer() then return end + if self:GetObjectOwner() ~= MySelf then return end if not self:BeingControlled() then return end @@ -168,23 +169,29 @@ function ENT:CreateMove(cmd) end function ENT:ShouldDrawLocalPlayer(pl) - if self:GetOwner() ~= LocalPlayer() then return end + if self:GetObjectOwner() ~= MySelf then return end if self:BeingControlled() then + if MySelf == pl and not MySelf.TargetIDFilter then + MySelf.TargetIDFilter = self + end + return true + elseif MySelf == pl and MySelf.TargetIDFilter then + MySelf.TargetIDFilter = nil end end -local ViewHullMins = Vector(-4, -4, -4) -local ViewHullMaxs = Vector(4, 4, 4) +local trace_cam = {mask = MASK_VISIBLE, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} function ENT:CalcView(pl, origin, angles, fov, znear, zfar) - if self:GetOwner() ~= pl then return end - - if not self:BeingControlled() then return end + if self:GetObjectOwner() ~= pl or not self:BeingControlled() then return end local filter = player.GetAll() filter[#filter + 1] = self - local tr = util.TraceHull({start = self:GetPos(), endpos = self:GetPos() + angles:Forward() * -48, mask = MASK_SHOT, filter = filter, mins = ViewHullMins, maxs = ViewHullMaxs}) + trace_cam.start = self:GetPos() + trace_cam.endpos = trace_cam.start + angles:Forward() * -48 + trace_cam.filter = filter + local tr = util.TraceHull(trace_cam) return {origin = tr.HitPos + tr.HitNormal * 3} end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack/init.lua index aba6e97..90d3d59 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextWaterDamage = 0 @@ -17,6 +14,7 @@ function ENT:Initialize() phys:EnableMotion(true) phys:Wake() phys:SetBuoyancyRatio(0.8) + phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) local Constraint = ents.Create("phys_keepupright") Constraint:SetAngles(Angle(0, 0, 0)) @@ -50,6 +48,7 @@ function ENT:Initialize() ent:SetOwner(self) ent.Size = self.HitBoxSize ent:Spawn() + ent.IgnoreMelee = false end ent = ents.Create("env_projectedtexture") @@ -60,7 +59,7 @@ function ENT:Initialize() ent:SetKeyValue("farz", 400) ent:SetKeyValue("nearz", 8) ent:SetKeyValue("lightfov", 80) - local owner = self:GetOwner() + local owner = self:GetObjectOwner() if owner:IsValid() and owner:IsPlayer() then local vcol = owner:GetPlayerColor() if vcol then @@ -84,11 +83,59 @@ function ENT:Initialize() ent:Input("SpotlightTexture", NULL, NULL, "effects/flashlight001") end + self:SetCustomCollisionCheck(true) self:CollisionRulesChanged() hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) end +function ENT:SetupPlayerSkills() + local owner = self:GetObjectOwner() + local newmaxhealth = self.MaxHealth + local currentmaxhealth = self:GetMaxObjectHealth() + local defaults = scripted_ents.Get(self:GetClass()) + local hitdamage = defaults.HitDamage + local maxspeed = defaults.MaxSpeed + local acceleration = defaults.Acceleration + local loaded = false + + if owner:IsValid() then + newmaxhealth = newmaxhealth * owner:GetTotalAdditiveModifier("ControllableHealthMul", "ManhackHealthMul") + hitdamage = hitdamage * (owner.ManhackDamageMul or 1) + maxspeed = maxspeed * (owner.ControllableSpeedMul or 1) + acceleration = acceleration * (owner.ControllableHandlingMul or 1) + loaded = owner:IsSkillActive(SKILL_LOADEDHULL) + end + + newmaxhealth = math.ceil(newmaxhealth) + + self:SetMaxObjectHealth(newmaxhealth) + self:SetObjectHealth(self:GetObjectHealth() / currentmaxhealth * newmaxhealth) + + self.HitDamage = hitdamage + self.MaxSpeed = maxspeed + self.Acceleration = acceleration + + if loaded then + if not IsValid(self.LoadedProp) then + local ent = ents.Create("prop_dynamic_override") + if ent:IsValid() then + ent:SetModel("models/props_junk/propane_tank001a.mdl") + ent:SetModelScale(0.5, 0) + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(Vector(-5, 0, -6.5)) + ent:SetLocalAngles(Angle(-40, 0, 0)) + ent:Spawn() + + self.LoadedProp = ent + end + end + elseif IsValid(self.LoadedProp) then + self.LoadedProp:Remove() + end +end + function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) @@ -98,28 +145,35 @@ function ENT:SetObjectHealth(health) end function ENT:OnTakeDamage(dmginfo) - --if dmginfo:GetDamageType() ~= DMG_CRUSH and not self._AllowDamage then return end + if dmginfo:GetDamage() <= 0 then return end local attacker = dmginfo:GetAttacker() - if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then - self:TakePhysicsDamage(dmginfo) + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end - self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:TakePhysicsDamage(dmginfo) - --self:EmitSound("npc/scanner/scanner_pain"..math.random(2)..".wav", 0.65, math.Rand(120, 130)) - self:EmitSound("npc/manhack/gib.wav") - - local effectdata = EffectData() - effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) - effectdata:SetNormal(VectorRand():GetNormalized()) - effectdata:SetMagnitude(4) - effectdata:SetScale(1.33) - util.Effect("sparks", effectdata) + if dmginfo:GetDamageType() == DMG_ACID then + dmginfo:SetDamage(dmginfo:GetDamage() * 2) end + + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + + if attacker:IsValidZombie() and dmginfo:GetInflictor().MeleeDamage then + self:EmitSound("npc/manhack/bat_away.wav") + else + self:EmitSound("npc/manhack/gib.wav") + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) + effectdata:SetNormal(VectorRand():GetNormalized()) + effectdata:SetMagnitude(4) + effectdata:SetScale(1.33) + util.Effect("sparks", effectdata) end function ENT:Use(pl) - if pl == self:GetOwner() and pl:Team() == TEAM_HUMAN and pl:Alive() and self:GetVelocity():Length() <= self.HoverSpeed then + if pl == self:GetObjectOwner() and pl:Team() == TEAM_HUMAN and pl:Alive() and self:GetVelocity():Length() <= self.HoverSpeed then self:OnPackedUp(pl) end end @@ -141,15 +195,21 @@ end function ENT:PhysicsSimulate(phys, frametime) phys:Wake() - local owner = self:GetOwner() - if not owner:IsValid() then return SIM_NOTHING end + local owner = self:GetObjectOwner() + if not owner:IsValid() or self.DisableControlUntil and CurTime() < self.DisableControlUntil then return SIM_NOTHING end local vel = phys:GetVelocity() - local movedir = Vector() + local movedir = Vector(0, 0, 0) local eyeangles = owner:SyncAngles() local aimangles = owner:EyeAngles() + local trace = {mask = MASK_HOVER, filter = self, start = self:GetPos()} + local tr, tr2 + if self:BeingControlled() then + trace.endpos = trace.start - Vector(0, 0, self.HoverHeight * 0.333) + tr = util.TraceLine(trace) + if owner:KeyDown(IN_FORWARD) then movedir = movedir + aimangles:Forward() end @@ -168,6 +228,12 @@ function ENT:PhysicsSimulate(phys, frametime) if owner:KeyDown(IN_GRENADE1) then movedir = movedir - Vector(0, 0, 0.5) end + trace.endpos = trace.start + Vector(0, 0, self.HoverHeight * 0.5) + tr2 = util.TraceLine(trace) + + if tr.Hit and not tr2.Hit then + movedir.z = 0.5 + end end if movedir == vector_origin then @@ -184,10 +250,8 @@ function ENT:PhysicsSimulate(phys, frametime) end if movedir == vector_origin and vel:Length() <= self.HoverSpeed then - local trace = {mask = MASK_HOVER, filter = self} - trace.start = self:GetPos() trace.endpos = trace.start + Vector(0, 0, self.HoverHeight * -2) - local tr = util.TraceLine(trace) + tr = util.TraceLine(trace) local hoverdir = (trace.start - tr.HitPos):GetNormalized() local hoverfrac = (0.5 - tr.Fraction) * 2 @@ -197,7 +261,15 @@ function ENT:PhysicsSimulate(phys, frametime) phys:EnableGravity(false) phys:SetAngleDragCoefficient(10000) phys:SetVelocityInstantaneous(vel) - phys:AddAngleVelocity(Vector(0, 0, math.Clamp(math.AngleDifference(eyeangles.yaw, phys:GetAngles().yaw), -32, 32) * frametime * 3)) + + local diff = math.AngleDifference(eyeangles.yaw, phys:GetAngles().yaw) + local z = math.Clamp(diff, -32, 32) * frametime * 10 + local curz = phys:GetAngleVelocity().z + z = z - curz * (frametime * math.min(1, math.abs(z - curz) ^ 2 * 0.02)) + + phys:AddAngleVelocity(Vector(0, 0, z)) + + self:SetPhysicsAttacker(owner) return SIM_NOTHING end @@ -206,15 +278,35 @@ function ENT:Destroy() if self.Destroyed then return end self.Destroyed = true + local epicenter = self:LocalToWorld(self:OBBCenter()) + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + self:EmitSound("npc/manhack/gib.wav") local effectdata = EffectData() - effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) - util.Effect("HelicopterMegaBomb", effectdata, true, true) + effectdata:SetOrigin(epicenter) effectdata:SetNormal(Vector(0, 0, 1)) effectdata:SetMagnitude(5) effectdata:SetScale(1.5) util.Effect("sparks", effectdata) + + local owner = self:GetObjectOwner() + if owner:IsValidLivingHuman() and owner:IsSkillActive(SKILL_LOADEDHULL) then + effectdata = EffectData() + effectdata:SetOrigin(epicenter) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 100, 100) + ParticleEffect("dusty_explosion_rockets", epicenter, angle_zero) + + util.BlastDamagePlayer(self, owner, epicenter, 128, 225, DMG_ALWAYSGIB) + else + util.Effect("HelicopterMegaBomb", effectdata, true, true) + end end ENT.PhysDamageImmunity = 0 @@ -243,7 +335,7 @@ function ENT:Think() return end - local owner = self:GetOwner() + local owner = self:GetObjectOwner() if owner:IsValid() then self:SetPhysicsAttacker(owner) @@ -270,28 +362,25 @@ function ENT:Think() end function ENT:ThreadSafePhysicsCollide(data) - local diddamage = false + local owner = self:GetObjectOwner() + if not owner:IsValidLivingHuman() then return end + + local hitflesh = false + local hitentity = false local ent = data.HitEntity - if ent and ent:IsValid() then - if ent:IsPlayer() and ent:Team() == TEAM_UNDEAD and ent:Alive() and CurTime() >= (self.NextTouch[ent] or 0) then - diddamage = true - self.NextTouch[ent] = CurTime() + self.HitCooldown + if ent and ent:IsValid() and CurTime() >= (self.NextTouch[ent] or 0) then + --if ent.LastHeld and CurTime() < ent.LastHeld + 0.1 then return end + local nest = ent.ZombieConstruction - local owner = self:GetOwner() - if not owner:IsValid() then owner = self end + hitentity = true - ent:TakeDamage(self.HitDamage, owner, self) - self:EmitHitFleshSound() + self.NextTouch[ent] = CurTime() + self.HitCooldown - local dir = (self:GetPos() - data.HitPos):GetNormalized() + ent:TakeSpecialDamage(self.HitDamage, DMG_SLASH, owner, self) - util.Blood(data.HitPos, math.random(10, 14), dir, 200) - - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:AddVelocity(dir * self.BounceFleshVelocity) - end + if ent:IsPlayer() and ent:Team() == TEAM_UNDEAD and ent:Alive() or nest then + hitflesh = true else local physattacker = ent:GetPhysicsAttacker() if physattacker:IsValid() and physattacker:Team() == TEAM_HUMAN then @@ -300,31 +389,43 @@ function ENT:ThreadSafePhysicsCollide(data) end end - if not diddamage then + if hitflesh then + self:EmitHitFleshSound() + local dir = (self:GetPos() - data.HitPos):GetNormalized() - if data.Speed > self.HoverSpeed then - local phys = self:GetPhysicsObject() - if phys:IsValid() then - phys:AddVelocity(dir * self.BounceVelocity) - end - end + util.Blood(data.HitPos, math.random(10, 14), dir, 200) - if data.DeltaTime > 0.33 and data.Speed > 32 then - self:EmitHitSound() - - local effectdata = EffectData() - effectdata:SetOrigin(self:NearestPoint(data.HitPos)) - effectdata:SetNormal(data.HitNormal) - effectdata:SetMagnitude(2) - effectdata:SetScale(1) - util.Effect("sparks", effectdata) + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:AddVelocity(dir * self.BounceFleshVelocity) end + elseif data.DeltaTime > 0.33 and data.Speed > 32 then + self:EmitHitSound() - if data.Speed >= self.MaxSpeed * self.SelfDamageSpeed and ent and ent:IsWorld() and CurTime() >= self.PhysDamageImmunity then - self:TakeDamage(math.Clamp(data.Speed * self.SelfDamageMul, 0, 30)) + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(data.HitPos)) + effectdata:SetNormal(data.HitNormal) + effectdata:SetMagnitude(2) + effectdata:SetScale(1) + util.Effect("sparks", effectdata) + end + + if hitentity then return end + + local dir = (self:GetPos() - data.HitPos):GetNormalized() + + if data.Speed > self.HoverSpeed then + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:AddVelocity(dir * self.BounceVelocity) end end + + if ((not owner:IsSkillActive(SKILL_STABLEHULL) and data.Speed >= self.MaxSpeed * 0.75) or (self.LastShadeLaunch and self.LastShadeLaunch + 2 > CurTime())) and + ent and ent:IsWorld() and CurTime() >= self.PhysDamageImmunity then + self:TakeDamage(math.Clamp(data.Speed * self.SelfDamageMul, 0, 40)) + end end function ENT:EmitHitFleshSound() @@ -336,18 +437,23 @@ function ENT:EmitHitSound() end function ENT:SetupPlayerVisibility(pl) - if pl ~= self:GetOwner() then return end + if pl ~= self:GetObjectOwner() then return end AddOriginToPVS(self:GetPos()) end if CLIENT then return end -local ENT = {} +local fhbENT = {} -ENT.Type = "anim" +fhbENT.Type = "anim" -function ENT:Initialize() +fhbENT.FHB = true + +fhbENT.IgnoreMelee = true +fhbENT.IgnoreBullets = true + +function fhbENT:Initialize() local size = self.Size or 16 self:SetNoDraw(true) @@ -364,46 +470,15 @@ function ENT:Initialize() self:SetUseType(SIMPLE_USE) end ---[[function ENT:OnTakeDamage(dmginfo) - local parent = self:GetParent() - if parent:IsValid() then - parent._AllowDamage = true - parent:TakePhysicsDamage(dmginfo) - parent:TakeDamage(dmginfo) - parent._AllowDamage = false - end -end]] - -function ENT:Use(ent) +function fhbENT:Use(ent) local parent = self:GetParent() if parent:IsValid() then parent:Use(ent, ent, 0, 0) end end --- Unfortunately I couldn't come up with a way to do this without hijacking these rather expensive functions. -local oldtl = util.TraceLine -function util.TraceLine(t) - local r = oldtl(t) - local e = r.Entity - if e:IsValid() and e:GetClass() == "fhb" then - r.Entity = e:GetParent() - end - return r -end - -local oldth = util.TraceHull -function util.TraceHull(t) - local r = oldth(t) - local e = r.Entity - if e:IsValid() and e:GetClass() == "fhb" then - r.Entity = e:GetParent() - end - return r -end - -function ENT:UpdateTransmitState() +function fhbENT:UpdateTransmitState() return TRANSMIT_NEVER end -scripted_ents.Register(ENT, "fhb") +scripted_ents.Register(fhbENT, "fhb") diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack/shared.lua index adf5244..2a2b0dd 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack/shared.lua @@ -7,13 +7,13 @@ ENT.NoNails = true ENT.WrenchRepairMultiplier = 0.25 ENT.Model = "models/manhack.mdl" -ENT.HitBoxSize = 9.5 +ENT.HitBoxSize = 11.5 ENT.Mass = 50 ENT.WeaponClass = "weapon_zs_manhack" ENT.ControllerClass = "weapon_zs_manhackcontrol" ENT.AmmoType = "manhack" -ENT.Acceleration = 160 +ENT.Acceleration = 250 ENT.MaxSpeed = 230 ENT.HoverSpeed = 64 ENT.HoverHeight = 48 @@ -21,15 +21,31 @@ ENT.HoverForce = 64 ENT.TurnSpeed = 30 ENT.IdleDrag = 0.25 -ENT.MaxHealth = 55 +ENT.MaxHealth = 150 ENT.HitCooldown = 0.25 -ENT.HitDamage = 15 -ENT.BounceFleshVelocity = 66 -ENT.BounceVelocity = 50 +ENT.HitDamage = 17 +ENT.BounceFleshVelocity = 33 +ENT.BounceVelocity = 25 ENT.SelfDamageSpeed = 0.7 ENT.SelfDamageMul = 0.08 +ENT.IgnoreBullets = true + +--ENT.PounceWeakness = 3 +ENT.IsShadeGrabbable = true +ENT.FlyingControllable = true +ENT.NoBlockExplosions = true + +AccessorFuncDT(ENT, "ObjectOwner", "Entity", 0) + function ENT:ShouldNotCollide(ent) + if not ent.ChargeTime and ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValidHuman() then + return true + end + end + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN end @@ -42,7 +58,7 @@ function ENT:SetObjectHealth(health) end function ENT:BeingControlled() - local owner = self:GetOwner() + local owner = self:GetObjectOwner() if owner:IsValid() then local wep = owner:GetActiveWeapon() return wep:IsValid() and wep:GetClass() == self.ControllerClass and wep:GetDTBool(0) @@ -63,8 +79,9 @@ function ENT:GetMaxObjectHealth() return self:GetDTFloat(1) end +local vecOffset = Vector(0, 0, -3) function ENT:GetRedLightPos() - return self:LocalToWorld(Vector(0, 0, -3)) + return self:LocalToWorld(vecOffset) end function ENT:GetRedLightAngles() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/cl_init.lua index 017e6dd..dd0bda3 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:CreateSubModel() local ent = ClientsideModel("models/props_junk/sawblade001a.mdl", RENDERGROUP_OPAQUE) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/init.lua index 061939e..3e20b96 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/init.lua @@ -1,4 +1 @@ -AddCSLuaFile("shared.lua") -AddCSLuaFile("cl_init.lua") - -include("shared.lua") +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/shared.lua index 32bfcbd..4f470aa 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_manhack_saw/shared.lua @@ -2,20 +2,20 @@ ENT.Type = "anim" ENT.Base = "prop_manhack" ENT.Model = "models/manhack.mdl" -ENT.HitBoxSize = 10.5 +ENT.HitBoxSize = 12.5 ENT.Mass = 80 ENT.WeaponClass = "weapon_zs_manhack_saw" ENT.ControllerClass = "weapon_zs_manhackcontrol_saw" ENT.AmmoType = "manhack_saw" -ENT.Acceleration = 140 +ENT.Acceleration = 219 ENT.MaxSpeed = 200 ENT.TurnSpeed = 30 ENT.IdleDrag = 0.2 -ENT.MaxHealth = 150 +ENT.MaxHealth = 170 ENT.HitCooldown = 0.15 -ENT.HitDamage = 20 +ENT.HitDamage = 22.5 ENT.BounceFleshVelocity = 30 ENT.BounceVelocity = 75 ENT.SelfDamageSpeed = 0.9 diff --git a/gamemodes/zombiesurvival/entities/entities/prop_meathook/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_meathook/cl_init.lua index 82fb317..c7052dc 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_meathook/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_meathook/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Draw() self:DrawModel() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_meathook/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_meathook/init.lua index 629128a..5fde63b 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_meathook/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_meathook/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextDamage = 0 -ENT.TicksLeft = 50 +ENT.TicksLeft = 10 function ENT:Initialize() self:SetModel("models/props_junk/meathook001a.mdl") @@ -13,40 +10,52 @@ function ENT:Initialize() self:AddEFlags(EFL_SETTING_UP_BONES) end +function ENT:Drop() + local ent = ents.Create("prop_weapon") + if ent:IsValid() then + ent:SetWeaponType(self.BaseWeapon) + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:Spawn() + + local owner = self:GetOwner() + if owner:IsValidHuman() then + ent.NoPickupsTime = CurTime() + 15 + ent.NoPickupsOwner = owner + end + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:AddAngleVelocity(VectorRand() * 200) + phys:SetVelocityInstantaneous(Vector(0, 0, 200)) + end + end + + self:Remove() +end + function ENT:Think() local parent = self:GetParent() if parent:IsValid() and parent:IsPlayer() then - if parent:Alive() and parent:Team() == TEAM_UNDEAD and self.TicksLeft >= 1 then + if parent:Alive() and parent:Team() == TEAM_UNDEAD and self.TicksLeft >= 1 and not parent.SpawnProtection then if CurTime() >= self.NextDamage then - self.NextDamage = CurTime() + 0.5 + local owner = self:GetOwner() + + self.NextDamage = CurTime() + 0.35 self.TicksLeft = self.TicksLeft - 1 + if self.Weaken then + local status = parent:GiveStatus("zombiestrdebuff") + status.DieTime = CurTime() + 0.45 + status.Applier = owner + end + util.Blood((parent:NearestPoint(self:GetPos()) + parent:WorldSpaceCenter()) / 2, math.random(4, 9), Vector(0, 0, 1), 100) - parent:TakeDamage(6, self:GetOwner(), self) + parent:TakeSpecialDamage(self.BleedPerTick, DMG_SLASH, owner, self) end else - local ent = ents.Create("prop_weapon") - if ent:IsValid() then - ent:SetWeaponType("weapon_zs_hook") - ent:SetPos(self:GetPos()) - ent:SetAngles(self:GetAngles()) - ent:Spawn() - - local owner = self:GetOwner() - if owner:IsValid() and owner:IsPlayer() and owner:Team() == TEAM_HUMAN then - ent.NoPickupsTime = CurTime() + 3 - ent.NoPickupsOwner = self:GetOwner() - end - - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:AddAngleVelocity(VectorRand() * 200) - phys:SetVelocityInstantaneous(Vector(0, 0, 200) + parent:GetVelocity()) - end - end - - self:Remove() + self:Drop() end else self:Remove() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/cl_init.lua index 1927065..38b9b7a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetModelScale(0.333, 0) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/init.lua index 9a1d216..dc1c34e 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/init.lua @@ -1,9 +1,6 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") - -ENT.m_Health = 100 +ENT.ObjHealth = 100 function ENT:Initialize() self:SetModel("models/props_combine/combine_mine01.mdl") @@ -14,6 +11,8 @@ function ENT:Initialize() self:SetCollisionGroup(COLLISION_GROUP_WORLD) self:SetUseType(SIMPLE_USE) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:SetMaterial("metal") @@ -44,17 +43,19 @@ function ENT:KeyValue(key, value) end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + self:TakePhysicsDamage(dmginfo) if not self.Destroyed then local attacker = dmginfo:GetAttacker() - if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then - if attacker:Team() == TEAM_UNDEAD and self:HumanNearby() then + if not attacker:IsValidHuman() then + if attacker:IsValidZombie() and self:HumanNearby() then attacker:AddLifeBarricadeDamage(dmginfo:GetDamage()) end - self.m_Health = self.m_Health - dmginfo:GetDamage() - if self.m_Health <= 0 then + self.ObjHealth = self.ObjHealth - dmginfo:GetDamage() + if self.ObjHealth <= 0 then self.Destroyed = true local effectdata = EffectData() effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) @@ -77,7 +78,7 @@ function ENT:OnPackedUp(pl) pl:GiveEmptyWeapon("weapon_zs_messagebeacon") pl:GiveAmmo(1, "striderminigun") - pl:PushPackedItem(self:GetClass(), self.m_Health) + pl:PushPackedItem(self:GetClass(), self.ObjHealth) self:Remove() end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/shared.lua index aad19e7..df96c06 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_messagebeacon/shared.lua @@ -1,7 +1,7 @@ ENT.Type = "anim" ENT.CanPackUp = true -ENT.PackUpTime = 3 +ENT.PackUpTime = 0.05 ENT.m_NoNailUnfreeze = true ENT.NoNails = true diff --git a/gamemodes/zombiesurvival/entities/entities/prop_nail/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_nail/cl_init.lua index 7fbea59..0089602 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_nail/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_nail/cl_init.lua @@ -1,6 +1,11 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.NextEmit = 0 + +function ENT:SetAttachEntity(ent, physbone1, physbone2) + self.m_AttachEntity = ent +end function ENT:OnRemove() local normal = self:GetForward() * -1 @@ -27,47 +32,97 @@ function ENT:OnRemove() particle:SetBounce(0.8) particle:SetGravity(grav) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end -local matOutlineWhite = Material("white_outline") -local ScaleOutline = 1.4 +local matExpert = Material("zombiesurvival/padlock.png") +local matHeart = Material("icon16/heart.png") local colNail = Color(0, 0, 5, 220) +local colText = Color(240, 240, 240, 105) +local colDead = Color(230, 80, 80, 95) function ENT:DrawTranslucent() - local drawowner = MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN and (GAMEMODE.AlwaysShowNails or MySelf:KeyDown(IN_SPEED) or MySelf:TraceLine(256, MASK_SHOT).HitPos:Distance(self:GetPos()) <= 16) - - if drawowner then - render.SuppressEngineLighting(true) - render.SetAmbientLight(1, 1, 1) - - local health = self:GetNailHealth() / self:GetMaxNailHealth() - render.SetColorModulation(1 - health, health, 0) - - local scale = self:GetModelScale() - self:SetModelScale(ScaleOutline * scale, 0) - render.ModelMaterialOverride(matOutlineWhite) - + local parent = self:GetParent() + if not parent:IsValid() or RealTime() == parent.LastNailInfoDraw then self:DrawModel() + return + end - render.ModelMaterialOverride() - self:SetModelScale(scale, 0) - - render.SuppressEngineLighting(false) - render.SetColorModulation(1, 1, 1) + local drawinfo + local myteam + local pos + local eyepos + if MySelf:IsValid() then + myteam = MySelf:Team() + pos = self:GetPos() + eyepos = EyePos() + if myteam == TEAM_HUMAN or myteam == TEAM_SPECTATOR then + drawinfo = (GAMEMODE.AlwaysShowNails or MySelf:KeyDown(IN_SPEED) or GAMEMODE.TraceTargetNoPlayers == self:GetParent()) and eyepos:DistToSqr(pos) <= 262144 and WorldVisible(eyepos, pos) + elseif myteam == TEAM_UNDEAD then + drawinfo = GAMEMODE.TraceTargetNoPlayers == self:GetParent() + end end self:DrawModel() - if drawowner then + local nhp = self:GetNailHealth() + local mnhp = self:GetMaxNailHealth() + + if nhp/mnhp < 0.35 and CurTime() > self.NextEmit then + local normal = self:GetForward() * -1 + local epos = self:GetPos() + normal + + sound.Play("physics/metal/metal_box_impact_bullet"..math.random(1, 3)..".wav", pos, 58, math.random(210, 240)) + + local emitter = ParticleEmitter(epos) + emitter:SetNearClip(22, 32) + for i=1, math.random(6, 12) do + local vNormal = (VectorRand() * 0.6 + normal):GetNormalized() + local particle = emitter:Add("effects/spark", epos + vNormal) + particle:SetDieTime(math.Rand(0.1, 0.2)) + particle:SetGravity(Vector(math.random(-5, 5), math.random(-5, 5), math.random(1, 3)):GetNormal() * 50) + particle:SetStartAlpha(100) + particle:SetEndAlpha(0) + particle:SetStartSize(4) + particle:SetEndSize(1) + particle:SetStartLength(10) + particle:SetEndLength(0) + particle:SetColor(165, 188, 0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-20, 20)) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + + self.NextEmit = CurTime() + math.Rand(4.2, 5.8) + end + + if drawinfo then + parent.LastNailInfoDraw = RealTime() + local displayowner = self:GetDTString(0) local redname = false + local expert = false + local hcolor = COLOR_WHITE + + local deployer = self:GetOwner() if displayowner == "" then displayowner = nil - local deployer = self:GetOwner() if deployer:IsValid() then displayowner = deployer:Name() - if deployer:Team() ~= TEAM_HUMAN or not deployer:Alive() then + if deployer:Team() == TEAM_HUMAN and deployer:Alive() then + local rlvl = deployer:GetZSRemortLevel() + expert = rlvl > 0 + + if expert then + local rlvlmod, hlvl = math.floor((rlvl % 40) / 4), 0 + for rlvlr, rcolor in pairs(GAMEMODE.RemortColors) do + if rlvlmod >= rlvlr and rlvlr >= hlvl then + hlvl = rlvlr + hcolor = rcolor + end + end + end + else displayowner = "(DEAD) "..displayowner redname = true end @@ -78,45 +133,79 @@ function ENT:DrawTranslucent() ang:RotateAroundAxis(ang:Up(), -90) ang:RotateAroundAxis(ang:Forward(), 90) - cam.Start3D2D(self:GetPos(), ang, 0.05) - local wid, hei = 180, 5 + local nearest = parent:WorldSpaceCenter() + local norm = nearest - eyepos + norm:Normalize() + local dot = EyeVector():Dot(norm) + + local dotsq = dot * dot + local vis = math.Clamp((dotsq * dotsq) - 0.1, 0, 1) + + if vis < 0.01 then return end + + cam.IgnoreZ(true) + + cam.Start3D2D(nearest, ang, 0.1) + local wid, hei = 150, 6 local x, y = wid * -0.5 + 2, 0 - if self:GetMaxRepairs() > 0 then - local repairs = self:GetRepairs() - local ru = 1 - math.Clamp(repairs / self:GetMaxRepairs(), 0, 1) - surface.SetDrawColor(0, 0, 0, 220) - surface.DrawRect(x, y, wid, hei) - surface.SetDrawColor(40, 40, 40, 220) - surface.DrawOutlinedRect(x, y, wid, hei) - surface.SetDrawColor(230, 5, 5, ru == 1 and (150 + math.abs(math.sin(RealTime() * 5)) * 105) or 220) - surface.DrawRect(x + 1, y + 1, (wid - 2) * ru, hei - 2) + local validfriend = deployer:IsValidLivingHuman() and deployer.ZSFriendAdded - draw.SimpleText(math.ceil(repairs), "ZS3D2DFont2Smaller", x + wid, y - 1, repairs <= 0 and COLOR_DARKRED or COLOR_GRAY, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP) + if validfriend or expert then + surface.SetMaterial(validfriend and matHeart or matExpert) + surface.SetDrawColor(hcolor.r, hcolor.g, hcolor.b, 240 * vis) + surface.DrawTexturedRect( + x - (validfriend and 24 or 32), + y - (validfriend and 0 or 5), + validfriend and 16 or 24, + validfriend and 16 or 24 + ) end - if self:GetMaxNailHealth() > 0 then - local mu = math.Clamp(self:GetNailHealth() / self:GetMaxNailHealth(), 0, 1) + if self:GetMaxRepairs() > 0 or self:GetMaxNailHealth() > 0 then + local repairs = self:GetRepairs() + local mrps = self:GetMaxRepairs() + + surface.SetDrawColor(0, 0, 0, 210 * vis) + surface.DrawRect(x - 1, y, mrps/5 + mrps/50 + 1, hei) + + for i = 0, repairs, 200 do + local val = math.Clamp(repairs - i, 0, 200) + + surface.SetDrawColor(100, 170, 215, 240 * vis) + surface.DrawRect(x + 1 + i/5 + i/50, y + 1, val/5, hei - 2) + end + + local mu = math.Clamp(nhp / mnhp, 0, 1) local green = mu * 200 colNail.r = 200 - green colNail.g = green + colNail.a = 240 * vis y = y + hei + 3 hei = 8 x = wid * -0.5 + 2 - surface.SetDrawColor(0, 0, 0, 220) - surface.DrawRect(x, y, wid, hei) - surface.SetDrawColor(40, 40, 40, 220) - surface.DrawOutlinedRect(x, y, wid, hei) - surface.SetDrawColor(colNail) - surface.DrawRect(x + 1, y + 1, (wid - 2) * mu, hei - 2) - draw.SimpleText(math.ceil(self:GetNailHealth()).." / "..math.ceil(self:GetMaxNailHealth()), "ZS3D2DFont2Smaller", x + wid / 2, y + hei + 1, colNail, TEXT_ALIGN_CENTER) - end + surface.SetDrawColor(0, 0, 0, 210 * vis) + surface.DrawRect(x - 1, y, mnhp/5 + mnhp/50 + 2, hei) - if displayowner then - draw.SimpleText(displayowner, "ZS3D2DFont2Smaller", 0, y + 38, redname and COLOR_DARKRED or COLOR_DARKGRAY, TEXT_ALIGN_CENTER) + for i = 0, nhp, 200 do + local val = math.Clamp(nhp - i, 0, 200) + + surface.SetDrawColor(colNail) + surface.DrawRect(x + 1 + i/5 + i/50, y + 1, val/5, hei - 2) + end + + if displayowner then + local col = redname and colDead or colText + col.a = 125 * vis + + draw.SimpleText(displayowner, "ZS3D2DUnstyleSmallest", 0, y + 20, col, TEXT_ALIGN_CENTER) + draw.SimpleText(math.floor(nhp) .. "/" .. math.floor(self:GetMaxNailHealth()), "ZS3D2DUnstyleTiny", x + 25, y - 30, col, TEXT_ALIGN_CENTER) + end end cam.End3D2D() + + cam.IgnoreZ(false) end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_nail/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_nail/init.lua index 9440aae..d6aa7b5 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_nail/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_nail/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.m_NextStrainSound = 0 @@ -17,6 +14,7 @@ end) function ENT:Initialize() self:SetModel("models/crossbow_bolt.mdl") + self:SetModelScale(0.75) self.m_NailUnremovable = self.m_NailUnremovable or false self.HealthOveride = self.HealthOveride or -1 self.HealthMultiplier = self.HealthMultiplier or 1 @@ -57,6 +55,39 @@ function ENT:AttachTo(baseent, attachent, physbone, physbone2) baseent:SetBarricadeHealth(health) baseent:SetBarricadeRepairs(baseent:GetMaxBarricadeRepairs()) end + + baseent:RecalculateNailBonuses() +end + +function ENT:SetAttachEntity(ent, physbone1, physbone2) + self.m_AttachEntity = ent + + local baseent = self:GetBaseEntity() + if not baseent:IsValid() then return end + + local cons = constraint.Weld(baseent, ent, physbone1 or 0, physbone2 or 0, 0, true) + if cons ~= nil then + for _, oldcons in pairs(constraint.FindConstraints(baseent, "Weld")) do + if oldcons.Ent1 == ent or oldcons.Ent2 == ent then + cons = oldcons.Constraint + break + end + end + end + + cons:DeleteOnRemove(self) + self:SetNailConstraint(cons) + + if baseent:IsValid() then + baseent:CollisionRulesChanged() + end + if ent and ent:IsValid() then + ent:CollisionRulesChanged() + end + + timer.Simple(0.1, function() GAMEMODE:EvaluatePropFreeze() end) + + return cons end function ENT:SetNailConstraint(const) @@ -118,7 +149,7 @@ function ENT:AcceptInput(name, activator, caller, args) return true elseif name == "sethealth" then self:SetNewHealth(args) - + return true elseif name == "setunremoveable" or name == "setunremovable" then self.m_NailUnremovable = tonumber(args) == 1 diff --git a/gamemodes/zombiesurvival/entities/entities/prop_nail/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_nail/shared.lua index d4ec0b9..cefb691 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_nail/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_nail/shared.lua @@ -51,39 +51,6 @@ function ENT:GetBaseEntity() return self:GetDTEntity(0) end -function ENT:SetAttachEntity(ent, physbone1, physbone2) - self.m_AttachEntity = ent - - if not SERVER then return end - - local baseent = self:GetBaseEntity() - if not baseent:IsValid() then return end - - local cons = constraint.Weld(baseent, ent, physbone1 or 0, physbone2 or 0, 0, true) - if cons ~= nil then - for _, oldcons in pairs(constraint.FindConstraints(baseent, "Weld")) do - if oldcons.Ent1 == ent or oldcons.Ent2 == ent then - cons = oldcons.Constraint - break - end - end - end - - cons:DeleteOnRemove(self) - self:SetNailConstraint(cons) - - if baseent:IsValid() then - baseent:CollisionRulesChanged() - end - if ent and ent:IsValid() then - ent:CollisionRulesChanged() - end - - timer.Simple(0.1, function() GAMEMODE:EvaluatePropFreeze() end) - - return cons -end - function ENT:GetAttachEntity() return self.m_AttachEntity or NULL end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/cl_init.lua index 66c2de2..200e52f 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -80,13 +80,15 @@ local CModWhiteOut = { function ENT:RenderScreenspaceEffects() local eyepos = EyePos() local nearest = self:NearestPoint(eyepos) - local dist = eyepos:Distance(nearest) - local power = math.Clamp(1 - dist / 300, 0, 1) ^ 2 * self:GetOpenedPercent() + local power = math.Clamp(1 - eyepos:DistToSqr(nearest) / 45000, 0, 1) ^ 2 * self:GetOpenedPercent() if power > 0 then - local size = 5 + power * 10 + local size = 1 + power * 2 - CModWhiteOut["$pp_colour_brightness"] = power * 0.5 + CModWhiteOut["$pp_colour_brightness"] = power * 0.25 + if MySelf:GetObserverMode() == OBS_MODE_NONE then + CModWhiteOut["$pp_colour_brightness"] = CModWhiteOut["$pp_colour_brightness"] / 2 + end DrawBloom(1 - power, power * 4, size, size, 1, 1, 1, 1, 1) DrawColorModify(CModWhiteOut) @@ -195,5 +197,5 @@ function ENT:DrawTranslucent() particle:SetRollDelta(math.Rand(-5, 5)) end - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/init.lua index 61f0dda..893722a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_obj_exit/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() local mins, maxs = Vector(-56, -8, -1), Vector(8, 8, 115) @@ -21,7 +18,7 @@ function ENT:Initialize() self:SetCreationTime(CurTime()) - --self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) local ent = ents.Create("point_worldhint") if ent:IsValid() then @@ -63,8 +60,17 @@ function ENT:Initialize() end function ENT:Use(activator) + self:OnUse(activator) +end + +function ENT:StartTouch(ent) + self:OnUse(ent) +end + +function ENT:OnUse(activator) if activator:IsPlayer() and activator:Alive() and activator:Team() == TEAM_HUMAN and self:GetOpenStartTime() == 0 and self:GetRise() == 1 then self:SetOpenStartTime(CurTime()) + self:EmitSound("plats/hall_elev_door.wav") end end @@ -76,10 +82,16 @@ function ENT:Touch(ent) ent:SpectateEntity(self) ent:StripWeapons() ent:GodEnable() + ent:SetMoveType(MOVETYPE_NOCLIP) ent:SetPos(pos) - ent:PrintMessage(3, "You've managed to survive! Waiting for other survivors...") + gamemode.Call("OnPlayerWin", ent) + + --ent:PrintMessage(HUD_PRINTTALK, "You've managed to survive! Waiting for other survivors...") + net.Start("zs_survivor") + net.WriteEntity(ent) + net.Broadcast() end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/cl_init.lua index c1e11ec..1fd6283 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/cl_init.lua @@ -1,25 +1,20 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT -local function DrawSigilHints() - for _, ent in pairs(ents.FindByClass("prop_obj_sigil")) do - ent:DrawWorldHint() - end -end - function ENT:Initialize() + self:DrawShadow(false) + self:SetRenderFX(kRenderFxDistort) + self:SetRenderBounds(Vector(-128, -128, -128), Vector(128, 128, 200)) self:SetModelScaleVector(Vector(1, 1, 1) * self.ModelScale) self.AmbientSound = CreateSound(self, "ambient/atmosphere/tunnel1.wav") - - hook.Add("PostDrawTranslucentRenderables", "DrawSigilHints", DrawSigilHints) end function ENT:Think() - if EyePos():Distance(self:GetPos()) <= 700 then + if EyePos():DistToSqr(self:GetPos()) <= 4900000 then -- 700^2 self.AmbientSound:PlayEx(0.33, 75 + (self:GetSigilHealth() / self:GetSigilMaxHealth()) * 25) else self.AmbientSound:Stop() @@ -30,10 +25,6 @@ function ENT:OnRemove() self.AmbientSound:Stop() end -function ENT:DrawWorldHint() - DrawWorldHint(math.ceil(self:GetSigilHealth()), self:GetPos(), nil, 0.75) -end - ENT.NextEmit = 0 ENT.Rotation = math.random(360) @@ -41,75 +32,88 @@ local matWhite = Material("models/debug/debugwhite") local matGlow = Material("sprites/light_glow02_add") local cDraw = Color(255, 255, 255) local cDrawWhite = Color(255, 255, 255) + +local math_sin = math.sin +local math_cos = math.cos +local math_abs = math.abs +local cam_Start3D = cam.Start3D +local cam_End3D = cam.End3D +local render_SetBlend = render.SetBlend +local render_ModelMaterialOverride = render.ModelMaterialOverride +local render_SetColorModulation = render.SetColorModulation +local render_SuppressEngineLighting = render.SuppressEngineLighting +local render_DrawQuadEasy = render.DrawQuadEasy +local render_DrawSprite = render.DrawSprite + function ENT:DrawTranslucent() self:RemoveAllDecals() + local scale = self.ModelScale + local curtime = CurTime() - local sat = math.abs(math.sin(curtime)) + local sat = math_abs(math_sin(curtime)) local colsat = sat * 0.125 local eyepos = EyePos() local eyeangles = EyeAngles() - local forwardoffset = self:GetForward() * 16 - local rightoffset = self:GetRight() * 16 + local forwardoffset = 16 * scale * self:GetForward() + local rightoffset = 16 * scale * self:GetRight() local healthperc = self:GetSigilHealth() / self:GetSigilMaxHealth() - local r, g, b = 0.15 + colsat, 0.4 + colsat, 1 - local radius = 180 + math.cos(sat) * 40 - local whiteradius = 122 + math.sin(sat) * 32 + local radius = (180 + math_cos(sat) * 40) * scale + local whiteradius = (122 + math_sin(sat) * 32) * scale local up = self:GetUp() local spritepos = self:GetPos() + up local spritepos2 = self:WorldSpaceCenter() - - local dlight = DynamicLight(self:EntIndex()) - if dlight then - dlight.Pos = self:GetPos() - dlight.r = r * 255 - dlight.g = g * 255 - dlight.b = b * 255 - dlight.Brightness = (2 + sat) * healthperc - dlight.Size = 100 + sat * 50 - dlight.Decay = 400 + sat * 200 - dlight.DieTime = curtime + 1 + local corrupt = self:GetSigilCorrupted() + local r, g, b + if corrupt then + r = colsat + g = 0.75 + b = colsat + else + r = 0.15 + colsat + g = 0.4 + colsat + b = 1 end r = r * healthperc g = g * healthperc b = b * healthperc - render.SuppressEngineLighting(true) - render.SetColorModulation(r ^ 0.5, g ^ 0.5, b ^ 0.5) - self:DrawModel() + render_SuppressEngineLighting(true) + render_SetColorModulation(r ^ 0.5, g ^ 0.5, b ^ 0.5) - render.SetColorModulation(r, g, b) - - render.ModelMaterialOverride(matWhite) - render.SetBlend(0.1 * healthperc) + self:SetModelScaleVector(Vector(1, 1, 1) * scale) self:DrawModel() - --[[r = r * healthperc - g = g * healthperc - b = b * healthperc]] - render.SetColorModulation(r, g, b) + render_SetColorModulation(r, g, b) - self:SetModelScaleVector(Vector(0.1, 0.1, 0.9 * math.max(0.02, healthperc)) * self.ModelScale) - render.SetBlend(1) - cam.Start3D(eyepos + forwardoffset + rightoffset, eyeangles) - self:DrawModel() - cam.End3D() - cam.Start3D(eyepos + forwardoffset - rightoffset, eyeangles) - self:DrawModel() - cam.End3D() - cam.Start3D(eyepos - forwardoffset + rightoffset, eyeangles) - self:DrawModel() - cam.End3D() - cam.Start3D(eyepos - forwardoffset - rightoffset, eyeangles) - self:DrawModel() - cam.End3D() - self:SetModelScaleVector(Vector(1, 1, 1) * self.ModelScale) + render_ModelMaterialOverride(matWhite) + render_SetBlend(0.1 * healthperc) - render.SetBlend(1) - render.ModelMaterialOverride() - render.SuppressEngineLighting(false) - render.SetColorModulation(1, 1, 1) + self:DrawModel() + + render_SetColorModulation(r, g, b) + + self:SetModelScaleVector(Vector(0.1, 0.1, 0.9 * math.max(0.02, healthperc)) * scale) + render_SetBlend(1) + cam_Start3D(eyepos + forwardoffset + rightoffset, eyeangles) + self:DrawModel() + cam_End3D() + cam_Start3D(eyepos + forwardoffset - rightoffset, eyeangles) + self:DrawModel() + cam_End3D() + cam_Start3D(eyepos - forwardoffset + rightoffset, eyeangles) + self:DrawModel() + cam_End3D() + cam_Start3D(eyepos - forwardoffset - rightoffset, eyeangles) + self:DrawModel() + cam_End3D() + self:SetModelScaleVector(Vector(1, 1, 1) * scale) + + render_SetBlend(1) + render_ModelMaterialOverride() + render_SuppressEngineLighting(false) + render_SetColorModulation(1, 1, 1) self.Rotation = self.Rotation + FrameTime() * 5 if self.Rotation >= 360 then @@ -124,12 +128,13 @@ function ENT:DrawTranslucent() cDrawWhite.b = cDrawWhite.r render.SetMaterial(matGlow) - render.DrawQuadEasy(spritepos, up, whiteradius, whiteradius, cDrawWhite, self.Rotation) - render.DrawQuadEasy(spritepos, up * -1, whiteradius, whiteradius, cDrawWhite, self.Rotation) - render.DrawQuadEasy(spritepos, up, radius, radius, cDraw, self.Rotation) - render.DrawQuadEasy(spritepos, up * -1, radius, radius, cDraw, self.Rotation) - --render.DrawSprite(spritepos2, whiteradius, whiteradius * 2, cDrawWhite) - render.DrawSprite(spritepos2, radius, radius * 2, cDraw) + if not corrupt then + render_DrawQuadEasy(spritepos, up, whiteradius, whiteradius, cDrawWhite, self.Rotation) + render_DrawQuadEasy(spritepos, up * -1, whiteradius, whiteradius, cDrawWhite, self.Rotation) + end + render_DrawQuadEasy(spritepos, up, radius, radius, cDraw, self.Rotation) + render_DrawQuadEasy(spritepos, up * -1, radius, radius, cDraw, self.Rotation) + render_DrawSprite(spritepos2, radius, radius * 2, cDraw) if curtime < self.NextEmit then return end self.NextEmit = curtime + 0.05 @@ -137,24 +142,24 @@ function ENT:DrawTranslucent() local offset = VectorRand() offset.z = 0 offset:Normalize() - offset = offset * math.Rand(-32, 32) + offset = math.Rand(-32, 32) * scale * offset offset.z = 1 local pos = self:LocalToWorld(offset) local emitter = ParticleEmitter(pos) emitter:SetNearClip(24, 32) - local particle = emitter:Add("sprites/glow04_noz", pos) + local particle = emitter:Add(corrupt and "particle/smokesprites_0001" or "sprites/glow04_noz", pos) particle:SetDieTime(math.Rand(1.5, 4)) - particle:SetVelocity(Vector(0, 0, math.Rand(32, 64))) + particle:SetVelocity(Vector(0, 0, math.Rand(32, 64) * scale)) particle:SetStartAlpha(0) particle:SetEndAlpha(255) - particle:SetStartSize(math.Rand(2, 4)) + particle:SetStartSize(math.Rand(2, 4) * (corrupt and 3 or 1) * scale) particle:SetEndSize(0) particle:SetRoll(math.Rand(0, 360)) particle:SetRollDelta(math.Rand(-1, 1)) particle:SetColor(r * 255, g * 255, b * 255) particle:SetCollide(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/init.lua index cdc1d54..8709c8f 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/init.lua @@ -1,15 +1,17 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() + +ENT.HealthLock = 0 -include("shared.lua") ---models/props_wasteland/antlionhill.mdl function ENT:Initialize() self:DrawShadow(false) + self:SetRenderFX(kRenderFxDistort) self:SetModel("models/props_wasteland/medbridge_post01.mdl") - self:PhysicsInit(SOLID_VPHYSICS) + self:PhysicsInitBox(Vector(-16.285, -16.285, -0.29) * self.ModelScale, Vector(16.285, 16.285, 104.29) * self.ModelScale) self:SetUseType(SIMPLE_USE) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) @@ -19,36 +21,76 @@ function ENT:Initialize() self:SetSigilHealthBase(self.MaxHealth) self:SetSigilHealthRegen(self.HealthRegen) self:SetSigilLastDamaged(0) -end -function ENT:Think() -end - -function ENT:OnTakeDamage(dmginfo) - if self:GetSigilHealth() <= 0 then return end - - local attacker = dmginfo:GetAttacker() - if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD and dmginfo:GetDamage() > 2) then return end - - local oldhealth = self:GetSigilHealth() - self:SetSigilLastDamaged(CurTime()) - self:SetSigilHealthBase(oldhealth - dmginfo:GetDamage()) - - if self:GetSigilHealth() <= 0 then - self:SetSigilHealthBase(0) - - gamemode.Call("OnSigilDestroyed", self, dmginfo) - - self:Destroy() + local ent = ents.Create("prop_prop_blocker") + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:Spawn() + ent:SetOwner(self) + --ent:SetParent(self) -- Prevents collisions + self:DeleteOnRemove(ent) end end -function ENT:Destroy() - local effectdata = EffectData() - effectdata:SetOrigin(self:LocalToWorld(self:OBBCenter())) - util.Effect("Explosion", effectdata, true, true) +function ENT:Use(pl) + if pl.NextSigilTPTry and pl.NextSigilTPTry >= CurTime() then return end - self:Fire("kill", "", 0.01) + if pl:Team() == TEAM_HUMAN and pl:Alive() and not self:GetSigilCorrupted() then + local tpexist = pl:GetStatus("sigilteleport") + if tpexist and tpexist:IsValid() then return end + + if GAMEMODE:NumUncorruptedSigils() >= 2 then + local status = pl:GiveStatus("sigilteleport") + if status:IsValid() then + status:SetFromSigil(self) + status:SetEndTime(CurTime() + 2 * (pl.SigilTeleportTimeMul or 1)) + + pl.NextSigilTPTry = CurTime() + 1 + end + end + end +end + +function ENT:OnTakeDamage(dmginfo) + if self:GetSigilHealth() <= 0 or dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and dmginfo:GetDamage() > 2 and CurTime() >= self.HealthLock then + if self:CanBeDamagedByTeam(attacker:Team()) then + if attacker:Team() == TEAM_HUMAN then + local dmgtype = dmginfo:GetDamageType() + if bit.band(dmgtype, DMG_SLASH) ~= 0 or bit.band(dmgtype, DMG_CLUB) ~= 0 then + dmginfo:SetDamage(dmginfo:GetDamage() * 1.6) + else + dmginfo:SetDamage(0) + return + end + end + + local oldhealth = self:GetSigilHealth() + self:SetSigilLastDamaged(CurTime()) + self:SetSigilHealthBase(oldhealth - dmginfo:GetDamage()) + + if self:GetSigilHealth() <= 0 then + if self:GetSigilCorrupted() then + gamemode.Call("PreOnSigilUncorrupted", self, dmginfo) + self:SetSigilCorrupted(false) + self:SetSigilHealthBase(self.MaxHealth) + self:SetSigilLastDamaged(0) + gamemode.Call("OnSigilUncorrupted", self, dmginfo) + else + gamemode.Call("PreOnSigilCorrupted", self, dmginfo) + self:SetSigilCorrupted(true) + self:SetSigilHealthBase(self.MaxHealth) + self:SetSigilLastDamaged(0) + gamemode.Call("OnSigilCorrupted", self, dmginfo) + end + end + elseif attacker:Team() == TEAM_UNDEAD then + self.HealthLock = CurTime() + 1 + end + end end function ENT:UpdateTransmitState() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/shared.lua index 480167c..3e4fd1d 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_obj_sigil/shared.lua @@ -1,10 +1,10 @@ ENT.Type = "anim" -ENT.MaxHealth = 1000 -ENT.HealthRegen = 10 -ENT.RegenDelay = 10 +ENT.MaxHealth = 2000 +ENT.HealthRegen = 40 +ENT.RegenDelay = 2 -ENT.ModelScale = 1 --ENT.ModelScale = 0.5 +ENT.ModelScale = 0.55 ENT.m_NoNailUnfreeze = true ENT.NoNails = true @@ -14,6 +14,22 @@ AccessorFuncDT(ENT, "SigilHealthBase", "Float", 0) AccessorFuncDT(ENT, "SigilHealthRegen", "Float", 1) AccessorFuncDT(ENT, "SigilLastDamaged", "Float", 2) +function ENT:SetSigilCorrupted(corrupt) + self.IsBarricadeObject = not corrupt + + if SERVER then + self:SetCollisionGroup(corrupt and COLLISION_GROUP_DEBRIS_TRIGGER or COLLISION_GROUP_NONE) + end + + self:CollisionRulesChanged() + + self:SetDTBool(0, corrupt) +end + +function ENT:GetSigilCorrupted() + return self:GetDTBool(0) +end + function ENT:SetSigilHealth(health) self:SetSigilHealthBase(health) @@ -30,3 +46,11 @@ end function ENT:GetSigilMaxHealth() return self.MaxHealth end + +function ENT:CanBeDamagedByTeam(teamid) + if self:GetSigilCorrupted() then + return teamid == TEAM_HUMAN + end + + return teamid == TEAM_UNDEAD +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_playergib/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_playergib/cl_init.lua index bf9d188..12d1041 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_playergib/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_playergib/cl_init.lua @@ -1,19 +1,19 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 function ENT:Draw() self:DrawModel() - if CurTime() >= self.NextEmit and self:GetVelocity():Length() >= 16 then + if CurTime() >= self.NextEmit and self:GetVelocity():LengthSqr() >= 256 then self.NextEmit = CurTime() + 0.05 - local pos = self:GetPos() + local pos = self:WorldSpaceCenter() local emitter = ParticleEmitter(pos) emitter:SetNearClip(16, 24) - local particle = emitter:Add("noxctf/sprite_bloodspray"..math.random(8), pos) + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(8, 16)) particle:SetDieTime(0.6) particle:SetStartAlpha(230) @@ -25,6 +25,6 @@ function ENT:Draw() particle:SetColor(255, 0, 0) particle:SetLighting(true) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_playergib/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_playergib/init.lua index 181f83b..bfd8144 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_playergib/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_playergib/init.lua @@ -1,12 +1,9 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.DieTime = 0 function ENT:Initialize() - self.m_Health = 25 + self.ObjHealth = 25 if self.DieTime == 0 then self.DieTime = CurTime() + GAMEMODE.GibLifeTime @@ -61,14 +58,16 @@ function ENT:KeyValue(key, value) end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + self:TakePhysicsDamage(dmginfo) - self.m_Health = self.m_Health - dmginfo:GetDamage() - if self.m_Health <= 0 and not self.Destroyed then + self.ObjHealth = self.ObjHealth - dmginfo:GetDamage() + if self.ObjHealth <= 0 and not self.Destroyed then self.Destroyed = true self.DieTime = 0 - util.Blood(self:GetPos(), math.random(1, 2), Vector(0, 0, 1), 100, self:GetDTInt(0), true) + util.Blood(self:GetPos(), math.random(2), Vector(0, 0, 1), 100, self:GetDTInt(0), true) end end @@ -79,7 +78,7 @@ function ENT:Think() end function ENT:StartTouch(ent) - if self.DieTime ~= 0 and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD and ent:Health() < ent:GetMaxZombieHealth() then + if self.DieTime ~= 0 and ent:IsValidLivingZombie() and ent:Health() < ent:GetMaxZombieHealth() and not ent:GetStatus("shockdebuff") --[[and not ent:GetZombieClassTable().Boss]] then self.DieTime = 0 ent:SetHealth(math.min(ent:GetMaxZombieHealth(), ent:Health() + 10)) @@ -87,4 +86,4 @@ function ENT:StartTouch(ent) self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav") util.Blood(self:GetPos(), math.random(2), Vector(0, 0, 1), 100, self:GetDTInt(0), true) end -end \ No newline at end of file +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_playergib/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_playergib/shared.lua index 1a2d077..6268e2a 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_playergib/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_playergib/shared.lua @@ -3,5 +3,5 @@ ENT.Type = "anim" ENT.NoNails = true function ENT:HumanHoldable(pl) - return true -end \ No newline at end of file + return false +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_prop_blocker.lua b/gamemodes/zombiesurvival/entities/entities/prop_prop_blocker.lua new file mode 100644 index 0000000..3877f07 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_prop_blocker.lua @@ -0,0 +1,32 @@ +AddCSLuaFile() + +ENT.Type = "anim" + +ENT.IgnoreMelee = true +ENT.IgnoreBullets = true +ENT.IgnoreTraces = true +ENT.Sigil = true + +function ENT:Initialize() + self:DrawShadow(false) + self:SetNoDraw(true) + + if SERVER then + self:PhysicsInitBox(Vector(-20, -20, 0), Vector(20, 20, 86)) + end + + self:SetCustomCollisionCheck(true) + self:CollisionRulesChanged() + --self:SetCollisionGroup(COLLISION_GROUP_DEBRIS) + + if SERVER then + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + end +end + +function ENT:ShouldNotCollide(ent) + return --[[ent:GetCollisionGroup() ~= COLLISION_GROUP_NONE or]] ent:IsPlayer() or ent:IsProjectile() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_remantler/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_remantler/cl_init.lua new file mode 100644 index 0000000..133e3f8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_remantler/cl_init.lua @@ -0,0 +1,61 @@ +INC_CLIENT() + +--ENT.Contents = "EMPTY" + +function ENT:Initialize() + self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 128)) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) +end + +local vOffset = Vector(11.75, 0, 13) +local vOffset2 = Vector(-12.75, 0, 13) +local aOffset = Angle(0, 90, 90) +local aOffset2 = Angle(0, 270, 90) + +function ENT:RenderInfo(pos, ang, owner) + cam.Start3D2D(pos, ang, 0.055) + draw.SimpleText(translate.Get("weapon_remantler"), "ZS3D2DFont2", 0, -50, COLOR_GREEN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + + if owner:IsValid() and owner:IsPlayer() then + draw.SimpleText(owner:ClippedName(), "ZS3D2DFont2", 0, 160, owner == MySelf and COLOR_LBLUE or COLOR_GRAY, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), nil, 570, 0.85) + + --[[if self.Contents then + local contents = self.Contents + if #contents > 32 then + contents = string.sub(contents, 1, 30)..".." + end + draw.SimpleText(contents, "ZS3D2DFont2Small", 0, 235, contents == "EMPTY" and COLOR_RED or COLOR_WHITE, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end]] + + if owner == MySelf then + draw.SimpleText(self:GetScraps() .. " Scrap", "ZS3D2DFont2Big", 0, 290, COLOR_GRAY, TEXT_ALIGN_CENTER) + --[[local ammotype = MySelf:GetResupplyAmmoType() + ammotype = GAMEMODE.AmmoNames[ammotype] or ammotype + + draw.SimpleText("["..ammotype.."]", "ZS3D2DFont2Small", 0, 360, COLOR_GRAY, TEXT_ALIGN_CENTER)]] + end + cam.End3D2D() +end + +function ENT:Draw() + self:DrawModel() + + if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then return end + + local owner = self:GetObjectOwner() + self:RenderInfo(self:LocalToWorld(vOffset), self:LocalToWorldAngles(aOffset), owner) + self:RenderInfo(self:LocalToWorld(vOffset2), self:LocalToWorldAngles(aOffset2), owner) +end + +net.Receive("zs_remantlercontent", function(length) + local ent = net.ReadEntity() + local readstring = net.ReadString() + + ent.WepClass = readstring ~= "" and readstring or nil + ent.Contents = readstring ~= "" and weapons.Get(readstring).PrintName or "EMPTY" +end) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_remantler/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_remantler/init.lua new file mode 100644 index 0000000..d061e27 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_remantler/init.lua @@ -0,0 +1,129 @@ +INC_SERVER() + +local function RefreshRemantlerOwners(pl) + for _, ent in pairs(ents.FindByClass("prop_remantler")) do + if ent:IsValid() and ent:GetObjectOwner() == pl then + ent:SetObjectOwner(NULL) + end + end +end +hook.Add("PlayerDisconnected", "Remantler.PlayerDisconnected", RefreshRemantlerOwners) +hook.Add("OnPlayerChangedTeam", "Remantler.OnPlayerChangedTeam", RefreshRemantlerOwners) + +function ENT:Initialize() + self.Contents = {} + self.NextUse = {} + + self:SetModel("models/props_lab/powerbox01a.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetUseType(SIMPLE_USE) + + self:CollisionRulesChanged() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:SetMaxObjectHealth(200) + self:SetObjectHealth(self:GetMaxObjectHealth()) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + + local pos = self:LocalToWorld(self:OBBCenter()) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + end +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:ResetLastBarricadeAttacker(attacker, dmginfo) + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon("weapon_zs_remantler") + pl:GiveAmmo(1, "remantler") + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth(), self:GetScraps()) + + self:Remove() +end + +function ENT:Think() + if self.Destroyed then + self:Remove() + end +end + +function ENT:Use(activator, caller) + if activator:Team() ~= TEAM_HUMAN or not activator:Alive() then return end + + local uid = activator:UniqueID() + if self.NextUse[uid] and CurTime() < self.NextUse[uid] then return end + self.NextUse[uid] = CurTime() + 0.75 + + local owner = self:GetObjectOwner() + if not owner:IsValid() then + self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) + return + end + + local currentwep = activator:GetActiveWeapon() + local currentwepclass = currentwep:GetClass() + local heldtbl = weapons.Get(currentwepclass) + + if activator == owner and self:GetScraps() > 0 then + local amount = self:GetScraps() + self:SetScraps(0) + + net.Start("zs_ammopickup") + net.WriteUInt(amount, 16) + net.WriteString("scrap") + net.Send(activator) + + activator:GiveAmmo(amount, "scrap") + + self.NextUse[uid] = CurTime() + 0.05 + return + end + + if (heldtbl.AllowQualityWeapons or heldtbl.PermitDismantle) then + activator:SendLua("surface.PlaySound(\"ambient/misc/shutter1.wav\")") + end + + activator:SendLua("GAMEMODE:OpenRemantlerMenu(MySelf:NearestRemantler())") +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_remantler/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_remantler/shared.lua new file mode 100644 index 0000000..9cb4d14 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_remantler/shared.lua @@ -0,0 +1,62 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_OPAQUE + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true + +ENT.CanPackUp = true + +ENT.IsBarricadeObject = true +ENT.AlwaysGhostable = true + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + end +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(0) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(1, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(1) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(0, ent) +end + +function ENT:GetObjectOwner() + return self:GetDTEntity(0) +end + +function ENT:SetScraps(scraps) + self:SetDTInt(0, scraps) +end + +function ENT:GetScraps() + return self:GetDTInt(0) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_repairfield/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/cl_init.lua new file mode 100644 index 0000000..4628d24 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/cl_init.lua @@ -0,0 +1,120 @@ +INC_CLIENT() + +ENT.Pulsed = true + +function ENT:Initialize() + self:SetModelScale(0.5, 0) + + self.AmbientSound = CreateSound(self, "npc/scanner/combat_scan_loop4.wav") + self.AmbientSound:SetSoundLevel(55) + + local cmodel = ClientsideModel("models/props_wasteland/buoy01.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, 0, -11))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, 0))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(Color(255, 150, 150)) + cmodel:SetParent(self) + cmodel:SetOwner(self) + + local matrix = Matrix() + matrix:Scale(Vector(0.6, 0.6, 0.02)) + cmodel:EnableMatrix( "RenderMultiply", matrix ) + + cmodel:Spawn() + + self.CModel = cmodel + end +end + +function ENT:DrawTranslucent() + self:DrawModel() + + local owner = self:GetObjectOwner() + local ammo = self:GetAmmo() + + if MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN then + local ang = self:LocalToWorldAngles(Angle(0, 90, 0)) + cam.Start3D2D(self:LocalToWorld(Vector(-11, 0, -10)), ang, 0.04) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 0, 0.65) + + if ammo > 0 then + draw.SimpleTextBlurry("["..ammo.." / "..self.MaxAmmo.."]", "ZS3D2DFont", 0, 550, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + else + draw.SimpleTextBlurry(translate.Get("empty"), "ZS3D2DFont", 0, 550, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + cam.End3D2D() + end +end + +function ENT:Think() + if self:GetObjectOwner():IsValid() and self:GetAmmo() > 0 then + self.AmbientSound:PlayEx(0.5, 100) + else + self.AmbientSound:Stop() + end + + if MySelf:IsValid() then + if self.Pulsed then + if CurTime() < self:GetNextRepairPulse() then + self.Pulsed = false + end + elseif CurTime() >= self:GetNextRepairPulse() then + self.Pulsed = true + + if self:GetAmmo() > 0 then + self:EmitSound("npc/scanner/scanner_scan2.wav", 70, 50) + + local pos = self:LocalToWorld(Vector(0, 0, 30)) + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 45 do + local dir = VectorRand():GetNormalized() + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(0.7) + particle:SetColor(225,150,255) + particle:SetStartAlpha(40) + particle:SetEndAlpha(0) + particle:SetStartSize(5) + particle:SetEndSize(15) + particle:SetCollide(true) + particle:SetBounce(0) + particle:SetGravity(dir * -210) + particle:SetVelocity(dir * 205) + end + + for i=1, 10 do + local dir = VectorRand():GetNormalized() + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(math.Rand(1.8, 2.5)) + particle:SetColor(145,155,255) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(15) + particle:SetEndSize(0) + particle:SetGravity(dir * -6) + particle:SetVelocity(dir * 5) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + end + end + + self:NextThink(CurTime() + 0.1) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + if self.CModel and self.CModel:IsValid() then + self.CModel:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_repairfield/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/init.lua new file mode 100644 index 0000000..6359a58 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/init.lua @@ -0,0 +1,195 @@ +INC_SERVER() + +local function RefreshRepFieldOwners(pl) + for _, ent in pairs(ents.FindByClass("prop_repairfield*")) do + if ent:IsValid() and ent:GetObjectOwner() == pl then + ent:ClearObjectOwner() + end + end +end +hook.Add("PlayerDisconnected", "RepairField.PlayerDisconnected", RefreshRepFieldOwners) +hook.Add("OnPlayerChangedTeam", "RepairField.OnPlayerChangedTeam", RefreshRepFieldOwners) + +function ENT:Initialize() + self:SetModel("models/props/de_nuke/smokestack01.mdl") + self:SetModelScale(0.55, 0) + self:PhysicsInitBox(Vector(-12.29, -12.29, 0), Vector(12.29, 12.29, 90.13)) + self:SetCollisionBounds(Vector(-12.29, -12.29, 0), Vector(12.29, 12.29, 90.13)) + self:SetCollisionGroup(COLLISION_GROUP_WORLD) -- I decided to make them not collide. + self:SetUseType(SIMPLE_USE) + + self:CollisionRulesChanged() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("metal") + phys:EnableMotion(false) + phys:Wake() + end + + self:SetMaxObjectHealth(150) + self:SetObjectHealth(self:GetMaxObjectHealth()) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(1, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + + local pos = self:LocalToWorld(self:OBBCenter()) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + + local amount = math.ceil(self:GetAmmo() * 0.5) + while amount > 0 do + local todrop = math.min(amount, 50) + amount = amount - todrop + ent = ents.Create("prop_ammo") + if ent:IsValid() then + local heading = VectorRand():GetNormalized() + ent:SetAmmoType("pulse") + ent:SetAmmo(todrop) + ent:SetPos(pos + heading * 8) + ent:SetAngles(VectorRand():Angle()) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:ApplyForceOffset(heading * math.Rand(8000, 32000), pos) + end + end + end + end +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:ResetLastBarricadeAttacker(attacker, dmginfo) + end +end + +function ENT:Use(activator, caller) + if self.Removing or not activator:IsPlayer() or self:GetMaterial() ~= "" then return end + + if activator:Team() == TEAM_HUMAN then + if self:GetObjectOwner():IsValid() then + if activator:GetInfo("zs_nousetodeposit") == "0" then + local curammo = self:GetAmmo() + local togive = math.min(math.min(15, activator:GetAmmoCount("pulse")), self.MaxAmmo - curammo) + if togive > 0 then + self:SetAmmo(curammo + togive) + activator:RemoveAmmo(togive, "pulse") + activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) + self:EmitSound("npc/scanner/combat_scan1.wav", 60, 250) + end + end + else + self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) + end + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, self.DeployableAmmo) + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + pl:GiveAmmo(self:GetAmmo(), "pulse") + + self:Remove() +end + +function ENT:Think() + if self.Destroyed then + self:Remove() + return + end + + if CurTime() < self:GetNextRepairPulse() or self:GetAmmo() <= 0 or not self:GetObjectOwner():IsValidLivingHuman() then return end + + local pos = self:LocalToWorld(Vector(0, 0, 30)) + local count = 0 + + local totalheal = self.HealValue * (self:GetObjectOwner().RepairRateMul or 1) + + for _, hitent in pairs(ents.FindInSphere(pos, self.MaxDistance * (self:GetObjectOwner().FieldRangeMul or 1))) do + if not hitent:IsValid() or hitent == self or not WorldVisible(pos, hitent:NearestPoint(pos)) then + continue + end + + local healed = false + + if hitent:IsNailed() then + local oldhealth = hitent:GetBarricadeHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxBarricadeHealth() or hitent:GetBarricadeRepairs() <= 0.01 then continue end + + hitent:SetBarricadeHealth(math.min(hitent:GetMaxBarricadeHealth(), hitent:GetBarricadeHealth() + math.min(hitent:GetBarricadeRepairs(), totalheal))) + healed = hitent:GetBarricadeHealth() - oldhealth + hitent:SetBarricadeRepairs(math.max(hitent:GetBarricadeRepairs() - healed, 0)) + + elseif hitent.GetObjectHealth then + -- Taking the nil tr parameter for granted for now + if hitent.HitByWrench and hitent:HitByWrench(self, owner, nil) then continue end + + local oldhealth = hitent:GetObjectHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxObjectHealth() or hitent.m_LastDamaged and CurTime() < hitent.m_LastDamaged + 4 then continue end + + hitent:SetObjectHealth(math.min(hitent:GetMaxObjectHealth(), hitent:GetObjectHealth() + totalheal/2)) + healed = hitent:GetObjectHealth() - oldhealth + end + + if healed then + hitent:EmitSound("npc/dog/dog_servo"..math.random(7, 8)..".wav", 70, math.random(100, 105)) + gamemode.Call("PlayerRepairedObject", self:GetObjectOwner(), hitent, healed, self) + + local effectdata = EffectData() + effectdata:SetOrigin(hitent:GetPos()) + effectdata:SetNormal((self:GetPos() - hitent:GetPos()):GetNormalized()) + effectdata:SetMagnitude(1) + util.Effect("nailrepaired", effectdata, true, true) + + self:SetAmmo(self:GetAmmo() - 1) + + count = count + 1 + + if count >= 3 or self:GetAmmo() <= 0 then break end + end + end + + if count > 0 then + self:SetNextRepairPulse(CurTime() + 2 * (self:GetObjectOwner().FieldDelayMul or 1)) + end + + self:NextThink(self:GetNextRepairPulse()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_repairfield/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/shared.lua new file mode 100644 index 0000000..61bdd21 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_repairfield/shared.lua @@ -0,0 +1,56 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.CanPackUp = true +ENT.PackUpTime = 3 +ENT.MaxAmmo = 300 -- 10 minutes of repair time when fully loaded. +ENT.HealValue = 8 +ENT.MaxDistance = 75 + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true + +ENT.IgnoreBullets = true + +ENT.IsBarricadeObject = false +ENT.AlwaysGhostable = true + +function ENT:GetObjectHealth() + return self:GetDTFloat(1) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(2, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(2) +end + +function ENT:GetNextRepairPulse() + return self:GetDTFloat(0) +end + +function ENT:SetNextRepairPulse(time) + self:SetDTFloat(0, time) +end + +function ENT:SetObjectOwner(owner) + self:SetDTEntity(0, owner) +end + +function ENT:GetObjectOwner() + return self:GetDTEntity(0) +end + +function ENT:SetAmmo(ammo) + self:SetDTInt(0, ammo) +end + +function ENT:GetAmmo() + return self:GetDTInt(0) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/cl_init.lua index 3980359..93a2718 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.Dinged = true @@ -10,7 +10,6 @@ function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) end -local NextUse = 0 local vOffset = Vector(16, 0, 0) local vOffset2 = Vector(-16, 0, 0) local aOffset = Angle(0, 90, 90) @@ -19,11 +18,12 @@ local vOffsetEE = Vector(-15, 0, 8) function ENT:Think() if MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN then + local nextuse = MySelf.NextUse or 0 if self.Dinged then - if CurTime() < NextUse then + if CurTime() < nextuse then self.Dinged = false end - elseif CurTime() >= NextUse then + elseif CurTime() >= nextuse then self.Dinged = true self:EmitSound("zombiesurvival/ding.ogg") @@ -36,22 +36,37 @@ end function ENT:RenderInfo(pos, ang, owner) cam.Start3D2D(pos, ang, 0.075) + draw.SimpleText(translate.Get("resupply_box"), "ZS3D2DFont2", 0, -130, (MySelf.NextUse or 0) <= CurTime() and COLOR_GREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) - draw.RoundedBox(32, -92, -50, 184, 100, color_black_alpha90) + local caches = MySelf.Stowage and MySelf.StowageCaches - draw.SimpleText(translate.Get("resupply_box"), "ZS3D2DFont2", 0, 0, NextUse <= CurTime() and COLOR_GREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) - - if owner:IsValid() and owner:IsPlayer() then - draw.SimpleText("("..owner:ClippedName()..")", "ZS3D2DFont2Small", 0, 40, owner == MySelf and COLOR_BLUE or COLOR_GRAY, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) + local timeremain = math.ceil(math.max(0, (MySelf.NextUse or 0) - CurTime())) + if MySelf.NextUse then + draw.SimpleText(timeremain > 0 and timeremain or translate.Get("ready"), "ZS3D2DFont2", 0, -60, (MySelf.NextUse or 0) <= CurTime() and COLOR_GREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + if caches then + draw.SimpleText(caches .. " Uses Left", "ZS3D2DFont2Small", 0, 0, caches > 0 and COLOR_GREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), nil, 190) + + if owner:IsValid() and owner:IsPlayer() then + draw.SimpleText("("..owner:ClippedName()..")", "ZS3D2DFont2Small", 0, 30, owner == MySelf and COLOR_LBLUE or COLOR_GRAY, TEXT_ALIGN_CENTER) + end + + if MySelf:Team() == TEAM_HUMAN then + local ammotype = GAMEMODE.CachedResupplyAmmoType + ammotype = GAMEMODE.AmmoNames[ammotype] or ammotype + + draw.SimpleText("["..ammotype.."]", "ZS3D2DFont2Smaller", 0, 70, COLOR_GRAY, TEXT_ALIGN_CENTER) + end cam.End3D2D() end function ENT:Draw() self:DrawModel() - if not MySelf:IsValid() then return end + if not MySelf:IsValid() or MySelf:Team() ~= TEAM_HUMAN then return end local owner = self:GetObjectOwner() local ang = self:LocalToWorldAngles(aOffset) @@ -67,5 +82,9 @@ function ENT:Draw() end net.Receive("zs_nextresupplyuse", function(length) - NextUse = net.ReadFloat() + MySelf.NextUse = net.ReadFloat() +end) + +net.Receive("zs_stowagecaches", function(length) + MySelf.StowageCaches = net.ReadInt(8) end) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/init.lua index 167fa49..7629e07 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() local function RefreshCrateOwners(pl) for _, ent in pairs(ents.FindByClass("prop_resupplybox")) do @@ -19,12 +16,14 @@ function ENT:Initialize() self:SetUseType(SIMPLE_USE) self:SetPlaybackRate(1) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) end - self:SetMaxObjectHealth(200) + self:SetMaxObjectHealth(400) self:SetObjectHealth(self:GetMaxObjectHealth()) end @@ -58,6 +57,10 @@ function ENT:SetObjectHealth(health) if health <= 0 and not self.Destroyed then self.Destroyed = true + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + local ent = ents.Create("prop_physics") if ent:IsValid() then ent:SetModel(self:GetModel()) @@ -74,6 +77,8 @@ function ENT:SetObjectHealth(health) end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + self:TakePhysicsDamage(dmginfo) local attacker = dmginfo:GetAttacker() @@ -106,58 +111,18 @@ function ENT:Think() end end -local NextUse = {} function ENT:Use(activator, caller) if activator:Team() ~= TEAM_HUMAN or not activator:Alive() or GAMEMODE:GetWave() <= 0 then return end if not self:GetObjectOwner():IsValid() then self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) end local owner = self:GetObjectOwner() - local owneruid = owner:IsValid() and owner:UniqueID() or "nobody" - local myuid = activator:UniqueID() + local resup = activator:Resupply(owner, self) - if CurTime() < (NextUse[myuid] or 0) then - activator:CenterNotify(COLOR_RED, translate.ClientGet(activator, "no_ammo_here")) - return - end - - local ammotype - local wep = activator:GetActiveWeapon() - if not wep:IsValid() then - ammotype = "smg1" - end - - if not ammotype then - ammotype = wep:GetPrimaryAmmoTypeString() - if not GAMEMODE.AmmoResupply[ammotype] then - ammotype = "smg1" - end - end - - NextUse[myuid] = CurTime() + 120 - - net.Start("zs_nextresupplyuse") - net.WriteFloat(NextUse[myuid]) - net.Send(activator) - - activator:GiveAmmo(GAMEMODE.AmmoResupply[ammotype], ammotype) - if activator ~= owner and owner:IsValid() and owner:IsPlayer() and owner:Team() == TEAM_HUMAN then - owner.ResupplyBoxUsedByOthers = owner.ResupplyBoxUsedByOthers + 1 - - if owner.ResupplyBoxUsedByOthers % 2 == 0 then - owner:AddPoints(1) - end - - net.Start("zs_commission") - net.WriteEntity(self) - net.WriteEntity(activator) - net.WriteUInt(1, 16) - net.Send(owner) - end - - if not self.Close then + if resup and not self.Close then self:ResetSequence("close") self:EmitSound("items/ammocrate_open.wav") end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/shared.lua index f87ff47..2652b31 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_resupplybox/shared.lua @@ -1,5 +1,4 @@ ENT.Type = "anim" -ENT.RenderGroup = RENDERGROUP_TRANSLUCENT ENT.m_NoNailUnfreeze = true ENT.NoNails = true @@ -13,19 +12,7 @@ function ENT:SetObjectHealth(health) self:SetDTFloat(0, health) if health <= 0 and not self.Destroyed then self.Destroyed = true - - local ent = ents.Create("prop_physics") - if ent:IsValid() then - ent:SetModel(self:GetModel()) - ent:SetMaterial(self:GetMaterial()) - ent:SetAngles(self:GetAngles()) - ent:SetPos(self:GetPos()) - ent:SetSkin(self:GetSkin() or 0) - ent:SetColor(self:GetColor()) - ent:Spawn() - ent:Fire("break", "", 0) - ent:Fire("kill", "", 0.1) - end + self:FakePropBreak() end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_rollermine/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/cl_init.lua new file mode 100644 index 0000000..da2589e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/cl_init.lua @@ -0,0 +1,160 @@ +INC_CLIENT() + +function ENT:Initialize() + self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 72)) + + self:CreateAmbientSounds() + self:CreateSubModel() + + self.PixVis = util.GetPixelVisibleHandle() + + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + hook.Add("CalcView", self, self.CalcView) +end + +function ENT:CreateSubModel() +end + +function ENT:CreateAmbientSounds() + self.AmbientSound = CreateSound(self, "npc/roller/mine/rmine_moveslow_loop1.wav") + self.AmbientSound2 = CreateSound(self, "npc/roller/mine/rmine_seek_loop2.wav") +end + +function ENT:PlayAmbientSounds() + if self:GetVelocity():Length() < 50 then + self.AmbientSound:Stop() + self.AmbientSound2:PlayEx(0.7, 100 + math.sin(CurTime())) + else + self.AmbientSound:PlayEx(0.8, math.min(70 + self:GetVelocity():Length() * 0.4, 140)) + self.AmbientSound2:Stop() + end +end + +ENT.NextEmit = 0 +local smokegravity = Vector(0, 0, 64) +function ENT:Think() + self:PlayAmbientSounds() + + local perc = math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 255) + if perc < 0.5 and CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.05 + perc * math.Rand(0.05, 0.25) + + local pos = self:GetPos() + local sat = perc * 90 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local particle = emitter:Add("particles/smokey", pos) + particle:SetStartAlpha(180) + particle:SetEndAlpha(0) + particle:SetStartSize(0) + particle:SetEndSize(math.Rand(8, 20)) + particle:SetVelocity(self:GetVelocity() * 0.7 + VectorRand():GetNormalized() * math.Rand(4, 24)) + particle:SetGravity(smokegravity) + particle:SetDieTime(math.Rand(0.8, 1.6)) + particle:SetAirResistance(150) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + particle:SetCollide(true) + particle:SetBounce(0.2) + particle:SetColor(sat, sat, sat) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + self.AmbientSound2:Stop() + self:RemoveSubModel() +end + +function ENT:RemoveSubModel() +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) +end + +function ENT:DrawSubModel() +end + +local colLight = Color(255, 0, 0) +local colWhite = Color(255, 255, 255) +local matLight = Material("sprites/light_ignorez") +function ENT:DrawTranslucent() + self:DrawModel() + + self:DrawSubModel() + + local lp = MySelf + local owner = self:GetObjectOwner() + + if lp:IsValid() and lp:Team() == TEAM_HUMAN and owner:IsValid() and owner:IsPlayer() then + local ang = EyeAngles() + ang.pitch = 0 + + ang:RotateAroundAxis(ang:Up(), 270) + ang:RotateAroundAxis(ang:Forward(), 90) + + cam.Start3D2D(self:GetPos() + Vector(0, 0, 20), ang, 0.03) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 150, 0.85, -150) + cam.End3D2D() + end +end + +function ENT:CreateMove(cmd) + if self:GetObjectOwner() ~= MySelf then return end + + if not self:BeingControlled() then return end + + local buttons = cmd:GetButtons() + + cmd:ClearMovement() + + if bit.band(buttons, IN_JUMP) ~= 0 then + buttons = buttons - IN_JUMP + buttons = buttons + IN_BULLRUSH + end + + if bit.band(buttons, IN_DUCK) ~= 0 then + buttons = buttons - IN_DUCK + buttons = buttons + IN_GRENADE1 + end + + cmd:SetButtons(buttons) +end + +function ENT:ShouldDrawLocalPlayer(pl) + if self:GetObjectOwner() ~= MySelf then return end + + if self:BeingControlled() then + if MySelf == pl and not MySelf.TargetIDFilter then + MySelf.TargetIDFilter = self + end + + return true + elseif MySelf == pl and MySelf.TargetIDFilter then + MySelf.TargetIDFilter = nil + end +end + +local trace_cam = {mask = MASK_VISIBLE, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} +function ENT:CalcView(pl, origin, angles, fov, znear, zfar) + if self:GetObjectOwner() ~= pl or not self:BeingControlled() then return end + + local filter = player.GetAll() + filter[#filter + 1] = self + trace_cam.start = self:GetPos() + trace_cam.endpos = trace_cam.start + angles:Forward() * -48 + trace_cam.filter = filter + local tr = util.TraceHull(trace_cam) + + return {origin = tr.HitPos + tr.HitNormal * 3} +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_rollermine/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/init.lua new file mode 100644 index 0000000..c42e32a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/init.lua @@ -0,0 +1,369 @@ +INC_SERVER() + +ENT.NextWaterDamage = 0 +ENT.NextJump = 0 + +function ENT:Initialize() + self:SetModel(self.Model) + self:SetUseType(SIMPLE_USE) + + self:PhysicsInit(SOLID_VPHYSICS) + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(self.Mass) + phys:EnableDrag(false) + phys:EnableMotion(true) + phys:Wake() + phys:SetBuoyancyRatio(0.8) + phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) + end + + self:StartMotionController() + + self:SetMaxObjectHealth(self.MaxHealth) + self:SetObjectHealth(self:GetMaxObjectHealth()) + + self.LastThink = CurTime() + self.NextTouch = {} + + self:UseClientSideAnimation(true) + + local ent = ents.Create("fhb") + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:SetParent(self) + ent:SetOwner(self) + ent.Size = self.HitBoxSize + ent:Spawn() + ent.IgnoreMelee = false + end + + self:SetCustomCollisionCheck(true) + self:CollisionRulesChanged() + + hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) +end + +function ENT:SetupPlayerSkills() + local owner = self:GetObjectOwner() + local newmaxhealth = self.MaxHealth + local currentmaxhealth = self:GetMaxObjectHealth() + local defaults = scripted_ents.Get(self:GetClass()) + local hitdamage = defaults.HitDamage + local maxspeed = defaults.MaxSpeed + local acceleration = defaults.Acceleration + local loaded = false + + if owner:IsValid() then + newmaxhealth = newmaxhealth * owner:GetTotalAdditiveModifier("ControllableHealthMul") + maxspeed = maxspeed * (owner.ControllableSpeedMul or 1) + acceleration = acceleration * (owner.ControllableHandlingMul or 1) + loaded = owner:IsSkillActive(SKILL_LOADEDHULL) + end + + newmaxhealth = math.ceil(newmaxhealth) + + self:SetMaxObjectHealth(newmaxhealth) + self:SetObjectHealth(self:GetObjectHealth() / currentmaxhealth * newmaxhealth) + + self.HitDamage = hitdamage + self.MaxSpeed = maxspeed + self.Acceleration = acceleration + + if loaded then + if not IsValid(self.LoadedProp) then + local ent = ents.Create("prop_dynamic_override") + if ent:IsValid() then + ent:SetModel("models/props_junk/propane_tank001a.mdl") + ent:SetModelScale(0.5, 0) + ent:SetParent(self) + ent:SetOwner(self) + ent:SetLocalPos(Vector(-7, 0, -8.5)) + ent:SetLocalAngles(Angle(-40, 0, 0)) + ent:Spawn() + + self.LoadedProp = ent + end + end + elseif IsValid(self.LoadedProp) then + self.LoadedProp:Remove() + end +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + + if health <= 0 then + self:Destroy() + end +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end + + self:TakePhysicsDamage(dmginfo) + + if dmginfo:GetDamageType() == DMG_ACID then + dmginfo:SetDamage(dmginfo:GetDamage() * 2) + end + + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + + if attacker:IsValidZombie() and dmginfo:GetInflictor().MeleeDamage then + self:EmitSound("npc/roller/mine/rmine_predetonate.wav") + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(dmginfo:GetDamagePosition())) + effectdata:SetNormal(VectorRand():GetNormalized()) + effectdata:SetMagnitude(4) + effectdata:SetScale(1.33) + util.Effect("sparks", effectdata) +end + +function ENT:Use(pl) + if pl == self:GetObjectOwner() and pl:Team() == TEAM_HUMAN and pl:Alive() then + self:OnPackedUp(pl) + end +end + +function ENT:PhysicsCollide(data, phys) + self.HitData = data + self:NextThink(CurTime()) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.WeaponClass) + pl:GiveAmmo(1, self.AmmoType) + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + + self:Remove() +end + +local trace = {mask = MASK_SOLID} +function ENT:PhysicsSimulate(phys, frametime) + phys:Wake() + + local owner = self:GetObjectOwner() + if not owner:IsValid() or self.DisableControlUntil and CurTime() < self.DisableControlUntil then return SIM_NOTHING end + + local vel = phys:GetVelocity() + local movedir = Vector(0, 0, 0) + local aimangles = owner:EyeAngles() + local onground = false + + if self:BeingControlled() then + trace.filter = self + trace.start = self:GetPos() + trace.endpos = trace.start + Vector(0, 0, self:OBBMins().z - 8) + local tr = util.TraceLine(trace) + onground = tr.Hit + + if owner:KeyDown(IN_FORWARD) then + movedir = movedir + aimangles:Forward() + end + if owner:KeyDown(IN_BACK) then + movedir = movedir - aimangles:Forward() + end + if owner:KeyDown(IN_MOVERIGHT) then + movedir = movedir + aimangles:Right() + end + if owner:KeyDown(IN_MOVELEFT) then + movedir = movedir - aimangles:Right() + end + + if owner:KeyDown(IN_BULLRUSH) and onground and self.NextJump < CurTime() and vel:Length() <= 48 then + vel.z = vel.z + 180 + self.NextJump = CurTime() + 1 + end + end + + if movedir == vector_origin then + vel = vel * (1 - frametime * self.IdleDrag) + else + movedir.z = math.min(0, math.abs(movedir.z)) + movedir:Normalize() + + vel = vel + frametime * self.Acceleration * 0.55 * math.Clamp((self:GetObjectHealth() / self:GetMaxObjectHealth() + 1) / 2, 0.5, 1) * (onground and 1 or 0.1) * movedir + end + + if vel:Length() > self.MaxSpeed then + vel:Normalize() + vel = vel * self.MaxSpeed + end + + phys:SetDragCoefficient(10) + phys:SetVelocityInstantaneous(vel) + phys:AddAngleVelocity(vel * 0.15) + + self:SetPhysicsAttacker(owner) + + return SIM_NOTHING +end + +function ENT:Destroy() + if self.Destroyed then return end + self.Destroyed = true + + local epicenter = self:LocalToWorld(self:OBBCenter()) + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + self:EmitSound("npc/manhack/gib.wav") + + local effectdata = EffectData() + effectdata:SetOrigin(epicenter) + effectdata:SetNormal(Vector(0, 0, 1)) + effectdata:SetMagnitude(5) + effectdata:SetScale(1.5) + util.Effect("sparks", effectdata) + + local owner = self:GetObjectOwner() + if owner:IsValidLivingHuman() and owner:IsSkillActive(SKILL_LOADEDHULL) then + effectdata = EffectData() + effectdata:SetOrigin(epicenter) + effectdata:SetNormal(Vector(0, 0, -1)) + util.Effect("decal_scorch", effectdata) + + self:EmitSound("npc/env_headcrabcanister/explosion.wav", 100, 100) + ParticleEffect("dusty_explosion_rockets", epicenter, angle_zero) + + util.BlastDamagePlayer(self, owner, epicenter, 128, 225, DMG_ALWAYSGIB) + else + util.Effect("HelicopterMegaBomb", effectdata, true, true) + end +end + +ENT.PhysDamageImmunity = 0 +function ENT:Think() + if self.Destroyed then + if not self.CreatedDebris then + self.CreatedDebris = true + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + ent:SetModel(self:GetModel()) + ent:Spawn() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(self:GetVelocity()) + end + + ent:Fire("break") + ent:Fire("kill", "", 0.05) + end + end + + self:Remove() + return + end + + local owner = self:GetObjectOwner() + if owner:IsValid() then + self:SetPhysicsAttacker(owner) + + if not owner:Alive() or owner:Team() ~= TEAM_HUMAN then + self:Destroy() + return + end + else + self:Destroy() + return + end + + if self.ChangeBackTime and self.ChangeBackTime < CurTime() then + self:SetModel("models/roller.mdl") + self:EmitSound("npc/roller/mine/rmine_blades_out1.wav", 65, 80) + self.ChangeBackTime = nil + end + + if self:WaterLevel() >= 2 and CurTime() >= self.NextWaterDamage then + self.NextWaterDamage = CurTime() + 0.2 + + self:TakeDamage(10) + end + + local data = self.HitData + if data then + self.HitData = nil + self:ThreadSafePhysicsCollide(data) + end +end + +function ENT:ThreadSafePhysicsCollide(data) + local owner = self:GetObjectOwner() + if not owner:IsValidLivingHuman() then return end + + local hitflesh = false + local ent = data.HitEntity + + if ent and ent:IsValid() and CurTime() >= (self.NextTouch[ent] or 0) then + self.NextTouch[ent] = CurTime() + self.HitCooldown + + if ent:IsPlayer() and ent:Team() == TEAM_UNDEAD and ent:Alive() then + ent:TakeSpecialDamage(self.HitDamage, DMG_SLASH, owner, self) + hitflesh = true + else + local physattacker = ent:GetPhysicsAttacker() + if physattacker:IsValid() and physattacker:Team() == TEAM_HUMAN then + self.PhysDamageImmunity = CurTime() + 0.5 + end + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(self:NearestPoint(data.HitPos)) + effectdata:SetNormal(data.HitNormal) + + if hitflesh then + self:EmitHitFleshSound() + + local dir = (self:GetPos() - data.HitPos):GetNormalized() + + util.Blood(data.HitPos, math.random(10, 14), dir, 200) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + dir.z = dir.z + 0.5 + + phys:AddVelocity(dir * self.BounceFleshVelocity) + end + + effectdata:SetStart(ent:WorldSpaceCenter()) + effectdata:SetEntity(self) + util.Effect("tracer_zapper", effectdata) + + self:SetModel("models/roller_spikes.mdl") + self.ChangeBackTime = CurTime() + 0.25 + self.DisableControlUntil = CurTime() + 1 + elseif data.DeltaTime > 0.33 and data.Speed > 200 then + self:EmitHitSound() + + effectdata:SetMagnitude(2) + effectdata:SetScale(1) + util.Effect("sparks", effectdata) + end +end + +function ENT:EmitHitFleshSound() + self:EmitSound("npc/roller/mine/rmine_explode_shock1.wav") +end + +function ENT:EmitHitSound() + self:EmitSound("npc/manhack/grind"..math.random(5)..".wav") +end + +function ENT:SetupPlayerVisibility(pl) + if pl ~= self:GetObjectOwner() then return end + + AddOriginToPVS(self:GetPos()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_rollermine/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/shared.lua new file mode 100644 index 0000000..9725525 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_rollermine/shared.lua @@ -0,0 +1,80 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true + +ENT.WrenchRepairMultiplier = 0.25 + +ENT.Model = "models/roller.mdl" +ENT.HitBoxSize = 11.5 +ENT.Mass = 50 +ENT.WeaponClass = "weapon_zs_rollermine" +ENT.ControllerClass = "weapon_zs_rollerminecontrol" +ENT.AmmoType = "rollermine" + +ENT.Acceleration = 900 +ENT.MaxSpeed = 450 +ENT.TurnSpeed = 30 +ENT.IdleDrag = 0.25 + +ENT.MaxHealth = 225 +ENT.HitCooldown = 1.15 +ENT.HitDamage = 25 +ENT.BounceFleshVelocity = 320 + +ENT.IgnoreBullets = true +ENT.IsShadeGrabbable = true +ENT.NoBlockExplosions = true + +AccessorFuncDT(ENT, "ObjectOwner", "Entity", 0) + +function ENT:ShouldNotCollide(ent) + if not ent.ChargeTime and ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValidHuman() then + return true + end + end + + return ent:IsPlayer() and ent:Team() == TEAM_HUMAN +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(0, health) + + if health <= 0 and not self.Destroyed then + self.Destroyed = true + end +end + +function ENT:BeingControlled() + local owner = self:GetObjectOwner() + if owner:IsValid() then + local wep = owner:GetActiveWeapon() + return wep:IsValid() and wep:GetClass() == self.ControllerClass and wep:GetDTBool(0) + end + + return false +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(0) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(1, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(1) +end + +local vecOffset = Vector(0, 0, -3) +function ENT:GetRedLightPos() + return self:LocalToWorld(vecOffset) +end + +function ENT:GetRedLightAngles() + return self:GetAngles() +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/cl_init.lua index 13580a3..a333505 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetRenderBounds(Vector(-72, -72, -72), Vector(72, 72, 128)) @@ -25,7 +25,7 @@ function ENT:DrawTranslucent() local LightPos = epos + LightNrm * 5 render.SetMaterial(matLight) - local Visibile = util.PixelVisible( LightPos, 16, self.PixVis ) + local Visibile = util.PixelVisible( LightPos, 16, self.PixVis ) if not Visibile then return end @@ -39,4 +39,14 @@ function ENT:DrawTranslucent() render.DrawSprite(LightPos, Size, Size, Col, Visibile * ViewDot) render.DrawSprite(LightPos, Size*0.4, Size*0.4, Color(255, 255, 255, Alpha), Visibile * ViewDot) end + + local name + local owner = self:GetObjectOwner() + if owner:IsValidHuman() then + name = owner:Name() + end + + cam.Start3D2D(self:LocalToWorld(Vector(self:OBBMaxs().x, 0, 1)), self:LocalToWorldAngles(Angle(180, 270, 180)), 0.05) + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name) + cam.End3D2D() end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/init.lua index c999a9d..eb7102f 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_spotlamp/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() local function RefreshCrateOwners(pl) for _, ent in pairs(ents.FindByClass("prop_spotlamp")) do @@ -17,6 +14,8 @@ function ENT:Initialize() self:SetModel("models/props_combine/combine_light001a.mdl") self:PhysicsInit(SOLID_VPHYSICS) + self:CollisionRulesChanged() + local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) @@ -78,6 +77,8 @@ function ENT:SetObjectHealth(health) end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + self:TakePhysicsDamage(dmginfo) local attacker = dmginfo:GetAttacker() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/cl_init.lua index 7187b13..6b7d3a6 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:SetModelScale(1.3, 0) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/init.lua index 2aa75d8..d4f9496 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/init.lua @@ -1,33 +1,42 @@ -AddCSLuaFile("shared.lua") -AddCSLuaFile("cl_init.lua") +INC_SERVER() -include("shared.lua") +ENT.AlwaysProjectile = true -- Quick fix to stop people being able to use this as ammo to prop kill. -ENT.m_IsProjectile = true -- Quick fix to stop people being able to use this as ammo to prop kill. +ENT.Created = 0 function ENT:Initialize() self:SetModel("models/props_c17/doll01.mdl") self:PhysicsInit(SOLID_VPHYSICS) --self:PhysicsInitBox(Vector(-10.8, -10.8, -10.8), Vector(10.8, 10.8, 10.8)) self:SetModelScale(1.3, 0) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) + self:CollisionRulesChanged() local phys = self:GetPhysicsObject() if phys:IsValid() then - phys:SetMass(10) + phys:SetMass(1) phys:EnableMotion(true) phys:Wake() end + self.Created = CurTime() + self:Fire("kill", "", 20) end function ENT:Think() - if not self:GetSettled() and CurTime() >= self:GetCreationTime() + 0.25 and self:GetVelocity():Length() <= 16 then + if not self:GetSettled() and CurTime() >= self.Created + 0.75 and self:GetVelocity():LengthSqr() <= 256 then self:SetSettled(true) self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + + net.Start("zs_nestbuilt") + net.Broadcast() end end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + local attacker = dmginfo:GetAttacker() if dmginfo:GetDamage() >= 1 and not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD) then self:Destroy() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/shared.lua index 6f99f53..612dd14 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownbaby/shared.lua @@ -1,5 +1,10 @@ ENT.Type = "anim" ENT.NoNails = true +ENT.MinionSpawn = true + +function ENT:ShouldNotCollide(ent) + return ent:IsPlayer() and ent:Team() == TEAM_UNDEAD +end AccessorFuncDT(ENT, "Settled", "Bool", 0) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/cl_init.lua new file mode 100644 index 0000000..61f0364 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/cl_init.lua @@ -0,0 +1,12 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function ENT:Draw() + render_SetBlend(0.55) + render_SetColorModulation(0.1, 0.1, 0.1) + self:DrawModel() + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/shared.lua new file mode 100644 index 0000000..09dfc30 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_thrownshadowbaby/shared.lua @@ -0,0 +1 @@ +ENT.Base = "prop_thrownbaby" diff --git a/gamemodes/zombiesurvival/entities/entities/prop_tv/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_tv/cl_init.lua new file mode 100644 index 0000000..fabc91a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_tv/cl_init.lua @@ -0,0 +1,87 @@ +INC_CLIENT() + +function ENT:SetObjectHealth(health) + self:SetDTFloat(3, health) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) +end + +local w, h = 320, 256 +local x, y = -w / 2, -h / 2 +local rt = GetRenderTarget("prop_camera", w * 2, h * 2) +local matRT = Material("prop_camera") +local matStatic = Material("zombiesurvival/filmgrain/filmgrain") +local CamPos = Vector(6, -2, 0) +local LightPos = Vector(7.4, 8, 3) +local LightPos2 = Vector(7.4, 8, 1) +local CamAng = Angle(0, 90, 90) +local CamScale = 0.05 +MyCamera = NULL + +local matGlow = Material("sprites/glow04_noz") +function ENT:Draw() + self:DrawModel() + + local dist = EyePos():DistToSqr(self:GetPos()) + if dist < 9000 then + local bpos, bang = self:LocalToWorld(CamPos), self:LocalToWorldAngles(CamAng) + + cam.Start3D2D(bpos, bang, CamScale) + + surface.SetDrawColor(255, 255, 255, 255) + + local camera = MyCamera + if camera:IsValid() then + matRT:SetTexture("$basetexture", rt) + surface.SetMaterial(matRT) + surface.DrawTexturedRect(x, y, w, h) + + surface.SetDrawColor(30, 30, 30, 200) + surface.SetMaterial(matStatic) + surface.DrawTexturedRectUV(x, y, w, h, 2, 2, 0, 0) + else + surface.SetDrawColor(50, 60, 80, 255) + surface.SetMaterial(matStatic) + surface.DrawTexturedRect(x, y, w, h) + end + + cam.End3D2D() + end + + render.SetMaterial(matGlow) + render.DrawSprite(self:LocalToWorld(LightPos), 3, 3, COLOR_DARKBLUE) + render.DrawSprite(self:LocalToWorld(LightPos2), 2, 2, COLOR_HURT) +end + +local CamData = {x = 0, y = 0, w = h * 2, h = h * 2, drawhud = false, drawmonitors = false, drawviewmodel = false, aspectratio = w / h} +function RenderScene(origin, angles, fov) + if FROM_CAMERA then return end + + local camera = MyCamera + if not camera:IsValid() then return end + + FROM_CAMERA = camera + + local camangs = camera:GetAngles() + camangs:RotateAroundAxis(camera:GetRight(), 90) + camangs:RotateAroundAxis(camera:GetUp(), 180) + camangs:RotateAroundAxis(camera:GetForward(), 180) + + CamData.origin = camera:GetPos() + camera:GetUp() * -16 + CamData.angles = camangs + + local originalRT = render.GetRenderTarget() + render.SetRenderTarget(rt) + render.RenderView(CamData) + render.SetRenderTarget(originalRT) + + FROM_CAMERA = nil +end + +net.Receive("zs_tvcamera", function(length) + MyCamera = net.ReadEntity() + + hook.Add("RenderScene", "TVCamera", RenderScene) +end) diff --git a/gamemodes/zombiesurvival/entities/entities/prop_tv/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_tv/init.lua new file mode 100644 index 0000000..acaba3f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_tv/init.lua @@ -0,0 +1,139 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModel("models/props_c17/tv_monitor01.mdl") + self:PhysicsInit(SOLID_VPHYSICS) + self:SetUseType(SIMPLE_USE) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + phys:Wake() + end + + self:SetMaxObjectHealth(self.MaxHealth) + self:SetObjectHealth(self:GetMaxObjectHealth()) + + self.Viewers = {} +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(3, health) + + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + self:EmitSound("npc/manhack/gib.wav") + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetPos(self:WorldSpaceCenter()) + ent:SetAngles(self:GetAngles()) + ent:SetModel("models/manhack.mdl") + ent:Spawn() + + ent:Fire("break") + ent:Fire("kill", "", 0.05) + end + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + self:Remove() + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, "tv") + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + + self:Remove() +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + if dmginfo:GetDamage() <= 0 then return end + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:ResetLastBarricadeAttacker(attacker, dmginfo) + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + end +end + +function ENT:CycleCamera(activator) + local cameras = {} + + for _, camera in pairs(ents.FindByClass("prop_camera")) do + if camera:IsValid() then + table.insert(cameras, camera) + end + end + + if #cameras == 0 then return end + + local index + for i, camera in pairs(cameras) do + if activator.Camera == camera then + index = i + break + end + end + + if not index or #cameras == 1 then + activator.Camera = cameras[1] + return + end + + activator.Camera = cameras[index + 1] or cameras[1] +end + +function ENT:Use(activator, caller) + if activator:Team() ~= TEAM_HUMAN or not activator:Alive() then return end + + local owner = self:GetObjectOwner() + if not owner:IsValid() then + self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) + return + end + + self:CycleCamera(activator) + + if activator.Camera and activator.Camera:IsValid() then + self:EmitSound("npc/scanner/combat_scan3.wav", 50, 250) + + self.Viewers[activator] = true + + hook.Add("SetupPlayerVisibility", self, function(tv) + if not tv.Viewers[activator] or not activator.Camera:IsValid() then return end + + AddOriginToPVS(activator.Camera:WorldSpaceCenter()) + end) + + net.Start("zs_tvcamera") + net.WriteEntity(activator.Camera) + net.Send(activator) + end +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTInt(1, health) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end + +function ENT:SetObjectOwner(ent) + self:SetDTEntity(1, ent) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_tv/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_tv/shared.lua new file mode 100644 index 0000000..0f33172 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_tv/shared.lua @@ -0,0 +1,26 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_OPAQUE + +ENT.SWEP = "weapon_zs_tv" +ENT.MaxHealth = 75 + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true +ENT.IgnoreBullets = true + +ENT.CanPackUp = true +ENT.PackUpTime = 1 + +ENT.AlwaysGhostable = true + +function ENT:GetObjectHealth() + return self:GetDTFloat(3) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTInt(1) +end + +function ENT:GetObjectOwner() + return self:GetDTEntity(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_animations.lua b/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_animations.lua index c0357f1..daaea05 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_animations.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_animations.lua @@ -1,6 +1,6 @@ -function ENT:RenderModels() +function ENT:RenderModels(ble, cmod) if not self.WElements then return end - + if not self.wRenderOrder then self.wRenderOrder = {} for k, v in pairs( self.WElements ) do @@ -11,25 +11,25 @@ function ENT:RenderModels() end end end - + for k, name in pairs( self.wRenderOrder ) do local v = self.WElements[name] if (!v) then self.wRenderOrder = nil break end if (v.hide) then continue end - + local pos, ang - + if (v.bone) then pos, ang = self:GetBoneOrientation( self.WElements, v ) else pos, ang = self:GetBoneOrientation( self.WElements, v, "ValveBiped.Bip01_R_Hand" ) end - + if (!pos) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) ang:RotateAroundAxis(ang:Up(), v.angle.y) @@ -37,39 +37,48 @@ function ENT:RenderModels() ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() - matrix:Scale(v.size) + local multi = cmod and 1.02 or 1 + matrix:Scale(v.size * multi) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then - for k, v in pairs( v.bodygroup ) do + for k, v in ipairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - - render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) - render.SetBlend(v.color.a/255) + + if not cmod then + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) + else + render.SetColorModulation(unpack(cmod)) + end + if not ble then + render.SetBlend(v.color.a/255) + else + render.SetBlend(ble) + end model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end @@ -77,7 +86,7 @@ function ENT:RenderModels() local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - elseif (v.type == "Quad" and v.draw_func) then + elseif (v.type == "Quad" and v.draw_func) then local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) @@ -93,35 +102,35 @@ function ENT:RenderModels() function ENT:GetBoneOrientation( basetab, tab, bone_override ) local bone, pos, ang if (tab.rel and tab.rel != "") then - + local v = basetab[tab.rel] - + if (!v) then return end - - // Technically, if there exists an element with the same name as a bone - // you can get in an infinite loop. Let's just hope nobody's that stupid. + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. pos, ang = self:GetBoneOrientation( basetab, v ) - + if (!pos) then return end - + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + else - + bone = self:LookupBone(bone_override or tab.bone) if (!bone) then return end - + pos, ang = Vector(0,0,0), Angle(0,0,0) local m = self:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end end - + return pos, ang end @@ -129,9 +138,9 @@ function ENT:CreateModels( tab ) if (!tab) then return end for k, v in pairs( tab ) do - if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then - + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) @@ -142,12 +151,12 @@ function ENT:CreateModels( tab ) else v.modelEnt = nil end - elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then - + local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } - // make sure we create a unique name based on the selected options + -- make sure we create a unique name based on the selected options local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then diff --git a/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_init.lua index 8e9f16d..a031aa9 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_weapon/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() include("cl_animations.lua") ENT.ColorModulation = Color(0.15, 0.8, 1) @@ -9,30 +9,26 @@ function ENT:Think() self.LastWeaponType = class self:RemoveModels() - self.ShowWorldModel = nil - local weptab = weapons.GetStored(class) + local weptab = weapons.Get(class) if weptab then - self.ShowWorldModel = not weptab.NoDroppedWorldModel + local showmdl = weptab.ShowWorldModel or not self:LookupBone("ValveBiped.Bip01_R_Hand") and not weptab.NoDroppedWorldModel + self.ShowBaseModel = weptab.ShowWorldModel == nil and true or showmdl if weptab.WElements then self.WElements = table.FullCopy(weptab.WElements) self:CreateModels(self.WElements) end + + self.ColorModulation = weptab.DroppedColorModulation or self.ColorModulation + self.PropWeapon = true + self.QualityTier = weptab.QualityTier + self.Branch = weptab.Branch + self.BranchData = weptab.Branches and weptab.Branches[self.Branch] end end end -function ENT:DrawTranslucent() - if not self.NoDrawSubModels then - self:RenderModels() - end - - if self.ShowWorldModel == nil or self.ShowWorldModel then - self.BaseClass.DrawTranslucent(self) - end -end - function ENT:OnRemove() self:RemoveModels() end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua index 8f4a5eb..2144b99 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_weapon/init.lua @@ -1,20 +1,18 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() AddCSLuaFile("cl_animations.lua") -include("shared.lua") - ENT.CleanupPriority = 1 function ENT:Initialize() - self.m_Health = 200 + self.ObjHealth = 200 self.IgnorePickupCount = self.IgnorePickupCount or false self.Forced = self.Forced or false self.NeverRemove = self.NeverRemove or false self.IgnoreUse = self.IgnoreUse or false self.Empty = self.Empty or false - - local weptab = weapons.GetStored(self:GetWeaponType()) + self.Restrained = self.Restrained or false + + local weptab = weapons.Get(self:GetWeaponType()) if weptab and not weptab.BoxPhysicsMax then self:PhysicsInit(SOLID_VPHYSICS) end @@ -26,13 +24,36 @@ function ENT:Initialize() local phys = self:GetPhysicsObject() if phys:IsValid() then phys:SetMaterial("material") - phys:EnableMotion(true) + phys:EnableMotion(not self.Restrained) + phys:SetMass(45) phys:Wake() end self:ItemCreated() end +function ENT:SetupPhysics(weptab) + if weptab.BoxPhysicsMax then + self:PhysicsInitBox(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) + self:SetCollisionBounds(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + end +end + +function ENT:MakeInvItemConvert(class) + local ent = ents.Create("prop_invitem") + if ent:IsValid() then + if not ent:SetInventoryItemType("trinket_"..string.sub(class, 13)) then return end + + ent:Spawn() + ent:SetPos(self:GetPos()) + ent:SetAngles(self:GetAngles()) + + self:RemoveNextFrame() + end +end + function ENT:SetClip1(ammo) self.m_Clip1 = tonumber(ammo) or self:GetClip1() end @@ -68,33 +89,40 @@ function ENT:GiveToActivator(activator, caller) or activator:Team() ~= TEAM_HUMAN or self.Removing or (activator:KeyDown(GAMEMODE.UtilityKey) and not self.Forced) - or self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator then - + or self.NoPickupsTime and CurTime() < self.NoPickupsTime and self.NoPickupsOwner ~= activator then + self:Input("OnPickupFailed", activator) - return + return end local weptype = self:GetWeaponType() - if not weptype then + if not weptype then self:Input("OnPickupFailed", activator) - return + return end if activator:HasWeapon(weptype) and (self.Forced or not GAMEMODE.MaxWeaponPickups) then - local wep = activator:GetWeapon(weptype) - if wep:IsValid() then - local primary = wep:ValidPrimaryAmmo() - local secondary = wep:ValidSecondaryAmmo() + local weptab = weapons.Get(weptype) + if not (weptab and weptab.NoPickupIfHas) then + local wep = activator:GetWeapon(weptype) + if wep:IsValid() then + local primary = wep:ValidPrimaryAmmo() + local secondary = wep:ValidSecondaryAmmo() - if primary then activator:GiveAmmo(self:GetClip1(), primary) self:SetClip1(0) end - if secondary then activator:GiveAmmo(self:GetClip2(), secondary) self:SetClip2(0) end + if weptab.AmmoIfHas and self.PlacedInMap then + self:SetClip1(1) + self:SetClip2(1) + end - local stored = weapons.GetStored(weptype) - if stored and stored.AmmoIfHas then - self:Input("OnPickupPassed", activator) - if not self.NeverRemove then self:RemoveNextFrame() end + if primary then activator:GiveAmmo(self:GetClip1(), primary) self:SetClip1(0) end + if secondary then activator:GiveAmmo(self:GetClip2(), secondary) self:SetClip2(0) end + + if weptab.AmmoIfHas then + self:Input("OnPickupPassed", activator) + if not self.NeverRemove then self:RemoveNextFrame() end + end + return end - return end end @@ -132,6 +160,8 @@ function ENT:KeyValue(key, value) self.IgnoreUse = tonumber(value) == 1 elseif key == "empty" then self.Empty = tonumber(value) == 1 + elseif key == "restrained" then + self.Restrained = tonumber(value) == 1 elseif string.sub(key, 1, 2) == "on" then self:AddOnOutput(key, value) end @@ -163,11 +193,16 @@ function ENT:AcceptInput(name, activator, caller, arg) end function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + if self.NeverRemove then return end self:TakePhysicsDamage(dmginfo) - self.m_Health = self.m_Health - dmginfo:GetDamage() - if self.m_Health <= 0 then + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then return end + + self.ObjHealth = self.ObjHealth - dmginfo:GetDamage() + if self.ObjHealth <= 0 then self:RemoveNextFrame() end end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_weapon/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_weapon/shared.lua index 6092e67..ca9b881 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_weapon/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_weapon/shared.lua @@ -8,22 +8,18 @@ function ENT:HumanHoldable(pl) end function ENT:SetWeaponType(class) - local weptab = weapons.GetStored(class) - if weptab then + local weptab = weapons.Get(class) + if string.sub(class, 1, 12) == "weapon_zs_t_" then -- Convertor + if SERVER then + self:MakeInvItemConvert(class) + end + elseif weptab then if weptab.WorldModel then self:SetModel(weptab.WorldModel) - elseif weptab.Base then - local weptabb = weapons.GetStored(weptab.Base) - if weptabb and weptabb.WorldModel then - self:SetModel(weptabb.WorldModel) - end end - if SERVER and weptab.BoxPhysicsMax then - self:PhysicsInitBox(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) - self:SetCollisionBounds(weptab.BoxPhysicsMin, weptab.BoxPhysicsMax) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + if SERVER then + self:SetupPhysics(weptab) end if weptab.ModelScale then diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper/cl_init.lua new file mode 100644 index 0000000..2918a17 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper/cl_init.lua @@ -0,0 +1,119 @@ +INC_CLIENT() + +ENT.Pulsed = true + +function ENT:Initialize() + local matrix = Matrix() + matrix:Scale(Vector(0.6, 0.6, 1.2)) + self:EnableMatrix( "RenderMultiply", matrix ) + + self.AmbientSound = CreateSound(self, "ambient/machines/combine_shield_touch_loop1.wav") + self.AmbientSound:SetSoundLevel(55) + + local cmodel = ClientsideModel("models/props_trainstation/trainstation_ornament002.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, 0, -25.6))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, 0))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(Color(190, 255, 255)) + cmodel:SetParent(self) + cmodel:SetOwner(self) + + matrix = Matrix() + matrix:Scale(Vector(2, 2, 0.25)) + cmodel:EnableMatrix( "RenderMultiply", matrix ) + + cmodel:Spawn() + + self.CModel = cmodel + end +end + +local material = Material("models/shiny") +function ENT:DrawZapper() + render.ModelMaterialOverride(material) + render.SetColorModulation(0.5, 0.5, 0.5) + self:DrawModel() + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) +end + +function ENT:DrawTranslucent() + self:DrawZapper() + + local owner = self:GetObjectOwner() + local ammo = self:GetAmmo() + + if MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN then + local ang = self:LocalToWorldAngles(Angle(0, 90, 0)) + cam.Start3D2D(self:LocalToWorld(Vector(-10, 0, -19)), ang, 0.05) + local name = "" + if owner:IsValid() and owner:IsPlayer() then + name = owner:ClippedName() + end + self:Draw3DHealthBar(math.Clamp(self:GetObjectHealth() / self:GetMaxObjectHealth(), 0, 1), name, 0, 0.8) + + if ammo > 0 then + draw.SimpleTextBlurry("["..ammo.." / "..self.MaxAmmo.."]", "ZS3D2DFont", 0, 450, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + else + draw.SimpleTextBlurry(translate.Get("empty"), "ZS3D2DFont", 0, 450, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + cam.End3D2D() + end +end + +ENT.NextEmit = 0 +function ENT:Think() + if self:GetObjectOwner():IsValid() and self:GetAmmo() > 1 then + self.AmbientSound:PlayEx(0.5, 90) + + if CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.2 + + local pos = self:LocalToWorld(Vector(0, 0, 23)) + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 2 do + local particle = emitter:Add("effects/blueflare1", pos) + particle:SetDieTime(0.3) + particle:SetColor(190,210,255) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 20) + end + + local charge = math.Clamp(29 - ((self:GetNextZap() - CurTime())/3)*40, -20, 22) + local chargepos = self:LocalToWorld(Vector(0, 0, charge)) + + for i=1, 6 do + local particle = emitter:Add("effects/blueflare1", chargepos) + particle:SetDieTime(0.4) + particle:SetColor(150,230,215) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 20) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + else + self.AmbientSound:Stop() + end + + self:NextThink(CurTime() + 0.05) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + if self.CModel and self.CModel:IsValid() then + self.CModel:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper/init.lua new file mode 100644 index 0000000..2dec977 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper/init.lua @@ -0,0 +1,200 @@ +INC_SERVER() + +local function RefreshZapperOwners(pl) + for _, ent in pairs(ents.FindByClass("prop_zapper*")) do + if ent:IsValid() and ent:GetObjectOwner() == pl then + ent:ClearObjectOwner() + end + end +end +hook.Add("PlayerDisconnected", "Zapper.PlayerDisconnected", RefreshZapperOwners) +hook.Add("OnPlayerChangedTeam", "Zapper.OnPlayerChangedTeam", RefreshZapperOwners) + +function ENT:Initialize() + self:SetModel("models/props_c17/utilityconnecter006c.mdl") + self:SetModelScale(0.75, 0) + self:PhysicsInit(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_WORLD) + self:SetUseType(SIMPLE_USE) + + self:CollisionRulesChanged() + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:SetMaterial("metal") + phys:EnableMotion(false) + phys:Wake() + end + + self:SetMaxObjectHealth(150) + self:SetObjectHealth(self:GetMaxObjectHealth()) + + self.NextZapCheck = CurTime() +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(1, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if self:GetObjectOwner():IsValidLivingHuman() then + self:GetObjectOwner():SendDeployableLostMessage(self) + end + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + + local pos = self:LocalToWorld(self:OBBCenter()) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + + local amount = math.ceil(self:GetAmmo() * 0.5) + while amount > 0 do + local todrop = math.min(amount, 50) + amount = amount - todrop + ent = ents.Create("prop_ammo") + if ent:IsValid() then + local heading = VectorRand():GetNormalized() + ent:SetAmmoType("pulse") + ent:SetAmmo(todrop) + ent:SetPos(pos + heading * 8) + ent:SetAngles(VectorRand():Angle()) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:ApplyForceOffset(heading * math.Rand(8000, 32000), pos) + end + end + end + end +end + +function ENT:OnTakeDamage(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + if not (attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN) then + self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage()) + self:ResetLastBarricadeAttacker(attacker, dmginfo) + end +end + +function ENT:Use(activator, caller) + if self.Removing or not activator:IsPlayer() or self:GetMaterial() ~= "" then return end + + if activator:Team() == TEAM_HUMAN then + if self:GetObjectOwner():IsValid() then + if activator:GetInfo("zs_nousetodeposit") == "0" then + local curammo = self:GetAmmo() + local togive = math.min(math.min(15, activator:GetAmmoCount("pulse")), self.MaxAmmo - curammo) + if togive > 0 then + self:SetAmmo(curammo + togive) + activator:RemoveAmmo(togive, "pulse") + activator:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) + self:EmitSound("npc/scanner/combat_scan1.wav", 60, 250) + end + end + else + self:SetObjectOwner(activator) + self:GetObjectOwner():SendDeployableClaimedMessage(self) + end + end +end + +function ENT:AltUse(activator, tr) + self:PackUp(activator) +end + +function ENT:OnPackedUp(pl) + pl:GiveEmptyWeapon(self.SWEP) + pl:GiveAmmo(1, self.DeployableAmmo) + + pl:PushPackedItem(self:GetClass(), self:GetObjectHealth()) + pl:GiveAmmo(self:GetAmmo(), "pulse") + + self:Remove() +end + +function ENT:FindZapperTarget(pos, owner) + local target + local targethealth = 99999 + local isheadcrab + + for k, ent in pairs(ents.FindInSphere(pos, 135 * (owner.FieldRangeMul or 1))) do + if ent:IsValidLivingZombie() and not ent:GetZombieClassTable().NeverAlive then + isheadcrab = ent:IsHeadcrab() + if (isheadcrab or ent:Health() < targethealth) and TrueVisibleFilters(pos, ent:NearestPoint(pos), self, ent) then + targethealth = ent:Health() + target = ent + + if isheadcrab then + break + end + end + end + end + + return target +end + +function ENT:Think() + if self.Destroyed then + self:Remove() + end + + if CurTime() < self:GetNextZap() or CurTime() < self.NextZapCheck then return end + + local curammo = self:GetAmmo() + local owner = self:GetObjectOwner() + if curammo >= 2 and owner:IsValid() then + self.NextZapCheck = CurTime() + 0.4 + + local pos = self:LocalToWorld(Vector(0, 0, 24)) + local target = self:FindZapperTarget(pos, owner) + + if target then + self:SetAmmo(curammo - 2) + if self:GetAmmo() == 0 then + owner:SendDeployableOutOfAmmoMessage(self) + end + + self:SetNextZap(CurTime() + 3 * (owner.FieldDelayMul or 1)) + + target:AddLegDamageExt(self.LegDamage, owner, self, SLOWTYPE_PULSE) + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + target:TakeSpecialDamage(self.Damage, DMG_SHOCK, owner, self) + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + local effectdata = EffectData() + effectdata:SetOrigin(target:WorldSpaceCenter()) + effectdata:SetStart(pos) + effectdata:SetEntity(self) + util.Effect("tracer_zapper", effectdata) + + self:EmitSound("ambient/levels/labs/electric_explosion5.wav", 80, 200) + end + end + + self:NextThink(CurTime()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper/shared.lua new file mode 100644 index 0000000..f51bae1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper/shared.lua @@ -0,0 +1,77 @@ +ENT.Type = "anim" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.CanPackUp = true +ENT.PackUpTime = 4 +ENT.MaxAmmo = 150 +ENT.PointsMultiplier = 1.25 +ENT.Damage = 25 +ENT.LegDamage = 10 + +ENT.m_NoNailUnfreeze = true +ENT.NoNails = true + +ENT.IgnoreBullets = true + +ENT.IsBarricadeObject = false +ENT.AlwaysGhostable = true + +function ENT:SetObjectHealth(health) + self:SetDTFloat(1, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + local ent = ents.Create("prop_physics") + if ent:IsValid() then + ent:SetModel(self:GetModel()) + ent:SetMaterial(self:GetMaterial()) + ent:SetAngles(self:GetAngles()) + ent:SetPos(self:GetPos()) + ent:SetSkin(self:GetSkin() or 0) + ent:SetColor(self:GetColor()) + ent:Spawn() + ent:Fire("break", "", 0) + ent:Fire("kill", "", 0.1) + end + end +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(1) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(2, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(2) +end + +function ENT:GetNextZap() + return self:GetDTFloat(0) +end + +function ENT:SetNextZap(time) + self:SetDTFloat(0, time) +end + +function ENT:SetObjectOwner(owner) + self:SetDTEntity(0, owner) +end + +function ENT:GetObjectOwner() + return self:GetDTEntity(0) +end + +function ENT:SetAmmo(ammo) + self:SetDTInt(0, ammo) +end + +function ENT:GetAmmo() + return self:GetDTInt(0) +end + +function ENT:ClearObjectOwner() + self:SetObjectOwner(NULL) +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/cl_init.lua new file mode 100644 index 0000000..9fc1541 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/cl_init.lua @@ -0,0 +1,157 @@ +INC_CLIENT() + +local arcscolor = Color(150, 150, 150) +function ENT:Initialize() + local matrix = Matrix() + matrix:Scale(Vector(0.85, 0.85, 1.2)) + self:EnableMatrix( "RenderMultiply", matrix ) + + self.AmbientSound = CreateSound(self, "ambient/machines/combine_shield_touch_loop1.wav") + self.AmbientSound:SetSoundLevel(65) + + local cmodel = ClientsideModel("models/props_trainstation/trainstation_ornament002.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, 0, -25.6))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, 0))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(Color(195, 195, 145)) + cmodel:SetParent(self) + cmodel:SetOwner(self) + + matrix = Matrix() + matrix:Scale(Vector(2, 2, 0.25)) + cmodel:EnableMatrix( "RenderMultiply", matrix ) + + cmodel:Spawn() + + self.CModel = cmodel + end + + cmodel = ClientsideModel("models/props_c17/utilityconnecter005.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, -2, 25.6))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, -70))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(arcscolor) + cmodel:SetMaterial("models/shiny") + cmodel:SetParent(self) + cmodel:SetOwner(self) + + matrix = Matrix() + matrix:Scale(Vector(2, 1.25, 0.25)) + cmodel:EnableMatrix( "RenderMultiply", matrix ) + + cmodel:Spawn() + + self.ArcOne = cmodel + end + + cmodel = ClientsideModel("models/props_c17/utilityconnecter005.mdl") + if cmodel:IsValid() then + cmodel:SetPos(self:LocalToWorld(Vector(0, 2, 25.6))) + cmodel:SetAngles(self:LocalToWorldAngles(Angle(0, 0, 70))) + cmodel:SetSolid(SOLID_NONE) + cmodel:SetMoveType(MOVETYPE_NONE) + cmodel:SetColor(arcscolor) + cmodel:SetMaterial("models/shiny") + cmodel:SetParent(self) + cmodel:SetOwner(self) + + matrix = Matrix() + matrix:Scale(Vector(2, 1.25, 0.25)) + cmodel:EnableMatrix( "RenderMultiply", matrix ) + + cmodel:Spawn() + + self.ArcTwo = cmodel + end +end + +local material = Material("models/shiny") +local matBeam = Material("trails/electric") +function ENT:DrawZapper() + render.ModelMaterialOverride(material) + render.SetColorModulation(0.4, 0.4, 0.4) + self:DrawModel() + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) + + if self:GetObjectOwner():IsValid() and self:GetAmmo() > 1 then + local charge = math.Clamp(29 - ((self:GetNextZap() - CurTime())/4.5)*49, -20, 34) + local spread = ((20 +charge)/34)*3 + + local pos1 = self:LocalToWorld(Vector(0, spread, 21.5 + charge/2.5)) + VectorRand()/1.5 + local pos2 = self:LocalToWorld(Vector(0, -spread, 21.5 + charge/2.5)) + VectorRand()/1.5 + + -- pos1.z = pos1.z + charge/2.5 + -- pos2.z = pos2.z + charge/2.5 + + render.SetMaterial(matBeam) + render.DrawBeam(pos1, pos2, 1, 0, 1, COLOR_CYAN) + end +end + +function ENT:Think() + if self:GetObjectOwner():IsValid() and self:GetAmmo() > 2 then + local charge = math.Clamp(29 - ((self:GetNextZap() - CurTime())/4.5)*49, -20, 25) + + self.AmbientSound:PlayEx(0.6, 65 + charge/1.5) + + if CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.2 + + local pos = self:LocalToWorld(Vector(0, 0, 25)) + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 32) + + for i=1, 2 do + local particle = emitter:Add("effects/blueflare1", pos) + particle:SetDieTime(0.3) + particle:SetColor(110,130,245) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 20) + end + + local chargepos = self:LocalToWorld(Vector(0, 0, charge)) + + for i=1, 6 do + local particle = emitter:Add("effects/blueflare1", chargepos) + particle:SetDieTime(0.4) + particle:SetColor(110,130,245) + particle:SetStartAlpha(200) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand():GetNormal() * 20) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + else + self.AmbientSound:Stop() + end + + self:NextThink(CurTime() + 0.05) + return true +end + +function ENT:OnRemove() + self.AmbientSound:Stop() + + if self.CModel and self.CModel:IsValid() then + self.CModel:Remove() + end + + if self.ArcOne and self.ArcOne:IsValid() then + self.ArcOne:Remove() + end + + if self.ArcTwo and self.ArcTwo:IsValid() then + self.ArcTwo:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/init.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/init.lua new file mode 100644 index 0000000..e6e33bf --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/init.lua @@ -0,0 +1,82 @@ +INC_SERVER() + +function ENT:HitTarget(ent, damage, owner) + ent:AddLegDamageExt(self.LegDamage, owner, self, SLOWTYPE_PULSE) + + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + ent:TakeSpecialDamage(damage, DMG_SHOCK, owner, self) + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + self:EmitSound("ambient/office/zap1.wav", 70, 160, 0.6, CHAN_AUTO) +end + +function ENT:Think() + if self.Destroyed then + self:Remove() + end + + if CurTime() < self:GetNextZap() or CurTime() < self.NextZapCheck then return end + + local curammo = self:GetAmmo() + local owner = self:GetObjectOwner() + if curammo >= 3 and owner:IsValid() then + self.NextZapCheck = CurTime() + 0.4 + + local pos = self:LocalToWorld(Vector(0, 0, 29)) + local target = self:FindZapperTarget(pos, owner) + + local shocked = {} + if target then + self:SetAmmo(curammo - 3) + + if self:GetAmmo() == 0 then + owner:SendDeployableOutOfAmmoMessage(self) + end + + self:SetNextZap(CurTime() + 4.5 * (owner.FieldDelayMul or 1)) + self:HitTarget(target, self.Damage, owner) + + local effectdata = EffectData() + effectdata:SetOrigin(target:WorldSpaceCenter()) + effectdata:SetStart(pos) + effectdata:SetEntity(self) + util.Effect("tracer_zapper", effectdata) + + shocked[target] = true + for i = 1, 3 do + local tpos = target:WorldSpaceCenter() + + for k, ent in pairs(ents.FindInSphere(tpos, 105)) do + if not shocked[ent] and ent:IsValidLivingZombie() and not ent:GetZombieClassTable().NeverAlive then + if WorldVisible(tpos, ent:NearestPoint(tpos)) then + shocked[ent] = true + target = ent + + timer.Simple(i * 0.15, function() + if not ent:IsValid() or not ent:IsValidLivingZombie() or not WorldVisible(tpos, ent:NearestPoint(tpos)) then return end + + self:HitTarget(ent, self.Damage / (i + 0.5), owner) + + local worldspace = ent:WorldSpaceCenter() + effectdata = EffectData() + effectdata:SetOrigin(worldspace) + effectdata:SetStart(tpos) + effectdata:SetEntity(target) + util.Effect("tracer_zapper", effectdata) + end) + + break + end + end + end + end + end + end + + self:NextThink(CurTime()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/shared.lua new file mode 100644 index 0000000..fd9c51d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/prop_zapper_arc/shared.lua @@ -0,0 +1,3 @@ +ENT.Base = "prop_zapper" + +ENT.Damage = 55 diff --git a/gamemodes/zombiesurvival/entities/entities/status__base/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status__base/cl_init.lua index 4bb9f12..1a1b8e9 100644 --- a/gamemodes/zombiesurvival/entities/entities/status__base/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status__base/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Draw() end diff --git a/gamemodes/zombiesurvival/entities/entities/status__base/init.lua b/gamemodes/zombiesurvival/entities/entities/status__base/init.lua index 2cc5124..4c38a6a 100644 --- a/gamemodes/zombiesurvival/entities/entities/status__base/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status__base/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -18,7 +15,6 @@ function ENT:SetPlayer(pPlayer, bExists) if bValid then self:SetPos(pPlayer:GetPos() + Vector(0,0,16)) end - self.Owner = pPlayer pPlayer[self:GetClass()] = self self:SetOwner(pPlayer) self:SetParent(pPlayer) @@ -53,9 +49,6 @@ function ENT:Touch(ent) end function ENT:OnRemove() - --[[if not self.SilentRemove and self:GetParent():IsValid() then - -- Emit death sound - end]] end function ENT:SetDie(fTime) diff --git a/gamemodes/zombiesurvival/entities/entities/status__base/shared.lua b/gamemodes/zombiesurvival/entities/entities/status__base/shared.lua index 3d8694a..b029747 100644 --- a/gamemodes/zombiesurvival/entities/entities/status__base/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status__base/shared.lua @@ -1,5 +1,7 @@ ENT.Type = "anim" +ENT.IsStatus = true + function ENT:OnInitialize() end diff --git a/gamemodes/zombiesurvival/entities/entities/status_adrenalineamp.lua b/gamemodes/zombiesurvival/entities/entities/status_adrenalineamp.lua new file mode 100644 index 0000000..dad65d2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_adrenalineamp.lua @@ -0,0 +1,47 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +if SERVER then + function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end + end +end + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + hook.Add("Move", self, self.Move) +end + +function ENT:Move(pl, move) + if pl ~= self:GetOwner() then return end + + move:SetMaxSpeed(move:GetMaxSpeed() + self:GetSpeed()) + move:SetMaxClientSpeed(move:GetMaxSpeed()) +end + +function ENT:SetSpeed(speed) + self:SetDTFloat(1, math.max(-15, speed)) +end + +function ENT:GetSpeed() + return self:GetDTFloat(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/cl_init.lua new file mode 100644 index 0000000..d8b1412 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/cl_init.lua @@ -0,0 +1,98 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.GlowMax = 48 +ENT.GlowMin = 26 + +ENT.GlowSize = ENT.GlowMin +ENT.NextEmit = 0 + +function ENT:Initialize() + self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "ambient/levels/canals/windmill_wind_loop1.wav") +end + +function ENT:Think() + local owner = self:GetOwner() + if owner:IsValid() then + self.AmbientSound:PlayEx(0.8, 50 + 70 * math.min(1, owner:GetVelocity():Length() / 200)) + end +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/shiny") +function ENT:DrawTranslucent() + local pl = self:GetOwner() + if not pl:IsValid() or pl == MySelf and not pl:ShouldDrawLocalPlayer() then return end + + local pos = pl:GetPos() + + local spawnprotection = pl.SpawnProtection + + render.ModelMaterialOverride(matWhite) + render.SuppressEngineLighting(true) + if spawnprotection then + render.SetBlend(0.02 + (CurTime() + pl:EntIndex() * 0.2) % 0.05) + render.SetColorModulation(0, 0.3, 0) + else + render.SetBlend(0.9) + render.SetColorModulation(0, 0.6, 1) + end + self:DrawModel() + render.SetColorModulation(1, 1, 1) + render.SetBlend(1) + render.SuppressEngineLighting(false) + render.ModelMaterialOverride(nil) + + local col = spawnprotection and Color(0, 0.3 * 255, 0) or Color(0, 180, 255) + + render.SetMaterial(matGlow) + render.DrawSprite(pos, 64, 64, col) + + if CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.075 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(12, 16) + + local base_ang = (self:GetVelocity() * -1):Angle() + local ang = Angle() + for i=1, 6 do + ang:Set(base_ang) + ang:RotateAroundAxis(ang:Right(), math.Rand(-30, 30)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-30, 30)) + + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(2) + particle:SetVelocity(ang:Forward() * math.Rand(32, 64)) + particle:SetAirResistance(24) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(col.r,col.g,col.b) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + + local dlight = DynamicLight(self:EntIndex()) + if dlight then + dlight.Pos = pos + dlight.r = 255 + dlight.g = 255 + dlight.b = 255 + dlight.Brightness = 1 + dlight.Size = 150 + dlight.Decay = 300 + dlight.DieTime = CurTime() + 1 + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/init.lua new file mode 100644 index 0000000..959f299 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/init.lua @@ -0,0 +1,11 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModel("models/dav0r/hoverball.mdl") +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Cool Wisp") then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ambience_coolwisp/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/cl_init.lua index 7e430a5..53ad29f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/cl_init.lua @@ -1,60 +1,86 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.GlowMax = 48 +ENT.GlowMin = 26 + +ENT.GlowSize = ENT.GlowMin ENT.NextEmit = 0 -ENT.GlowSize = 32 function ENT:Initialize() self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "^thrusters/hover02.wav") end -local matGlow = Material("sprites/glow04_noz") -local matRing = Material("Effects/splashwake3") +function ENT:Think() + local owner = self:GetOwner() + if owner:IsValid() then + self.AmbientSound:PlayEx(0.7, 20 + 15 * math.min(1, owner:GetVelocity():Length() / 200)) + end +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matGlow = Material("sprites/light_glow02_add") +local matWhite = Material("models/debug/debugwhite") function ENT:DrawTranslucent() local pl = self:GetOwner() - if not pl:IsValid() then return end - - local wep = pl:GetActiveWeapon() - local attackdown = wep:IsValid() and wep.GetAttackDown and wep:GetAttackDown() - - self.GlowSize = math.Approach(self.GlowSize, attackdown and 28 or 16, FrameTime() * 50) - local basesize = self.GlowSize + if not pl:IsValid() or pl == MySelf and not pl:ShouldDrawLocalPlayer() then return end local pos = pl:GetPos() - local time = CurTime() - local ringsize = basesize * (0.75 + math.max(0, math.sin(time * 2)) ^ 0.75 * 0.6 + math.sin(time * 4) * 0.05) - render.SetMaterial(matRing) - render.DrawSprite(pos, ringsize, ringsize, color_white) + local spawnprotection = pl.SpawnProtection + + render.ModelMaterialOverride(matWhite) + render.SuppressEngineLighting(true) + if spawnprotection then + render.SetBlend(0.02 + (CurTime() + pl:EntIndex() * 0.2) % 0.05) + render.SetColorModulation(0, 0.3, 0) + end + self:DrawModel() + if spawnprotection then + render.SetColorModulation(1, 1, 1) + render.SetBlend(1) + end + render.SuppressEngineLighting(false) + render.ModelMaterialOverride(nil) + + local col = spawnprotection and Color(0, 0.3 * 255, 0) or Color(255, 255, 255) render.SetMaterial(matGlow) - render.DrawSprite(pos, basesize, basesize, color_white) - render.DrawSprite(pos + Vector(math.sin(time * 3) * 4, 0, 0), basesize, basesize, color_white) - render.DrawSprite(pos + Vector(0, math.cos(time * 3.5) * 4, 0), basesize, basesize, color_white) - render.DrawSprite(pos + Vector(0, 0, math.sin(time * 4) * 4), basesize, basesize, color_white) + render.DrawSprite(pos, 64, 64, col) - if time >= self.NextEmit then - self.NextEmit = time + math.Rand(0.05, 0.25) + if CurTime() >= self.NextEmit then + self.NextEmit = CurTime() + 0.075 local emitter = ParticleEmitter(pos) - emitter:SetNearClip(16, 24) + emitter:SetNearClip(12, 16) - local particle = emitter:Add("sprites/glow04_noz", pos) - particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(-64, 64)) - particle:SetDieTime(math.Rand(2, 4)) - particle:SetStartSize(1) - particle:SetEndSize(0) - particle:SetStartAlpha(255) - particle:SetEndAlpha(255) - particle:SetRoll(math.Rand(0, 360)) - particle:SetRollDelta(math.Rand(-4, 4)) - particle:SetGravity(Vector(0, 0, -128)) - particle:SetAirResistance(32) - particle:SetCollide(true) - particle:SetBounce(0.75) + local base_ang = (self:GetVelocity() * -1):Angle() + local ang = Angle() + for i=1, 6 do + ang:Set(base_ang) + ang:RotateAroundAxis(ang:Right(), math.Rand(-30, 30)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-30, 30)) - emitter:Finish() + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetDieTime(2) + particle:SetVelocity(ang:Forward() * math.Rand(32, 64)) + particle:SetAirResistance(24) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetColor(col.r,col.g,col.b) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) end local dlight = DynamicLight(self:EntIndex()) diff --git a/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/init.lua index 6dde495..07462f7 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ambience_wow/init.lua @@ -1,13 +1,11 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) + self:SetModel("models/dav0r/hoverball.mdl") end function ENT:Think() local owner = self:GetOwner() - if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Will O' Wisp") then self:Remove() end + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Wil O' Wisp") then self:Remove() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/cl_init.lua new file mode 100644 index 0000000..6df1c09 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/cl_init.lua @@ -0,0 +1,44 @@ +INC_CLIENT() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModelScale(0.4, 0) + + self:SetRenderBounds(Vector(-26, -26, -26), Vector(26, 26, 45)) +end + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + + local boneid = owner:LookupBone("ValveBiped.Bip01_Spine2") + if not boneid or boneid <= 0 then return end + + local bonepos, boneang = owner:GetBonePositionMatrixed(boneid) + + self:SetPos(bonepos + boneang:Forward() + boneang:Right() * 4) + boneang:RotateAroundAxis(boneang:Right(), 270) + boneang:RotateAroundAxis(boneang:Forward(), 90) + self:SetAngles(boneang) + + local shadowman = owner.ShadowMan + local hidepacks = not GAMEMODE.HidePacks + + if hidepacks and shadowman then + render.SetBlend(0) + end + + self:DrawModel() + + if hidepacks and shadowman then + render.SetBlend(1) + end + + if not hidepacks or not shadowman then + local w, h = 420, 200 + cam.Start3D2D(self:LocalToWorld(Vector(0, 0, self:OBBMaxs().z)), self:GetAngles(), 0.025) + draw.RoundedBox(64, w * -0.5, h * -0.5, w, h, color_black_alpha120) + draw.SimpleText(translate.Get("arsenal_crate"), "ZS3D2DFont2", 0, 0, COLOR_GRAY, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/init.lua b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/init.lua new file mode 100644 index 0000000..1752c6b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/init.lua @@ -0,0 +1,16 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModelScale(0.4, 0) + + self:SetModel("models/Items/item_item_crate.mdl") + self:SetMoveType(MOVETYPE_NONE) + self:PhysicsInitSphere(3) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:IsValid() and owner:Alive() and owner:HasTrinket("arsenalpack")) then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/shared.lua new file mode 100644 index 0000000..d37df0c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_arsenalpack/shared.lua @@ -0,0 +1,6 @@ +ENT.Type = "anim" + +ENT.IgnoreMelee = true +ENT.IgnoreBullets = true +ENT.IgnoreTraces = true +ENT.NoNails = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_bleed/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_bleed/cl_init.lua index 4fd5083..2298cd4 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bleed/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bleed/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Draw() end diff --git a/gamemodes/zombiesurvival/entities/entities/status_bleed/init.lua b/gamemodes/zombiesurvival/entities/entities/status_bleed/init.lua index 210582d..581f54a 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bleed/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bleed/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer.Bleed = self @@ -10,7 +7,7 @@ end function ENT:Think() local owner = self:GetOwner() - if self:GetDamage() <= 0 or owner:Team() == TEAM_UNDEAD then + if self:GetDamage() <= 0 then self:Remove() return end @@ -24,6 +21,8 @@ function ENT:Think() dir:Normalize() util.Blood(owner:WorldSpaceCenter(), 3, dir, 32) - self:NextThink(CurTime() + 1) + local moving = owner:GetVelocity():LengthSqr() >= 19600 --140^2 + local ticktime = (moving and 0.65 or 1.3)/(owner.BleedSpeedMul or 1) + self:NextThink(CurTime() + ticktime) return true end diff --git a/gamemodes/zombiesurvival/entities/entities/status_bleed/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_bleed/shared.lua index a5cfd65..34db92c 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bleed/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bleed/shared.lua @@ -1,6 +1,8 @@ ENT.Type = "anim" ENT.Base = "status__base" +ENT.Ephemeral = true + function ENT:Initialize() self:DrawShadow(false) if self:GetDTFloat(1) == 0 then @@ -8,12 +10,20 @@ function ENT:Initialize() end end -function ENT:AddDamage(damage) +function ENT:AddDamage(damage, attacker) + local owner = self:GetOwner() + if damage > 0 and owner:IsValid() and owner.BleedDamageTakenMul then + damage = damage * owner.BleedDamageTakenMul + end + self:SetDamage(self:GetDamage() + damage) + if attacker then + self.Damager = attacker + end end function ENT:SetDamage(damage) - self:SetDTFloat(0, math.min(50, damage)) + self:SetDTFloat(0, math.min(GAMEMODE.MaxBleedDamage or 1000, damage)) end function ENT:GetDamage() diff --git a/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/cl_init.lua index b9e5db2..e8086dd 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE diff --git a/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/init.lua index cf35381..cf491fe 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bonemeshambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_burn/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_burn/cl_init.lua new file mode 100644 index 0000000..9b2bbe0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_burn/cl_init.lua @@ -0,0 +1,43 @@ +INC_CLIENT() + +local function GetRandomBonePos(pl) + if pl ~= MySelf or pl:ShouldDrawLocalPlayer() then + local bone = pl:GetBoneMatrix(math.random(0,25)) + if bone then + return bone:GetTranslation() + end + end + + return pl:GetShootPos() +end + +function ENT:Draw() + local ent = self:GetOwner() + if not ent:IsValid() then return end + + local pos + if ent == MySelf and not ent:ShouldDrawLocalPlayer() then + local aa, bb = ent:WorldSpaceAABB() + pos = Vector(math.Rand(aa.x, bb.x), math.Rand(aa.y, bb.y), math.Rand(aa.z, bb.z)) + else + pos = GetRandomBonePos(ent) + end + + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(24, 32) + + for i = 1, 2 do + local particle = emitter:Add("sprites/flamelet"..math.random(4), pos + VectorRand():GetNormalized() * 2) + particle:SetDieTime(math.Rand(0.2, 0.5)) + particle:SetStartSize(5) + particle:SetEndSize(10) + particle:SetStartAlpha(255) + particle:SetEndAlpha(0) + particle:SetVelocity(ent:GetVelocity()) + particle:SetAirResistance(32) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-1.5, 1.5)) + end + + emitter:Finish() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_burn/init.lua b/gamemodes/zombiesurvival/entities/entities/status_burn/init.lua new file mode 100644 index 0000000..98d0016 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_burn/init.lua @@ -0,0 +1,18 @@ +INC_SERVER() + +function ENT:Think() + local owner = self:GetOwner() + + if self:GetDamage() <= 0 or owner:WaterLevel() > 0 or not owner:Alive() or (owner:Team() == self.Damager:Team() and owner ~= self.Damager) then + self:Remove() + return + end + + local dmg = math.Clamp(self:GetDamage(), 1, 2) + + owner:TakeSpecialDamage(dmg, DMG_BURN, self.Damager and self.Damager:IsValid() and self.Damager:IsPlayer() and self.Damager:Team() ~= owner:Team() and self.Damager or owner, self) + self:AddDamage(-dmg) + + self:NextThink(CurTime() + 0.5) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_burn/shared.lua similarity index 94% rename from gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/shared.lua rename to gamemodes/zombiesurvival/entities/entities/status_burn/shared.lua index a5cfd65..d2013a6 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_burn/shared.lua @@ -1,6 +1,8 @@ ENT.Type = "anim" ENT.Base = "status__base" +ENT.Ephemeral = true + function ENT:Initialize() self:DrawShadow(false) if self:GetDTFloat(1) == 0 then diff --git a/gamemodes/zombiesurvival/entities/entities/status_bursterambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_bursterambience/cl_init.lua index e642ac8..4ea3eb6 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bursterambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bursterambience/cl_init.lua @@ -1,7 +1,9 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.NextEmit = 0 + function ENT:Initialize() self:DrawShadow(false) @@ -16,24 +18,38 @@ end function ENT:Think() local owner = self:GetOwner() if owner:IsValid() then - local wep = owner:GetActiveWeapon() - if wep:IsValid() and wep.GetCharge and wep:GetCharge() > 0 then - self.AmbientSound:Stop() - else - self.AmbientSound:PlayEx(0.55, 85 + math.sin(RealTime())) - end + self.AmbientSound:PlayEx(0.55, 85 + math.sin(RealTime())) end end function ENT:Draw() local owner = self:GetOwner() - if owner:IsValid() then - local wep = owner:GetActiveWeapon() - if wep:IsValid() and wep.GetCharge then - local charge = wep:GetCharge() - if charge > 0 then - - end - end - end + if not owner:IsValid() or owner.SpawnProtection then return end + + local pos = owner:WorldSpaceCenter() + pos.z = pos.z + 5 + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.12 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local particle = emitter:Add("particle/smokestack", pos + VectorRand() * 5) + particle:SetDieTime(math.Rand(0.95, 1.35)) + particle:SetStartAlpha(190) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(17, 19)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-3, 3)) + particle:SetVelocity(Vector(0, 0, 45)) + particle:SetGravity(Vector(0, 0, -65)) + particle:SetCollide(true) + particle:SetBounce(0.45) + particle:SetAirResistance(12) + particle:SetColor(100, 235, 100) + particle:SetLighting(true) + + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/status_bursterambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_bursterambience/init.lua index f8f5827..75681aa 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_bursterambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_bursterambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -9,5 +6,5 @@ end function ENT:Think() local owner = self:GetOwner() - if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Burster") then self:Remove() end + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Chem Burster") then self:Remove() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_butcherambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_butcherambience/cl_init.lua index 07c3d1f..cfdbbda 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_butcherambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_butcherambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE diff --git a/gamemodes/zombiesurvival/entities/entities/status_butcherambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_butcherambience/init.lua index 57baacb..bcb622b 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_butcherambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_butcherambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/cl_init.lua index 5aec78f..8b89ccb 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -17,14 +17,14 @@ function ENT:OnRemove() end function ENT:Think() - self.AmbientSound:PlayEx(0.67, 100 + math.sin(RealTime())) + self.AmbientSound:PlayEx(0.67, 100 + RealTime() % 1) end local matGlow = Material("sprites/glow04_noz") local colGlow = Color(0, 255, 0, 255) function ENT:DrawTranslucent() local owner = self:GetOwner() - if owner:IsValid() and (owner ~= LocalPlayer() or owner:ShouldDrawLocalPlayer()) then + if owner:IsValid() and (owner ~= MySelf or owner:ShouldDrawLocalPlayer()) then local pos = owner:LocalToWorld(owner:OBBCenter()) render.SetMaterial(matGlow) render.DrawSprite(pos, math.Rand(64, 72), math.Rand(64, 72), colGlow) @@ -50,7 +50,7 @@ function ENT:DrawTranslucent() particle:SetAirResistance(12) particle:SetColor(0, 200, 0) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/init.lua index 527b949..abe9e37 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_chemzombieambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_confusion/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_confusion/cl_init.lua index 569d2a8..c2596a9 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_confusion/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_confusion/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_confusion/init.lua b/gamemodes/zombiesurvival/entities/entities/status_confusion/init.lua index 01668ec..4c8aeab 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_confusion/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_confusion/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer.Confusion = self diff --git a/gamemodes/zombiesurvival/entities/entities/status_confusion/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_confusion/shared.lua index e34d268..a77ca57 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_confusion/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_confusion/shared.lua @@ -1,6 +1,8 @@ ENT.Type = "anim" ENT.Base = "status__base" +ENT.Ephemeral = true + function ENT:SetEndTime(time) self:SetDTFloat(0, time) end diff --git a/gamemodes/zombiesurvival/entities/entities/status_corruptedteleport.lua b/gamemodes/zombiesurvival/entities/entities/status_corruptedteleport.lua new file mode 100644 index 0000000..0ed2661 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_corruptedteleport.lua @@ -0,0 +1,10 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_sigilteleport" + +ENT.ParticleMaterial = "particle/smokesprites_0001" + +function ENT:SetParticleColor(particle) + particle:SetColor(38, 255, 102) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourer/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_devourer/cl_init.lua new file mode 100644 index 0000000..f170e63 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourer/cl_init.lua @@ -0,0 +1,4 @@ +INC_CLIENT() + +function ENT:Draw() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourer/init.lua b/gamemodes/zombiesurvival/entities/entities/status_devourer/init.lua new file mode 100644 index 0000000..ccd3588 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourer/init.lua @@ -0,0 +1,31 @@ +INC_SERVER() + +function ENT:Think() + local owner = self:GetOwner() + + if self:GetDamage() <= 0 or owner:Team() == TEAM_UNDEAD then + self:Remove() + return + end + + if not self:GetPuller():IsValid() then + return + end + + local puller = self:GetPuller() + if puller:GetPos():DistToSqr(owner:GetPos()) < 14000 then + self:Remove() + return + end + + local dir = (puller:GetPos() - owner:GetPos()) + dir.z = math.Clamp(dir.z + 35, 0, 65) + dir = dir:GetNormalized() + + owner:SetGroundEntity(NULL) + owner:SetVelocity(dir * 380) + self:SetDamage(self:GetDamage() - 1) + + self:NextThink(CurTime() + 0.12) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourer/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_devourer/shared.lua new file mode 100644 index 0000000..8263e69 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourer/shared.lua @@ -0,0 +1,18 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +function ENT:SetDamage(damage) + self:SetDTFloat(0, math.min(15, damage)) +end + +function ENT:GetDamage() + return self:GetDTFloat(0) +end + +function ENT:SetPuller(puller) + self:SetDTEntity(0, puller) +end + +function ENT:GetPuller() + return self:GetDTEntity(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourerambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/cl_init.lua new file mode 100644 index 0000000..55e9773 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/cl_init.lua @@ -0,0 +1,29 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_NONE + +function ENT:Initialize() + self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "npc/fast_zombie/gurgle_loop1.wav") + self.AmbientSound:PlayEx(1, 26) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Think() + --[[owner = self:GetOwner() + if owner:IsValid() then + local wep = owner:GetActiveWeapon() + if wep:IsValid() and wep.IsSwinging and wep:IsSwinging() then + self.AmbientSound:Stop() + else + self.AmbientSound:PlayEx(1, 26 + math.sin(RealTime())) + end + end]] +end + +function ENT:Draw() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourerambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/init.lua new file mode 100644 index 0000000..2050732 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Devourer") then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_devourerambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_devourerambience/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/status_dimvision/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_dimvision/cl_init.lua new file mode 100644 index 0000000..2a1b798 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_dimvision/cl_init.lua @@ -0,0 +1,39 @@ +INC_CLIENT() + +function ENT:GetDim() + local creation_time = self:GetStartTime() + local time = CurTime() + local life_time = self:GetDuration() + local end_time = creation_time + life_time + + if time > end_time - 0.5 then + return math.Clamp((end_time - time) * 2, 0, 1) + end + + if time < creation_time + 0.5 then + return math.max(0, (time - creation_time) * 2) + end + + return 1 +end + +function ENT:Draw() +end + +local colModDimVision = { + ["$pp_colour_colour"] = 1, + ["$pp_colour_brightness"] = 0, + ["$pp_colour_contrast"] = 1, + ["$pp_colour_mulr"] = 0, + ["$pp_colour_mulg"] = 0, + ["$pp_colour_mulb"] = 0, + ["$pp_colour_addr"] = 0, + ["$pp_colour_addg"] = 0, + ["$pp_colour_addb"] = 0 +} +function ENT:RenderScreenspaceEffects() + if MySelf ~= self:GetOwner() then return end + + colModDimVision["$pp_colour_brightness"] = self:GetDim() * -0.15 + DrawColorModify(colModDimVision) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_dimvision/init.lua b/gamemodes/zombiesurvival/entities/entities/status_dimvision/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_dimvision/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_dimvision/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_dimvision/shared.lua new file mode 100644 index 0000000..b14794f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_dimvision/shared.lua @@ -0,0 +1,36 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + self:DrawShadow(false) + + if CLIENT then + hook.Add("RenderScreenspaceEffects", self, self.RenderScreenspaceEffects) + end + + self:GetOwner().DimVision = self +end + +function ENT:OnRemove() + self.BaseClass.OnRemove(self) + + self:GetOwner().DimVision = nil +end + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) + + local owner = self:GetOwner() + if owner:IsValid() and owner.VisionAlterDurationMul then + local newdur = self:GetDuration() * owner.VisionAlterDurationMul + self.DieTime = CurTime() + newdur + self:SetDuration(newdur) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_disorientation.lua b/gamemodes/zombiesurvival/entities/entities/status_disorientation.lua index a6e07a8..ce5eeeb 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_disorientation.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_disorientation.lua @@ -5,6 +5,8 @@ ENT.Base = "status__base" ENT.LifeTime = 3 +ENT.Ephemeral = true + function ENT:Initialize() self.BaseClass.Initialize(self) @@ -16,7 +18,7 @@ function ENT:Initialize() end local parent = self:GetParent() - if parent:IsValid() and (SERVER or CLIENT and LocalPlayer() == parent) then + if parent:IsValid() and (SERVER or CLIENT and MySelf == parent) then parent:SetDSP(35) end @@ -30,7 +32,7 @@ function ENT:GetPower() end function ENT:CreateMove(cmd) - if LocalPlayer() ~= self:GetOwner() then return end + if MySelf ~= self:GetOwner() then return end local curtime = CurTime() local frametime = FrameTime() @@ -44,7 +46,7 @@ function ENT:CreateMove(cmd) end function ENT:RenderScreenspaceEffects() - if LocalPlayer() ~= self:GetOwner() then return end + if MySelf ~= self:GetOwner() then return end local power = self:GetPower() diff --git a/gamemodes/zombiesurvival/entities/entities/status_drown/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_drown/shared.lua index 3896c2d..6186b4d 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_drown/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_drown/shared.lua @@ -27,7 +27,7 @@ end function ENT:GetDrownTime() local owner = self:GetOwner() - if owner:IsValid() and owner:HasWeapon("weapon_zs_oxygentank") then + if owner:IsValid() and owner:HasTrinket("oxygentank") then return 300 end @@ -36,7 +36,7 @@ end function ENT:GetRecoverTime() local owner = self:GetOwner() - if owner:IsValid() and owner:HasWeapon("weapon_zs_oxygentank") then + if owner:IsValid() and owner:HasTrinket("oxygentank") then return 20 end diff --git a/gamemodes/zombiesurvival/entities/entities/status_enfeeble/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/cl_init.lua new file mode 100644 index 0000000..5337b05 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/cl_init.lua @@ -0,0 +1,43 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:DrawTranslucent() + local owner = self:GetOwner() + if not owner:IsValid() then return end + + render.SetColorModulation(1, 0, 0) + render.SetBlend(self:GetPower() * 0.95) + render.SuppressEngineLighting(true) + + self:SetRenderOrigin(owner:GetPos() + Vector(0, 0, owner:OBBMaxs().z + math.abs(math.sin(CurTime() * 2)) * 4)) + self:SetRenderAngles(Angle(0, CurTime() * 270, 0)) + self:DrawModel() + + render.SuppressEngineLighting(false) + render.SetBlend(1) + render.SetColorModulation(1, 1, 1) +end + +function ENT:PrePlayerDraw(pl) + if pl ~= self:GetOwner() then return end + + local r = 1 - math.abs(math.sin((CurTime() + self:EntIndex()) * 3)) * 0.2 + render.SetColorModulation(r, 0.1, 0.1) +end + +function ENT:PostPlayerDraw(pl) + if pl ~= self:GetOwner() then return end + + render.SetColorModulation(1, 1, 1) +end + +function ENT:GetPower() + return math.Clamp(self:GetStartTime() + self:GetDuration() - CurTime(), 0, 1) +end + +function ENT:RenderScreenspaceEffects() + if MySelf ~= self:GetOwner() then return end + + DrawMotionBlur(0.1, self:GetPower() * 0.3, 0.01) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_enfeeble/init.lua b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/init.lua new file mode 100644 index 0000000..25121d5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/init.lua @@ -0,0 +1,38 @@ +INC_SERVER() + +function ENT:EntityTakeDamage(ent, dmginfo) + if ent ~= self:GetOwner() then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then + dmginfo:SetDamage(dmginfo:GetDamage() * self.DamageScale) + end +end + +function ENT:PlayerHurt(victim, attacker, healthleft, damage) + local applier = self.Applier + if applier and applier:IsValidLivingZombie() and applier ~= attacker and victim:IsValidLivingHuman() then + local attributeddamage = damage + if healthleft < 0 then + attributeddamage = attributeddamage + healthleft + end + + if attributeddamage > 0 then + attributeddamage = attributeddamage - (attributeddamage / self.DamageScale) + + applier.DamageDealt[TEAM_UNDEAD] = applier.DamageDealt[TEAM_UNDEAD] + attributeddamage + applier:AddLifeHumanDamage(attributeddamage) + end + end +end + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_enfeeble/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/shared.lua new file mode 100644 index 0000000..abb405e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_enfeeble/shared.lua @@ -0,0 +1,37 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.DamageScale = 1.4 + +ENT.Model = Model("models/gibs/HGIBS.mdl") + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + self:SetModel(self.Model) + self:DrawShadow(false) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + hook.Add("PlayerHurt", self, self.PlayerHurt) + + self:EmitSound("beams/beamstart5.wav", 65, 140) + end + + if CLIENT then + hook.Add("PrePlayerDraw", self, self.PrePlayerDraw) + hook.Add("PostPlayerDraw", self, self.PostPlayerDraw) + hook.Add("RenderScreenspaceEffects", self, self.RenderScreenspaceEffects) + end +end + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/cl_init.lua new file mode 100644 index 0000000..683b8c8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/cl_init.lua @@ -0,0 +1,21 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_NONE + +function ENT:Initialize() + self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "npc/antlion_guard/confused1.wav") + self.AmbientSound:PlayEx(0.55, 110) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Think() + self.AmbientSound:PlayEx(0.5, 70 + math.sin(RealTime() * 3) * 10) +end + +function ENT:Draw() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/init.lua new file mode 100644 index 0000000..8c43a22 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Eradicator") then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_eradicatorambience/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/cl_init.lua index b823430..119880d 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE diff --git a/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/init.lua index 14cc71f..aa398c1 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_fastzombieambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -9,5 +6,6 @@ end function ENT:Think() local owner = self:GetOwner() - if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Fast Zombie") then self:Remove() end + local name = owner:GetZombieClassTable().Name + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and (name == "Fast Zombie" or name == "Slingshot Zombie" or name == "Fast Zombie Torso" or name == "Slingshot Zombie Torso")) then self:Remove() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_feigndeath/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_feigndeath/cl_init.lua index 80144a4..2c29c7f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_feigndeath/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_feigndeath/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -13,6 +13,7 @@ function ENT:OnInitialize() if owner:IsValid() then owner.FeignDeath = self owner.NoCollideAll = true + owner:CollisionRulesChanged() self.CommandYaw = owner:GetAngles().yaw @@ -22,7 +23,7 @@ function ENT:OnInitialize() end function ENT:CreateMove(cmd) - if LocalPlayer() ~= self:GetOwner() then return end + if MySelf ~= self:GetOwner() then return end local ang = cmd:GetViewAngles() ang.yaw = self.CommandYaw or ang.yaw @@ -44,12 +45,13 @@ function ENT:OnRemove() if owner:IsValid() then owner.FeignDeath = nil owner.NoCollideAll = owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().NoCollideAll + owner:CollisionRulesChanged() end end function ENT:DrawTranslucent() local owner = self:GetOwner() - if LocalPlayer() ~= owner then return end + if MySelf ~= owner then return end local pos = owner:GetPos() + EyeAngles():Right() * 32 local col = table.Copy(COLOR_GRAY) diff --git a/gamemodes/zombiesurvival/entities/entities/status_feigndeath/init.lua b/gamemodes/zombiesurvival/entities/entities/status_feigndeath/init.lua index 7f9f8c7..2dfe35c 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_feigndeath/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_feigndeath/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextHeal = 0 @@ -38,8 +35,8 @@ function ENT:Think() if fCurTime >= self.NextHeal then self.NextHeal = fCurTime + 0.25 - if owner:Health() < owner:GetMaxHealth() then - owner:SetHealth(owner:Health() + 1) + if owner:Health() < owner:GetMaxHealth() and not owner:GetZombieClassTable().Boss then + owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + math.min(owner:GetMaxHealth() * 0.035, 3))) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_fistcombo.lua b/gamemodes/zombiesurvival/entities/entities/status_fistcombo.lua new file mode 100644 index 0000000..665c0ca --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_fistcombo.lua @@ -0,0 +1,38 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +function ENT:AddCounter(counter) + local owner = self:GetOwner() + if owner.LastStunned and owner.LastStunned + 3 > CurTime() then return end + + if self:GetCounter() + counter >= 4 then + owner:AddLegDamage(18) + owner:AddArmDamage(18) + owner:EmitSound("weapons/crowbar/crowbar_impact1.wav", 75, math.random(60, 65)) + self:Remove() + else + self:SetCounter(self:GetCounter() + counter) + end +end + +function ENT:SetCounter(counter) + self:SetDTFloat(0, math.max(0, counter)) +end + +function ENT:GetCounter() + return self:GetDTFloat(0) +end + +if CLIENT then return end + +function ENT:Think() + self.BaseClass.Think(self) + + local owner = self:GetOwner() + + if not owner:Alive() or owner:Team() == TEAM_HUMAN then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frightened/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_frightened/cl_init.lua new file mode 100644 index 0000000..b0508bc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frightened/cl_init.lua @@ -0,0 +1,23 @@ +INC_CLIENT() + +function ENT:OnInitialize() + local owner = self:GetOwner() + if owner ~= MySelf then return end + + owner:SetDSP(31, false) + self.AmbientSound = CreateSound(self, "player/breathe1.wav") + self.AmbientSound:Play() + self.AmbientSound2 = CreateSound(self, "player/heartbeat1.wav") + self.AmbientSound2:Play() +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner == MySelf then + self.AmbientSound:Stop() + self.AmbientSound2:Stop() + owner:SetDSP(0, false) + end + + self.BaseClass.OnRemove(self) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frightened/init.lua b/gamemodes/zombiesurvival/entities/entities/status_frightened/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frightened/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frightened/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_frightened/shared.lua new file mode 100644 index 0000000..d95d0f1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frightened/shared.lua @@ -0,0 +1,20 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) + + local owner = self:GetOwner() + if owner:IsValid() and owner.FrightDurationMul then + local newdur = self:GetDuration() * owner.FrightDurationMul + self.DieTime = CurTime() + newdur + self:SetDuration(newdur) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frost/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_frost/cl_init.lua new file mode 100644 index 0000000..2a7dc45 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frost/cl_init.lua @@ -0,0 +1,39 @@ +INC_CLIENT() + +function ENT:PrePlayerDraw(pl) + if pl ~= self:GetOwner() then return end + + local b = 1 - math.abs(math.sin((CurTime() + self:EntIndex()) * 3)) * 0.2 + render.SetColorModulation(0.1, 0.1, b) +end + +function ENT:PostPlayerDraw(pl) + if pl ~= self:GetOwner() then return end + + render.SetColorModulation(1, 1, 1) +end + +function ENT:GetPower() + return math.Clamp(self:GetStartTime() + self:GetDuration() - CurTime(), 0, 1) +end + +local colModDimVision = { + ["$pp_colour_colour"] = 1, + ["$pp_colour_brightness"] = 0, + ["$pp_colour_contrast"] = 1, + ["$pp_colour_mulr"] = 0, + ["$pp_colour_mulg"] = 0, + ["$pp_colour_mulb"] = 0, + ["$pp_colour_addr"] = 0, + ["$pp_colour_addg"] = 0, + ["$pp_colour_addb"] = 0 +} + +function ENT:RenderScreenspaceEffects() + if MySelf ~= self:GetOwner() then return end + + colModDimVision["$pp_colour_addb"] = self:GetPower() * 0.2 + colModDimVision["$pp_colour_addg"] = self:GetPower() * -0.05 + colModDimVision["$pp_colour_addr"] = self:GetPower() * -0.13 + DrawColorModify(colModDimVision) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frost/init.lua b/gamemodes/zombiesurvival/entities/entities/status_frost/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frost/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frost/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_frost/shared.lua new file mode 100644 index 0000000..f01f3f1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frost/shared.lua @@ -0,0 +1,27 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + self:EmitSound("physics/glass/glass_impact_bullet"..math.random(4)..".wav", 70, 85) + end + + if CLIENT then + hook.Add("PrePlayerDraw", self, self.PrePlayerDraw) + hook.Add("PostPlayerDraw", self, self.PostPlayerDraw) + hook.Add("RenderScreenspaceEffects", self, self.RenderScreenspaceEffects) + end +end + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/cl_init.lua new file mode 100644 index 0000000..6939eff --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/cl_init.lua @@ -0,0 +1,55 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.NextEmit = 0 + +function ENT:Initialize() + self:DrawShadow(false) + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 90)) + + self.AmbientSound = CreateSound(self, "ambient/levels/canals/windmill_wind_loop1.wav") + self.AmbientSound:PlayEx(0.6, 100) + + self:GetOwner().status_frostshadeambience = self +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +local matGlow = Material("sprites/glow04_noz") +local colGlow = Color(255, 255, 255, 150) +function ENT:DrawTranslucent() + local owner = self:GetOwner() + if owner.SpawnProtection then return end + if owner:IsValid() and (owner ~= MySelf or owner:ShouldDrawLocalPlayer()) then + local pos = owner:LocalToWorld(owner:OBBCenter()) + render.SetMaterial(matGlow) + render.DrawSprite(pos, math.Rand(64, 72), math.Rand(64, 72), colGlow) + + if self.NextEmit <= CurTime() then + self.NextEmit = CurTime() + 0.25 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(32, 48) + + local particle = emitter:Add("particle/smokestack", pos) + particle:SetVelocity(owner:GetVelocity() * 0.8) + particle:SetDieTime(math.Rand(1, 1.35)) + particle:SetStartAlpha(130) + particle:SetEndAlpha(0) + particle:SetStartSize(10) + particle:SetEndSize(math.Rand(25,50)) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-5, 5)) + particle:SetGravity(Vector(0, 0, 90)) + particle:SetCollide(true) + particle:SetBounce(0.45) + particle:SetAirResistance(12) + particle:SetColor(255, 255, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/init.lua new file mode 100644 index 0000000..008d74b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/init.lua @@ -0,0 +1,14 @@ +INC_SERVER() + +ENT.NextFlashlightCheck = 0 + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Frost Shade") then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/shared.lua new file mode 100644 index 0000000..baa7c9b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeambience/shared.lua @@ -0,0 +1,17 @@ +ENT.Type = "anim" + +function ENT:SetLastDamaged(time) + self:SetDTFloat(0, time) +end + +function ENT:GetLastDamaged() + return self:GetDTFloat(0) +end + +function ENT:SetLastDamage(damage) + self:SetDTFloat(1, damage) +end + +function ENT:GetLastDamage() + return self:GetDTFloat(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/cl_init.lua new file mode 100644 index 0000000..9651a0c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/cl_init.lua @@ -0,0 +1,95 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +local materialp = {} +materialp["$refractamount"] = 0.02 +materialp["$colortint"] = "[1.0 1.3 1.6]" +materialp["$SilhouetteColor"] = "[2.1 3.5 5.0]" +materialp["$BlurAmount"] = 0.04 +materialp["$SilhouetteThickness"] = 0.05 +materialp["$normalmap"] = "effects/combineshield/comshieldwall" +function ENT:OnInitialize() + hook.Add("Move", self, self.Move) + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 80)) + + local owner = self:GetOwner() + if owner:IsValid() then + owner.ShadeShield = self + end + + self:EmitSound("physics/glass/glass_impact_bullet4.wav", 70, 75) + + self.AmbientSound = CreateSound(self, "vehicles/fast_windloop1.wav") + self.ShieldMaterial = CreateMaterial("shadeshield" .. self:EntIndex(), "Aftershock_dx9", materialp) +end + +function ENT:Think() + local curtime = CurTime() + + if self:GetStateEndTime() <= curtime and self:GetState() == 0 then + self.AmbientSound:PlayEx(0.8, 100) + + if curtime >= self.NextEmit then + self.NextEmit = curtime + 0.05 + + local pos = self:WorldSpaceCenter() + pos.z = pos.z + 8 + local owner = self:GetOwner() + local emitter = ParticleEmitter(pos) + local handpos = owner:GetAttachment(owner:LookupAttachment("anim_attachment_RH")).Pos + emitter:SetNearClip(16, 24) + + local particle = emitter:Add("sprites/glow04_noz", handpos) + local dir = (pos - handpos + (VectorRand() * 2)):GetNormalized() + particle:SetVelocity(dir * math.Rand(120, 125)) + particle:SetDieTime(math.Rand(0.25, 0.27)) + particle:SetStartAlpha(math.Rand(230, 250)) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(12, 14)) + particle:SetColor(0, 140, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + elseif self:GetState() == 1 then + self.AmbientSound:Stop() + end +end + +local matWhite = Material("models/debug/debugwhite") +function ENT:DrawTranslucent() + local curtime = CurTime() + local diff = self:GetStateEndTime() - curtime + local scalar = self:GetState() == 1 and diff or 0.5 - diff + local scale = math.Clamp((scalar ^ 2)/0.25, 0, 1) + + local red = 1 - self:GetObjectHealth()/self:GetMaxObjectHealth() + render.SetColorModulation(red, 0.7 * (1 - red), 1 - red) + local blend = 0.3 + math.abs(math.cos(CurTime())) ^ 2 * 0.1 + render.SetBlend(blend * scale) + render.SuppressEngineLighting(true) + render.ModelMaterialOverride(matWhite) + + self:DrawModel() + + render.SetColorModulation(1, 1, 1) + render.SuppressEngineLighting(false) + render.ModelMaterialOverride() + render.SetBlend(1) + + if render.SupportsPixelShaders_2_0() then + self.ShieldMaterial:SetFloat("$refractamount", 0.01 * scale) + self.ShieldMaterial:SetFloat("$BlurAmount", 0.01 * scale) + render.UpdateRefractTexture() + + render.ModelMaterialOverride(self.ShieldMaterial) + nodraw = true + self:DrawModel() + nodraw = false + render.ModelMaterialOverride(0) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/init.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/init.lua new file mode 100644 index 0000000..5c3376c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/init.lua @@ -0,0 +1,55 @@ +INC_SERVER() + +function ENT:Think() + local fCurTime = CurTime() + local owner = self:GetOwner() + + if owner:IsValid() then + if self:GetStateEndTime() <= fCurTime and self:GetState() == 1 or not owner:Alive() or owner:Team() ~= TEAM_UNDEAD or self.Destroyed then + local extraduration = (1 - self:GetObjectHealth()/self:GetMaxObjectHealth()) * 10 + owner.NextShield = fCurTime + (self.Destroyed and 12 or (2 + extraduration)) + self:Remove() + return + elseif self:GetStateEndTime() <= fCurTime and self:GetState() == 0 and not self.Constructed then + self:PhysicsInit(SOLID_VPHYSICS) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:EmitSound("physics/glass/glass_impact_bullet3.wav", 70, 75) + self.Constructed = true + end + + if self:GetState() == 1 and self.Constructed then + self:PhysicsInit(SOLID_NONE) + self:EmitSound("physics/glass/glass_pottery_break4.wav", 70, 110) + + self.Constructed = false + end + + if fCurTime >= self.NextHeal and self.DamageTaken ~= 150 then + self.NextHeal = fCurTime + 0.4 + + if self:GetObjectHealth() < self:GetMaxObjectHealth() then + self:SetObjectHealth(math.min(self:GetObjectHealth() + 15, self:GetMaxObjectHealth())) + end + end + + if fCurTime >= self.NextDamageSet then + self.NextDamageSet = fCurTime + 1 + self.DamageTaken = 0 + end + + self:SetPos(LerpVector(0.1, self:GetPos(), owner:GetPos() + owner:GetForward() * 40)) + local angs = owner:GetAngles() + angs:RotateAroundAxis(self:GetUp(), 135) + self:SetAngles(LerpAngle(0.2, self:GetAngles(), angs)) + else + self:Remove() + end + + self:NextThink(fCurTime) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/shared.lua new file mode 100644 index 0000000..0ab8175 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_frostshadeshield/shared.lua @@ -0,0 +1,30 @@ +ENT.Base = "status_shadeshield" + +function ENT:SetObjectHealth(health) + self:SetDTFloat(1, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if SERVER then + local effectdata = EffectData() + effectdata:SetOrigin(self:WorldSpaceCenter()) + effectdata:SetNormal(self:GetUp()) + util.Effect("hit_ice", effectdata) + + local owner = self:GetOwner() + local pos = self:LocalToWorld(self:OBBCenter()) + for _, ent in pairs(util.BlastAlloc(self, owner, pos, 128)) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + ent:GiveStatus("frost", 7) + ent:AddLegDamageExt(18, owner, self, SLOWTYPE_COLD) + end + end + + owner:GodEnable() + util.BlastDamageEx(self, owner, pos, 128, 30, DMG_GENERIC) + owner:GodDisable() + util.ScreenShake(self:GetPos(), 15, 5, 1.5, 800) + self:EmitSound("physics/glass/glass_largesheet_break"..math.random(1, 3)..".wav", 85) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate.lua new file mode 100644 index 0000000..6a19e83 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/Items/item_item_crate.mdl") +ENT.GhostRotation = Angle(270, 0, 0) +ENT.GhostHitNormalOffset = 0 +ENT.GhostEntity = "prop_arsenalcrate" +ENT.GhostWeapon = "weapon_zs_arsenalcrate" +ENT.GhostDistance = 128 +ENT.GhostLimitedNormal = 0.75 diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/cl_init.lua deleted file mode 100644 index c787a7b..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/cl_init.lua +++ /dev/null @@ -1,29 +0,0 @@ -include("shared.lua") - -ENT.RenderGroup = RENDERGROUP_TRANSLUCENT - -function ENT:Think() - self:RecalculateValidity() - - self:NextThink(CurTime()) - return true -end - -function ENT:DrawTranslucent() - cam.Start3D(EyePos(), EyeAngles()) - render.SuppressEngineLighting(true) - if self:GetValidPlacement() then - render.SetBlend(0.75) - render.SetColorModulation(0, 1, 0) - else - render.SetBlend(0.5) - render.SetColorModulation(1, 0, 0) - end - - self:DrawModel() - - render.SetBlend(1) - render.SetColorModulation(1, 1, 1) - render.SuppressEngineLighting(false) - cam.End3D() -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/init.lua deleted file mode 100644 index 8ef309e..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/init.lua +++ /dev/null @@ -1,13 +0,0 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") - -function ENT:Think() - self:RecalculateValidity() - - local owner = self:GetOwner() - if not (owner:IsValid() and owner:GetActiveWeapon():IsValid() and owner:GetActiveWeapon():GetClass() == "weapon_zs_arsenalcrate") then - self:Remove() - end -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/shared.lua deleted file mode 100644 index e13ce1d..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_arsenalcrate/shared.lua +++ /dev/null @@ -1,87 +0,0 @@ -ENT.Type = "anim" -ENT.Base = "status__base" - -ENT.Model = Model("models/Items/item_item_crate.mdl") - -function ENT:Initialize() - self:DrawShadow(false) - self:SetMaterial("models/wireframe") - self:SetModel(self.Model) - - self:RecalculateValidity() -end - -function ENT:IsInsideProp() - for _, ent in pairs(ents.FindInBox(self:WorldSpaceAABB())) do - if ent and ent ~= self and ent:IsValid() and ent:GetMoveType() == MOVETYPE_VPHYSICS and ent:GetSolid() > 0 then return true end - end - - return false -end - -function ENT:RecalculateValidity() - local owner = self:GetOwner() - if not owner:IsValid() then return end - - if SERVER or MySelf == owner then - self:SetRotation(math.NormalizeAngle(owner:GetInfoNum("_zs_ghostrotation", 0))) - end - - local rotation = self:GetRotation() - local eyeangles = owner:EyeAngles() - local shootpos = owner:GetShootPos() - local tr = util.TraceLine({start = shootpos, endpos = shootpos + owner:GetAimVector() * 48, mask = MASK_SOLID, filter = owner}) - - if tr.HitWorld and not tr.HitSky and tr.HitNormal.z >= 0.75 then - eyeangles = tr.HitNormal:Angle() - eyeangles:RotateAroundAxis(eyeangles:Right(), 270) - - local valid = true - if self:IsInsideProp() then - valid = false - else - for _, ent in pairs(ents.FindInSphere(tr.HitPos, 128)) do - if ent and ent:IsValid() and ent:GetClass() == "prop_arsenalcrate" then - valid = false - break - end - end - end - - if valid and SERVER and GAMEMODE:EntityWouldBlockSpawn(self) then - valid = false - end - - self:SetValidPlacement(valid) - else - self:SetValidPlacement(false) - end - - if tr.HitNormal.z >= 0.75 then - eyeangles:RotateAroundAxis(eyeangles:Up(), owner:GetAngles().yaw + rotation) - else - eyeangles:RotateAroundAxis(eyeangles:Up(), rotation) - end - - local pos, ang = tr.HitPos, eyeangles - self:SetPos(pos) - self:SetAngles(ang) - - return pos, ang -end - -function ENT:GetValidPlacement() - return self:GetDTBool(0) -end - -function ENT:SetValidPlacement(onoff) - self:SetDTBool(0, onoff) -end - -function ENT:GetRotation() - return self:GetDTFloat(0) -end - -function ENT:SetRotation(rotation) - self:SetDTFloat(0, rotation) -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/cl_init.lua index c787a7b..9e1762d 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/init.lua index 864fd6b..1b4b71f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Think() self:RecalculateValidity() diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/shared.lua index 452183b..e0c29cb 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_barricadekit/shared.lua @@ -11,6 +11,22 @@ function ENT:Initialize() self:RecalculateValidity() end +function ENT:IsInsideProp() + --for _, ent in pairs(ents.FindInBox(self:WorldSpaceAABB())) do + + local mycenter = self:WorldSpaceCenter() + for _, ent in pairs(ents.FindInSphere(mycenter, self:BoundingRadius())) do + if ent and ent ~= self and ent:IsValid() and ent:GetMoveType() == MOVETYPE_VPHYSICS and ent:GetSolid() > 0 then + local nearest = ent:NearestPoint(mycenter) + if self:NearestPoint(nearest):DistToSqr(nearest) <= 144 then + return true + end + end + end + + return false +end + function ENT:RecalculateValidity() local owner = self:GetOwner() if not owner:IsValid() then @@ -25,34 +41,39 @@ function ENT:RecalculateValidity() local rotation = self:GetRotation() local eyeangles = owner:EyeAngles() local shootpos = owner:GetShootPos() - local tr = util.TraceLine({start = shootpos, endpos = shootpos + owner:GetAimVector() * 32, mask = MASK_SOLID, filter = owner}) + local tr = util.TraceLine({start = shootpos, endpos = shootpos + owner:GetAimVector() * 44, mask = MASK_SOLID_BRUSHONLY, filter = owner}) local valid = false if tr.HitWorld and not tr.HitSky then eyeangles = tr.HitNormal:Angle() eyeangles:RotateAroundAxis(eyeangles:Right(), 180) + eyeangles:RotateAroundAxis(eyeangles:Forward(), rotation) valid = true else - local vRight = eyeangles:Right() * self:BoundingRadius() - local trRight = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos + vRight, mask = MASK_SOLID, filter = owner}) - local trLeft = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos - vRight, mask = MASK_SOLID, filter = owner}) + eyeangles:RotateAroundAxis(eyeangles:Forward(), rotation) + + local vUp = eyeangles:Up() * self:BoundingRadius() + local trRight = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos + vUp, mask = MASK_SOLID, filter = owner}) + local trLeft = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos - vUp, mask = MASK_SOLID, filter = owner}) valid = trLeft.HitWorld and trRight.HitWorld and not trLeft.HitSky and not trRight.HitSky end - eyeangles:RotateAroundAxis(eyeangles:Forward(), rotation) - local pos, ang = tr.HitPos + tr.HitNormal, eyeangles - if CLIENT then + --if CLIENT then self:SetPos(pos) self:SetAngles(ang) - end + --end if valid and SERVER and GAMEMODE:EntityWouldBlockSpawn(self) then valid = false end + --[[if valid and self:IsInsideProp() then + valid = false + end]] + self:SetValidPlacement(valid) return pos, ang diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/cl_init.lua index dd25212..e6debc8 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT @@ -9,10 +9,14 @@ function ENT:Think() return true end +local colValid = Color(50, 255, 50, 50) +local colInvalid = Color(255, 50, 50, 50) function ENT:DrawTranslucent() + local validp = self:GetValidPlacement() + cam.Start3D(EyePos(), EyeAngles()) render.SuppressEngineLighting(true) - if self:GetValidPlacement() then + if validp then render.SetBlend(0.75) render.SetColorModulation(0, 1, 0) else @@ -20,6 +24,16 @@ function ENT:DrawTranslucent() render.SetColorModulation(1, 0, 0) end + if self.GhostArrow then + local angs = self:GetAngles() + angs:RotateAroundAxis(self:GetRight(), self.GhostArrowUp and 270 or 0) + + cam.Start3D2D(self:WorldSpaceCenter(), angs, 0.2) + surface.SetDrawColor(validp and colValid or colInvalid) + surface.DrawRect( 0, -1, 128, 2 ) + cam.End3D2D() + end + self:DrawModel() render.SetBlend(1) diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/init.lua index 990bb97..c76fbb9 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Think() self:RecalculateValidity() @@ -10,4 +7,7 @@ function ENT:Think() if not (owner:IsValid() and owner:GetActiveWeapon():IsValid() and owner:GetActiveWeapon():GetClass() == self.GhostWeapon) then self:Remove() end + + self:NextThink(CurTime()) + return true end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/shared.lua index 3ed5b66..226ef44 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_base/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_base/shared.lua @@ -11,15 +11,24 @@ ENT.GhostRotateFunction = "Up" function ENT:Initialize() self:DrawShadow(false) - self:SetMaterial("models/wireframe") --self:SetMaterial("models/debug/debugwhite") + self:SetMaterial("models/wireframe") self:SetModel(self.GhostModel) + self:SetModelScale(self.GhostScale or 1) self:RecalculateValidity() end function ENT:IsInsideProp() - for _, ent in pairs(ents.FindInBox(self:WorldSpaceAABB())) do - if ent and ent ~= self and ent:IsValid() and ent:GetMoveType() == MOVETYPE_VPHYSICS and ent:GetSolid() > 0 then return true end + if self.GhostNotBarricadeProp then return false end + + local mycenter = self:WorldSpaceCenter() + for _, ent in pairs(ents.FindInSphere(mycenter, self:BoundingRadius())) do + if ent and ent ~= self and ent:IsValid() and ent:GetMoveType() == MOVETYPE_VPHYSICS and ent:GetSolid() > 0 then + local nearest = ent:NearestPoint(mycenter) + if self:NearestPoint(nearest):DistToSqr(nearest) <= 144 then + return true + end + end end return false @@ -38,7 +47,7 @@ function ENT:RecalculateValidity() local eyeangles = owner:EyeAngles() local shootpos = owner:GetShootPos() local entity - local tr = util.TraceLine({start = shootpos, endpos = shootpos + owner:GetAimVector() * 48, mask = MASK_SOLID, filter = owner}) + local tr = util.TraceLine({start = shootpos, endpos = shootpos + owner:GetAimVector() * 48, mask = MASK_SOLID_BRUSHONLY, filter = owner}) if tr.HitWorld and not tr.HitSky or tr.HitNonWorld and self.GhostPlaceOnEntities then if self.GhostHitNormalOffset then @@ -52,13 +61,20 @@ function ENT:RecalculateValidity() eyeangles:RotateAroundAxis(eyeangles:Forward(), rot.roll) local valid = true - if self.GhostLimitedNormal and tr.HitNormal.z < self.GhostLimitedNormal or self:IsInsideProp() then + if self.GhostLimitedNormal and tr.HitNormal.z < self.GhostLimitedNormal then valid = false elseif self.GhostDistance then for _, ent in pairs(ents.FindInSphere(tr.HitPos, self.GhostDistance)) do - if ent and ent:IsValid() and ent:GetClass() == self.GhostEntity then - valid = false - break + if ent and ent:IsValid() then + if self.GhostEntityWildCard then + if self.GhostEntityWildCard == ent:GetClass():sub(1, #self.GhostEntityWildCard) then + valid = false + break + end + elseif ent:GetClass() == self.GhostEntity then + valid = false + break + end end end end @@ -82,6 +98,13 @@ function ENT:RecalculateValidity() self:SetValidPlacement(valid) else + local rot = self.GhostNoTraceRot + if rot then + eyeangles:RotateAroundAxis(eyeangles:Right(), rot.pitch) + eyeangles:RotateAroundAxis(eyeangles:Up(), rot.yaw) + eyeangles:RotateAroundAxis(eyeangles:Forward(), rot.roll) + end + self:SetValidPlacement(false) end @@ -95,6 +118,10 @@ function ENT:RecalculateValidity() self:SetPos(pos) self:SetAngles(ang) + if self:GetValidPlacement() and self:IsInsideProp() then + self:SetValidPlacement(false) + end + return pos, ang, entity end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_camera.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_camera.lua new file mode 100644 index 0000000..27f4b1d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_camera.lua @@ -0,0 +1,15 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/props_c17/light_domelight02_off.mdl") +ENT.GhostRotation = Angle(90, 0, 0) +ENT.GhostNoTraceRot = Angle(270, 0, 0) +ENT.GhostHitNormalOffset = 0 +ENT.GhostEntity = "prop_camera" +ENT.GhostWeapon = "weapon_zs_camera" +ENT.GhostFlatGround = false +ENT.GhostDistance = 32 +ENT.GhostArrow = true +ENT.GhostArrowUp = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_ffemitter.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_ffemitter.lua index 3a152f0..0a7bb47 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_ffemitter.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_ffemitter.lua @@ -5,8 +5,12 @@ ENT.Base = "status_ghost_base" ENT.GhostModel = Model("models/props_lab/lab_flourescentlight002b.mdl") ENT.GhostRotation = Angle(0, 0, 0) +ENT.GhostNoTraceRot = Angle(90, 0, 0) ENT.GhostEntity = "prop_ffemitter" ENT.GhostWeapon = "weapon_zs_ffemitter" -ENT.GhostDistance = 80 +ENT.GhostDistance = 70 ENT.GhostHitNormalOffset = 2.9 ENT.GhostRotateFunction = "Forward" +ENT.GhostNotBarricadeProp = true +ENT.GhostArrow = true +ENT.GhostArrowUp = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret.lua index 55bab8c..027ca0f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret.lua @@ -7,4 +7,7 @@ ENT.GhostModel = Model("models/Combine_turrets/Floor_turret.mdl") ENT.GhostRotation = Angle(270, 0, 0) ENT.GhostEntity = "prop_gunturret" ENT.GhostWeapon = "weapon_zs_gunturret" -ENT.GhostDistance = 140 +ENT.GhostDistance = 130 +ENT.GhostFlatGround = false +ENT.GhostEntityWildCard = "prop_gunturret" +ENT.GhostNotBarricadeProp = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_assault.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_assault.lua new file mode 100644 index 0000000..2a4e43b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_assault.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_gunturret" + +ENT.GhostEntity = "prop_gunturret_assault" +ENT.GhostWeapon = "weapon_zs_gunturret_assault" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_buckshot.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_buckshot.lua new file mode 100644 index 0000000..befd1a6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_buckshot.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_gunturret" + +ENT.GhostEntity = "prop_gunturret_buckshot" +ENT.GhostWeapon = "weapon_zs_gunturret_buckshot" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_rocket.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_rocket.lua new file mode 100644 index 0000000..3734d6f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_gunturret_rocket.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_gunturret" + +ENT.GhostEntity = "prop_gunturret_rocket" +ENT.GhostWeapon = "weapon_zs_gunturret_rocket" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/cl_init.lua index add2cf4..c6ad92c 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/init.lua index b53dbfc..f492225 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_messagebeacon/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Think() self:RecalculateValidity() diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_remantler.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_remantler.lua new file mode 100644 index 0000000..aceb4d7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_remantler.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/props_lab/powerbox01a.mdl") +ENT.GhostRotation = Angle(270, 180, 0) +ENT.GhostEntity = "prop_remantler" +ENT.GhostWeapon = "weapon_zs_remantler" +ENT.GhostDistance = 128 +ENT.GhostLimitedNormal = 0.75 +ENT.GhostHitNormalOffset = 23 diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_repairfield.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_repairfield.lua new file mode 100644 index 0000000..9cf88bf --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_repairfield.lua @@ -0,0 +1,14 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/props/de_nuke/smokestack01.mdl") +ENT.GhostRotation = Angle(270, 0, 0) +ENT.GhostEntity = "prop_repairfield" +ENT.GhostWeapon = "weapon_zs_repairfield" +ENT.GhostDistance = 120 +ENT.GhostHitNormalOffset = 12 +ENT.GhostScale = 0.55 +ENT.GhostNotBarricadeProp = true +ENT.GhostEntityWildCard = "prop_repairfield" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_resupplybox.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_resupplybox.lua index 90ed33a..e652431 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ghost_resupplybox.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_resupplybox.lua @@ -5,8 +5,8 @@ ENT.Base = "status_ghost_base" ENT.GhostModel = Model("models/Items/ammocrate_ar2.mdl") ENT.GhostRotation = Angle(270, 0, 0) -ENT.GhostHitNormalOffset = 12 +ENT.GhostHitNormalOffset = 16 ENT.GhostEntity = "prop_resupplybox" ENT.GhostWeapon = "weapon_zs_resupplybox" -ENT.GhostDistance = 64 +ENT.GhostDistance = 256 ENT.GhostLimitedNormal = 0.75 diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_tv.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_tv.lua new file mode 100644 index 0000000..752c9ac --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_tv.lua @@ -0,0 +1,16 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/props_c17/tv_monitor01.mdl") +ENT.GhostRotation = Angle(0, 0, 0) +ENT.GhostNoTraceRot = Angle(0, 180, 0) +ENT.GhostHitNormalOffset = 0 +ENT.GhostEntity = "prop_tv" +ENT.GhostWeapon = "weapon_zs_tv" +ENT.GhostFlatGround = false +ENT.GhostDistance = 32 +ENT.GhostHitNormalOffset = 1 +ENT.GhostArrow = true +ENT.GhostArrowUp = false diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper.lua new file mode 100644 index 0000000..36b8e83 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper.lua @@ -0,0 +1,13 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_base" + +ENT.GhostModel = Model("models/props_c17/utilityconnecter006c.mdl") +ENT.GhostRotation = Angle(270, 0, 0) +ENT.GhostEntity = "prop_zapper" +ENT.GhostWeapon = "weapon_zs_zapper" +ENT.GhostDistance = 120 +ENT.GhostHitNormalOffset = 25 +ENT.GhostNotBarricadeProp = true +ENT.GhostEntityWildCard = "prop_zapper" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper_arc.lua b/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper_arc.lua new file mode 100644 index 0000000..3768a6c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_ghost_zapper_arc.lua @@ -0,0 +1,7 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status_ghost_zapper" + +ENT.GhostEntity = "prop_zapper_arc" +ENT.GhostWeapon = "weapon_zs_zapper_arc" diff --git a/gamemodes/zombiesurvival/entities/entities/status_ghoultouch.lua b/gamemodes/zombiesurvival/entities/entities/status_ghoultouch.lua deleted file mode 100644 index 62595f0..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_ghoultouch.lua +++ /dev/null @@ -1,104 +0,0 @@ -AddCSLuaFile() - -ENT.Type = "anim" -ENT.Base = "status__base" - -ENT.RenderGroup = RENDERGROUP_TRANSLUCENT - -ENT.DamageScale = 1.3 -ENT.LifeTime = 10 - -ENT.Model = Model("models/gibs/HGIBS.mdl") - -function ENT:Initialize() - self.BaseClass.Initialize(self) - - self:SetModel(self.Model) - self:DrawShadow(false) - - if SERVER then - hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) - hook.Add("PlayerHurt", self, self.PlayerHurt) - - self:EmitSound("beams/beamstart5.wav", 65, 140) - end - - if CLIENT then - hook.Add("PrePlayerDraw", self, self.PrePlayerDraw) - hook.Add("PostPlayerDraw", self, self.PostPlayerDraw) - hook.Add("RenderScreenspaceEffects", self, self.RenderScreenspaceEffects) - end - - self.DieTime = CurTime() + self.LifeTime -end - -if SERVER then - function ENT:EntityTakeDamage(ent, dmginfo) - if ent ~= self:GetOwner() then return end - - local attacker = dmginfo:GetAttacker() - if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then - dmginfo:SetDamage(dmginfo:GetDamage() * self.DamageScale) - end - end - - function ENT:PlayerHurt(pl, attacker, healthleft, damage) - if attacker:IsValid() and attacker:IsPlayer() and attacker ~= pl and attacker:Team() == TEAM_UNDEAD then - local attributeddamage = damage - if healthleft < 0 then - attributeddamage = attributeddamage + healthleft - end - - if attributeddamage > 0 then - local myteam = pl:Team() - - attributeddamage = attributeddamage * (self.DamageScale - 1) - - attacker.DamageDealt[myteam] = attacker.DamageDealt[myteam] + attributeddamage - attacker:AddLifeHumanDamage(attributeddamage) - end - end - end -end - -if not CLIENT then return end - -function ENT:DrawTranslucent() - local owner = self:GetOwner() - if not owner:IsValid() then return end - - render.SetColorModulation(1, 0, 0) - render.SetBlend(self:GetPower() * 0.95) - render.SuppressEngineLighting(true) - - self:SetRenderOrigin(owner:GetPos() + Vector(0, 0, owner:OBBMaxs().z + math.abs(math.sin(CurTime() * 2)) * 4)) - self:SetRenderAngles(Angle(0, CurTime() * 270, 0)) - self:DrawModel() - - render.SuppressEngineLighting(false) - render.SetBlend(1) - render.SetColorModulation(1, 1, 1) -end - -function ENT:PrePlayerDraw(pl) - if pl ~= self:GetOwner() then return end - - local r = 1 - math.abs(math.sin((CurTime() + self:EntIndex()) * 3)) * 0.2 - render.SetColorModulation(r, 0.1, 0.1) -end - -function ENT:PostPlayerDraw(pl) - if pl ~= self:GetOwner() then return end - - render.SetColorModulation(1, 1, 1) -end - -function ENT:GetPower() - return math.Clamp(self.DieTime - CurTime(), 0, 1) -end - -function ENT:RenderScreenspaceEffects() - if LocalPlayer() ~= self:GetOwner() then return end - - DrawMotionBlur(0.1, self:GetPower() * 0.3, 0.01) -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/cl_init.lua new file mode 100644 index 0000000..ea37bfc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/cl_init.lua @@ -0,0 +1,24 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_NONE + +function ENT:Initialize() + self:DrawShadow(false) + + self.AmbientSound = CreateSound(self, "npc/fast_zombie/gurgle_loop1.wav") + self.AmbientSound:PlayEx(0.55, 110) +end + +function ENT:OnRemove() + self.AmbientSound:Stop() +end + +function ENT:Think() + local owner = self:GetOwner() + if owner:IsValid() then + self.AmbientSound:PlayEx(0.6, 50 + math.Rand(-15, 15) + math.sin(RealTime() * 4) * 10) + end +end + +function ENT:Draw() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/init.lua new file mode 100644 index 0000000..900441d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "The Grave Digger") then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_gravediggerambience/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/cl_init.lua index 9cca3ce..a2becda 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/init.lua b/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/init.lua index bc0196b..163a652 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_headcrabcouple/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer.m_Couple = self diff --git a/gamemodes/zombiesurvival/entities/entities/status_healdartboost.lua b/gamemodes/zombiesurvival/entities/entities/status_healdartboost.lua index 4d1946b..71087c0 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_healdartboost.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_healdartboost.lua @@ -3,6 +3,26 @@ AddCSLuaFile() ENT.Type = "anim" ENT.Base = "status__base" +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +if SERVER then + function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end + end +end + function ENT:Initialize() self.BaseClass.Initialize(self) diff --git a/gamemodes/zombiesurvival/entities/entities/status_human_holding/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_human_holding/cl_init.lua index fbc32bb..32340f4 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_human_holding/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_human_holding/cl_init.lua @@ -1,10 +1,17 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_TRANSLUCENT ENT.AnimTime = 0.25 function ENT:OnRemove() + local object = self:GetObject() + if object:IsValid() then + object.IgnoreMelee = nil + object.IgnoreTraces = nil + object.IgnoreBullets = nil + end + local owner = self:GetOwner() if owner == MySelf then if self.Rotating then @@ -27,6 +34,13 @@ end function ENT:Initialize() hook.Add("Move", self, self.Move) + local object = self:GetObject() + if object:IsValid() then + object.IgnoreMelee = true + object.IgnoreTraces = true + object.IgnoreBullets = true + end + self.Created = CurTime() if not self.NoHolster then diff --git a/gamemodes/zombiesurvival/entities/entities/status_human_holding/init.lua b/gamemodes/zombiesurvival/entities/entities/status_human_holding/init.lua index 8789f61..e62c9cb 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_human_holding/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_human_holding/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() hook.Add("Move", self, self.Move) @@ -34,12 +31,22 @@ function ENT:Initialize() local object = self:GetObject() if object:IsValid() then + object.IgnoreMeleeTeam = TEAM_HUMAN + object.IgnoreTraces = true + object.IgnoreBullets = true + for _, ent in pairs(ents.FindByClass("logic_pickupdrop")) do if ent.EntityToWatch == object:GetName() and ent:IsValid() then ent:Input("onpickedup", owner, object, "") end end + for _, ent in pairs(ents.FindByClass("point_propnocollide")) do + if ent:IsValid() and ent:GetProp() == object then + ent:Remove() + end + end + local objectphys = object:GetPhysicsObject() if objectphys:IsValid() then objectphys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) @@ -47,17 +54,39 @@ function ENT:Initialize() self:SetObjectMass(objectphys:GetMass()) - if owner.BuffMuscular or (objectphys:GetMass() < CARRY_DRAG_MASS and (object:OBBMins():Length() + object:OBBMaxs():Length() < CARRY_DRAG_VOLUME or object.NoVolumeCarryCheck)) then - objectphys:AddGameFlag(FVPHYSICS_PLAYER_HELD) - object._OriginalMass = objectphys:GetMass() + object.PreHoldCollisionGroup = object.PreHoldCollisionGroup or object:GetCollisionGroup() + object.PreHoldAlpha = object.PreHoldAlpha or object:GetAlpha() + object.PreHoldRenderMode = object.PreHoldRenderMode or object:GetRenderMode() - objectphys:EnableGravity(false) - objectphys:SetMass(2) + objectphys:AddGameFlag(FVPHYSICS_PLAYER_HELD) + object._OriginalMass = objectphys:GetMass() - object:SetOwner(owner) - else - self:SetIsHeavy(true) - self:SetHingePos(object:NearestPoint(self:GetPullPos())) + objectphys:EnableGravity(false) + objectphys:SetMass(2) + + object:SetOwner(owner) + object:SetCollisionGroup(COLLISION_GROUP_WEAPON) + object:SetRenderMode(RENDERMODE_TRANSALPHA) + object:SetAlpha(180) + + self.StartX = owner.InputMouseX or 0 + self.StartY = owner.InputMouseY or 0 + + local children = object:GetChildren() + for _, child in pairs(children) do + if not child:IsValid() then continue end + + child.PreHoldCollisionGroup = child.PreHoldCollisionGroup or child:GetCollisionGroup() + if child:IsPhysicsModel() then -- Stops child sprites from getting fucked up rendering + child.PreHoldAlpha = child.PreHoldAlpha or child:GetAlpha() + child.PreHoldRenderMode = child.PreHoldRenderMode or child:GetRenderMode() + + child:SetAlpha(180) + child:SetRenderMode(RENDERMODE_TRANSALPHA) + end + + child:SetCollisionGroup(COLLISION_GROUP_WEAPON) + child:CollisionRulesChanged() end object:CollisionRulesChanged() @@ -65,7 +94,24 @@ function ENT:Initialize() end end +local function DoubleCheck(object) + if not IsValid(object) then return end + + for _, status in pairs(ents.FindByClass("status_human_holding")) do + if status:IsValid() and not status.Removing and status:GetObject() == object then + return + end + end + + object.IgnoreMeleeTeam = nil + object.IgnoreTraces = nil + object.IgnoreBullets = nil +end + function ENT:OnRemove() + if self.Removing then return end + self.Removing = true + local owner = self:GetOwner() if owner:IsValid() then --owner.status_human_holding = nil @@ -82,6 +128,12 @@ function ENT:OnRemove() local object = self:GetObject() if object:IsValid() then + object.IgnoreMelee = nil + object.IgnoreTraces = nil + object.IgnoreBullets = nil + + timer.Simple(0.1, function() DoubleCheck(object) end) + local objectphys = object:GetPhysicsObject() if objectphys:IsValid() then objectphys:ClearGameFlag(FVPHYSICS_PLAYER_HELD) @@ -94,7 +146,24 @@ function ENT:OnRemove() end if not self:GetIsHeavy() then - object:GhostAllPlayersInMe(2.5, true) + if not object:GhostAllPlayersInMe(4, true) then + object:SetCollisionGroup(object.PreHoldCollisionGroup or COLLISION_GROUP_NONE) + end + object:SetAlpha(object.PreHoldAlpha or 255) + object:SetRenderMode(object.PreHoldRenderMode or RENDERMODE_NORMAL) + + local children = object:GetChildren() + for _, child in pairs(children) do + if not child:IsValid() then continue end + + child:SetCollisionGroup(child.PreHoldCollisionGroup or COLLISION_GROUP_NONE) + if child:IsPhysicsModel() then + child:SetAlpha(child.PreHoldAlpha or 255) + child:SetRenderMode(child.PreHoldRenderMode or RENDERMODE_NORMAL) + end + + child:CollisionRulesChanged() + end end object:SetOwner(NULL) @@ -117,8 +186,8 @@ concommand.Add("_zs_rotateang", function(sender, command, arguments) local y = tonumbersafe(arguments[2]) if x and y then - sender.InputMouseX = math.Clamp(x * 0.2, -180, 180) - sender.InputMouseY = math.Clamp(y * 0.2, -180, 180) + sender.InputMouseX = math.NormalizeAngle(x)--sender.InputMouseX + math.Clamp(x * 0.02, -180, 180) + sender.InputMouseY = math.NormalizeAngle(y)--sender.InputMouseY + math.Clamp(y * 0.02, -180, 180) end end) @@ -131,7 +200,7 @@ function ENT:Think() local object = self:GetObject() local owner = self:GetOwner() - if not object:IsValid() or object:IsNailed() or not owner:IsValid() or not owner:Alive() or not owner:Team() == TEAM_HUMAN then + if not object:IsValid() or object:IsNailed() or not owner:IsValid() or not owner:Alive() or owner:Team() ~= TEAM_HUMAN then self:Remove() return end @@ -146,11 +215,11 @@ function ENT:Think() end if self:GetIsHeavy() then - if 64 < self:GetHingePos():Distance(self:GetPullPos()) then + if self:GetHingePos():DistToSqr(self:GetPullPos()) >= 4096 then self:Remove() return end - elseif 64 < nearestpoint:Distance(shootpos) then + elseif nearestpoint:DistToSqr(shootpos) >= 4096 then self:Remove() return end @@ -168,7 +237,7 @@ function ENT:Think() objectphys:ApplyForceOffset(objectphys:GetMass() * frametime * 450 * (pullpos - hingepos):GetNormalized(), hingepos) elseif owner:KeyDown(IN_ATTACK2) and not owner:GetActiveWeapon().NoPropThrowing then owner:ConCommand("-attack2") - objectphys:ApplyForceCenter(objectphys:GetMass() * math.Clamp(1.25 - math.min(1, (object:OBBMins():Length() + object:OBBMaxs():Length()) / CARRY_DRAG_VOLUME), 0.25, 1) * 500 * owner:GetAimVector()) + objectphys:ApplyForceCenter(objectphys:GetMass() * math.Clamp(1.25 - math.min(1, (object:OBBMins():Length() + object:OBBMaxs():Length()) / CARRY_DRAG_VOLUME), 0.25, 1) * 500 * owner:GetAimVector() * (owner.ObjectThrowStrengthMul or 1)) object:SetPhysicsAttacker(owner) self:Remove() @@ -178,7 +247,7 @@ function ENT:Think() local obbcenter = object:OBBCenter() local objectpos = shootpos + owner:GetAimVector() * 48 objectpos = objectpos - obbcenter.z * object:GetUp() - objectpos = objectpos - obbcenter.y * object:GetRight() + objectpos = objectpos + obbcenter.y * object:GetRight() objectpos = objectpos - obbcenter.x * object:GetForward() self.ObjectPosition = objectpos if not self.ObjectAngles then @@ -191,8 +260,16 @@ function ENT:Think() self.ObjectAngles = object:GetAngles() end elseif owner:KeyDown(IN_WALK) then - self.ObjectAngles:RotateAroundAxis(owner:EyeAngles():Up(), owner.InputMouseX or 0) - self.ObjectAngles:RotateAroundAxis(owner:EyeAngles():Right(), owner.InputMouseY or 0) + local xdiff = math.NormalizeAngle(self.StartX - (owner.InputMouseX or 0)) + local ydiff = math.NormalizeAngle(self.StartY - (owner.InputMouseY or 0)) + local sxdiff = xdiff * FrameTime() * 8 + local sydiff = ydiff * FrameTime() * 8 + + self.ObjectAngles:RotateAroundAxis(owner:GetUp(), sxdiff) + self.ObjectAngles:RotateAroundAxis(owner:GetRight(), sydiff) + + self.StartX = math.NormalizeAngle(self.StartX - (sxdiff)) + self.StartY = math.NormalizeAngle(self.StartY - (sydiff)) end ShadowParams.pos = self.ObjectPosition @@ -202,6 +279,7 @@ function ENT:Think() end object:SetPhysicsAttacker(owner) + object.LastHeld = CurTime() self:NextThink(ct) return true diff --git a/gamemodes/zombiesurvival/entities/entities/status_human_holding/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_human_holding/shared.lua index 79df7f6..2d62131 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_human_holding/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_human_holding/shared.lua @@ -10,7 +10,10 @@ function ENT:Move(pl, mv) if object:IsValid() then --local objectphys = object:GetPhysicsObject() --if objectphys:IsValid() then - mv:SetMaxSpeed(math.max(mv:GetMaxSpeed() / 4, mv:GetMaxSpeed() - self:GetObjectMass() * CARRY_SPEEDLOSS_PERKG)) + mv:SetMaxSpeed(math.max( + mv:GetMaxSpeed() / 4, + mv:GetMaxSpeed() - self:GetObjectMass() * CARRY_SPEEDLOSS_PERKG * pl.PropCarrySlowMul) + ) mv:SetMaxClientSpeed(mv:GetMaxSpeed()) --end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_knockdown/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_knockdown/cl_init.lua index 5f6cc13..c59bc1f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_knockdown/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_knockdown/cl_init.lua @@ -1,21 +1,42 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() + hook.Add("CreateMove", self, self.CreateMove) + self:DrawShadow(false) self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 80)) local owner = self:GetOwner() + if owner:IsValid() then + owner[self:GetClass()] = self + + self.CommandYaw = owner:GetAngles().yaw + end if owner:IsPlayer() then owner.KnockedDown = self owner:SetNoDraw(true) end end +function ENT:CreateMove(cmd) + if MySelf ~= self:GetOwner() then return end + + local ang = cmd:GetViewAngles() + ang.yaw = self.CommandYaw or ang.yaw + cmd:SetViewAngles(ang) + + cmd:ClearButtons(0) + cmd:ClearMovement() +end + function ENT:OnRemove() local owner = self:GetOwner() if owner:IsValid() then owner.KnockedDown = nil owner:SetNoDraw(false) + if owner[self:GetClass()] == self then + owner[self:GetClass()] = nil + end end end @@ -25,7 +46,7 @@ function ENT:Think() if owner:IsValid() and 0 < owner:Health() then local rag = owner:GetRagdollEntity() if rag and rag:IsValid() then - local endtime = self:GetDTFloat(0) + local endtime = self:GetDTFloat(1) if endtime - 0.65 <= ct then local delta = math.max(0.01, endtime - ct) for i = 0, rag:GetPhysicsObjectCount() do diff --git a/gamemodes/zombiesurvival/entities/entities/status_knockdown/init.lua b/gamemodes/zombiesurvival/entities/entities/status_knockdown/init.lua index 11ca7e2..855b2c5 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_knockdown/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_knockdown/init.lua @@ -1,16 +1,29 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end function ENT:PlayerSet(pPlayer, bExists) + self:SetStartTime(CurTime()) + pPlayer.KnockedDown = self - pPlayer:Freeze(true) + --pPlayer:Freeze(true) pPlayer:DrawWorldModel(false) pPlayer:DrawViewModel(false) - self:SetDTFloat(0, self.DieTime) + local lifetime = self.DieTime - CurTime() + self.DieTime = CurTime() + lifetime * (pPlayer.KnockdownRecoveryMul or 1) + self:SetDTFloat(1, self.DieTime) + if not bExists then pPlayer:CreateRagdoll() end @@ -19,7 +32,7 @@ end function ENT:OnRemove() local parent = self:GetParent() if parent:IsValid() then - parent:Freeze(false) + --parent:Freeze(false) parent.KnockedDown = nil if parent:Alive() then diff --git a/gamemodes/zombiesurvival/entities/entities/status_knockdown/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_knockdown/shared.lua index 2f44d2c..6dae532 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_knockdown/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_knockdown/shared.lua @@ -1,2 +1,7 @@ ENT.Type = "anim" ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) diff --git a/gamemodes/zombiesurvival/entities/entities/status_magnet.lua b/gamemodes/zombiesurvival/entities/entities/status_magnet.lua new file mode 100644 index 0000000..cdb558e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_magnet.lua @@ -0,0 +1,47 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Radius = 400 + +if CLIENT then return end + +ENT.Classes = table.ToAssoc( + {"prop_ammo", "prop_invitem", "prop_weapon"} +) +ENT.Force = 50 +ENT.ForceDelay = 0.25 + +function ENT:Think() + local owner = self:GetOwner() + + if owner:Team() == TEAM_UNDEAD then + self:Remove() + return + end + + local activeweapon = owner:GetActiveWeapon() + if not activeweapon:IsValid() or not activeweapon.IsMagnet then return end + + local pos = self:GetPos() + for _, ent in pairs(ents.FindInSphere(pos, self.Radius)) do + local class = ent:GetClass() + local ownsitem = not ent.NoPickupsOwner or ent.NoPickupsOwner == owner + local droppedrecent = not ent.DroppedTime or ent.DroppedTime + 4 < CurTime() + + if ent and ent:IsValid() and self.Classes[class] and WorldVisible(pos, ent:NearestPoint(pos)) and droppedrecent and ownsitem then + local phys = ent:GetPhysicsObject() + local dir = (pos - ent:NearestPoint(pos)):GetNormalized() + phys:ApplyForceCenter(phys:GetMass() * self.Force * dir) + ent:SetPhysicsAttacker(owner, 4) + + if (ent:GetPos() - pos):LengthSqr() <= 5600 and ent.GiveToActivator then + ent:GiveToActivator(owner) + end + end + end + + self:NextThink(CurTime() + self.ForceDelay) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_magnet_electro.lua b/gamemodes/zombiesurvival/entities/entities/status_magnet_electro.lua new file mode 100644 index 0000000..19197c4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_magnet_electro.lua @@ -0,0 +1,9 @@ +AddCSLuaFile() + +ENT.Base = "status_magnet" +ENT.Radius = 650 + +if CLIENT then return end + +ENT.Force = 120 +ENT.ForceDelay = 0.2 diff --git a/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/cl_init.lua new file mode 100644 index 0000000..787996a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/cl_init.lua @@ -0,0 +1,35 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.5 + + local pos = owner:WorldSpaceCenter() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i = 1, 2 do + particle = emitter:Add("sprites/light_glow02_add", pos + VectorRand() * 12) + particle:SetDieTime(math.Rand(1.1, 1.2)) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetGravity(Vector(0, 0, 75)) + particle:SetAirResistance(300) + particle:SetStartLength(1) + particle:SetEndLength(35) + particle:SetColor(80, 190, 250) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/init.lua b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/init.lua new file mode 100644 index 0000000..1ac4912 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/init.lua @@ -0,0 +1,34 @@ +INC_SERVER() + +if SERVER then + function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end + end +end + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if ent ~= self:GetOwner() then return end + + if attacker:IsValidZombie() then + local protect = 0.3 + + local dmgfraction = dmginfo:GetDamage() * protect + dmginfo:SetDamage(dmginfo:GetDamage() * (1 - protect)) + + local hpperpoint = GAMEMODE.MedkitPointsPerHealth + local points = (dmgfraction / hpperpoint) * 1.5 + + if self.Applier and self.Applier:IsValidLivingHuman() then + self.Applier.DefenceDamage = (applier.DefenceDamage or 0) + dmgfraction + self.Applier:AddPoints(points) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/shared.lua new file mode 100644 index 0000000..2a6c24e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_medrifledefboost/shared.lua @@ -0,0 +1,24 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + + self:SetDTInt(1, 0) + end + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/cl_init.lua index 0f82f63..174633f 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/cl_init.lua @@ -1,12 +1,12 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE function ENT:Initialize() self:DrawShadow(false) - self.AmbientSound = CreateSound(self, "npc/antlion_guard/growl_idle.wav") - self.AmbientSound:PlayEx(0.55, 110) + self.AmbientSound = CreateSound(self, "zombiesurvival/nightmare_ambiance.ogg") + self.AmbientSound:PlayEx(0.8, 100) end function ENT:OnRemove() @@ -14,15 +14,15 @@ function ENT:OnRemove() end function ENT:Think() - owner = self:GetOwner() + --[[owner = self:GetOwner() if owner:IsValid() then local wep = owner:GetActiveWeapon() if wep:IsValid() and wep.IsSwinging and wep:IsSwinging() then self.AmbientSound:Stop() - else - self.AmbientSound:PlayEx(0.55, 110 + math.sin(RealTime())) - end - end + else]] + --self.AmbientSound:PlayEx(0.8, 100 + RealTime() % 0.1) + --[[end + end]] end function ENT:Draw() diff --git a/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/init.lua index 9afd15d..3579407 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_nightmareambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -9,5 +6,6 @@ end function ENT:Think() local owner = self:GetOwner() - if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "The Tickle Monster") then self:Remove() end + local classname = owner:GetZombieClassTable().Name + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and (classname == "Nightmare" or classname == "Ancient Nightmare")) then self:Remove() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_overridemodel.lua b/gamemodes/zombiesurvival/entities/entities/status_overridemodel.lua index 895bcaf..53e8c51 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_overridemodel.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_overridemodel.lua @@ -2,26 +2,32 @@ AddCSLuaFile() ENT.Type = "anim" ENT.Base = "status__base" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT function ENT:Initialize() self:SetSolid(SOLID_NONE) self:SetMoveType(MOVETYPE_NONE) self:AddEffects(bit.bor(EF_BONEMERGE, EF_BONEMERGE_FASTCULL, EF_PARENT_ANIMATES)) + self:SetRenderMode(RENDERMODE_TRANSALPHA) local pPlayer = self:GetOwner() if pPlayer:IsValid() then pPlayer.status_overridemodel = self - pPlayer:SetRenderMode(RENDERMODE_NONE) + if SERVER and pPlayer:Team() ~= TEAM_UNDEAD or not pPlayer:GetZombieClassTable().NoHideMainModel then + pPlayer:SetRenderMode(RENDERMODE_NONE) + end end end function ENT:PlayerSet(pPlayer, bExists) - pPlayer:SetRenderMode(RENDERMODE_NONE) + if SERVER and pPlayer:Team() ~= TEAM_UNDEAD or not pPlayer:GetZombieClassTable().NoHideMainModel then + pPlayer:SetRenderMode(RENDERMODE_NONE) + end end function ENT:OnRemove() local pPlayer = self:GetOwner() - if pPlayer:IsValid() then + if SERVER and pPlayer:IsValid() then pPlayer:SetRenderMode(RENDERMODE_NORMAL) end end @@ -32,11 +38,29 @@ end if CLIENT then function ENT:Draw() local owner = self:GetOwner() - if owner:IsValid() and owner:Alive() then - local col = owner:GetColor() - col.a = 255 - self:SetColor(col) - self:DrawModel() + if owner:IsValid() and (not owner:IsPlayer() or owner:Alive()) then + local pcolor = owner:GetColor() + if owner.SpawnProtection then + pcolor.a = (0.02 + (CurTime() + self:EntIndex() * 0.2) % 0.05) * 255 + pcolor.r = 0 + pcolor.b = 0 + pcolor.g = 255 + render.SuppressEngineLighting(true) + end + self:SetColor(pcolor) + + if not (owner.SpawnProtection and owner:GetZombieClassTable().NoHideMainModel) then + if not owner:CallZombieFunction1("PrePlayerDrawOverrideModel", self) then + self:DrawModel() + + owner:CallZombieFunction1("PostPlayerDrawOverrideModel", self) + end + end + + if owner.SpawnProtection then + render.SuppressEngineLighting(false) + end end end + ENT.DrawTranslucent = ENT.Draw end diff --git a/gamemodes/zombiesurvival/entities/entities/status_oxygentank/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_oxygentank/cl_init.lua index 5c38184..db6e550 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_oxygentank/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_oxygentank/cl_init.lua @@ -1,16 +1,36 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) self:SetModelScale(0.5, 0) + + if self:GetOwner() == MySelf then + self.AmbientSound = CreateSound(self, "player/breathe1.wav") + end +end + +function ENT:Think() + if self.AmbientSound then + if MySelf:WaterLevel() >= 3 then + self.AmbientSound:Play() + else + self.AmbientSound:Stop() + end + end +end + +function ENT:OnRemove() + if self.AmbientSound then + self.AmbientSound:Stop() + end end function ENT:Draw() local owner = self:GetOwner() - if not owner:IsValid() or owner == LocalPlayer() and not owner:ShouldDrawLocalPlayer() then return end + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end local wep = owner:GetActiveWeapon() - if wep:IsValid() and wep:GetClass() == "weapon_zs_oxygentank" then return end + if wep:IsValid() and wep:GetClass() == "weapon_zs_t_oxygentank" then return end local boneid = owner:LookupBone("ValveBiped.Bip01_Spine2") if not boneid or boneid <= 0 then return end @@ -22,5 +42,13 @@ function ENT:Draw() boneang:RotateAroundAxis(boneang:Up(), 180) self:SetAngles(boneang) + if owner.ShadowMan then + render.SetBlend(0.2) + end + self:DrawModel() + + if owner.ShadowMan then + render.SetBlend(1) + end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_oxygentank/init.lua b/gamemodes/zombiesurvival/entities/entities/status_oxygentank/init.lua index a149a8f..f12fed8 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_oxygentank/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_oxygentank/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) @@ -14,5 +11,5 @@ end function ENT:Think() local owner = self:GetOwner() - if not (owner:IsValid() and owner:Alive() and owner:HasWeapon("weapon_zs_oxygentank")) then self:Remove() end + if not (owner:IsValid() and owner:Alive() and owner:HasTrinket("oxygentank")) then self:Remove() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_packup/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_packup/cl_init.lua index 3929a2c..943df16 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_packup/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_packup/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_packup/init.lua b/gamemodes/zombiesurvival/entities/entities/status_packup/init.lua index 9d2b24c..a90d6c7 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_packup/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_packup/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer:EmitSound("items/ammocrate_open.wav") @@ -19,44 +16,56 @@ function ENT:Think() local packer = self:GetOwner() local owner = packer local pack = self:GetPackUpEntity() - if pack:IsValid() and owner:TraceLine(64, MASK_SOLID, owner:GetMeleeFilter()).Entity == pack then - if not self:GetNotOwner() and pack.GetObjectOwner then - local packowner = pack:GetObjectOwner() - if packowner:IsValid() and packowner:Team() == TEAM_HUMAN and packowner ~= packer and not gamemode.Call("PlayerIsAdmin", packer) then - self:SetNotOwner(true) - end - end - if CurTime() >= self:GetEndTime() then - if self:GetNotOwner() then - local count = 0 - for _, ent in pairs(ents.FindByClass("status_packup")) do - if ent:GetPackUpEntity() == pack then - count = count + 1 + if pack:IsValid() then + local eyepos = owner:EyePos() + local aimvec = owner:GetAimVector() + local point = pack:NearestPoint(eyepos) + local dist = point:DistToSqr(eyepos) + if owner:CompensatedMeleeTrace(64, 4, nil, nil, nil, true).Entity == pack or ((dist <= 64 or (point - eyepos):GetNormalized():Dot(aimvec) >= 0.75) and dist <= 4096 and WorldVisible(aimvec, point)) then + if not self:GetNotOwner() and pack.GetObjectOwner then + local packowner = pack:GetObjectOwner() + if packowner:IsValid() and packowner:Team() == TEAM_HUMAN and packowner ~= packer and not gamemode.Call("PlayerIsAdmin", packer) then + self:SetNotOwner(true) + end + end + + if CurTime() >= self:GetEndTime() then + if self:GetNotOwner() then + local count = 0 + for _, ent in pairs(ents.FindByClass("status_packup")) do + if ent:GetPackUpEntity() == pack then + count = count + 1 + end + end + + if count < self.PackUpOverride then + self:NextThink(CurTime()) + return true + end + + if pack.GetObjectOwner then + local objowner = pack:GetObjectOwner() + if objowner:IsValid() and objowner:Team() == TEAM_HUMAN and objowner:IsValid() then + owner = objowner + end end end - if count < self.PackUpOverride then - self:NextThink(CurTime()) - return true - end + if pack.OnPackedUp and not pack:OnPackedUp(owner) then + owner:EmitSound("items/ammocrate_close.wav") + self.Removing = true - if pack.GetObjectOwner then - local objowner = pack:GetObjectOwner() - if objowner:IsValid() and objowner:Team() == TEAM_HUMAN and objowner:IsValid() then - owner = objowner - end + gamemode.Call("ObjectPackedUp", pack, packer, owner) + + self:Remove() end end + else + owner:EmitSound("items/medshotno1.wav") - if pack.OnPackedUp and not pack:OnPackedUp(owner) then - owner:EmitSound("items/ammocrate_close.wav") - self.Removing = true - - gamemode.Call("ObjectPackedUp", pack, packer, owner) - - self:Remove() - end + self:Remove() + self.Removing = true end else owner:EmitSound("items/medshotno1.wav") diff --git a/gamemodes/zombiesurvival/entities/entities/status_patientzero/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_patientzero/cl_init.lua new file mode 100644 index 0000000..bf3fb13 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_patientzero/cl_init.lua @@ -0,0 +1,39 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + local pos = owner:WorldSpaceCenter() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.25 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local dir = (VectorRand() * 20 + Vector(0, 0, 40)):GetNormal() + + for i = 1, 10 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(dir * 120) + particle:SetDieTime(math.Rand(1.1, 1.4)) + particle:SetStartAlpha(150) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(6, 7)) + particle:SetEndSize(12) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-5, 5)) + particle:SetGravity(Vector(0, 0, 25)) + particle:SetCollide(true) + particle:SetBounce(0.45) + particle:SetAirResistance(300) + particle:SetColor(30, 60, 30) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_patientzero/init.lua b/gamemodes/zombiesurvival/entities/entities/status_patientzero/init.lua new file mode 100644 index 0000000..6a79413 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_patientzero/init.lua @@ -0,0 +1,27 @@ +INC_SERVER() + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker == self:GetOwner() and attacker:IsValidLivingZombie() then + local dmg = dmginfo:GetDamage() + local extradamage = dmg * 0.15 + dmginfo:SetDamage(dmg + extradamage) + + if ent:IsValidLivingHuman() and dmg >= 15 and math.random(4) == 1 then + ent:GiveStatus(math.random(2) == 1 and "enfeeble" or "frightened", 5) + end + end + + if ent == self:GetOwner() and attacker:IsValidHuman() then + if bit.band(dmginfo:GetDamageType(), DMG_SLASH) == 0 and bit.band(dmginfo:GetDamageType(), DMG_CLUB) == 0 then + dmginfo:SetDamage(dmginfo:GetDamage() * 0.9) + else + dmginfo:SetDamage(dmginfo:GetDamage() * 1.2) + end + end +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:IsValidLivingZombie() and not owner:GetZombieClassTable().Boss) then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_patientzero/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_patientzero/shared.lua new file mode 100644 index 0000000..3f70394 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_patientzero/shared.lua @@ -0,0 +1,27 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + + self:SetDTInt(1, 0) + end + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end + + hook.Add("Move", self, self.Move) +end + +function ENT:Move(pl, move) + if pl ~= self:GetOwner() then return end + + move:SetMaxSpeed(move:GetMaxSpeed() + 20) + move:SetMaxClientSpeed(move:GetMaxSpeed()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poison/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_poison/cl_init.lua new file mode 100644 index 0000000..a2cf023 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_poison/cl_init.lua @@ -0,0 +1,8 @@ +INC_CLIENT() + +function ENT:Draw() +end + +function ENT:Initialize() + self:GetOwner().Poison = self +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poison/init.lua b/gamemodes/zombiesurvival/entities/entities/status_poison/init.lua new file mode 100644 index 0000000..1945be2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_poison/init.lua @@ -0,0 +1,52 @@ +INC_SERVER() + +function ENT:PlayerSet(pPlayer, bExists) + self.Attackers = {} + + pPlayer.Poison = self + + self:NextThink(CurTime() + 2) +end + +function ENT:Think() + local owner = self:GetOwner() + + if self:GetDamage() <= 0 --[[or owner:Team() ~= TEAM_HUMAN]] then + self:Remove() + return + end + + local attackers = self.Attackers + local damage = math.min(self.DamagePerTick, self:GetDamage()) + local attacker = self + + -- Whoever has the most amount of remaining damage should get this credit. + local mostd = 0 + for a, d in pairs(attackers) do + if a:IsValidZombie() and d > mostd then + attacker = a + mostd = d + end + end + -- Uhhh... just pick the first one in the list then. + if attacker == self then + for a, d in pairs(attackers) do + if a:IsValidZombie() then + attacker = a + break + end + end + end + + owner:EmitSound("player/pl_pain"..math.random(5, 7)..".wav") + self:AddDamage(-damage) + + if attackers[attacker] then + attackers[attacker] = attackers[attacker] - damage + end + + owner:TakeSpecialDamage(damage, DMG_ACID, attacker, self) + + self:NextThink(CurTime() + 2 / (owner.PoisonSpeedMul or 1)) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poison/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_poison/shared.lua new file mode 100644 index 0000000..2a6334a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_poison/shared.lua @@ -0,0 +1,29 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.DamagePerTick = 3 + +ENT.Ephemeral = true + +function ENT:Initialize() + self:DrawShadow(false) + if self:GetDTFloat(1) == 0 then + self:SetDTFloat(1, CurTime()) + end +end + +function ENT:AddDamage(damage, attacker) + self:SetDamage(self:GetDamage() + damage) + + if SERVER and attacker then + self.Attackers[attacker] = (self.Attackers[attacker] or 0) + damage + end +end + +function ENT:SetDamage(damage) + self:SetDTFloat(0, math.min(GAMEMODE.MaxPoisonDamage or 1000, damage)) +end + +function ENT:GetDamage() + return self:GetDTFloat(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/cl_init.lua deleted file mode 100644 index 11a5e13..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/cl_init.lua +++ /dev/null @@ -1,8 +0,0 @@ -include("shared.lua") - -function ENT:Draw() -end - -function ENT:Initialize() - self:GetOwner().PoisonRecovery = self -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/init.lua b/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/init.lua deleted file mode 100644 index 268294d..0000000 --- a/gamemodes/zombiesurvival/entities/entities/status_poisonrecovery/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") - -function ENT:PlayerSet(pPlayer, bExists) - pPlayer.PoisonRecovery = self -end - -function ENT:Think() - local owner = self:GetOwner() - - if self:GetDamage() <= 0 or owner:Team() == TEAM_UNDEAD then - self:Remove() - return - end - - owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + 1)) - self:AddDamage(-1) - - self:NextThink(CurTime() + 0.75) - --self:NextThink(CurTime() + (owner.BuffResistant and 0.375 or 0.75)) - return true -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/cl_init.lua index 4ac2871..ff94831 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE @@ -6,7 +6,7 @@ function ENT:Initialize() self:DrawShadow(false) self.AmbientSound = CreateSound(self, "npc/zombie_poison/pz_breathe_loop2.wav") - self.AmbientSound:PlayEx(0.55, 85) + self.AmbientSound:PlayEx(0.75, 65) end function ENT:OnRemove() @@ -20,7 +20,7 @@ function ENT:Think() if wep:IsValid() and wep.IsSwinging and wep:IsSwinging() then self.AmbientSound:Stop() else - self.AmbientSound:PlayEx(0.55, 85 + math.sin(RealTime())) + self.AmbientSound:PlayEx(0.75, 65 + math.sin(RealTime())) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/init.lua index c27d382..b3217bf 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_pukepusambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_reaper/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_reaper/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_reaper/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/entities/status_reaper/init.lua b/gamemodes/zombiesurvival/entities/entities/status_reaper/init.lua new file mode 100644 index 0000000..0f4492d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_reaper/init.lua @@ -0,0 +1,31 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker ~= self:GetOwner() then return end + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + dmginfo:SetDamage(dmginfo:GetDamage() * (1 + 0.08 * self:GetDTInt(1))) + end +end + +function ENT:HumanKilledZombie(pl, attacker, inflictor, dmginfo, headshot, suicide) + if attacker ~= self:GetOwner() then return end + + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + local reaperstatus = attacker:GiveStatus("reaper", math.min(14, self.DieTime - CurTime() + 7)) + if reaperstatus and reaperstatus:IsValid() then + attacker:EmitSound("hl1/ambience/particle_suck1.wav", 55, 150 + reaperstatus:GetDTInt(1) * 30, 0.45) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_reaper/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_reaper/shared.lua new file mode 100644 index 0000000..b74d0c3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_reaper/shared.lua @@ -0,0 +1,22 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + hook.Add("HumanKilledZombie", self, self.HumanKilledZombie) + + self:SetDTInt(1, 0) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_redmarrow/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/cl_init.lua new file mode 100644 index 0000000..a859fc3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/cl_init.lua @@ -0,0 +1,69 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.ParticleTimer = 0 + +function ENT:OnInitialize() + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 128)) +end + +function ENT:Think() + local owner = self:GetOwner() + if owner:IsValid() then self:SetPos(owner:EyePos()) end +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner:IsValid() and owner[self:GetClass()] == self then + owner[self:GetClass()] = nil + end +end + + +local function GetRandomBonePos(pl) + if pl ~= MySelf or pl:ShouldDrawLocalPlayer() then + local bone = pl:GetBoneMatrix(math.random(0,25)) + if bone then + return bone:GetTranslation() + end + end + + return pl:GetShootPos() +end + +function ENT:DrawTranslucent() + local ent = self:GetOwner() + if not ent:IsValid() then return end + + if self.ParticleTimer < CurTime() then + self.ParticleTimer = CurTime() + 0.1 + + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(24, 32) + + local pos, aa, bb + for i = 0, 11 do + if ent == MySelf and not ent:ShouldDrawLocalPlayer() then + aa, bb = ent:WorldSpaceAABB() + pos = Vector(math.Rand(aa.x, bb.x), math.Rand(aa.y, bb.y), math.Rand(aa.z, bb.z)) + else + pos = GetRandomBonePos(ent) + end + + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos + VectorRand():GetNormalized() * 5) + particle:SetDieTime(math.Rand(0.75, 0.85)) + particle:SetStartSize(11) + particle:SetEndSize(1) + particle:SetColor(200,30,30) + particle:SetStartAlpha(235) + particle:SetEndAlpha(0) + particle:SetVelocity(ent:GetVelocity()) + particle:SetRoll(math.random(0, 360)) + particle:SetRollDelta(math.random(5, -5)) + particle:SetGravity(Vector(0, 0, -200)) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_redmarrow/init.lua b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/init.lua new file mode 100644 index 0000000..bc9995d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/init.lua @@ -0,0 +1,9 @@ +INC_SERVER() + +function ENT:Think() + local owner = self:GetOwner() + + if self.DieTime <= CurTime() or not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Red Marrow") then + self:Remove() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_redmarrow/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/shared.lua new file mode 100644 index 0000000..2f44d2c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_redmarrow/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "status__base" diff --git a/gamemodes/zombiesurvival/entities/entities/status_renegade/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_renegade/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_renegade/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/entities/status_renegade/init.lua b/gamemodes/zombiesurvival/entities/entities/status_renegade/init.lua new file mode 100644 index 0000000..876d440 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_renegade/init.lua @@ -0,0 +1,20 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker ~= self:GetOwner() then return end + if attacker:IsValidLivingHuman() and not ent.Corrosion then + dmginfo:SetDamage(dmginfo:GetDamage() / GAMEMODE:GetZombieDamageScale(dmginfo:GetDamagePosition(), ent)) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_renegade/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_renegade/shared.lua new file mode 100644 index 0000000..88c151b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_renegade/shared.lua @@ -0,0 +1,21 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + + self:SetDTInt(1, 0) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_resupplypack/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/cl_init.lua new file mode 100644 index 0000000..4f31dab --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/cl_init.lua @@ -0,0 +1,65 @@ +INC_CLIENT() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModelScale(0.35, 0) + + self:SetRenderBounds(Vector(-26, -26, -26), Vector(26, 26, 45)) +end + +function ENT:Think() + if MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN then + local nextuse = MySelf.NextUse or 0 + if self.Dinged then + if CurTime() < nextuse then + self.Dinged = false + end + elseif CurTime() >= nextuse then + self.Dinged = true + + self:EmitSound("zombiesurvival/ding.ogg") + end + end + + self:NextThink(CurTime() + 0.5) + return true +end + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + + local wep = owner:GetActiveWeapon() + if wep:IsValid() and wep:GetClass() == "weapon_zs_t_resupplypack" then return end + + local boneid = owner:LookupBone("ValveBiped.Bip01_Spine2") + if not boneid or boneid <= 0 then return end + + local bonepos, boneang = owner:GetBonePositionMatrixed(boneid) + + self:SetPos(bonepos + boneang:Forward() + boneang:Right() * 6) + boneang:RotateAroundAxis(boneang:Right(), 270) + boneang:RotateAroundAxis(boneang:Forward(), 90) + self:SetAngles(boneang) + + local shadowman = owner.ShadowMan + local hidepacks = not GAMEMODE.HidePacks + + if hidepacks and shadowman then + render.SetBlend(0) + end + + self:DrawModel() + + if hidepacks and shadowman then + render.SetBlend(1) + end + + if not hidepacks or not shadowman then + local w, h = 420, 200 + cam.Start3D2D(self:LocalToWorld(Vector(0, 0, self:OBBMaxs().z)), self:GetAngles(), 0.025) + draw.RoundedBox(64, w * -0.5, h * -0.5, w, h, color_black_alpha120) + draw.SimpleText(translate.Get("resupply_box"), "ZS3D2DFont2", 0, 0, (MySelf.NextUse or 0) <= CurTime() and COLOR_GREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_resupplypack/init.lua b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/init.lua new file mode 100644 index 0000000..7a14f49 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/init.lua @@ -0,0 +1,24 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) + self:SetModelScale(0.35, 0) + + self:SetModel("models/Items/ammocrate_ar2.mdl") + self:SetMoveType(MOVETYPE_NONE) + self:PhysicsInitSphere(3) + self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + self:SetUseType(SIMPLE_USE) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:IsValid() and owner:Alive() and owner:HasTrinket("resupplypack")) then self:Remove() end +end + +function ENT:Use(activator, caller) + if activator:Team() ~= TEAM_HUMAN or not activator:Alive() or GAMEMODE:GetWave() <= 0 then return end + + local owner = self:GetOwner() + activator:Resupply(owner, self) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_resupplypack/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/shared.lua new file mode 100644 index 0000000..d37df0c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_resupplypack/shared.lua @@ -0,0 +1,6 @@ +ENT.Type = "anim" + +ENT.IgnoreMelee = true +ENT.IgnoreBullets = true +ENT.IgnoreTraces = true +ENT.NoNails = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive/cl_init.lua index 9094db4..2d5673e 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive/init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive/init.lua index 2126505..9851793 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer.Revive = self diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive2/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive2/cl_init.lua index f3cb9ff..80abb21 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive2/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive2/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive2/init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive2/init.lua index 2126505..9851793 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive2/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive2/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) pPlayer.Revive = self diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/cl_init.lua index af63d09..995d43d 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/cl_init.lua @@ -1,6 +1,8 @@ -include("shared.lua") +INC_CLIENT() function ENT:Initialize() + hook.Add("CreateMove", self, self.CreateMove) + self:DrawShadow(false) self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 80)) @@ -8,11 +10,24 @@ function ENT:Initialize() if owner:IsValid() then owner.Revive = self + self.CommandYaw = owner:GetAngles().yaw + owner:CallWeaponFunction("KnockedDown", self, false) owner:CallZombieFunction("KnockedDown", self, false) end end +function ENT:CreateMove(cmd) + if MySelf ~= self:GetOwner() then return end + + local ang = cmd:GetViewAngles() + ang.yaw = self.CommandYaw or ang.yaw + cmd:SetViewAngles(ang) + + cmd:ClearButtons(0) + cmd:ClearMovement() +end + function ENT:OnRemove() local owner = self:GetOwner() if owner:IsValid() then diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/init.lua index c28bbb3..b0052ab 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/init.lua @@ -1,13 +1,10 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:PlayerSet(pPlayer, bExists) self.HealCarryOver = self.HealCarryOver or 0 pPlayer.Revive = self - pPlayer:Freeze(true) + --pPlayer:Freeze(true) if not bExists then pPlayer:GodEnable() self.GodDisableTime = CurTime() + 0.1 @@ -31,7 +28,7 @@ function ENT:Think() self.GodDisableTime = nil end - self.HealCarryOver = self.HealCarryOver + FrameTime() * 10 + self.HealCarryOver = self.HealCarryOver + FrameTime() * self:GetReviveHeal() if self.HealCarryOver >= 1 then local toheal = math.floor(self.HealCarryOver) owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + toheal)) @@ -47,7 +44,8 @@ function ENT:OnRemove() local parent = self:GetOwner() if parent:IsValid() then parent.Revive = nil - parent:Freeze(false) + --parent:Freeze(false) parent:GodDisable() + parent:AddFlags(FL_ONGROUND) end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/shared.lua index a1f4b01..db4d69b 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive_slump/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive_slump/shared.lua @@ -4,7 +4,7 @@ ENT.Base = "status__base" ENT.AnimTime = 1.9 function ENT:GetRagdollEyes(pl) - local attachid = pl:LookupAttachment("head") + local attachid = pl:LookupAttachment("eyes") if attachid then local attach = pl:GetAttachment(attachid) if attach then @@ -24,3 +24,19 @@ end function ENT:GetReviveTime() return self:GetDTFloat(0) end + +function ENT:SetReviveAnim(t) + self:SetDTFloat(1, t) +end + +function ENT:GetReviveAnim() + return self:GetDTFloat(1) +end + +function ENT:SetReviveHeal(h) + self:SetDTFloat(2, h) +end + +function ENT:GetReviveHeal() + return self:GetDTFloat(2) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_revive_slump_human/init.lua b/gamemodes/zombiesurvival/entities/entities/status_revive_slump_human/init.lua index 50bc19a..feb225e 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_revive_slump_human/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_revive_slump_human/init.lua @@ -12,7 +12,7 @@ function ENT:Think() if not owner:Alive() then owner:SecondWind() - owner:Freeze(true) + --owner:Freeze(true) owner:TemporaryNoCollide() end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/cl_init.lua index ffd05cd..ceb3908 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/cl_init.lua @@ -1,12 +1,12 @@ -include("shared.lua") +INC_CLIENT() ENT.NextEmit = 0 function ENT:Initialize() self:DrawShadow(false) - self.AmbientSound = CreateSound(self, "npc/antlion_guard/growl_idle.wav") - self.AmbientSound:PlayEx(0.55, 130) + self.AmbientSound = CreateSound(self, "ambient/levels/citadel/citadel_ambient_scream_loop1.wav") + self.AmbientSound:PlayEx(1, 88) self:GetOwner().status_shadeambience = self end @@ -15,10 +15,6 @@ function ENT:OnRemove() self.AmbientSound:Stop() end -function ENT:Think() - self.AmbientSound:PlayEx(0.55, 130 + math.sin(RealTime())) -end - function ENT:Draw() if CurTime() < self.NextEmit then return end @@ -46,7 +42,7 @@ function ENT:Draw() particle:SetRollDelta(math.Rand(-5, 5)) particle:SetColor(255, 255, 190) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/init.lua index a9985b1..ff0cdee 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() ENT.NextFlashlightCheck = 0 @@ -13,52 +10,5 @@ function ENT:Think() local owner = self:GetOwner() if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Shade") then self:Remove() - elseif CurTime() >= self.NextFlashlightCheck then - self.NextFlashlightCheck = CurTime() + 0.33 - - local totaldamage = 0 - for _, pl in pairs(team.GetPlayers(TEAM_HUMAN)) do - if pl:Alive() and pl:FlashlightIsOn() then - local eyepos = pl:GetShootPos() - local nearest = owner:NearestPoint(eyepos) - local dist = eyepos:Distance(nearest) - if dist <= 300 and LightVisible(eyepos, nearest, owner, pl) then - local dot = (nearest - eyepos):GetNormalized():Dot(pl:GetAimVector()) - if dot >= 0.85 then - local damage = (1 - dist / 300) * dot * 7 - totaldamage = totaldamage + damage - - SHADEFLASHLIGHTDAMAGE = true - owner:TakeDamage(damage, pl, self) - SHADEFLASHLIGHTDAMAGE = false - end - end - end - end - - for _, ent in pairs(ents.FindByClass("prop_spotlamp")) do - local eyepos = ent:GetSpotLightPos() - local nearest = owner:NearestPoint(eyepos) - local dist = eyepos:Distance(nearest) - if dist <= 500 and LightVisible(eyepos, nearest, owner, ent) then - local dot = (nearest - eyepos):GetNormalized():Dot(ent:GetSpotLightAngles():Forward()) - if dot >= 0.85 then - local damage = (1 - dist / 500) * dot * 8 - totaldamage = totaldamage + damage - - SHADEFLASHLIGHTDAMAGE = true - owner:TakeDamage(damage, ent, self) - SHADEFLASHLIGHTDAMAGE = false - end - end - end - - if totaldamage > 0 then - self:SetLastDamaged(CurTime()) - end - - if self:GetLastDamage() ~= totaldamage then - self:SetLastDamage(totaldamage) - end end end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/shared.lua index c6ccdbb..baa7c9b 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_shadeambience/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeambience/shared.lua @@ -15,11 +15,3 @@ end function ENT:GetLastDamage() return self:GetDTFloat(1) end - -function ENT:SetLastReflect(time) - self:SetDTFloat(2, time) -end - -function ENT:GetLastReflect() - return self:GetDTFloat(2) -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeshield/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/cl_init.lua new file mode 100644 index 0000000..e12c82d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/cl_init.lua @@ -0,0 +1,118 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +local materialp = {} +materialp["$refractamount"] = 0.02 +materialp["$colortint"] = "[1.0 1.3 1.6]" +materialp["$SilhouetteColor"] = "[2.1 3.5 5.0]" +materialp["$BlurAmount"] = 0.04 +materialp["$SilhouetteThickness"] = 0.05 +materialp["$normalmap"] = "effects/combineshield/comshieldwall" +function ENT:OnInitialize() + hook.Add("Move", self, self.Move) + hook.Add("CreateMove", self, self.CreateMove) + hook.Add("ShouldDrawLocalPlayer", self, self.ShouldDrawLocalPlayer) + + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 80)) + + local owner = self:GetOwner() + if owner:IsValid() then + owner.ShadeShield = self + end + + self:EmitSound("weapons/physcannon/physcannon_charge.wav", 70, 250) + + self.AmbientSound = CreateSound(self, "weapons/physcannon/superphys_hold_loop.wav") + self.ShieldMaterial = CreateMaterial("shadeshield" .. self:EntIndex(), "Aftershock_dx9", materialp) +end + +function ENT:CreateMove(cmd) + if MySelf ~= self:GetOwner() then return end + + if bit.band(cmd:GetButtons(), IN_JUMP) ~= 0 then + cmd:SetButtons(cmd:GetButtons() - IN_JUMP) + end +end + +function ENT:ShouldDrawLocalPlayer(pl) + if pl ~= self:GetOwner() then return end + + return true +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner:IsValid() then + owner.ShadeShield = nil + end + + self.AmbientSound:Stop() +end + +function ENT:Think() + local curtime = CurTime() + + if self:GetStateEndTime() <= curtime and self:GetState() == 0 then + self.AmbientSound:PlayEx(0.77, 53) + + if curtime >= self.NextEmit then + self.NextEmit = curtime + 0.05 + + local pos = self:WorldSpaceCenter() + pos.z = pos.z + 8 + local owner = self:GetOwner() + local emitter = ParticleEmitter(pos) + local handpos = owner:GetAttachment(owner:LookupAttachment("anim_attachment_RH")).Pos + emitter:SetNearClip(16, 24) + + local particle = emitter:Add("sprites/glow04_noz", handpos) + local dir = (pos - handpos + (VectorRand() * 2)):GetNormalized() + particle:SetVelocity(dir * math.Rand(120, 125)) + particle:SetDieTime(math.Rand(0.25, 0.27)) + particle:SetStartAlpha(math.Rand(230, 250)) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(math.Rand(12, 14)) + particle:SetColor(49, 110, 255) + + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + elseif self:GetState() == 1 then + self.AmbientSound:Stop() + end +end + +local matWhite = Material("models/debug/debugwhite") +function ENT:DrawTranslucent() + local curtime = CurTime() + local diff = self:GetStateEndTime() - curtime + local scalar = self:GetState() == 1 and diff or 0.5 - diff + local scale = math.Clamp((scalar ^ 2)/0.25, 0, 1) + + local red = 1 - self:GetObjectHealth()/self:GetMaxObjectHealth() + render.SetColorModulation(red, 0.1, 1 - red) + local blend = 0.3 + math.abs(math.cos(CurTime())) ^ 2 * 0.1 + render.SetBlend(blend * scale) + render.SuppressEngineLighting(true) + render.ModelMaterialOverride(matWhite) + + self:DrawModel() + + render.SetColorModulation(1, 1, 1) + render.SuppressEngineLighting(false) + render.ModelMaterialOverride() + render.SetBlend(1) + + if render.SupportsPixelShaders_2_0() then + self.ShieldMaterial:SetFloat("$refractamount", 0.01 * scale) + self.ShieldMaterial:SetFloat("$BlurAmount", 0.01 * scale) + render.UpdateRefractTexture() + + render.ModelMaterialOverride(self.ShieldMaterial) + nodraw = true + self:DrawModel() + nodraw = false + render.ModelMaterialOverride(0) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeshield/init.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/init.lua new file mode 100644 index 0000000..44047e0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/init.lua @@ -0,0 +1,139 @@ +INC_SERVER() +DEFINE_BASECLASS("status__base") + +ENT.NextHeal = 0 +ENT.NextDamageSet = 0 +ENT.DamageTaken = 0 + +function ENT:OnInitialize() + hook.Add("Move", self, self.Move) +end + +function ENT:Initialize() + BaseClass.Initialize(self) + self.NextDeflect = 0 + + self:SetModel("models/props_phx/construct/metal_plate_curve2x2.mdl") + self:DrawShadow(false) + self:SetCustomCollisionCheck(true) + self:SetCollisionGroup(COLLISION_GROUP_PASSABLE_DOOR) + + --self:EmitSound("weapons/physcannon/physcannon_charge.wav", 70, 190) + + self:SetMaxObjectHealth(600) + self:SetObjectHealth(self:GetMaxObjectHealth()) +end + +function ENT:PlayerSet(pPlayer, bExists) + pPlayer.ShadeShield = self + pPlayer:AnimResetGestureSlot(GESTURE_SLOT_ATTACK_AND_RELOAD) + --pPlayer:SetMoveType(MOVETYPE_NONE) + + self:SetParent(nil) + self:SetPos(pPlayer:GetPos()) + + local angs = pPlayer:GetAngles() + angs:RotateAroundAxis(self:GetUp(), 135) + self:SetAngles(angs) + + --[[if pPlayer:KeyDown(IN_BACK) then + self:SetDirection(DIR_BACK) + elseif pPlayer:KeyDown(IN_MOVERIGHT) then + self:SetDirection(DIR_RIGHT) + elseif pPlayer:KeyDown(IN_MOVELEFT) then + self:SetDirection(DIR_LEFT) + else + self:SetDirection(DIR_FORWARD) + end--]] +end + +function ENT:OnTakeDamage(dmginfo) + self:TakePhysicsDamage(dmginfo) + + local attacker = dmginfo:GetAttacker() + local owner = self:GetOwner() + + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + if self.NextDeflect and self.NextDeflect < CurTime() then + local center = self:LocalToWorld(self:OBBCenter()) + local hitpos = self:NearestPoint(dmginfo:GetDamagePosition()) + local effectdata = EffectData() + effectdata:SetOrigin(center) + effectdata:SetStart(self:WorldToLocal(hitpos)) + effectdata:SetAngles((center - hitpos):Angle()) + effectdata:SetEntity(self) + util.Effect("shadedeflect", effectdata, true, true) + + owner:TakeSpecialDamage(1, DMG_GENERIC, attacker, self, owner:WorldSpaceCenter()) + + self.NextDeflect = CurTime() + 0.1 + end + + local damagetaken = math.min(self.DamageTaken + dmginfo:GetDamage(), 150) + local diff = damagetaken - self.DamageTaken + self.DamageTaken = self.DamageTaken + diff + self:SetObjectHealth(self:GetObjectHealth() - diff) + end +end + +function ENT:Think() + local fCurTime = CurTime() + local owner = self:GetOwner() + + if owner:IsValid() then + if self:GetStateEndTime() <= fCurTime and self:GetState() == 1 or not owner:Alive() or owner:Team() ~= TEAM_UNDEAD or self.Destroyed then + local extraduration = (1 - self:GetObjectHealth()/self:GetMaxObjectHealth()) * 10 + owner.NextShield = fCurTime + (self.Destroyed and 12 or (2 + extraduration)) + self:Remove() + return + elseif self:GetStateEndTime() <= fCurTime and self:GetState() == 0 and not self.Constructed then + self:PhysicsInit(SOLID_VPHYSICS) + + local phys = self:GetPhysicsObject() + if phys:IsValid() then + phys:EnableMotion(false) + end + + self:EmitSound("npc/vort/attack_shoot.wav", 70, 245) + self.Constructed = true + end + + if self:GetState() == 1 and self.Constructed then + self:PhysicsInit(SOLID_NONE) + self:EmitSound("weapons/physgun_off.wav", 70, 190) + + self.Constructed = false + end + + if fCurTime >= self.NextHeal and self.DamageTaken ~= 150 then + self.NextHeal = fCurTime + 0.4 + + if self:GetObjectHealth() < self:GetMaxObjectHealth() then + self:SetObjectHealth(math.min(self:GetObjectHealth() + 20, self:GetMaxObjectHealth())) + end + end + + if fCurTime >= self.NextDamageSet then + self.NextDamageSet = fCurTime + 1 + self.DamageTaken = 0 + end + + self:SetPos(LerpVector(0.1, self:GetPos(), owner:GetPos() + owner:GetForward() * 40)) + local angs = owner:GetAngles() + angs:RotateAroundAxis(self:GetUp(), 135) + self:SetAngles(LerpAngle(0.2, self:GetAngles(), angs)) + else + self:Remove() + end + + self:NextThink(fCurTime) + return true +end + +function ENT:OnRemove() + local parent = self:GetOwner() + if parent:IsValid() then + parent.ShadeShield = nil + --parent:SetMoveType(MOVETYPE_WALK) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shadeshield/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/shared.lua new file mode 100644 index 0000000..703106e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shadeshield/shared.lua @@ -0,0 +1,78 @@ +ENT.Type = "anim" +ENT.Base = "status__base" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.IgnoreMelee = true + +function ENT:ShouldNotCollide(ent) + if ent:IsProjectile() then + local owner = ent:GetOwner() + if owner:IsValid() and owner:Team() == TEAM_UNDEAD then return true end + end + + local colgroup = ent:GetCollisionGroup() + if ent.IsBarricadeObject or colgroup == COLLISION_GROUP_PLAYER or colgroup == COLLISION_GROUP_WEAPON or colgroup == COLLISION_GROUP_NONE then + return true + end + + return false +end + +function ENT:Move(pl, move) + if pl ~= self:GetOwner() then return end + + move:SetMaxSpeed(0) + move:SetMaxClientSpeed(0) +end + +function ENT:SetState(state) + self:SetDTInt(0, state) +end + +function ENT:GetState() + return self:GetDTInt(0) +end + +function ENT:SetStateEndTime(time) + self:SetDTFloat(0, time) +end + +function ENT:GetStateEndTime() + return self:GetDTFloat(0) +end + +function ENT:SetDirection(m) + self:SetDTInt(1, m) +end + +function ENT:GetDirection() + return self:GetDTInt(1) +end + +function ENT:SetObjectHealth(health) + self:SetDTFloat(1, health) + if health <= 0 and not self.Destroyed then + self.Destroyed = true + + if SERVER then + local effectdata = EffectData() + effectdata:SetOrigin(self:WorldSpaceCenter()) + effectdata:SetNormal(self:GetUp()) + util.Effect("explosion_shadeshield", effectdata, true, true) + + util.ScreenShake(self:GetPos(), 15, 5, 1.5, 800) + self:EmitSound("ambient/levels/labs/electric_explosion2.wav", 85, 100) + end + end +end + +function ENT:GetObjectHealth() + return self:GetDTFloat(1) +end + +function ENT:SetMaxObjectHealth(health) + self:SetDTFloat(2, health) +end + +function ENT:GetMaxObjectHealth() + return self:GetDTFloat(2) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/cl_init.lua new file mode 100644 index 0000000..1e43043 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/cl_init.lua @@ -0,0 +1,36 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.15 + + local pos = owner:WorldSpaceCenter() + pos.z = pos.z + 12 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i = 1, 3 do + particle = emitter:Add("trails/electric", pos + VectorRand() * 8) + particle:SetDieTime(0.1) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetVelocity(VectorRand() * 5) + particle:SetAirResistance(300) + particle:SetStartLength(12) + particle:SetEndLength(12) + particle:SetColor(150, 255, 150) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/init.lua b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/shared.lua new file mode 100644 index 0000000..7debea2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_shockdebuff/shared.lua @@ -0,0 +1,12 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sickness/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_sickness/cl_init.lua new file mode 100644 index 0000000..3f3a9b9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sickness/cl_init.lua @@ -0,0 +1,18 @@ +INC_CLIENT() + +function ENT:OnInitialize() + local owner = self:GetOwner() + if owner ~= MySelf then return end + + self.AmbientSound = CreateSound(self, "player/heartbeat1.wav") + self.AmbientSound:PlayEx(1, 222) +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner == MySelf then + self.AmbientSound:Stop() + end + + self.BaseClass.OnRemove(self) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sickness/init.lua b/gamemodes/zombiesurvival/entities/entities/status_sickness/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sickness/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sickness/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_sickness/shared.lua new file mode 100644 index 0000000..7705b43 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sickness/shared.lua @@ -0,0 +1,11 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/cl_init.lua new file mode 100644 index 0000000..b10d435 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/cl_init.lua @@ -0,0 +1,74 @@ +INC_CLIENT() + +ENT.Sound1 = Sound("ambient/levels/labs/teleport_preblast_suckin1.wav") +ENT.Sound2 = Sound("ambient/levels/labs/teleport_mechanism_windup3.wav") +ENT.ParticleMaterial = "sprites/glow04_noz" + +function ENT:Initialize() + self:DrawShadow(false) + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 80)) + + local owner = self:GetOwner() + + self.TeleportingSound = CreateSound(self, self.Sound1) + self.TeleportingSound2 = CreateSound(self, self.Sound2) + if owner:IsValid() and owner == MySelf then + self.TeleportingSound:PlayEx(1, 100 / (owner.SigilTeleportTimeMul or 1)) + self.TeleportingSound2:PlayEx(0.22, 245) + end + + if self:GetStartTime() == 0 then + self:SetStartTime(CurTime()) + end + + owner.SigilTeleport = self +end + +function ENT:OnRemove() + self.TeleportingSound:Stop() + self.TeleportingSound2:Stop() +end + +function ENT:Think() + local owner = self:GetOwner() + if owner ~= LocalPlayer() then return end + + local sigil = self:GetTargetSigil() + if not sigil or not sigil:IsValid() then return end + + local ownerpos = owner:GetPos() + local sigilpos = sigil:GetPos() + local dir = sigilpos - ownerpos + dir:Normalize() + + local aa, bb = owner:WorldSpaceAABB() + local startpos = Vector(math.Rand(aa.x, bb.x), math.Rand(aa.y, bb.y), math.Rand(aa.z, bb.z)) + + local emitter = ParticleEmitter(startpos) + emitter:SetNearClip(24, 32) + + local particle = emitter:Add(self.ParticleMaterial, startpos) + particle:SetDieTime(math.Rand(1.5, 4)) + particle:SetVelocity(dir * math.min(1400, ownerpos:Distance(sigilpos))) + particle:SetStartAlpha(100) + particle:SetEndAlpha(255) + particle:SetStartSize(math.Rand(1, 2)) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-2, 2)) + if math.random(4) ~= 1 then + self:SetParticleColor(particle) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) + + self:NextThink(CurTime() + 0.05) + return true +end + +function ENT:SetParticleColor(particle) + particle:SetColor(38, 102, 255) +end + +function ENT:Draw() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/init.lua b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/init.lua new file mode 100644 index 0000000..74c339e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/init.lua @@ -0,0 +1,38 @@ +INC_SERVER() + +function ENT:PlayerSet(pPlayer, bExists) + pPlayer:SendLua("MySelf:EmitSound(\"buttons/button1.wav\", 50, 35, 0.5)") + + if self:GetStartTime() == 0 then + self:SetStartTime(CurTime()) + end + + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) +end + +function ENT:Think() + local owner = self:GetOwner() + local froms = self:GetFromSigil() + + if CurTime() >= self:GetEndTime() then + if self:GetTargetSigil():IsValid() then + owner:DoSigilTeleport(self:GetTargetSigil(), froms, self:GetClass() == "status_corruptedteleport") + end + + self:Remove() + end + + if froms and froms:IsValid() and not froms:IsWeapon() and (froms:GetSigilCorrupted() or owner:GetPos():DistToSqr(froms:GetPos()) > 16384) then + self:Remove() + end + + self:NextThink(CurTime()) + return true +end + +function ENT:EntityTakeDamage(ent, dmginfo) + if ent == self:GetOwner() and not dmginfo:GetInflictor().IsStatus then + self:SetStartTime(CurTime()) + self:SetEndTime(CurTime() + 2 * (ent.SigilTeleportTimeMul or 1)) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/shared.lua new file mode 100644 index 0000000..b250698 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_sigilteleport/shared.lua @@ -0,0 +1,53 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +function ENT:GetTimeRemaining() + return math.max(0, self:GetEndTime() - CurTime()) +end + +function ENT:RefreshMaxTime() + self:SetMaxTime(math.max(self:GetMaxTime(), self:GetEndTime() - self:GetStartTime())) +end + +function ENT:SetMaxTime(time) + self:SetDTFloat(2, time) +end + +function ENT:GetMaxTime() + return self:GetDTFloat(2) +end + +function ENT:SetEndTime(time) + self:SetDTFloat(0, time) + self:RefreshMaxTime() +end + +function ENT:GetEndTime() + return self:GetDTFloat(0) +end + +function ENT:GetStartTime() + return self:GetDTFloat(1) +end + +function ENT:SetStartTime(time) + self:SetDTFloat(1, time) + self:RefreshMaxTime() +end + +function ENT:GetTargetSigil() + local owner = self:GetParent() + if owner:IsValid() then + return owner:SigilTeleportDestination(self:GetFromSigil():IsValid() and self:GetFromSigil():IsWeapon(), self:GetClass() == "status_corruptedteleport") + end + + return NULL +end + +function ENT:SetFromSigil(ent) + self:SetDTEntity(1, ent) +end + +function ENT:GetFromSigil() + return self:GetDTEntity(1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_slow/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_slow/cl_init.lua new file mode 100644 index 0000000..9bac232 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_slow/cl_init.lua @@ -0,0 +1,36 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.5 + + local pos = owner:WorldSpaceCenter() + pos.z = pos.z + 24 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i = 1, 3 do + particle = emitter:Add("sprites/light_glow02_add", pos + VectorRand() * 12) + particle:SetDieTime(math.Rand(1.1, 1.2)) + particle:SetStartAlpha(160) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetGravity(Vector(0, 0, -155)) + particle:SetAirResistance(300) + particle:SetStartLength(1) + particle:SetEndLength(35) + particle:SetColor(90, 140, 30) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_slow/init.lua b/gamemodes/zombiesurvival/entities/entities/status_slow/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_slow/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_slow/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_slow/shared.lua new file mode 100644 index 0000000..c2c353b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_slow/shared.lua @@ -0,0 +1,32 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + self.Seed = math.Rand(0, 10) + + hook.Add("Move", self, self.Move) + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end + +function ENT:Move(pl, move) + if pl ~= self:GetOwner() then return end + + local sloweffect = 1 - 0.4 * (pl.SlowEffTakenMul or 1) + + move:SetMaxSpeed(move:GetMaxSpeed() * sloweffect) + move:SetMaxClientSpeed(move:GetMaxClientSpeed() * sloweffect) +end + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_spawnslow/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/cl_init.lua new file mode 100644 index 0000000..d79d4e7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/cl_init.lua @@ -0,0 +1,69 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +local Bones = {"ValveBiped.Bip01_R_Foot", "ValveBiped.Bip01_L_Foot"} +function ENT:Draw() + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.05 + + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + + local boneid, particle, pos + + local emitter = ParticleEmitter(owner:GetPos()) + emitter:SetNearClip(12, 16) + + for _, bonename in pairs(Bones) do + boneid = owner:LookupBone(bonename) + if boneid and boneid > 0 then + pos = owner:GetBonePositionMatrixed(boneid) + if pos then + pos.z = pos.z + 8 + + particle = emitter:Add("particle/smokesprites_0001", pos) + particle:SetDieTime(math.Rand(1, 1.3)) + particle:SetVelocity(Vector(math.Rand(-12, 12), math.Rand(-12, 12), 0)) + particle:SetGravity(Vector(0, 0, -20)) + particle:SetColor(0, 80, 0) + particle:SetAirResistance(8) + particle:SetStartAlpha(100) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(14) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-10, 10)) + end + end + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function ENT:GetPower() + return math.Clamp(self:GetStartTime() + self:GetDuration() - CurTime(), 0, 1) +end + +local colModDimVision = { + ["$pp_colour_colour"] = 1, + ["$pp_colour_brightness"] = 0, + ["$pp_colour_contrast"] = 1, + ["$pp_colour_mulr"] = 0, + ["$pp_colour_mulg"] = 0, + ["$pp_colour_mulb"] = 0, + ["$pp_colour_addr"] = 0, + ["$pp_colour_addg"] = 0, + ["$pp_colour_addb"] = 0 +} + +local overlay = Material("effects/tp_eyefx/tpeye") +function ENT:RenderScreenspaceEffects() + if MySelf ~= self:GetOwner() then return end + + overlay:SetFloat("$alpha", 0.05 * self:GetPower()) + DrawMaterialOverlay("effects/tp_eyefx/tpeye", -0.05) + + colModDimVision["$pp_colour_addg"] = self:GetPower() * 0.15 + DrawColorModify(colModDimVision) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_spawnslow/init.lua b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/init.lua new file mode 100644 index 0000000..1587cbb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_spawnslow/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/shared.lua new file mode 100644 index 0000000..5fee196 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_spawnslow/shared.lua @@ -0,0 +1,30 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + self.Seed = math.Rand(0, 10) + + if CLIENT then + hook.Add("RenderScreenspaceEffects", self, self.RenderScreenspaceEffects) + end + + hook.Add("Move", self, self.Move) +end + +function ENT:Move(pl, move) + if pl ~= self:GetOwner() then return end + + local sloweffect = 0.4 + + move:SetMaxSpeed(move:GetMaxSpeed() * sloweffect) + move:SetMaxClientSpeed(move:GetMaxClientSpeed() * sloweffect) +end + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/cl_init.lua new file mode 100644 index 0000000..6b5ff3e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/cl_init.lua @@ -0,0 +1,35 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.5 + + local pos = owner:WorldSpaceCenter() + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i = 1, 2 do + particle = emitter:Add("sprites/light_glow02_add", pos + VectorRand() * 12) + particle:SetDieTime(math.Rand(1.1, 1.2)) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetGravity(Vector(0, 0, 75)) + particle:SetAirResistance(300) + particle:SetStartLength(1) + particle:SetEndLength(35) + particle:SetColor(255, 30, 30) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/init.lua b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/init.lua new file mode 100644 index 0000000..7b03a1f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/init.lua @@ -0,0 +1,37 @@ +INC_SERVER() + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + else + self.DieTime = CurTime() + fTime + self:SetDuration(fTime) + end +end + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker ~= self:GetOwner() then return end + + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN --[[and inflictor == wep and wep.IsMelee]] then + local dmg = dmginfo:GetDamage() + local extradamage = dmg * 0.25 + dmginfo:SetDamage(dmg + extradamage) + + if self.Applier and self.Applier:IsValidLivingHuman() and ent:IsPlayer() and ent:Team() == TEAM_ZOMBIE then + local applier = self.Applier + + ent.DamagedBy[applier] = (ent.DamagedBy[applier] or 0) + extradamage + applier.StrengthBoostDamage = (applier.StrengthBoostDamage or 0) + extradamage + local points = extradamage / ent:GetMaxHealth() * ent:GetZombieClassTable().Points + applier.PointQueue = applier.PointQueue + points * 1.5 + + local pos = ent:GetPos() + pos.z = pos.z + 32 + applier.LastDamageDealtPos = pos + applier.LastDamageDealtTime = CurTime() + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/shared.lua new file mode 100644 index 0000000..2dccc63 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_strengthdartboost/shared.lua @@ -0,0 +1,23 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +AccessorFuncDT(ENT, "Duration", "Float", 0) +AccessorFuncDT(ENT, "StartTime", "Float", 4) + +function ENT:PlayerSet() + self:SetStartTime(CurTime()) +end + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + + self:SetDTInt(1, 0) + end + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_stun/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_stun/cl_init.lua new file mode 100644 index 0000000..fdbc66f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_stun/cl_init.lua @@ -0,0 +1,18 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:DrawTranslucent() + local owner = self:GetOwner() + if not owner:IsValid() then return end + + render.SetColorModulation(1, 0, 0) + render.SuppressEngineLighting(true) + + self:SetRenderOrigin(owner:GetPos() + Vector(0, 0, owner:OBBMaxs().z)) + self:SetRenderAngles(Angle(0, CurTime() * 500, 0)) + self:DrawModel() + + render.SuppressEngineLighting(false) + render.SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_stun/init.lua b/gamemodes/zombiesurvival/entities/entities/status_stun/init.lua new file mode 100644 index 0000000..5fd7719 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_stun/init.lua @@ -0,0 +1,25 @@ +INC_SERVER() + +function ENT:Think() + self.BaseClass.Think(self) + + local owner = self:GetOwner() + + if not owner:Alive() then + self:Remove() + end +end + + +function ENT:PlayerSet(pPlayer, bExists) + pPlayer:Freeze(true) + + pPlayer.LastStunned = CurTime() +end + +function ENT:OnRemove() + local parent = self:GetParent() + if parent:IsValid() then + parent:Freeze(false) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_stun/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_stun/shared.lua new file mode 100644 index 0000000..9518fdf --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_stun/shared.lua @@ -0,0 +1,15 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Model = Model("models/effects/splodeglass.mdl") + +ENT.Ephemeral = true + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + self:SetModel(self.Model) + self:SetModelScale(0.05, 0) + self:DrawShadow(false) + +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/cl_init.lua index 0f82f63..8e5c666 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.RenderGroup = RENDERGROUP_NONE diff --git a/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/init.lua index 9afd15d..aaae08b 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_ticklemonsterambience/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function ENT:Initialize() self:DrawShadow(false) diff --git a/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/cl_init.lua new file mode 100644 index 0000000..afd41e3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/cl_init.lua @@ -0,0 +1,40 @@ +INC_CLIENT() + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT +ENT.NextEmit = 0 + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner.SpawnProtection then return end + local pos = owner:WorldSpaceCenter() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.25 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local dir = (VectorRand() * 20 + Vector(0, 0, 40)):GetNormal() + + local particle = emitter:Add("!sprite_bloodspray"..math.random(8), pos) + particle:SetVelocity(dir * 100) + particle:SetDieTime(math.Rand(1.1, 1.4)) + particle:SetStartAlpha(240) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(6, 7)) + particle:SetEndSize(12) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-5, 5)) + particle:SetGravity(Vector(0, 0, -165)) + particle:SetCollide(true) + particle:SetBounce(0.45) + particle:SetAirResistance(12) + particle:SetColor(60, 170, 40) + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/init.lua b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/init.lua new file mode 100644 index 0000000..337e12e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function ENT:Initialize() + self:DrawShadow(false) +end + +function ENT:Think() + local owner = self:GetOwner() + if not (owner:Alive() and owner:Team() == TEAM_UNDEAD and owner:GetZombieClassTable().Name == "Vile Bloated Zombie") then self:Remove() end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/shared.lua new file mode 100644 index 0000000..40b3860 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_vbloatedambience/shared.lua @@ -0,0 +1 @@ +ENT.Type = "anim" diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/cl_init.lua new file mode 100644 index 0000000..ad0236d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/cl_init.lua @@ -0,0 +1,70 @@ +INC_CLIENT() + +ENT.ParticleTimer = 0 + +function ENT:OnInitialize() + self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 128)) + + if self:GetOwner() ~= MySelf then return end + self.AmbientSound = CreateSound(self, "player/heartbeat1.wav") + self.AmbientSound:PlayEx(0.85, 150) +end + +function ENT:OnRemove() + local owner = self:GetOwner() + if owner == MySelf then + self.AmbientSound:Stop() + end + + self.BaseClass.OnRemove(self) +end + + +local function GetRandomBonePos(pl) + if pl ~= MySelf or pl:ShouldDrawLocalPlayer() then + local bone = pl:GetBoneMatrix(math.random(0,25)) + if bone then + return bone:GetTranslation() + end + end + + return pl:GetShootPos() +end + +function ENT:DrawTranslucent() + local ent = self:GetOwner() + if not ent:IsValid() then return end + if ent.SpawnProtection then return end + + local pos + if ent == MySelf and not ent:ShouldDrawLocalPlayer() then + local aa, bb = ent:WorldSpaceAABB() + pos = Vector(math.Rand(aa.x, bb.x), math.Rand(aa.y, bb.y), math.Rand(aa.z, bb.z)) + else + pos = GetRandomBonePos(ent) + end + + local emitter = ParticleEmitter(self:GetPos()) + emitter:SetNearClip(24, 32) + + if self.ParticleTimer <= CurTime() then + self.ParticleTimer = CurTime() + 0.065 + + local scale = MySelf:GetModelScale() + + local particle = emitter:Add("sprites/glow04_noz", pos + VectorRand():GetNormalized() * 2) + particle:SetDieTime(0.65) + particle:SetStartSize(12 * scale) + particle:SetEndSize(5 * scale) + particle:SetColor(255, 40, 0) + particle:SetStartAlpha(90) + particle:SetEndAlpha(0) + particle:SetGravity(Vector(0, 0, 256)) + particle:SetVelocity(ent:GetVelocity()) + particle:SetRoll(math.random(0, 360)) + particle:SetRollDelta(math.random(-5, 5)) + + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/init.lua new file mode 100644 index 0000000..bcad8bb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/init.lua @@ -0,0 +1,17 @@ +INC_SERVER() + +function ENT:Think() + local owner = self:GetOwner() + + if owner:GetStatus("shockdebuff") then + self:Remove() + return + end + + if self.DieTime <= CurTime() then + self:Remove() + end + + self:NextThink(CurTime() + 0.1) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/shared.lua new file mode 100644 index 0000000..0a76e7b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_battlecry/shared.lua @@ -0,0 +1,5 @@ +ENT.Type = "anim" +ENT.Base = "status__base" +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +ENT.Ephemeral = true diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/cl_init.lua new file mode 100644 index 0000000..91fb84f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/cl_init.lua @@ -0,0 +1,42 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + local pos = owner:WorldSpaceCenter() + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.25 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + local dir = (VectorRand() * 20 + Vector(0, 0, 40)):GetNormal() + + for i = 1, 6 do + local particle = emitter:Add("sprites/glow04_noz", pos) + particle:SetVelocity(dir * 120) + particle:SetDieTime(math.Rand(1.1, 1.4)) + particle:SetStartAlpha(150) + particle:SetEndAlpha(0) + particle:SetStartSize(math.Rand(6, 7)) + particle:SetEndSize(12) + particle:SetRoll(math.Rand(0, 360)) + particle:SetRollDelta(math.Rand(-5, 5)) + particle:SetGravity(Vector(0, 0, 25)) + particle:SetCollide(true) + particle:SetBounce(0.45) + particle:SetAirResistance(300) + particle:SetColor(60, 20, 20) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end + +function ENT:Initialize() +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/init.lua new file mode 100644 index 0000000..3e3064c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/init.lua @@ -0,0 +1,25 @@ +INC_SERVER() + +function ENT:Think() + local owner = self:GetOwner() + + if owner:GetStatus("shockdebuff") or self:GetHealLeft() <= 0 or owner.BossHealRemaining and owner.BossHealRemaining <= 0 then + self:Remove() + return + end + + local zombieclasstbl = owner:GetZombieClassTable() + local heal = math.Clamp(self:GetHealLeft(), 1, 5) * (zombieclasstbl.SkeletalRes and 0.36 or 1) + + local ehp = zombieclasstbl.Boss and owner:GetMaxHealth() * 0.4 or owner:GetMaxHealth() * 1.25 + + if owner.BossHealRemaining and owner.BossHealRemaining > 0 then + owner.BossHealRemaining = owner.BossHealRemaining - heal + end + + owner:SetHealth(math.min(ehp, owner:Health() + heal)) + self:SetHealLeft(self:GetHealLeft() - heal) + + self:NextThink(CurTime() + 0.1) + return true +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/shared.lua new file mode 100644 index 0000000..3e192a9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombie_regen/shared.lua @@ -0,0 +1,23 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +ENT.Ephemeral = true + +function ENT:Initialize() + self:DrawShadow(false) + if self:GetDTFloat(1) == 0 then + self:SetDTFloat(1, CurTime()) + end + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end + +function ENT:SetHealLeft(healleft) + self:SetDTFloat(0, math.min(75, healleft)) +end + +function ENT:GetHealLeft() + return self:GetDTFloat(0) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombiedartdebuff.lua b/gamemodes/zombiesurvival/entities/entities/status_zombiedartdebuff.lua new file mode 100644 index 0000000..a8af242 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombiedartdebuff.lua @@ -0,0 +1,24 @@ +AddCSLuaFile() + +ENT.Type = "anim" +ENT.Base = "status__base" + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + + self:SetDTInt(1, 0) + end +end + +function ENT:EntityTakeDamage(ent, dmginfo) + local attacker = dmginfo:GetAttacker() + if attacker ~= self:GetOwner() then return end + + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then + local dmg = dmginfo:GetDamage() + dmginfo:SetDamage(dmg * 0.75) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombiespawnbuff.lua b/gamemodes/zombiesurvival/entities/entities/status_zombiespawnbuff.lua index cead86c..d369a8a 100644 --- a/gamemodes/zombiesurvival/entities/entities/status_zombiespawnbuff.lua +++ b/gamemodes/zombiesurvival/entities/entities/status_zombiespawnbuff.lua @@ -6,42 +6,27 @@ ENT.Base = "status__base" function ENT:Initialize() self.BaseClass.Initialize(self) - hook.Add("Move", self, self.Move) - hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + self.Seed = math.Rand(0, 10) - if CLIENT then - hook.Add("PrePlayerDraw", self, self.PrePlayerDraw) - hook.Add("PostPlayerDraw", self, self.PostPlayerDraw) + self:GetOwner().SpawnProtection = true +end + +function ENT:PlayerSet(pl) + pl.SpawnProtection = true +end + +function ENT:OnRemove() + self.BaseClass.OnRemove(self) + + self:GetOwner().SpawnProtection = false +end + +function ENT:SetDie(fTime) + if fTime == 0 or not fTime then + self.DieTime = 0 + elseif fTime == -1 then + self.DieTime = 999999999 + elseif self.DieTime < CurTime() + fTime then + self.DieTime = CurTime() + fTime end end - -function ENT:Move(pl, move) - if pl ~= self:GetOwner() then return end - - move:SetMaxSpeed(move:GetMaxSpeed() * 1.25) - move:SetMaxClientSpeed(move:GetMaxSpeed()) -end - -function ENT:EntityTakeDamage(ent, dmginfo) - if ent ~= self:GetOwner() then return end - - local attacker = dmginfo:GetAttacker() - if attacker:IsValid() and attacker:IsPlayer() then - dmginfo:SetDamage(dmginfo:GetDamage() * 0.4) - end -end - -if not CLIENT then return end - -function ENT:PrePlayerDraw(pl) - if pl ~= self:GetOwner() then return end - - local r = math.abs(math.sin((CurTime() + self:EntIndex()) * 3)) * 0.6 - render.SetColorModulation(r, 1, r) -end - -function ENT:PostPlayerDraw(pl) - if pl ~= self:GetOwner() then return end - - render.SetColorModulation(1, 1, 1) -end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/cl_init.lua new file mode 100644 index 0000000..ce6e66b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/cl_init.lua @@ -0,0 +1,36 @@ +INC_CLIENT() + +ENT.NextEmit = 0 + +function ENT:Draw() + local owner = self:GetOwner() + if not owner:IsValid() or owner == MySelf and not owner:ShouldDrawLocalPlayer() then return end + if owner:GetZombieClassTable().IgnoreTargetAssist then return end + + if owner.SpawnProtection then return end + + if CurTime() < self.NextEmit then return end + self.NextEmit = CurTime() + 0.25 + + local pos = owner:WorldSpaceCenter() + pos.z = pos.z + 24 + + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(16, 24) + + for i = 1, 6 do + particle = emitter:Add("sprites/light_glow02_add", pos + VectorRand() * 12) + particle:SetDieTime(math.Rand(1.1, 1.2)) + particle:SetStartAlpha(230) + particle:SetEndAlpha(0) + particle:SetStartSize(2) + particle:SetEndSize(0) + particle:SetGravity(Vector(0, 0, -155)) + particle:SetAirResistance(300) + particle:SetStartLength(1) + particle:SetEndLength(35) + particle:SetColor(255, 30, 30) + end + + emitter:Finish() emitter = nil collectgarbage("step", 64) +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/init.lua b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/init.lua new file mode 100644 index 0000000..bd75180 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/init.lua @@ -0,0 +1,35 @@ +INC_SERVER() + +function ENT:EntityTakeDamage(ent, dmginfo) + if ent ~= self:GetOwner() then return end + + local attacker = dmginfo:GetAttacker() + if attacker:IsValidHuman() then + dmginfo:SetDamage(dmginfo:GetDamage() * 1.25) + end +end + +function ENT:PlayerHurt(victim, attacker, healthleft, damage) + local applier = self.Applier + if applier and applier:IsValidLivingHuman() and applier ~= attacker and victim:IsValidLivingZombie() then + local attributeddamage = damage + if healthleft < 0 then + attributeddamage = attributeddamage + healthleft + end + + if attributeddamage > 0 then + attributeddamage = attributeddamage - (attributeddamage / 1.25) + + applier.DamageDealt[TEAM_HUMAN] = applier.DamageDealt[TEAM_HUMAN] + attributeddamage + victim.DamagedBy[applier] = (victim.DamagedBy[applier] or 0) + attributeddamage + + local points = attributeddamage / victim:GetMaxHealth() * victim:GetZombieClassTable().Points + applier.PointQueue = applier.PointQueue + points + + local pos = victim:GetPos() + pos.z = pos.z + 32 + applier.LastDamageDealtPos = pos + applier.LastDamageDealtTime = CurTime() + end + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/shared.lua b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/shared.lua new file mode 100644 index 0000000..d796302 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/entities/status_zombiestrdebuff/shared.lua @@ -0,0 +1,17 @@ +ENT.Type = "anim" +ENT.Base = "status__base" + +function ENT:Initialize() + self.BaseClass.Initialize(self) + + if SERVER then + hook.Add("EntityTakeDamage", self, self.EntityTakeDamage) + hook.Add("PlayerHurt", self, self.PlayerHurt) + + self:SetDTInt(1, 0) + end + + if CLIENT then + hook.Add("Draw", self, self.Draw) + end +end diff --git a/gamemodes/zombiesurvival/entities/entities/trigger_bossclass/init.lua b/gamemodes/zombiesurvival/entities/entities/trigger_bossclass/init.lua index 87c28aa..51d06fe 100644 --- a/gamemodes/zombiesurvival/entities/entities/trigger_bossclass/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/trigger_bossclass/init.lua @@ -16,7 +16,7 @@ function ENT:AcceptInput(name, activator, caller, args) if string.sub(name, 1, 2) == "on" then self:FireOutput(name, activator, caller, args) elseif name == "spawnboss" then - GAMEMODE:SpawnBossZombie(false, self.Silent) + GAMEMODE:SpawnBossZombie(false, self.Silent, self.BossIndex, true) elseif name == "seton" then self.On = tonumber(args) == 1 return true @@ -26,7 +26,7 @@ function ENT:AcceptInput(name, activator, caller, args) elseif name == "disable" then self.On = false return true - elseif name == "setsilent" or name == "setinstantchange" then + elseif name == "setsilent" or name == "setinstantchange" or name == "setclass" then self:KeyValue(string.sub(name, 4), args) end end @@ -41,6 +41,17 @@ function ENT:KeyValue(key, value) self.Silent = tonumber(value) == 1 elseif key == "instantchange" then self.InstantChange = tonumber(value) == 1 + elseif key == "class" then + self.BossIndex = nil + for _, classtable in ipairs(GAMEMODE.ZombieClasses) do + if classtable.Boss then + local classname=GAMEMODE.ZombieClasses[classtable.Index].Name + if string.lower(classname) == string.lower(value or "") then + self.BossIndex = classtable.Index + break + end + end + end end end @@ -51,7 +62,7 @@ function ENT:StartTouch(ent) else local prevpos = ent:GetPos() local prevang = ent:EyeAngles() - GAMEMODE:SpawnBossZombie(ent, self.Silent) + GAMEMODE:SpawnBossZombie(ent, self.Silent, self.BossIndex, true) if self.InstantChange then ent:SetPos(prevpos) ent:SetEyeAngles(prevang) diff --git a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua index 9f0e0ad..35ba869 100644 --- a/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/trigger_zombieclass/init.lua @@ -5,9 +5,9 @@ function ENT:Initialize() if self.On == nil then self.On = true end if self.InstantChange == nil then self.InstantChange = true end - if self.OnlyWhenClass == nil then - self.OnlyWhenClass = {} - self.OnlyWhenClass[1] = -1 + if self.OnlyWhenClass == nil then + self.OnlyWhenClass = {} + self.OnlyWhenClass[1] = -1 end end @@ -38,7 +38,7 @@ function ENT:KeyValue(key, value) self.TouchClass = string.lower(value) elseif key == "onlywhenclass" then self.OnlyWhenClass = {} - if value == "disabled" then + if value == "disabled" then self.OnlyWhenClass[1] = -1 else self.OnlyWhenClass[1] = -1 @@ -65,7 +65,7 @@ function ENT:KeyValue(key, value) end function ENT:DoTouch(ent, class_name, death_class_name) - if self.On and ent:IsPlayer() and ent:Alive() and ent:Team() == TEAM_UNDEAD then + if self.On and ent:IsValidLivingZombie() then local prev = ent:GetZombieClass() if table.HasValue( self.OnlyWhenClass, prev ) or self.OnlyWhenClass[1] == -1 then if class_name and class_name ~= string.lower(ent:GetZombieClassTable().Name) then diff --git a/gamemodes/zombiesurvival/entities/entities/zombiegasses/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/zombiegasses/cl_init.lua index 14f4d04..6312174 100644 --- a/gamemodes/zombiesurvival/entities/entities/zombiegasses/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/zombiegasses/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() ENT.NextGas = 0 ENT.NextSound = 0 @@ -12,7 +12,8 @@ function ENT:Think() if 0 < GAMEMODE:GetWave() and MySelf:IsValid() and MySelf:Team() == TEAM_HUMAN and MySelf:Alive() then local mypos = self:GetPos() local eyepos = MySelf:NearestPoint(mypos) - if eyepos:Distance(mypos) <= self:GetRadius() + 72 and WorldVisible(eyepos, mypos) then + local radius = self:GetRadius() + if eyepos:DistToSqr(mypos) <= radius * radius + 5184 and WorldVisible(eyepos, mypos) then MySelf:EmitSound("ambient/voices/cough"..math.random(4)..".wav") end end @@ -20,13 +21,13 @@ function ENT:Think() end local particleTable = { - [ 1 ] = { particle = "particle/smokesprites_0001", sizeStart = 0, sizeEnd = 96, airRecis = 90, startAlpha = 180, endAlpha = 0, randXY = 46, randZMin = 34, randZMax = 72, color = Color( 0, 80, 0 ), rotRate = 0.9, lifeTimeMin = 1.8, lifeTimeMax = 2.9 }, - [ 2 ] = { particle = "particle/smokesprites_0002", sizeStart = 0, sizeEnd = 90, airRecis = 76, startAlpha = 110, endAlpha = 0, randXY = 24, randZMin = 24, randZMax = 62, color = Color( 0, 120, 0 ), rotRate = 0.6, lifeTimeMin = 1.6, lifeTimeMax = 2.2 }, - [ 3 ] = { particle = "particle/smokesprites_0003", sizeStart = 0, sizeEnd = 140, airRecis = 49, startAlpha = 130, endAlpha = 0,randXY = 36, randZMin = 39, randZMax = 42, color = Color( 0, 90, 0 ), rotRate = 0.6, lifeTimeMin = 1.8, lifeTimeMax = 2.4 }, - [ 4 ] = { particle = "particle/smokesprites_0004", sizeStart = 0, sizeEnd = 100, airRecis = 59, startAlpha = 160, endAlpha = 0,randXY = 42, randZMin = 31, randZMax = 68, color = Color( 0, 60, 0 ), rotRate = 0.2, lifeTimeMin = 1.6, lifeTimeMax = 2.9 }, - [ 5 ] = { particle = "particle/smokesprites_0007", sizeStart = 0, sizeEnd = 160, airRecis = 79, startAlpha = 180, endAlpha = 0,randXY = 46, randZMin = 16, randZMax = 56, color = Color( 0, 70, 0 ), rotRate = 1.4, lifeTimeMin = 1.6, lifeTimeMax = 2.2 }, - [ 6 ] = { particle = "particle/smokesprites_0008", sizeStart = 0, sizeEnd = 60, airRecis = 46, startAlpha = 190, endAlpha = 0,randXY = 49, randZMin = 12, randZMax = 48, color = Color( 0, 90, 0 ), rotRate = 1, lifeTimeMin = 1.7, lifeTimeMax = 2.4 }, - [ 7 ] = { particle = "particle/particle_glow_03", sizeStart = 0, sizeEnd = 4, airRecis = 4, startAlpha = 255, endAlpha = 0,randXY = 69, randZMin = 16, randZMax = 64, color = Color( 0, 255, 0 ), rotRate = 0, lifeTimeMin = 1.5, lifeTimeMax = 2.8 }, + [ 1 ] = { particle = "particle/smokesprites_0001", sizeStart = 0, sizeEnd = 96, airRecis = 90, startAlpha = 180, endAlpha = 0, randXY = 76, randZMin = 34, randZMax = 72, color = Color( 0, 80, 0 ), rotRate = 0.9, lifeTimeMin = 1.8, lifeTimeMax = 2.9 }, + [ 2 ] = { particle = "particle/smokesprites_0002", sizeStart = 0, sizeEnd = 90, airRecis = 76, startAlpha = 110, endAlpha = 0, randXY = 54, randZMin = 24, randZMax = 62, color = Color( 0, 120, 0 ), rotRate = 0.6, lifeTimeMin = 1.6, lifeTimeMax = 2.2 }, + [ 3 ] = { particle = "particle/smokesprites_0003", sizeStart = 0, sizeEnd = 140, airRecis = 49, startAlpha = 130, endAlpha = 0,randXY = 66, randZMin = 39, randZMax = 42, color = Color( 0, 90, 0 ), rotRate = 0.6, lifeTimeMin = 1.8, lifeTimeMax = 2.4 }, + [ 4 ] = { particle = "particle/smokesprites_0004", sizeStart = 0, sizeEnd = 100, airRecis = 59, startAlpha = 160, endAlpha = 0,randXY = 72, randZMin = 31, randZMax = 68, color = Color( 0, 60, 0 ), rotRate = 0.2, lifeTimeMin = 1.6, lifeTimeMax = 2.9 }, + [ 5 ] = { particle = "particle/smokesprites_0007", sizeStart = 0, sizeEnd = 160, airRecis = 79, startAlpha = 180, endAlpha = 0,randXY = 76, randZMin = 16, randZMax = 56, color = Color( 0, 70, 0 ), rotRate = 1.4, lifeTimeMin = 1.6, lifeTimeMax = 2.2 }, + [ 6 ] = { particle = "particle/smokesprites_0008", sizeStart = 0, sizeEnd = 60, airRecis = 46, startAlpha = 190, endAlpha = 0,randXY = 79, randZMin = 12, randZMax = 48, color = Color( 0, 90, 0 ), rotRate = 1, lifeTimeMin = 1.7, lifeTimeMax = 2.4 }, + [ 7 ] = { particle = "particle/particle_glow_03", sizeStart = 0, sizeEnd = 4, airRecis = 4, startAlpha = 255, endAlpha = 0,randXY = 59, randZMin = 16, randZMax = 64, color = Color( 0, 255, 0 ), rotRate = 0, lifeTimeMin = 1.5, lifeTimeMax = 2.8 }, } function ENT:Draw() @@ -39,12 +40,14 @@ function ENT:Draw() local particledata = particleTable[math.random(7)] vecRan = vecRan * math.Rand( 20, 40 ) vecRan.z = math.Rand( 10, 60 ) - + local emitter = ParticleEmitter( pos ) emitter:SetNearClip( 48, 64 ) + local radiusmul = self:GetRadius() / 170 + local particle = emitter:Add( particledata.particle, pos + vecRan ) - particle:SetVelocity( Vector( math.Rand( -particledata.randXY, particledata.randXY ), math.Rand( -particledata.randXY, particledata.randXY ), math.Rand( particledata.randZMin, particledata.randZMax ) ) ) + particle:SetVelocity( Vector( math.Rand(-particledata.randXY, particledata.randXY) * radiusmul * 2, math.Rand(-particledata.randXY, particledata.randXY) * radiusmul * 2, math.Rand(particledata.randZMin, particledata.randZMax) * radiusmul )) particle:SetColor( particledata.color.r, particledata.color.g, particledata.color.b ) particle:SetAirResistance( particledata.airRecis ) particle:SetCollide( true ) @@ -55,5 +58,5 @@ function ENT:Draw() particle:SetEndSize( particledata.sizeEnd ) particle:SetRollDelta( math.Rand( -particledata.rotRate, particledata.rotRate ) ) - emitter:Finish() + emitter:Finish() emitter = nil collectgarbage("step", 64) end diff --git a/gamemodes/zombiesurvival/entities/entities/zombiegasses/init.lua b/gamemodes/zombiesurvival/entities/entities/zombiegasses/init.lua index 2b95195..00eceb2 100644 --- a/gamemodes/zombiesurvival/entities/entities/zombiegasses/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/zombiegasses/init.lua @@ -1,12 +1,10 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") +ENT.TickTime = 0.5 function ENT:Initialize() - self.Heal = self.Heal or 25 self:DrawShadow(false) - self:Fire("attack", "", 1.5) + self:Fire("attack", "", self.TickTime) if self:GetRadius() == 0 then self:SetRadius(400) end end @@ -15,38 +13,28 @@ function ENT:KeyValue(key, value) key = string.lower(key) if key == "radius" then self:SetRadius(tonumber(value)) - elseif key == "heal" then - self.Heal = tonumber(value) or self.Heal end end -local function TrueVisible(posa, posb) - local filt = ents.FindByClass("projectile_*") - filt = table.Add(filt, ents.FindByClass("npc_*")) - filt = table.Add(filt, ents.FindByClass("prop_*")) - filt = table.Add(filt, player.GetAll()) - - return not util.TraceLine({start = posa, endpos = posb, filter = filt}).Hit -end - function ENT:AcceptInput(name, activator, caller, arg) if name ~= "attack" then return end - self:Fire("attack", "", 1.5) - if GAMEMODE:GetWave() <= 0 or GAMEMODE.ZombieEscape then return end + if GAMEMODE.ZombieEscape then + return true + end + + self:Fire("attack", "", self.TickTime) local vPos = self:GetPos() + for _, ent in pairs(ents.FindInSphere(vPos, self:GetRadius())) do - if ent and ent:IsValid() and ent:IsPlayer() and ent:Alive() and WorldVisible(vPos, ent:NearestPoint(vPos)) then + if ent and ent:IsValidLivingPlayer() and WorldVisible(vPos, ent:WorldSpaceCenter()) then if ent:Team() == TEAM_UNDEAD then - --[[if ent:Health() < ent:GetMaxHealth() and not ent:GetZombieClassTable().Boss then - ent:SetHealth(math.min(ent:GetMaxZombieHealth(), ent:Health() + self.Heal)) - ent.m_LastGasHeal = CurTime() - end]] - ent:GiveStatus("zombiespawnbuff", 3) - elseif 1 < ent:Health() then - --ent:PoisonDamage(math.min(10, ent:Health() - 1), self, self) - ent:PoisonDamage(math.min(5, ent:Health() - 1), self, self) + if CurTime() >= (ent.LastRangedAttack or 0) + 3 then + ent:GiveStatus("zombiespawnbuff", self.TickTime + 0.1) + end + elseif GAMEMODE:GetWave() ~= 0 then + ent:GiveStatus("spawnslow", self.TickTime + 0.1) end end end diff --git a/gamemodes/zombiesurvival/entities/entities/zs_hands.lua b/gamemodes/zombiesurvival/entities/entities/zs_hands.lua index 0f395b9..3cbea2b 100644 --- a/gamemodes/zombiesurvival/entities/entities/zs_hands.lua +++ b/gamemodes/zombiesurvival/entities/entities/zs_hands.lua @@ -6,13 +6,13 @@ ENT.RenderGroup = RENDERGROUP_OTHER function ENT:Initialize() - + hook.Add( "OnViewModelChanged", self, self.ViewModelChanged ) self:SetNotSolid( true ) self:DrawShadow( false ) self:SetTransmitWithParent( true ) -- Transmit only when the viewmodel does! - + end function ENT:DoSetup( ply ) @@ -50,7 +50,7 @@ end function ENT:ViewModelChanged( vm, old, new ) if not IsValid(self) then return end - + -- Ignore other peoples viewmodel changes! if ( vm:GetOwner() != self:GetOwner() ) then return end @@ -59,7 +59,7 @@ function ENT:ViewModelChanged( vm, old, new ) end function ENT:AttachToViewmodel( vm ) - + self:AddEffects( EF_BONEMERGE ) self:SetParent( vm ) self:SetMoveType( MOVETYPE_NONE ) @@ -68,3 +68,9 @@ function ENT:AttachToViewmodel( vm ) self:SetAngles( Angle( 0, 0, 0 ) ) end + +function ENT:Draw() + if MySelf:CallZombieFunction1("DrawHands", self) then return end + + self:DrawModel() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/base_code.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/base_code.lua index 981f9ca..f8c992d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/base_code.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/base_code.lua @@ -1,69 +1,69 @@ -/******************************************************** +--[[******************************************************* SWEP Construction Kit base code Created by Clavus Available for public use, thread at: facepunch.com/threads/1032378 - - + + DESCRIPTION: - This script is meant for experienced scripters - that KNOW WHAT THEY ARE DOING. Don't come to me + This script is meant for experienced scripters + that KNOW WHAT THEY ARE DOING. Don't come to me with basic Lua questions. - + Just copy into your SWEP or SWEP base of choice and merge with your own code. - + The SWEP.VElements, SWEP.WElements and SWEP.ViewModelBoneMods tables are all optional and only have to be visible to the client. -********************************************************/ +*******************************************************]] function SWEP:Initialize() - // other initialize code goes here + -- other initialize code goes here if CLIENT then - - // Create a new table for every weapon instance + + -- Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) - self:CreateModels(self.VElements) // create viewmodels - self:CreateModels(self.WElements) // create worldmodels - - // init view model bone build function - if IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + self:CreateModels(self.VElements) -- create viewmodels + self:CreateModels(self.WElements) -- create worldmodels + + -- init view model bone build function + if IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) - - // Init viewmodel visibility + + -- Init viewmodel visibility if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else - // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called + -- we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called vm:SetColor(Color(255,255,255,1)) - // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in - // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing - vm:SetMaterial("Debug/hsv") + -- ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in + -- however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing + vm:SetMaterial("Debug/hsv") end end end - + end end function SWEP:Holster() - - if CLIENT and IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + + if CLIENT and IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end - + return true end @@ -75,17 +75,17 @@ if CLIENT then SWEP.vRenderOrder = nil function SWEP:ViewModelDrawn() - - local vm = self.Owner:GetViewModel() + + local vm = self:GetOwner():GetViewModel() if !IsValid(vm) then return end - + if (!self.VElements) then return end - + self:UpdateBonePositions(vm) if (!self.vRenderOrder) then - - // we build a render order because sprites need to be drawn after models + + -- we build a render order because sprites need to be drawn after models self.vRenderOrder = {} for k, v in pairs( self.VElements ) do @@ -95,24 +95,24 @@ if CLIENT then table.insert(self.vRenderOrder, k) end end - + end for k, name in ipairs( self.vRenderOrder ) do - + local v = self.VElements[name] if (!v) then self.vRenderOrder = nil break end if (v.hide) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (!v.bone) then continue end - + local pos, ang = self:GetBoneOrientation( self.VElements, v, vm ) - + if (!pos) then continue end - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -121,21 +121,21 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then @@ -143,53 +143,53 @@ if CLIENT then end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end SWEP.wRenderOrder = nil function SWEP:DrawWorldModel() - + if (self.ShowWorldModel == nil or self.ShowWorldModel) then self:DrawModel() end - + if (!self.WElements) then return end - + if (!self.wRenderOrder) then self.wRenderOrder = {} @@ -203,33 +203,33 @@ if CLIENT then end end - - if (IsValid(self.Owner)) then - bone_ent = self.Owner + + if (IsValid(self:GetOwner())) then + bone_ent = self:GetOwner() else - // when the weapon is dropped + -- when the weapon is dropped bone_ent = self end - + for k, name in pairs( self.wRenderOrder ) do - + local v = self.WElements[name] if (!v) then self.wRenderOrder = nil break end if (v.hide) then continue end - + local pos, ang - + if (v.bone) then pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent ) else pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" ) end - + if (!pos) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -238,21 +238,21 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then @@ -260,83 +260,83 @@ if CLIENT then end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override ) - + local bone, pos, ang if (tab.rel and tab.rel != "") then - + local v = basetab[tab.rel] - + if (!v) then return end - - // Technically, if there exists an element with the same name as a bone - // you can get in an infinite loop. Let's just hope nobody's that stupid. + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. pos, ang = self:GetBoneOrientation( basetab, v, ent ) - + if (!pos) then return end - + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + else - + bone = ent:LookupBone(bone_override or tab.bone) if (!bone) then return end - + pos, ang = Vector(0,0,0), Angle(0,0,0) local m = ent:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end - - if (IsValid(self.Owner) and self.Owner:IsPlayer() and - ent == self.Owner:GetViewModel() and self.ViewModelFlip) then - ang.r = -ang.r // Fixes mirrored models + + if (IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() and + ent == self:GetOwner():GetViewModel() and self.ViewModelFlip) then + ang.r = -ang.r -- Fixes mirrored models end - + end - + return pos, ang end @@ -344,11 +344,11 @@ if CLIENT then if (!tab) then return end - // Create the clientside models here because Garry says we can't do it in the render hook + -- Create the clientside models here because Garry says we can't do it in the render hook for k, v in pairs( tab ) do - if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then - + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) @@ -359,13 +359,13 @@ if CLIENT then else v.modelEnt = nil end - - elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then - + local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } - // make sure we create a unique name based on the selected options + -- make sure we create a unique name based on the selected options local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then @@ -378,48 +378,48 @@ if CLIENT then v.createdSprite = v.sprite v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) - + end end - + end - + local allbones local hasGarryFixedBoneScalingYet = false function SWEP:UpdateBonePositions(vm) - + if self.ViewModelBoneMods then - + if (!vm:GetBoneCount()) then return end - - // !! WORKAROUND !! // - // We need to check all model names :/ + + -- !! WORKAROUND !! -- + -- We need to check all model names :/ local loopthrough = self.ViewModelBoneMods if (!hasGarryFixedBoneScalingYet) then allbones = {} for i=0, vm:GetBoneCount() do local bonename = vm:GetBoneName(i) - if (self.ViewModelBoneMods[bonename]) then + if (self.ViewModelBoneMods[bonename]) then allbones[bonename] = self.ViewModelBoneMods[bonename] else - allbones[bonename] = { + allbones[bonename] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end end - + loopthrough = allbones end - // !! ----------- !! // - + -- !! ----------- !! -- + for k, v in pairs( loopthrough ) do local bone = vm:LookupBone(k) if (!bone) then continue end - - // !! WORKAROUND !! // + + -- !! WORKAROUND !! -- local s = Vector(v.scale.x,v.scale.y,v.scale.z) local p = Vector(v.pos.x,v.pos.y,v.pos.z) local ms = Vector(1,1,1) @@ -431,10 +431,10 @@ if CLIENT then cur = vm:GetBoneParent(cur) end end - + s = s * ms - // !! ----------- !! // - + -- !! ----------- !! -- + if vm:GetManipulateBoneScale(bone) != s then vm:ManipulateBoneScale( bone, s ) end @@ -448,9 +448,9 @@ if CLIENT then else self:ResetBonePositions(vm) end - + end - + function SWEP:ResetBonePositions(vm) -- New code vm:SetColor(color_white) @@ -463,24 +463,24 @@ if CLIENT then vm:ManipulateBoneAngles( i, Angle(0, 0, 0) ) vm:ManipulateBonePosition( i, Vector(0, 0, 0) ) end - + end - /************************** + --[[************************* Global utility code - **************************/ + *************************]] - // Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). - // Does not copy entities of course, only copies their reference. - // WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop + -- Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). + -- Does not copy entities of course, only copies their reference. + -- WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop function table.FullCopy( tab ) if (!tab) then return nil end - + local res = {} for k, v in pairs( tab ) do if (type(v) == "table") then - res[k] = table.FullCopy(v) // recursion ho! + res[k] = table.FullCopy(v) -- recursion ho! elseif (type(v) == "Vector") then res[k] = Vector(v.x, v.y, v.z) elseif (type(v) == "Angle") then @@ -489,10 +489,10 @@ if CLIENT then res[k] = v end end - + return res - + end - + end diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/client.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/client.lua index 40d72ea..bd09fc9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/client.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/client.lua @@ -10,38 +10,38 @@ SWEP.thirdPersonDis = 100 SWEP.mlast_x = ScrW()/2 SWEP.mlast_y = ScrH()/2 -local playerBones = { - "ValveBiped.Bip01_Head1", +local playerBones = { + "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_Pelvis", - "ValveBiped.Bip01_Spine", + "ValveBiped.Bip01_Spine", "ValveBiped.Bip01_Spine1", "ValveBiped.Bip01_Spine2", "ValveBiped.Bip01_Spine4", - "ValveBiped.Anim_Attachment_RH", - "ValveBiped.Bip01_R_Hand", + "ValveBiped.Anim_Attachment_RH", + "ValveBiped.Bip01_R_Hand", "ValveBiped.Bip01_R_Forearm", "ValveBiped.Bip01_R_UpperArm", "ValveBiped.Bip01_R_Clavicle", - "ValveBiped.Bip01_R_Foot", + "ValveBiped.Bip01_R_Foot", "ValveBiped.Bip01_R_Toe0", - "ValveBiped.Bip01_R_Thigh", - "ValveBiped.Bip01_R_Calf", - "ValveBiped.Bip01_R_Shoulder", + "ValveBiped.Bip01_R_Thigh", + "ValveBiped.Bip01_R_Calf", + "ValveBiped.Bip01_R_Shoulder", "ValveBiped.Bip01_R_Elbow", "ValveBiped.Bip01_Neck1", - "ValveBiped.Anim_Attachment_LH", - "ValveBiped.Bip01_L_Hand", + "ValveBiped.Anim_Attachment_LH", + "ValveBiped.Bip01_L_Hand", "ValveBiped.Bip01_L_Forearm", "ValveBiped.Bip01_L_UpperArm", "ValveBiped.Bip01_L_Clavicle", - "ValveBiped.Bip01_L_Foot", + "ValveBiped.Bip01_L_Foot", "ValveBiped.Bip01_L_Toe0", - "ValveBiped.Bip01_L_Thigh", - "ValveBiped.Bip01_L_Calf", - "ValveBiped.Bip01_L_Shoulder", + "ValveBiped.Bip01_L_Thigh", + "ValveBiped.Bip01_L_Calf", + "ValveBiped.Bip01_L_Shoulder", "ValveBiped.Bip01_L_Elbow" } - + SWEP.v_models = {} SWEP.v_panelCache = {} SWEP.v_modelListing = nil @@ -92,24 +92,24 @@ SWEP.ir_drag = { SWEP.Frame = nil SWEP.cur_drag_mode = "x / z" SWEP.basecode = "FAILED TO READ BASE CODE" - + function SWEP:ClientInit() - + SCKDebug("Client init start") - - if (IsValid(self.Owner)) then - // init view model bone mods - local vm = self.Owner:GetViewModel() + + if (IsValid(self:GetOwner())) then + -- init view model bone mods + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end - + local basecodepath = "lua/weapons/swep_construction_kit/base_code.lua" self.basecode = file.Read(basecodepath, "GAME") - + SCKDebug("Loaded base code") - + end function SimplePanel( parent ) @@ -117,7 +117,7 @@ function SimplePanel( parent ) local p = vgui.Create("DPanel", parent) p.Paint = function() end return p - + end function PrintVec( vec ) @@ -132,50 +132,50 @@ end function PrintColor( col ) return "Color("..col.r..", "..col.g..", "..col.b..", "..col.a..")" -end +end -// Populates a DChoiceList with all the bones of the specified entity -// returns if it has a first option +-- Populates a DChoiceList with all the bones of the specified entity +-- returns if it has a first option function PopulateBoneList( choicelist, ent ) if (!IsValid(choicelist)) then return false end if (!IsValid(ent)) then return end - + SCKDebug("Populating bone list for entity "..tostring(ent)) - + if (ent == LocalPlayer()) then - // if the local player is in third person, his bone lookup is all messed up so - // we just use the predefined playerBones table + -- if the local player is in third person, his bone lookup is all messed up so + -- we just use the predefined playerBones table for k, v in pairs(playerBones) do choicelist:AddChoice(v) end - + return true else local hasfirstoption for i = 0, ent:GetBoneCount() - 1 do local name = ent:GetBoneName(i) - if (ent:LookupBone(name)) then // filter out invalid bones + if (ent:LookupBone(name)) then -- filter out invalid bones choicelist:AddChoice(name) if (!firstoption) then hasfirstoption = true end end end - + return hasfirstoption end end function SWEP:CreateWeaponWorldModel() - + local model = self.CurWorldModel SCKDebug("Creating weapon world model") - - if ((!self.world_model or (IsValid(self.world_model) and self.cur_wmodel != model)) and + + if ((!self.world_model or (IsValid(self.world_model) and self.cur_wmodel != model)) and string.find(model, ".mdl") and file.Exists(model,"GAME") ) then - + if IsValid(self.world_model) then self.world_model:Remove() end self.world_model = ClientsideModel(model, RENDERGROUP_TRANSLUCENT) if (IsValid(self.world_model)) then - self.world_model:SetParent(self.Owner) + self.world_model:SetParent(self:GetOwner()) self.world_model:SetNoDraw(true) self.cur_wmodel = model if (self.world_model:LookupBone( "ValveBiped.Bip01_R_Hand" )) then @@ -187,20 +187,20 @@ function SWEP:CreateWeaponWorldModel() end end - + end function SWEP:CreateModels( tab ) - - //if true then return end - - // Create the clientside models here because Garry says we can't do it in the render hook + + --if true then return end + + -- Create the clientside models here because Garry says we can't do it in the render hook for k, v in pairs( tab ) do - if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists(v.model,"GAME") ) then - + SCKDebug("Creating new ClientSideModel "..v.model) - + v.modelEnt = ClientsideModel(v.model, RENDERGROUP_TRANSLUCENT) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) @@ -211,14 +211,14 @@ function SWEP:CreateModels( tab ) else v.modelEnt = nil end - + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists("materials/"..v.sprite..".vmt", "GAME")) then - + SCKDebug("Creating new sprite "..v.sprite) - + local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } - // make sure we create a unique name based on the selected options + -- make sure we create a unique name based on the selected options local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then @@ -231,41 +231,41 @@ function SWEP:CreateModels( tab ) v.createdSprite = v.sprite v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) - + end end - + end function SWEP:Think() - + self:CreateModels( self.v_models ) self:CreateModels( self.w_models ) - - // Some hacky shit to get 3rd person view compatible with - // other addons that override CalcView + + -- Some hacky shit to get 3rd person view compatible with + -- other addons that override CalcView self:CalcViewHookManagement() - - /************************ + + --[[*********************** Camera fiddling - ************************/ + ***********************]] self.useThirdPerson = self:GetThirdPerson() - + local mx, my = gui.MousePos() local diffx, diffy = (mx - self.mlast_x), (my - self.mlast_y) - - if (input.IsMouseDown(MOUSE_RIGHT) and !(diffx > 40 or diffy > 40) and self.Frame and self.Frame:IsVisible()) then // right mouse press without sudden jumps - + + if (input.IsMouseDown(MOUSE_RIGHT) and !(diffx > 40 or diffy > 40) and self.Frame and self.Frame:IsVisible()) then -- right mouse press without sudden jumps + if (self.useThirdPerson) then - + if (input.IsKeyDown(KEY_E)) then self.thirdPersonDis = math.Clamp( self.thirdPersonDis + diffy, 10, 500 ) else self.thirdPersonAngle = self.thirdPersonAngle + Angle( diffy/2, diffx/2, 0 ) end - + else - // ironsight adjustment + -- ironsight adjustment for k, v in pairs( self.ir_drag ) do if (v[1]) then local temp = GetConVar( "_sp_ironsight_"..k ):GetFloat() @@ -282,11 +282,11 @@ function SWEP:Think() end end end - + end - + end - + self.mlast_x, self.mlast_y = mx, my end @@ -302,7 +302,7 @@ function SWEP:RemoveModels() end self.v_models = {} self.w_models = {} - + if (IsValid(self.world_model)) then self.world_model:Remove() self.world_model = nil @@ -311,55 +311,55 @@ function SWEP:RemoveModels() end function SWEP:GetBoneOrientation( basetab, name, ent, bone_override, buildup ) - + local bone, pos, ang local tab = basetab[name] - + if (tab.rel and tab.rel != "") then local v = basetab[tab.rel] - + if (!v) then return end - + if (!buildup) then buildup = {} end - + table.insert(buildup, name) if (table.HasValue(buildup, tab.rel)) then return end - - // Technically, if there exists an element with the same name as a bone - // you can get in an infinite loop. Let's just hope nobody's that stupid. + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. pos, ang = self:GetBoneOrientation( basetab, tab.rel, ent, nil, buildup ) - + if (!pos) then return end - + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z if (v.angle) then ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) end - + else - + bone = ent:LookupBone(bone_override or tab.bone) if (!bone) then return end - + pos, ang = Vector(0,0,0), Angle(0,0,0) local m = ent:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end - - if (IsValid(self.Owner) and self.Owner:IsPlayer() and - ent == self.Owner:GetViewModel() and self.ViewModelFlip) then - ang.r = -ang.r // Fixes mirrored models + + if (IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() and + ent == self:GetOwner():GetViewModel() and self.ViewModelFlip) then + ang.r = -ang.r -- Fixes mirrored models end - + end - + return pos, ang end @@ -367,38 +367,38 @@ local allbones local hasGarryFixedBoneScalingYet = false function SWEP:UpdateBonePositions(vm) - + if self.v_bonemods then - + if (!vm:GetBoneCount()) then return end - - // !! WORKAROUND !! // - // We need to check all model names :/ + + -- !! WORKAROUND !! -- + -- We need to check all model names :/ local loopthrough = self.v_bonemods if (!hasGarryFixedBoneScalingYet) then allbones = {} for i=0, vm:GetBoneCount() do local bonename = vm:GetBoneName(i) - if (self.v_bonemods[bonename]) then + if (self.v_bonemods[bonename]) then allbones[bonename] = self.v_bonemods[bonename] else - allbones[bonename] = { + allbones[bonename] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end end - + loopthrough = allbones end - // !! ----------- !! // - + -- !! ----------- !! -- + for k, v in pairs( loopthrough ) do local bone = vm:LookupBone(k) if (!bone) then continue end - - // !! WORKAROUND !! // + + -- !! WORKAROUND !! -- local s = Vector(v.scale.x,v.scale.y,v.scale.z) local p = Vector(v.pos.x,v.pos.y,v.pos.z) local ms = Vector(1,1,1) @@ -410,18 +410,18 @@ function SWEP:UpdateBonePositions(vm) cur = vm:GetBoneParent(cur) end end - - //local bpos = vm:GetBonePosition(bone) - //local par = vm:GetBoneParent(bone) + + --local bpos = vm:GetBonePosition(bone) + --local par = vm:GetBoneParent(bone) s = s * ms - - //SCKDebug("Bone ("..bone..") "..vm:GetBoneName(bone).." rel to p ("..par.."): "..tostring(bpos - (vm:GetBonePosition(vm:GetBoneParent(bone)) or bpos))) - //local relp = bpos - (vm:GetBonePosition(vm:GetBoneParent(bone)) or bpos) - //p = relp * ms - relp - //SCKDebug("Bone ("..bone..") scale = "..tostring(ms).." | newpos = "..tostring(p)) - - // !! ----------- !! // - + + --SCKDebug("Bone ("..bone..") "..vm:GetBoneName(bone).." rel to p ("..par.."): "..tostring(bpos - (vm:GetBonePosition(vm:GetBoneParent(bone)) or bpos))) + --local relp = bpos - (vm:GetBonePosition(vm:GetBoneParent(bone)) or bpos) + --p = relp * ms - relp + --SCKDebug("Bone ("..bone..") scale = "..tostring(ms).." | newpos = "..tostring(p)) + + -- !! ----------- !! -- + if vm:GetManipulateBoneScale(bone) != s then vm:ManipulateBoneScale( bone, s ) end @@ -435,41 +435,41 @@ function SWEP:UpdateBonePositions(vm) else self:ResetBonePositions(vm) end - + end - + function SWEP:ResetBonePositions(vm) - + if (!vm:GetBoneCount()) then return end - + for i=0, vm:GetBoneCount() do vm:ManipulateBoneScale( i, Vector(1, 1, 1) ) vm:ManipulateBoneAngles( i, Angle(0, 0, 0) ) vm:ManipulateBonePosition( i, Vector(0, 0, 0) ) end - + end -/******************************** +--[[******************************* All viewmodel drawing magic -*********************************/ +********************************]] SWEP.vRenderOrder = nil function SWEP:ViewModelDrawn() - - //if true then return end - //SCKDebugRepeat( "SWEP:VMD", "Drawing viewmodel!" ) - - local vm = self.Owner:GetViewModel() + + --if true then return end + --SCKDebugRepeat( "SWEP:VMD", "Drawing viewmodel!" ) + + local vm = self:GetOwner():GetViewModel() if !IsValid(vm) then return end - + self:UpdateBonePositions(vm) - /*if vm.BuildBonePositions ~= self.BuildViewModelBones then + --[[if vm.BuildBonePositions ~= self.BuildViewModelBones then vm.BuildBonePositions = self.BuildViewModelBones - end*/ + end]] if (!self.vRenderOrder) then - - // we build a render order because sprites need to be drawn after models + + -- we build a render order because sprites need to be drawn after models self.vRenderOrder = {} for k, v in pairs( self.v_models ) do @@ -479,23 +479,23 @@ function SWEP:ViewModelDrawn() table.insert(self.vRenderOrder, k) end end - + end - + for k, name in ipairs( self.vRenderOrder ) do - + local v = self.v_models[name] if (!v) then self.vRenderOrder = nil break end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (!v.bone) then continue end - + local pos, ang = self:GetBoneOrientation( self.v_models, name, vm ) - + if (!pos) then continue end - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -504,29 +504,29 @@ function SWEP:ViewModelDrawn() ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end - - // Ain't working :/ - /*halo.Render({ + + -- Ain't working :/ + --[[halo.Render({ Ents = {model}, Color = Color(255,0,0,200), BlurX = 2, @@ -534,35 +534,35 @@ function SWEP:ViewModelDrawn() DrawPasses = 1, Additive = true, IgnoreZ = true - })*/ - + })]] + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad") then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) draw.RoundedBox( 0, -20, -20, 40, 40, Color(200,0,0,100) ) surface.SetDrawColor( 255, 255, 255, 100 ) @@ -575,23 +575,23 @@ function SWEP:ViewModelDrawn() cam.End3D2D() end - + end - + end -/******************************** +--[[******************************* All worldmodel drawing science -*********************************/ +********************************]] SWEP.wRenderOrder = nil function SWEP:DrawWorldModel() - - //if true then return end - //SCKDebugRepeat( "SWEP:WMD", "Drawing worldmodel!" ) - + + --if true then return end + --SCKDebugRepeat( "SWEP:WMD", "Drawing worldmodel!" ) + local wm = self.world_model if !IsValid(wm) then return end - + if (!self.wRenderOrder) then self.wRenderOrder = {} @@ -607,57 +607,57 @@ function SWEP:DrawWorldModel() end local bone_ent - - if (IsValid(self.Owner)) then + + if (IsValid(self:GetOwner())) then self:SetColor(Color(255,255,255,255)) - self:SetRenderMode(0) + self:SetRenderMode(0) wm:SetNoDraw(true) - if (self.Owner:GetActiveWeapon() != self.Weapon) then return end - wm:SetParent(self.Owner) + if (self:GetOwner():GetActiveWeapon() != self.Weapon) then return end + wm:SetParent(self:GetOwner()) if (self.ShowWorldModel) then wm:DrawModel() end - bone_ent = self.Owner + bone_ent = self:GetOwner() else - // this only happens if the weapon is dropped, which shouldn't happen normally. + -- this only happens if the weapon is dropped, which shouldn't happen normally. self:SetColor(Color(255,0,0,0)) self:SetRenderMode(1) - wm:SetNoDraw(false) // else DrawWorldModel stops being called for some reason + wm:SetNoDraw(false) -- else DrawWorldModel stops being called for some reason wm:SetParent(self) - //wm:SetPos(opos) - //wm:SetAngles(oang) + --wm:SetPos(opos) + --wm:SetAngles(oang) if (self.ShowWorldModel) then wm:DrawModel() end - - // the reason that we don't always use this bone is because it lags 1 frame behind the player's right hand bone when held + + -- the reason that we don't always use this bone is because it lags 1 frame behind the player's right hand bone when held bone_ent = wm end - - /* BASE CODE FOR NEW SWEPS */ - /*self:DrawModel() - if (IsValid(self.Owner)) then - bone_ent = self.Owner + + --[[ BASE CODE FOR NEW SWEPS ]] + --[[self:DrawModel() + if (IsValid(self:GetOwner())) then + bone_ent = self:GetOwner() else - // when the weapon is dropped + -- when the weapon is dropped bone_ent = self - end*/ - + end]] + for k, name in pairs( self.wRenderOrder ) do - + local v = self.w_models[name] if (!v) then self.wRenderOrder = nil break end - + local pos, ang - + if (v.bone) then pos, ang = self:GetBoneOrientation( self.w_models, name, bone_ent ) else pos, ang = self:GetBoneOrientation( self.w_models, name, bone_ent, "ValveBiped.Bip01_R_Hand" ) end - + if (!pos) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial @@ -669,54 +669,54 @@ function SWEP:DrawWorldModel() ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + for k, v in pairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad") then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) draw.RoundedBox( 0, -20, -20, 40, 40, Color(200,0,0,100) ) surface.SetDrawColor( 255, 255, 255, 100 ) @@ -729,19 +729,19 @@ function SWEP:DrawWorldModel() cam.End3D2D() end - + end - + end function SWEP:Holster() self.useThirdPerson = false - - local vm = self.Owner:GetViewModel() + + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end - + return true end @@ -749,24 +749,24 @@ local function DrawDot( x, y ) surface.SetDrawColor(100, 100, 100, 255) surface.DrawRect(x - 2, y - 2, 4, 4) - + surface.SetDrawColor(255, 255, 255, 255) surface.DrawRect(x - 1, y - 1, 2, 2) - + end SWEP.FirstTimeOpen = true function SWEP:DrawHUD() - + DrawDot( ScrW()/2, ScrH()/2 ) DrawDot( ScrW()/2 + 10, ScrH()/2 ) DrawDot( ScrW()/2 - 10, ScrH()/2 ) DrawDot( ScrW()/2, ScrH()/2 + 10 ) DrawDot( ScrW()/2, ScrH()/2 - 10 ) - + if (self.Frame and self.Frame:IsVisible()) then - + self.FirstTimeOpen = false local text = "" if (self.useThirdPerson) then @@ -775,21 +775,21 @@ function SWEP:DrawHUD() text = "Hold right mouse and drag to adjust ironsights (mode: "..self.cur_drag_mode..")" end draw.SimpleTextOutlined(text, "default", ScrW()/2, ScrH()/4, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(20,20,20,255)) - + elseif (self.FirstTimeOpen) then draw.SimpleTextOutlined("Press right mouse to open menu", "default", ScrW()/2, ScrH()/4, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(20,20,20,255)) end - + end -/****** Create model browser *****/ -// callback = function( selected_model ) +--[[***** Create model browser ****]] +-- callback = function( selected_model ) function SWEP:OpenBrowser( current, browse_type, callback ) - + local wep = self wep.browser_callback = callback wep.Frame:SetVisible( false ) - + if (browse_type == "model" and wep.modelbrowser) then wep.modelbrowser:SetVisible(true) wep.modelbrowser:MakePopup() @@ -817,18 +817,18 @@ function SWEP:OpenBrowser( current, browse_type, callback ) browser:SetTitle( "Material browser" ) wep.matbrowser = browser end - + local tree = vgui.Create( "DTree", browser ) - //tree:SetPos( 5, 30 ) - //tree:SetSize( browser:GetWide() - 10, browser:GetTall()-355 ) + --tree:SetPos( 5, 30 ) + --tree:SetSize( browser:GetWide() - 10, browser:GetTall()-355 ) tree:SetTall(300) tree:DockPadding(5,5,5,5) tree:Dock(TOP) - + local nodelist = {} local filecache = {} local checked = {} - + local modlist = vgui.Create("DListView", browser) modlist:SetMultiSelect(false) modlist:SetDrawBackground(true) @@ -839,16 +839,16 @@ function SWEP:OpenBrowser( current, browse_type, callback ) end modlist:DockPadding(5,5,5,0) modlist:Dock(FILL) - + local bpanel = vgui.Create("DPanel", browser) bpanel:SetTall(200) bpanel:SetDrawBackground(false) bpanel:DockMargin(5,5,5,5) bpanel:Dock(BOTTOM) - + local modzoom = 30 - local modview - + local modview + if (browse_type == "model") then modview = vgui.Create("DModelPanel", bpanel) modview:SetModel("") @@ -856,24 +856,24 @@ function SWEP:OpenBrowser( current, browse_type, callback ) modview:SetLookAt( Vector( 0, 0, 0 ) ) elseif (browse_type == "material") then modview = vgui.Create("DImage", bpanel) - //modview:SetImage("") + --modview:SetImage("") end - + modview:SetSize(200, 200) modview:Dock(LEFT) - + local rpanel = vgui.Create("DPanel", bpanel) rpanel:SetDrawBackground(false) rpanel:DockPadding(5,0,0,0) rpanel:Dock(FILL) - + local mdlabel = vgui.Create("DLabel", rpanel) mdlabel:SetText( current ) mdlabel:SizeToContents() mdlabel:Dock(TOP) - + if (browse_type == "model") then - + local zoomslider = vgui.Create( "DNumSlider", rpanel) zoomslider:SetText( "Zoom" ) zoomslider:SetMin( 8 ) @@ -886,20 +886,20 @@ function SWEP:OpenBrowser( current, browse_type, callback ) modview:SetLookAt( Vector( 0, 0, 0 ) ) end zoomslider:Dock(FILL) - + end - + local selected = "" - + modlist.OnRowSelected = function( panel, line, override ) - if (type(override) != "string") then override = nil end // for some reason the list itself throws a panel at it in the callback + if (type(override) != "string") then override = nil end -- for some reason the list itself throws a panel at it in the callback local path = override or modlist:GetLine(line):GetValue(1) if (browse_type == "model") then modview:SetModel(path) elseif (browse_type == "material") then if (path:sub( 1, 10 ) == "materials/") then - path = path:sub( 11 ) // removes the "materials/" part + path = path:sub( 11 ) -- removes the "materials/" part end path = path:gsub( "%.vmt", "" ) if (file.Exists( "materials/"..path..".vmt", "GAME" )) then @@ -910,15 +910,15 @@ function SWEP:OpenBrowser( current, browse_type, callback ) mdlabel:SetText(path) selected = path end - - // set the default + + -- set the default modlist.OnRowSelected(nil,nil,current) if (browse_type == "model") then wep.modelbrowser_list = modlist elseif (browse_type == "material") then wep.matbrowser_list = modlist end - + local cancelbtn = vgui.Create("DButton", rpanel) cancelbtn:SetTall(20) cancelbtn:SetText("cancel") @@ -929,7 +929,7 @@ function SWEP:OpenBrowser( current, browse_type, callback ) browser:Close() end cancelbtn:Dock(BOTTOM) - + local choosebtn = vgui.Create("DButton", rpanel) choosebtn:SetTall(20) if (browse_type == "model") then @@ -937,7 +937,7 @@ function SWEP:OpenBrowser( current, browse_type, callback ) elseif (browse_type == "material") then choosebtn:SetText("DO WANT THIS MATERIAL") end - + choosebtn.DoClick = function() if (wep.browser_callback) then pcall(wep.browser_callback, selected) @@ -949,30 +949,30 @@ function SWEP:OpenBrowser( current, browse_type, callback ) end choosebtn:DockMargin(0,0,0,5) choosebtn:Dock(BOTTOM) - - - + + + local LoadDirectories local AddNode = function( base, dir, tree_override ) - + local newpath = base.."/"..dir local basenode = nodelist[base] - + if (tree_override) then newpath = dir basenode = tree_override end - + if (!basenode) then print("No base node for \""..tostring(base).."\", \""..tostring(dir).."\", "..tostring(tree_override)) end - + nodelist[newpath] = basenode:AddNode( dir ) nodelist[newpath].DoClick = function() LoadDirectories( newpath ) modlist:Clear() modlist:SetVisible(true) - + if (filecache[newpath]) then for k, f in pairs(filecache[newpath]) do modlist:AddLine(f) @@ -993,30 +993,30 @@ function SWEP:OpenBrowser( current, browse_type, callback ) end end end - + end - + if (browse_type == "model") then AddNode( "", "models", tree ) elseif (browse_type == "material") then AddNode( "", "materials", tree ) end - + LoadDirectories = function( v ) - + if (table.HasValue(checked,v)) then return end local files files, newdirs = file.Find(v.."/*", "GAME") table.insert(checked, v) - + table.sort(newdirs) - + for _, dir in pairs(newdirs) do AddNode( v, dir ) end end - + if (browse_type == "model") then LoadDirectories( "models" ) elseif (browse_type == "material") then @@ -1025,27 +1025,27 @@ function SWEP:OpenBrowser( current, browse_type, callback ) browser:SetVisible( true ) browser:MakePopup() - + end -/*************************** +--[[************************** Menu -***************************/ +**************************]] local function CreateMenu( preset ) - + local wep = GetSCKSWEP( LocalPlayer() ) if !IsValid(wep) then return nil end - + wep.save_data = table.Copy(save_data_template) - + if (preset) then - // use the preset + -- use the preset for k, v in pairs( preset ) do wep.save_data[k] = v end end - // Now for the actual menu: + -- Now for the actual menu: local f = vgui.Create("DFrame") f:SetSize( 480, ScrH()*0.8 ) f:SetPos( 50, 50 ) @@ -1054,42 +1054,42 @@ local function CreateMenu( preset ) f:ShowCloseButton( true ) f:SetSizable( true ) f:SetDeleteOnClose( false ) - + local tpanel= vgui.Create( "DPanel", f ) tpanel:SetDrawBackground(false) tpanel:SetTall(20) tpanel:DockMargin(0,0,0,5) tpanel:Dock(TOP) - + local tpsbonelist = vgui.Create( "DComboBox", tpanel ) tpsbonelist:SetWide(150) - tpsbonelist:SetToolTip("Bone to focus third person view on") + tpsbonelist:SetTooltip("Bone to focus third person view on") tpsbonelist.OnSelect = function( p, index, value ) wep.tpsfocusbone = value end tpsbonelist:SetText( wep.tpsfocusbone ) tpsbonelist:DockMargin(5,0,0,0) tpsbonelist:Dock(RIGHT) - + local tlabel = vgui.Create( "DLabel", tpanel ) tlabel:SetText( "Focus:" ) tlabel:SizeToContents() tlabel:SetTall(20) tlabel:DockMargin(10,0,0,0) tlabel:Dock(RIGHT) - + PopulateBoneList( tpsbonelist, LocalPlayer() ) - + local tbtn = vgui.Create( "DButton", tpanel ) tbtn:SetText( "Toggle thirdperson" ) tbtn.DoClick = function() RunConsoleCommand("swepck_togglethirdperson") end - + tbtn:Dock(FILL) - + local tab = vgui.Create( "DPropertySheet", f ) - + wep.ptool = vgui.Create("DPanel", tab) wep.ptool.Paint = function() surface.SetDrawColor(70,70,70,255) surface.DrawRect(0,0,wep.ptool:GetWide(),wep.ptool:GetTall()) end wep.pweapon = vgui.Create("DPanel", tab) @@ -1100,42 +1100,42 @@ local function CreateMenu( preset ) wep.pmodels.Paint = function() surface.SetDrawColor(70,70,70,255) surface.DrawRect(0,0,wep.pmodels:GetWide(),wep.pmodels:GetTall()) end wep.pwmodels = vgui.Create("DPanel", tab) wep.pwmodels.Paint = function() surface.SetDrawColor(70,70,70,255) surface.DrawRect(0,0,wep.pwmodels:GetWide(),wep.pwmodels:GetTall()) end - + tab:AddSheet( "Tool", wep.ptool, nil, false, false, "Modify tool settings" ) tab:AddSheet( "Weapon", wep.pweapon, nil, false, false, "Modify weapon settings" ) tab:AddSheet( "Ironsights", wep.pironsight, nil, false, false, "Modify ironsights" ) tab:AddSheet( "View Models", wep.pmodels, nil, false, false, "Modify view models" ) tab:AddSheet( "World Models", wep.pwmodels, nil, false, false, "Modify world models" ) - + wep.ptool:DockPadding(5, 5, 5, 5) wep.pweapon:DockPadding(5, 5, 5, 5) wep.pironsight:DockPadding(5, 5, 5, 5) wep.pmodels:DockPadding(5, 5, 5, 5) wep.pwmodels:DockPadding(5, 5, 5, 5) - + tab:Dock(FILL) - - /***************** + + --[[**************** Tool page - *****************/ + ****************]] include("weapons/"..wep:GetClass().."/menu/tool.lua") - - /***************** + + --[[**************** Weapon page - *****************/ + ****************]] include("weapons/"..wep:GetClass().."/menu/weapon.lua") - - /********************* + + --[[******************** Ironsights page - *********************/ + ********************]] include("weapons/"..wep:GetClass().."/menu/ironsights.lua") - - /**************************************** + + --[[*************************************** View models and World models page - ****************************************/ + ***************************************]] include("weapons/"..wep:GetClass().."/menu/models.lua") - - // finally, return the frame! + + -- finally, return the frame! return f end @@ -1144,14 +1144,14 @@ function SWEP:OpenMenu( preset ) if (!self.Frame) then self.Frame = CreateMenu( preset ) end - + if (IsValid(self.Frame)) then self.Frame:SetVisible(true) self.Frame:MakePopup() else self.Frame = nil end - + end function SWEP:OnRemove() @@ -1168,7 +1168,7 @@ end function SWEP:CleanMenu() self:RemoveModels() if (!self.Frame) then return end - + self.v_modelListing = nil self.w_modelListing = nil self.v_panelCache = {} @@ -1181,66 +1181,66 @@ function SWEP:HUDShouldDraw( el ) return el != "CHudAmmo" and el != "CHudSecondaryAmmo" end -/*************************** +--[[************************** Third person view -***************************/ +**************************]] function TPCalcView(pl, pos, angles, fov) local wep = pl:GetActiveWeapon() if (!IsValid(wep) or !wep.IsSCK or !wep.useThirdPerson) then wep.useThirdPerson = false - return + return end - + local look_pos = pos local rhand_bone = pl:LookupBone(wep.tpsfocusbone) if (rhand_bone) then look_pos = pl:GetBonePosition( rhand_bone ) end - + local view = {} view.origin = look_pos + ((pl:GetAngles()+wep.thirdPersonAngle):Forward()*wep.thirdPersonDis) view.angles = (look_pos - view.origin):Angle() view.fov = fov - + return view end oldCVHooks = {} hooksCleared = false local function CVHookReset() - - //print("Hook reset") + + --print("Hook reset") hook.Remove( "CalcView", "TPCalcView" ) for k, v in pairs( oldCVHooks ) do hook.Add("CalcView", k, v) end oldCVHooks = {} hooksCleared = false - -end + +end function SWEP:CalcViewHookManagement() - + if (!hooksCleared) then - + local CVHooks = hook.GetTable()["CalcView"] if CVHooks then - + for k, v in pairs( CVHooks ) do oldCVHooks[k] = v hook.Remove( "CalcView", k ) end - + end - + hook.Add("CalcView", "TPCalcView", TPCalcView) hooksCleared = true else timer.Create("CVHookReset", 2, 1, CVHookReset) end - -end + +end hook.Add("ShouldDrawLocalPlayer", "ThirdPerson", function(pl) local wep = pl:GetActiveWeapon() diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/glon.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/glon.lua index 1005106..bf31833 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/glon.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/glon.lua @@ -1,5 +1,5 @@ -// NOTE by Clavus: glon was removed from GMod 13, replaced by the util.TableToJSON etc functions -// In order to maintain compatability and not rewrite all that shit, I'm including it with the SCK. +-- NOTE by Clavus: glon was removed from GMod 13, replaced by the util.TableToJSON etc functions +-- In order to maintain compatability and not rewrite all that shit, I'm including it with the SCK. -- GLON: Garry's Mod Lua Object Notation -- A extension of LON: Lua Object Notation @@ -22,7 +22,7 @@ -- 254: The number equal to -math.huge (tostring(math.huge) == "-1.#INF") -- 254: The number equal to math.huge (tostring(math.huge) == "1.#INF") -- 255: reference (Sends the ID of the table to use (for "local t = {} t.a=t")) -/*local pairs = pairs +--[[local pairs = pairs local type = type local string = string local math = math @@ -39,7 +39,7 @@ local GetConVar = GetConVar local tonumber = tonumber local player = player local IsValid = IsValid -module("glon")*/ +module("glon")]] glon = {} local encode_types local decode_types @@ -49,7 +49,7 @@ local Read local function InDataEscape(s) s = string.gsub(s, "([\1\2])", "\2%1") s = string.gsub(s, "%z", "\2\3") - s = string.gsub(s, "\"", "\4") // escape the " character to simplify client commands + s = string.gsub(s, "\"", "\4") -- escape the " character to simplify client commands return s end @@ -74,9 +74,9 @@ encode_types = { end local s = "" for k,v in pairs(o) do - + if ( !encode_types[type(v)] ) then continue end - + if not is_array then s = s..Write(k, rtabs) end @@ -277,7 +277,7 @@ decode_types = { elseif c == "\2" then e = true elseif c == "\1" then - s = string.gsub(s, "\4", "\"") // unescape quotes + s = string.gsub(s, "\4", "\"") -- unescape quotes return s else s = s..c @@ -319,11 +319,11 @@ decode_types = { return GetConVar(decode_types[7](reader)) end, [14 ] = function(reader) -- PhysicsObject - + local ent = Entity(decode_types[6](reader)) local bone = decode_types[6](reader) - - if ( !IsValid( ent ) ) then return nil end; + + if ( !IsValid( ent ) ) then return nil end; return ent:GetPhysicsObjectNum( bone ) end, [15 ] = function(reader) -- Color @@ -399,8 +399,8 @@ function glon.decode(data) elseif data:len() == 0 then return nil end - - + + return Read(setmetatable({ s = data, i = 0, diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/ironsights.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/ironsights.lua index d341e3f..e10cd9f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/ironsights.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/ironsights.lua @@ -3,7 +3,7 @@ local drag_modes = { ["x / z"] = { "x", "z" }, ["y"] = { "y" }, ["pitch / yaw"] = { "pitch", "yaw" }, - ["roll"] = { "roll" } + ["roll"] = { "roll" } } local function GetIronSightPrintText( vec, ang ) @@ -25,7 +25,7 @@ local pironsight_enable = SimplePanel( pironsight ) if (wep.save_data.IronSightsEnabled) then icbox:SetValue(1) else icbox:SetValue(0) end icbox:Dock(LEFT) - + local ribtn = vgui.Create( "DButton", pironsight_enable ) ribtn:SetTall( 20 ) ribtn:SetText( "Reset ironsights" ) @@ -43,7 +43,7 @@ local pironsight_drag = SimplePanel( pironsight ) modlabel:SetSize( 150, 20 ) modlabel:SetText( "Drag mode:" ) modlabel:Dock(LEFT) - + local drbox = vgui.Create( "DComboBox", pironsight_drag ) drbox:SetTall( 20 ) drbox:SetText( wep.cur_drag_mode ) @@ -54,12 +54,12 @@ local pironsight_drag = SimplePanel( pironsight ) local modes = drag_modes[value] wep.cur_drag_mode = value for k, v in pairs( wep.ir_drag ) do - v[1] = table.HasValue( modes, k ) // set the drag modus + v[1] = table.HasValue( modes, k ) -- set the drag modus end end drbox:Dock(FILL) - -pironsight_drag:DockMargin(0,0,0,10) + +pironsight_drag:DockMargin(0,0,0,10) pironsight_drag:Dock(TOP) local ixslider = vgui.Create( "DNumSlider", pironsight ) diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/models.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/models.lua index a029bd7..54d79d1 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/models.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/models.lua @@ -3,12 +3,12 @@ local function GetVModelsText() local wep = GetSCKSWEP( LocalPlayer() ) if (!IsValid(wep)) then return "" end - + local str = ("SWEP.VElements = {\n") local i = 0 local num = table.Count(wep.v_models) for k, v in pairs( wep.v_models ) do - + if (v.type == "Model") then str = str.."\t[\""..k.."\"] = { type = \"Model\", model = \""..v.model.."\", bone = \""..v.bone.."\", rel = \""..v.rel.."\", pos = "..PrintVec(v.pos) str = str..", angle = "..PrintAngle( v.angle )..", size = "..PrintVec(v.size)..", color = "..PrintColor( v.color ) @@ -31,7 +31,7 @@ local function GetVModelsText() str = str.."\t[\""..k.."\"] = { type = \"Quad\", bone = \""..v.bone.."\", rel = \""..v.rel.."\", pos = "..PrintVec(v.pos)..", angle = "..PrintAngle( v.angle ) str = str..", size = "..v.size..", draw_func = nil}" end - + if (v.type) then i = i + 1 if (i < num) then str = str.."," end @@ -52,7 +52,7 @@ local function GetWModelsText() local i = 0 local num = table.Count(wep.w_models) for k, v in pairs( wep.w_models ) do - + if (v.type == "Model") then str = str.."\t[\""..k.."\"] = { type = \"Model\", model = \""..v.model.."\", bone = \""..v.bone.."\", rel = \""..v.rel.."\", pos = "..PrintVec(v.pos) str = str..", angle = "..PrintAngle( v.angle )..", size = "..PrintVec(v.size)..", color = "..PrintColor( v.color ) @@ -75,7 +75,7 @@ local function GetWModelsText() str = str.."\t[\""..k.."\"] = { type = \"Quad\", bone = \""..v.bone.."\", rel = \""..v.rel.."\", pos = "..PrintVec(v.pos)..", angle = "..PrintAngle( v.angle ) str = str..", size = "..v.size..", draw_func = nil}" end - + if (v.type) then i = i + 1 if (i < num) then str = str.."," end @@ -102,7 +102,7 @@ local function GetWModelsText() end local function PopulateRelative( sourcetab, box, startchoice, ignore ) - + box:Clear() local choose = box:AddChoice("") for k, v in pairs( sourcetab ) do @@ -113,15 +113,15 @@ local function PopulateRelative( sourcetab, box, startchoice, ignore ) end end box:ChooseOptionID( choose ) - + end -// Some hacky shit to keep the relative DComboBoxes updated +-- Some hacky shit to keep the relative DComboBoxes updated local v_relelements = {} local w_relelements = {} local boxes_to_update = {} local function RegisterRelBox( elementname, box, w_or_v, preset_choice ) - table.insert(boxes_to_update, { box, w_or_v, elementname, preset_choice }) + table.insert(boxes_to_update, { box, w_or_v, elementname, preset_choice }) end local function RemoveRelBox( w_or_v, elementname ) @@ -138,11 +138,11 @@ local function UpdateRelBoxes( w_or_v ) if (w_or_v == "w") then source = w_relelements end - + for k, v in pairs( boxes_to_update ) do - if (IsValid(v[1]) and v[2] == w_or_v) then + if (IsValid(v[1]) and v[2] == w_or_v) then local choose = v[1]:GetValue() - if (v[4]) then // preset choice + if (v[4]) then -- preset choice choose = v[4] v[4] = nil end @@ -182,13 +182,13 @@ pnewelement:SetTall(20) mntext:SetMultiline(false) mntext:SetText( "element_name" ) mntext:Dock(FILL) - + local mnbtn = vgui.Create( "DButton", pnewelement ) mnbtn:SetSize( 50, 20 ) mnbtn:SetText( "Add" ) mnbtn:DockMargin(5,0,0,0) mnbtn:Dock(RIGHT) - + local tpbox = vgui.Create( "DComboBox", pnewelement ) tpbox:SetSize( 100, 20 ) tpbox:SetText( "Model" ) @@ -207,21 +207,21 @@ pnewelement:Dock(TOP) local mlist = vgui.Create( "DListView", pmodels) wep.v_modelListing = mlist - + mlist:SetTall( 160 ) mlist:SetMultiSelect(false) mlist:SetDrawBackground(true) mlist:AddColumn("Name") mlist:AddColumn("Type") - // cache the created panels + -- cache the created panels mlist.OnRowSelected = function( panel, line ) local name = mlist:GetLine(line):GetValue(1) - + if (wep.v_panelCache[lastVisible]) then wep.v_panelCache[lastVisible]:SetVisible(false) end wep.v_panelCache[name]:SetVisible(true) - + lastVisible = name end @@ -233,7 +233,7 @@ local pbuttons = SimplePanel( pmodels ) rmbtn:SetSize( 160, 25 ) rmbtn:SetText( "Remove selected" ) rmbtn:Dock(LEFT) - + local copybtn = vgui.Create( "DButton", pbuttons ) copybtn:SetSize( 160, 25 ) copybtn:SetText( "Copy selected" ) @@ -242,7 +242,7 @@ local pbuttons = SimplePanel( pmodels ) pbuttons:DockMargin(0,5,0,5) pbuttons:Dock(TOP) -// Print buttons +-- Print buttons local pctbtn = vgui.Create( "DButton", pmodels) pctbtn:SetTall( 30 ) pctbtn:SetText("Copy view model table to clipboard") @@ -272,26 +272,26 @@ local function PanelBackgroundReset() end local function PanelApplyBackground(panel) - + if (pCol == 1) then panel:SetPaintBackground(true) panel.Paint = function() surface.SetDrawColor( 85, 85, 85, 255 ) surface.DrawRect( 0, 0, panel:GetWide(), panel:GetTall() ) end end - + pCol = (pCol + 1) % 2 end local function CreatePositionModifiers( data, panel ) - + panel:SetTall(32*3) PanelApplyBackground(panel) - + local trlabel = vgui.Create( "DLabel", panel ) trlabel:SetText( "Position:" ) trlabel:SizeToContents() trlabel:SetWide(45) trlabel:Dock(LEFT) - + local mxwang = vgui.Create( "DNumSlider", panel ) mxwang:SetText("x") mxwang:SetMinMax( -80, 80 ) @@ -299,15 +299,15 @@ local function CreatePositionModifiers( data, panel ) mxwang.Wang.ConVarChanged = function( p, value ) data.pos.x = tonumber(value) end mxwang:SetValue( data.pos.x ) mxwang:DockMargin(10,0,0,0) - + local mywang = vgui.Create( "DNumSlider", panel ) - mywang:SetText("y") + mywang:SetText("y") mywang:SetMinMax( -80, 80 ) mywang:SetDecimals( 3 ) mywang.Wang.ConVarChanged = function( p, value ) data.pos.y = tonumber(value) end mywang:SetValue( data.pos.y ) mywang:DockMargin(10,0,0,0) - + local mzwang = vgui.Create( "DNumSlider", panel ) mzwang:SetText("z") mzwang:SetMinMax( -80, 80 ) @@ -315,31 +315,31 @@ local function CreatePositionModifiers( data, panel ) mzwang.Wang.ConVarChanged = function( p, value ) data.pos.z = tonumber(value) end mzwang:SetValue( data.pos.z ) mzwang:DockMargin(10,0,0,0) - - panel.PerformLayout = function() + + panel.PerformLayout = function() mxwang:SetWide(panel:GetWide()*4/15) - mywang:SetWide(panel:GetWide()*4/15) + mywang:SetWide(panel:GetWide()*4/15) mzwang:SetWide(panel:GetWide()*4/15) end - + mxwang:Dock(TOP) mywang:Dock(TOP) mzwang:Dock(TOP) - + return panel end local function CreateAngleModifiers( data, panel ) - + panel:SetTall(32*3) PanelApplyBackground(panel) - + local anlabel = vgui.Create( "DLabel", panel ) anlabel:SetText( "Angle:" ) anlabel:SizeToContents() anlabel:SetWide(45) anlabel:Dock(LEFT) - + local mpitchwang = vgui.Create( "DNumSlider", panel ) mpitchwang:SetText("pitch") mpitchwang:SetMinMax( -180, 180 ) @@ -347,7 +347,7 @@ local function CreateAngleModifiers( data, panel ) mpitchwang.Wang.ConVarChanged = function( p, value ) data.angle.p = tonumber(value) end mpitchwang:SetValue( data.angle.p ) mpitchwang:DockMargin(10,0,0,0) - + local myawwang = vgui.Create( "DNumSlider", panel ) myawwang:SetText("yaw") myawwang:SetMinMax( -180, 180 ) @@ -355,7 +355,7 @@ local function CreateAngleModifiers( data, panel ) myawwang.Wang.ConVarChanged = function( p, value ) data.angle.y = tonumber(value) end myawwang:SetValue( data.angle.y ) myawwang:DockMargin(10,0,0,0) - + local mrollwang = vgui.Create( "DNumSlider", panel ) mrollwang:SetText("roll") mrollwang:SetMinMax( -180, 180 ) @@ -363,17 +363,17 @@ local function CreateAngleModifiers( data, panel ) mrollwang.Wang.ConVarChanged = function( p, value ) data.angle.r = tonumber(value) end mrollwang:SetValue( data.angle.r ) mrollwang:DockMargin(10,0,0,0) - - panel.PerformLayout = function() + + panel.PerformLayout = function() mrollwang:SetWide(panel:GetWide()*4/15) - myawwang:SetWide(panel:GetWide()*4/15) + myawwang:SetWide(panel:GetWide()*4/15) mpitchwang:SetWide(panel:GetWide()*4/15) end - + mpitchwang:Dock(TOP) myawwang:Dock(TOP) mrollwang:Dock(TOP) - + return panel end @@ -381,21 +381,21 @@ local function CreateSizeModifiers( data, panel, dimensions ) panel:SetTall(32*dimensions) PanelApplyBackground(panel) - + local sizelabel = vgui.Create( "DLabel", panel ) sizelabel:SetText( "Size:" ) sizelabel:SizeToContents() sizelabel:SetWide(45) sizelabel:Dock(LEFT) - + local msywang, mszwang - + local msxwang = vgui.Create( "DNumSlider", panel ) msxwang:SetMinMax( 0.01, 10 ) msxwang:SetDecimals( 3 ) - + if (dimensions > 1 ) then - + msywang = vgui.Create( "DNumSlider", panel ) msywang:SetText("y") msywang:SetMinMax( 0.01, 10 ) @@ -403,7 +403,7 @@ local function CreateSizeModifiers( data, panel, dimensions ) msywang.Wang.ConVarChanged = function( p, value ) data.size.y = tonumber(value) end msywang:DockMargin(10,0,0,0) msywang:Dock(TOP) - + if (dimensions > 2) then mszwang = vgui.Create( "DNumSlider", panel ) mszwang:SetText("z") @@ -413,10 +413,10 @@ local function CreateSizeModifiers( data, panel, dimensions ) mszwang:DockMargin(10,0,0,0) mszwang:Dock(TOP) end - + end - - // make the x numberwang set the total size + + -- make the x numberwang set the total size msxwang.Wang.ConVarChanged = function( p, value ) if (mszwang) then mszwang:SetValue( value ) @@ -424,18 +424,18 @@ local function CreateSizeModifiers( data, panel, dimensions ) if (msywang) then msywang:SetValue( value ) end - + if (dimensions > 1) then data.size.x = tonumber(value) else data.size = tonumber(value) end end - + msxwang:DockMargin(10,0,0,0) msxwang:Dock(TOP) - - /*panel.PerformLayout = function() + + --[[panel.PerformLayout = function() msxwang:SetWide(panel:GetWide()*4/5/dimensions) if (dimensions > 1) then msywang:SetWide(panel:GetWide()*4/5/dimensions) @@ -443,43 +443,43 @@ local function CreateSizeModifiers( data, panel, dimensions ) mszwang:SetWide(panel:GetWide()*4/15) end end - end*/ - + end]] + if (dimensions == 1) then - + msxwang:SetText("factor") msxwang:SetValue( data.size ) - + else - + local new_y = data.size.y local new_z = data.size.z - + msxwang:SetText("x / y") msxwang:SetValue( data.size.x ) msywang:SetValue( new_y ) - + if (mszwang) then msxwang:SetText("x / y / z") mszwang:SetValue( new_z ) end - + end - + return panel end local function CreateColorModifiers( data, panel ) - + panel:SetTall(32*4) PanelApplyBackground(panel) - + local collabel = vgui.Create( "DLabel", panel ) collabel:SetText( "Color:" ) collabel:SizeToContents() collabel:SetWide(45) collabel:Dock(LEFT) - + local colrwang = vgui.Create( "DNumSlider", panel ) colrwang:SetText("red") colrwang:SetMinMax( 0, 255 ) @@ -487,7 +487,7 @@ local function CreateColorModifiers( data, panel ) colrwang.Wang.ConVarChanged = function( p, value ) data.color.r = tonumber(value) end colrwang:SetValue(data.color.r) colrwang:DockMargin(10,0,0,0) - + local colgwang = vgui.Create( "DNumSlider", panel ) colgwang:SetText("green") colgwang:SetMinMax( 0, 255 ) @@ -495,7 +495,7 @@ local function CreateColorModifiers( data, panel ) colgwang.Wang.ConVarChanged = function( p, value ) data.color.g = tonumber(value) end colgwang:SetValue(data.color.g) colgwang:DockMargin(10,0,0,0) - + local colbwang = vgui.Create( "DNumSlider", panel ) colbwang:SetText("blue") colbwang:SetMinMax( 0, 255 ) @@ -503,7 +503,7 @@ local function CreateColorModifiers( data, panel ) colbwang.Wang.ConVarChanged = function( p, value ) data.color.b = tonumber(value) end colbwang:SetValue(data.color.b) colbwang:DockMargin(10,0,0,0) - + local colawang = vgui.Create( "DNumSlider", panel ) colawang:SetText("alpha") colawang:SetMinMax( 0, 255 ) @@ -511,40 +511,40 @@ local function CreateColorModifiers( data, panel ) colawang.Wang.ConVarChanged = function( p, value ) data.color.a = tonumber(value) end colawang:SetValue(data.color.a) colawang:DockMargin(10,0,0,0) - - panel.PerformLayout = function() + + panel.PerformLayout = function() colawang:SetWide(panel:GetWide()/5) colbwang:SetWide(panel:GetWide()/5) colgwang:SetWide(panel:GetWide()/5) colrwang:SetWide(panel:GetWide()/5) end - + colrwang:Dock(TOP) colgwang:Dock(TOP) colbwang:Dock(TOP) colawang:Dock(TOP) - + return panel end local function CreateModelModifier( data, panel ) - + panel:SetTall(20) - + local pmolabel = vgui.Create( "DLabel", panel ) pmolabel:SetText( "Model:" ) pmolabel:SetWide(60) pmolabel:SizeToContentsY() pmolabel:Dock(LEFT) - + local wtbtn = vgui.Create( "DButton", panel ) wtbtn:SetSize( 25, 20 ) wtbtn:SetText("...") wtbtn:Dock(RIGHT) - + local pmmtext = vgui.Create( "DTextEntry", panel ) pmmtext:SetMultiline(false) - pmmtext:SetToolTip("Path to the model file") + pmmtext:SetTooltip("Path to the model file") pmmtext.OnTextChanged = function() local newmod = pmmtext:GetValue() if file.Exists(newmod, "GAME") then @@ -556,32 +556,32 @@ local function CreateModelModifier( data, panel ) pmmtext.OnTextChanged() pmmtext:DockMargin(10,0,0,0) pmmtext:Dock(FILL) - + wtbtn.DoClick = function() wep:OpenBrowser( data.model, "model", function( val ) pmmtext:SetText(val) pmmtext:OnTextChanged() end ) end - + return panel end local function CreateSpriteModifier( data, panel ) - + panel:SetTall(20) - + local pmolabel = vgui.Create( "DLabel", panel ) pmolabel:SetText( "Sprite:" ) pmolabel:SetWide(60) pmolabel:SizeToContentsY() pmolabel:Dock(LEFT) - + local wtbtn = vgui.Create( "DButton", panel ) wtbtn:SetSize( 25, 20 ) wtbtn:SetText("...") wtbtn:Dock(RIGHT) - + local pmmtext = vgui.Create( "DTextEntry", panel ) pmmtext:SetMultiline(false) - pmmtext:SetToolTip("Path to the sprite material") + pmmtext:SetTooltip("Path to the sprite material") pmmtext.OnTextChanged = function() local newsprite = pmmtext:GetValue() if file.Exists("materials/"..newsprite..".vmt", "GAME") then @@ -592,128 +592,128 @@ local function CreateSpriteModifier( data, panel ) pmmtext.OnTextChanged() pmmtext:DockMargin(10,0,0,0) pmmtext:Dock(FILL) - + wtbtn.DoClick = function() wep:OpenBrowser( data.sprite, "material", function( val ) pmmtext:SetText(val) pmmtext:OnTextChanged() end ) end - + return panel end local function CreateNameLabel( name, panel ) - + panel:SetTall(20) - + local pnmlabel = vgui.Create( "DLabel", panel ) pnmlabel:SetText( "Name: "..name ) pnmlabel:SizeToContents() pnmlabel:Dock(LEFT) - - /*local pnmtext = vgui.Create( "DTextEntry", panel ) + + --[[local pnmtext = vgui.Create( "DTextEntry", panel ) pnmtext:SetMultiline(false) pnmtext:SetText( name ) pnmtext:SetEditable( false ) - pnmtext:Dock(FILL)*/ - + pnmtext:Dock(FILL)]] + return panel end local function CreateParamModifiers( data, panel ) - + panel:SetTall(45) - + local strip1 = SimplePanel( panel ) strip1:SetTall(20) - + local ncchbox = vgui.Create( "DCheckBoxLabel", strip1 ) ncchbox:SetText("$nocull") ncchbox:SizeToContents() ncchbox:SetValue( 0 ) ncchbox.OnChange = function() data.nocull = ncchbox:GetChecked() - data.spriteMaterial = nil // dump old material + data.spriteMaterial = nil -- dump old material end if (data.nocull) then ncchbox:SetValue( 1 ) end ncchbox:DockMargin(0,0,10,0) ncchbox:Dock(LEFT) - + local adchbox = vgui.Create( "DCheckBoxLabel", strip1 ) adchbox:SetText("$additive") adchbox:SizeToContents() adchbox:SetValue( 0 ) adchbox.OnChange = function() data.additive = adchbox:GetChecked() - data.spriteMaterial = nil // dump old material + data.spriteMaterial = nil -- dump old material end if (data.additive) then adchbox:SetValue( 1 ) end adchbox:DockMargin(0,0,10,0) adchbox:Dock(LEFT) - + local vtachbox = vgui.Create( "DCheckBoxLabel", strip1 ) vtachbox:SetText("$vertexalpha") vtachbox:SizeToContents() vtachbox:SetValue( 0 ) vtachbox.OnChange = function() data.vertexalpha = vtachbox:GetChecked() - data.spriteMaterial = nil // dump old material + data.spriteMaterial = nil -- dump old material end if (data.vertexalpha) then vtachbox:SetValue( 1 ) end vtachbox:DockMargin(0,0,10,0) vtachbox:Dock(LEFT) - + strip1:DockMargin(0,0,0,5) strip1:Dock(TOP) - + local strip2 = SimplePanel( panel ) strip2:SetTall(20) - + local vtcchbox = vgui.Create( "DCheckBoxLabel", strip2 ) vtcchbox:SetText("$vertexcolor") vtcchbox:SizeToContents() vtcchbox:SetValue( 0 ) vtcchbox.OnChange = function() data.vertexcolor = vtcchbox:GetChecked() - data.spriteMaterial = nil // dump old material + data.spriteMaterial = nil -- dump old material end if (data.vertexcolor) then vtcchbox:SetValue( 1 ) end vtcchbox:DockMargin(0,0,10,0) vtcchbox:Dock(LEFT) - + local izchbox = vgui.Create( "DCheckBoxLabel", strip2 ) izchbox:SetText("$ignorez") izchbox:SizeToContents() izchbox:SetValue( 0 ) izchbox.OnChange = function() data.ignorez = izchbox:GetChecked() - data.spriteMaterial = nil // dump old material + data.spriteMaterial = nil -- dump old material end if (data.ignorez) then izchbox:SetValue( 1 ) end izchbox:DockMargin(0,0,10,0) izchbox:Dock(LEFT) - + strip2:Dock(TOP) - + return panel end local function CreateMaterialModifier( data, panel ) - + panel:SetTall(20) - + local matlabel = vgui.Create( "DLabel", panel ) matlabel:SetText( "Material:" ) matlabel:SetWide(60) matlabel:SizeToContentsY() - matlabel:Dock(LEFT) - + matlabel:Dock(LEFT) + local wtbtn = vgui.Create( "DButton", panel ) wtbtn:SetSize( 25, 20 ) wtbtn:SetText("...") wtbtn:Dock(RIGHT) - + local mattext = vgui.Create("DTextEntry", panel ) mattext:SetMultiline(false) - mattext:SetToolTip("Path to the material file") + mattext:SetTooltip("Path to the material file") mattext.OnTextChanged = function() local newmat = mattext:GetValue() if file.Exists("materials/"..newmat..".vmt", "GAME") then @@ -725,11 +725,11 @@ local function CreateMaterialModifier( data, panel ) mattext:SetText( data.material ) mattext:DockMargin(10,0,0,0) mattext:Dock(FILL) - + wtbtn.DoClick = function() wep:OpenBrowser( data.material, "material", function( val ) mattext:SetText(val) mattext:OnTextChanged() end ) end - + return panel end @@ -747,80 +747,80 @@ local function CreateSLightningModifier( data, panel ) lschbox:SetValue( 0 ) end lschbox:Dock(LEFT) - + return panel end local function CreateBoneModifier( data, panel, ent ) - + local pbonelabel = vgui.Create( "DLabel", panel ) pbonelabel:SetText( "Bone:" ) pbonelabel:SetWide(60) pbonelabel:SizeToContentsY() pbonelabel:Dock(LEFT) - + local bonebox = vgui.Create( "DComboBox", panel ) - bonebox:SetToolTip("Bone to parent the selected element to. Is ignored if the 'Relative' field is not empty") + bonebox:SetTooltip("Bone to parent the selected element to. Is ignored if the 'Relative' field is not empty") bonebox.OnSelect = function( p, index, value ) data.bone = value end bonebox:SetText( data.bone ) bonebox:DockMargin(10,0,0,0) bonebox:Dock(FILL) - + local delay = 0 - // we have to call it later when loading settings because the viewmodel needs to be changed first + -- we have to call it later when loading settings because the viewmodel needs to be changed first if (data.bone != "") then delay = 2 end - + timer.Simple(delay, function() local option = PopulateBoneList( bonebox, ent ) - if (option and data.bone == "") then + if (option and data.bone == "") then bonebox:ChooseOptionID(1) end end) - + return panel end local function CreateVRelativeModifier( name, data, panel ) - + local prellabel = vgui.Create( "DLabel", panel ) prellabel:SetText( "Relative:" ) prellabel:SetWide(60) prellabel:SizeToContentsY() prellabel:Dock(LEFT) - + local relbox = vgui.Create( "DComboBox", panel ) - relbox:SetToolTip("Element you want to parent this element to (position and angle become relative). Overrides parenting to a bone if not blank.") + relbox:SetTooltip("Element you want to parent this element to (position and angle become relative). Overrides parenting to a bone if not blank.") relbox.OnSelect = function( p, index, value ) data.rel = value end relbox:DockMargin(10,0,0,0) relbox:Dock(FILL) - + RegisterRelBox(name, relbox, "v", data.rel) - + return panel end local function CreateWRelativeModifier( name, data, panel ) - + local prellabel = vgui.Create( "DLabel", panel ) prellabel:SetText( "Relative:" ) prellabel:SetWide(60) prellabel:SizeToContentsY() prellabel:Dock(LEFT) - + local relbox = vgui.Create( "DComboBox", panel ) - relbox:SetToolTip("Element you want to parent this element to (position and angle become relative). Overrides parenting to a bone if not blank.") + relbox:SetTooltip("Element you want to parent this element to (position and angle become relative). Overrides parenting to a bone if not blank.") relbox.OnSelect = function( p, index, value ) data.rel = value end relbox:DockMargin(10,0,0,0) relbox:Dock(FILL) - + RegisterRelBox(name, relbox, "w", data.rel) - + return panel end @@ -830,29 +830,29 @@ local function CreateBodygroupSkinModifier( data, panel ) bdlabel:SetText( "Bodygroup:" ) bdlabel:SizeToContents() bdlabel:Dock(LEFT) - + local bdwang = vgui.Create( "DNumberWang", panel ) bdwang:SetSize( 30, 20 ) bdwang:SetMinMax( 1, 9 ) bdwang:SetDecimals( 0 ) - bdwang:SetToolTip("Bodygroup number") + bdwang:SetTooltip("Bodygroup number") bdwang:DockMargin(10,0,0,0) bdwang:Dock(LEFT) - + local islabel = vgui.Create( "DLabel", panel ) islabel:SetSize( 10, 20 ) islabel:SetText( "=" ) islabel:DockMargin(1,0,1,0) islabel:Dock(LEFT) - + local bdvwang = vgui.Create( "DNumberWang", panel ) bdvwang:SetSize( 30, 20 ) bdvwang:SetMinMax( 0, 9 ) bdvwang:SetDecimals( 0 ) - bdvwang:SetToolTip("State number") + bdvwang:SetTooltip("State number") bdvwang:Dock(LEFT) - - bdvwang.ConVarChanged = function( p, value ) + + bdvwang.ConVarChanged = function( p, value ) local group = tonumber(bdwang:GetValue()) local val = tonumber(value) data.bodygroup[group] = val @@ -872,7 +872,7 @@ local function CreateBodygroupSkinModifier( data, panel ) sklabel:SizeToContents() sklabel:DockMargin(50,0,0,0) sklabel:Dock(LEFT) - + local skwang = vgui.Create( "DNumberWang", panel ) skwang:SetSize( 30, 20 ) skwang:SetMin( 0 ) @@ -882,11 +882,11 @@ local function CreateBodygroupSkinModifier( data, panel ) skwang:SetValue(data.skin) skwang:DockMargin(10,0,0,0) skwang:Dock(LEFT) - + return panel end -/*** Model panel for adjusting models *** +--[[** Model panel for adjusting models *** Name: Model: Bone name: @@ -895,13 +895,13 @@ Rotation pitch / yaw / role Model size x / y / z Material Color modulation -*/ +]] local function CreateModelPanel( name, preset_data ) - + local data = wep.v_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Model" data.model = preset_data.model or "" data.bone = preset_data.bone or "" @@ -914,9 +914,9 @@ local function CreateModelPanel( name, preset_data ) data.material = preset_data.material or "" data.bodygroup = preset_data.bodygroup or {} data.skin = preset_data.skin or 0 - - wep.vRenderOrder = nil // force viewmodel render order to recache - + + wep.vRenderOrder = nil -- force viewmodel render order to recache + local panellist = vgui.Create("DPanelList", pmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -925,9 +925,9 @@ local function CreateModelPanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name, SimplePanel(panellist) )) panellist:AddItem(CreateModelModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer():GetViewModel() )) @@ -939,25 +939,25 @@ local function CreateModelPanel( name, preset_data ) panellist:AddItem(CreateSLightningModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateMaterialModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBodygroupSkinModifier( data, SimplePanel(panellist) )) - + return panellist - + end -/*** Sprite panel for adjusting sprites *** +--[[** Sprite panel for adjusting sprites *** Name: Sprite: Bone name: Translation x / y / z Sprite x / y size Color -*/ +]] local function CreateSpritePanel( name, preset_data ) - + local data = wep.v_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Sprite" data.sprite = preset_data.sprite or "" data.bone = preset_data.bone or "" @@ -970,9 +970,9 @@ local function CreateSpritePanel( name, preset_data ) data.vertexalpha = preset_data.vertexalpha or true data.vertexcolor = preset_data.vertexcolor or true data.ignorez = preset_data.ignorez or false - + wep.vRenderOrder = nil - + local panellist = vgui.Create("DPanelList", pmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -981,9 +981,9 @@ local function CreateSpritePanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name,SimplePanel(panellist) )) panellist:AddItem(CreateSpriteModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer():GetViewModel() )) @@ -992,25 +992,25 @@ local function CreateSpritePanel( name, preset_data ) panellist:AddItem(CreateSizeModifiers( data, SimplePanel(panellist), 2 )) panellist:AddItem(CreateColorModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateParamModifiers( data, SimplePanel(panellist) )) - + return panellist - + end -/*** Model panel for adjusting models *** +--[[** Model panel for adjusting models *** Name: Model: Bone name: Translation x / y / z Rotation pitch / yaw / role Size -*/ +]] local function CreateQuadPanel( name, preset_data ) - + local data = wep.v_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Quad" data.model = preset_data.model or "" data.bone = preset_data.bone or "" @@ -1019,8 +1019,8 @@ local function CreateQuadPanel( name, preset_data ) data.angle = preset_data.angle or Angle(0,0,0) data.size = preset_data.size or 0.05 - wep.vRenderOrder = nil // force viewmodel render order to recache - + wep.vRenderOrder = nil -- force viewmodel render order to recache + local panellist = vgui.Create("DPanelList", pmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -1029,28 +1029,28 @@ local function CreateQuadPanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer():GetViewModel() )) panellist:AddItem(CreateVRelativeModifier( name, data, SimplePanel(panellist) )) panellist:AddItem(CreatePositionModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateAngleModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateSizeModifiers( data, SimplePanel(panellist), 1 )) - + return panellist - + end -// adding button DoClick +-- adding button DoClick mnbtn.DoClick = function() local new = string.Trim( mntext:GetValue() ) if (new) then if (new == "") then CreateNote("Empty name field!") return end if (wep.v_models[new] != nil) then CreateNote("Name already exists!") return end wep.v_models[new] = {} - + if (!wep.v_panelCache[new]) then if (boxselected == "Model") then wep.v_panelCache[new] = CreateModelPanel( new ) @@ -1062,12 +1062,12 @@ mnbtn.DoClick = function() Error("wtf are u doing") end end - + wep.v_panelCache[new]:SetVisible(false) - + table.insert(v_relelements, new) UpdateRelBoxes("v") - + mlist:AddLine(new,boxselected) end end @@ -1082,24 +1082,24 @@ for k, v in pairs( wep.save_data.v_models ) do wep.v_panelCache[k] = CreateQuadPanel( k, v ) end wep.v_panelCache[k]:SetVisible(false) - + table.insert(v_relelements, k) mlist:AddLine(k,v.type) end UpdateRelBoxes("v") -// remove a line +-- remove a line rmbtn.DoClick = function() local line = mlist:GetSelectedLine() if (line) then local name = mlist:GetLine(line):GetValue(1) wep.v_models[name] = nil - // clear from panel cache - if (wep.v_panelCache[name]) then + -- clear from panel cache + if (wep.v_panelCache[name]) then wep.v_panelCache[name]:Remove() wep.v_panelCache[name] = nil - + table.RemoveByValue( v_relelements, name ) RemoveRelBox( "v", name ) UpdateRelBoxes( "v" ) @@ -1108,20 +1108,20 @@ rmbtn.DoClick = function() end end -// duplicate line +-- duplicate line copybtn.DoClick = function() local line = mlist:GetSelectedLine() if (line) then local name = mlist:GetLine(line):GetValue(1) local to_copy = wep.v_models[name] local new_preset = table.Copy(to_copy) - - // quickly generate a new unique name + + -- quickly generate a new unique name while(wep.v_models[name]) do name = name.."+" end - - // have to fix every sub-table as well because table.Copy copies references + + -- have to fix every sub-table as well because table.Copy copies references new_preset.pos = Vector(to_copy.pos.x, to_copy.pos.y, to_copy.pos.z) if (to_copy.angle) then new_preset.angle = Angle(to_copy.angle.p, to_copy.angle.y, to_copy.angle.r) @@ -1137,9 +1137,9 @@ copybtn.DoClick = function() if (to_copy.bodygroup) then new_preset.bodygroup = table.Copy(to_copy.bodygroup) end - + wep.v_models[name] = {} - + if (new_preset.type == "Model") then wep.v_panelCache[name] = CreateModelPanel( name, new_preset ) elseif (new_preset.type == "Sprite") then @@ -1147,23 +1147,23 @@ copybtn.DoClick = function() elseif (new_preset.type == "Quad") then wep.v_panelCache[name] = CreateQuadPanel( name, new_preset ) end - + wep.v_panelCache[name]:SetVisible(false) - + table.insert(v_relelements, name) UpdateRelBoxes("v") - + mlist:AddLine(name,new_preset.type) end end -/*////////////////////////////////////////////////////////////// +--[[-------------------------------------------------------------- World Models -/////////////////////////////////////////////////////////////*/ +------------------------------------------------------------/]] local lastVisible = "" @@ -1193,13 +1193,13 @@ pnewelement:SetTall(20) mnwtext:SetMultiline(false) mnwtext:SetText( "element_name" ) mnwtext:Dock(FILL) - + local mnwbtn = vgui.Create( "DButton", pnewelement ) mnwbtn:SetSize( 50, 20 ) mnwbtn:SetText( "Add" ) mnwbtn:DockMargin(5,0,0,0) mnwbtn:Dock(RIGHT) - + local tpbox = vgui.Create( "DComboBox", pnewelement ) tpbox:SetSize( 100, 20 ) tpbox:SetText( "Model" ) @@ -1218,21 +1218,21 @@ pnewelement:Dock(TOP) local mwlist = vgui.Create( "DListView", pwmodels) wep.w_modelListing = mwlist - + mwlist:SetTall( 160 ) mwlist:SetMultiSelect(false) mwlist:SetDrawBackground(true) mwlist:AddColumn("Name") mwlist:AddColumn("Type") - // cache the created panels + -- cache the created panels mwlist.OnRowSelected = function( panel, line ) local name = mwlist:GetLine(line):GetValue(1) - + if (wep.w_panelCache[lastVisible]) then wep.w_panelCache[lastVisible]:SetVisible(false) end wep.w_panelCache[name]:SetVisible(true) - + lastVisible = name end @@ -1244,12 +1244,12 @@ local pwbuttons = SimplePanel( pwmodels ) rmbtn:SetSize( 140, 25 ) rmbtn:SetText( "Remove selected" ) rmbtn:Dock(LEFT) - + local copybtn = vgui.Create( "DButton", pwbuttons ) copybtn:SetSize( 140, 25 ) copybtn:SetText( "Copy selected" ) copybtn:Dock(RIGHT) - + local importbtn = vgui.Create( "DButton", pwbuttons ) importbtn:SetTall( 25 ) importbtn:SetText( "Import viewmodels" ) @@ -1258,7 +1258,7 @@ local pwbuttons = SimplePanel( pwmodels ) pwbuttons:DockMargin(0,5,0,5) pwbuttons:Dock(TOP) -// Print buttons +-- Print buttons local pctbtn = vgui.Create( "DButton", pwmodels) pctbtn:SetTall( 30 ) pctbtn:SetText("Copy world model table to clipboard") @@ -1282,7 +1282,7 @@ local prtbtn = vgui.Create( "DButton", pwmodels) end prtbtn:Dock(BOTTOM) -/*** Model panel for adjusting models *** +--[[** Model panel for adjusting models *** Name: Model: Translation x / y / z @@ -1290,13 +1290,13 @@ Rotation pitch / yaw / role Model size x / y / z Material Color modulation -*/ +]] local function CreateWorldModelPanel( name, preset_data ) - + local data = wep.w_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Model" data.model = preset_data.model or "" data.bone = preset_data.bone or "ValveBiped.Bip01_R_Hand" @@ -1309,9 +1309,9 @@ local function CreateWorldModelPanel( name, preset_data ) data.material = preset_data.material or "" data.bodygroup = preset_data.bodygroup or {} data.skin = preset_data.skin or 0 - + wep.wRenderOrder = nil - + local panellist = vgui.Create("DPanelList", pwmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -1320,9 +1320,9 @@ local function CreateWorldModelPanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name, SimplePanel(panellist) )) panellist:AddItem(CreateModelModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer() )) @@ -1334,24 +1334,24 @@ local function CreateWorldModelPanel( name, preset_data ) panellist:AddItem(CreateSLightningModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateMaterialModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBodygroupSkinModifier( data, SimplePanel(panellist) )) - + return panellist - + end -/*** Sprite panel for adjusting sprites *** +--[[** Sprite panel for adjusting sprites *** Name: Sprite: Translation x / y / z Sprite x / y size Color -*/ +]] local function CreateWorldSpritePanel( name, preset_data ) - + local data = wep.w_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Sprite" data.sprite = preset_data.sprite or "" data.bone = preset_data.bone or "ValveBiped.Bip01_R_Hand" @@ -1364,9 +1364,9 @@ local function CreateWorldSpritePanel( name, preset_data ) data.vertexalpha = preset_data.vertexalpha or true data.vertexcolor = preset_data.vertexcolor or true data.ignorez = preset_data.ignorez or false - + wep.wRenderOrder = nil - + local panellist = vgui.Create("DPanelList", pwmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -1375,9 +1375,9 @@ local function CreateWorldSpritePanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name, SimplePanel(panellist) )) panellist:AddItem(CreateSpriteModifier( data, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer() )) @@ -1386,25 +1386,25 @@ local function CreateWorldSpritePanel( name, preset_data ) panellist:AddItem(CreateSizeModifiers( data, SimplePanel(panellist), 2 )) panellist:AddItem(CreateColorModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateParamModifiers( data, SimplePanel(panellist) )) - + return panellist - + end -/*** Model panel for adjusting models *** +--[[** Model panel for adjusting models *** Name: Model: Bone name: Translation x / y / z Rotation pitch / yaw / role Size -*/ +]] local function CreateWorldQuadPanel( name, preset_data ) - + local data = wep.w_models[name] if (!preset_data) then preset_data = {} end - - // default data + + -- default data data.type = preset_data.type or "Quad" data.model = preset_data.model or "" data.bone = preset_data.bone or "ValveBiped.Bip01_R_Hand" @@ -1413,8 +1413,8 @@ local function CreateWorldQuadPanel( name, preset_data ) data.angle = preset_data.angle or Angle(0,0,0) data.size = preset_data.size or 0.05 - wep.vRenderOrder = nil // force viewmodel render order to recache - + wep.vRenderOrder = nil -- force viewmodel render order to recache + local panellist = vgui.Create("DPanelList", pwmodels ) panellist:SetPaintBackground( true ) panellist.Paint = function() surface.SetDrawColor( 90, 90, 90, 255 ) surface.DrawRect( 0, 0, panellist:GetWide(), panellist:GetTall() ) end @@ -1423,28 +1423,28 @@ local function CreateWorldQuadPanel( name, preset_data ) panellist:SetPadding(5) panellist:DockMargin(0,0,0,5) panellist:Dock(FILL) - + PanelBackgroundReset() - + panellist:AddItem(CreateNameLabel( name, SimplePanel(panellist) )) panellist:AddItem(CreateBoneModifier( data, SimplePanel(panellist), LocalPlayer() )) panellist:AddItem(CreateWRelativeModifier( name, data, SimplePanel(panellist) )) panellist:AddItem(CreatePositionModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateAngleModifiers( data, SimplePanel(panellist) )) panellist:AddItem(CreateSizeModifiers( data, SimplePanel(panellist), 1 )) - + return panellist - + end -// adding button DoClick +-- adding button DoClick mnwbtn.DoClick = function() local new = string.Trim( mnwtext:GetValue() ) if (new) then if (new == "") then CreateWNote("Empty name field!") return end if (wep.w_models[new] != nil) then CreateWNote("Name already exists!") return end wep.w_models[new] = {} - + if (!wep.w_panelCache[new]) then if (wboxselected == "Model") then wep.w_panelCache[new] = CreateWorldModelPanel( new ) @@ -1456,40 +1456,40 @@ mnwbtn.DoClick = function() Error("wtf are u doing") end end - + wep.w_panelCache[new]:SetVisible(false) - + table.insert(w_relelements, new) UpdateRelBoxes("w") - + mwlist:AddLine(new,wboxselected) end end for k, v in pairs( wep.save_data.w_models ) do wep.w_models[k] = {} - - // backwards compatability + + -- backwards compatability if (!v.bone or v.bone == "") then v.bone = "ValveBiped.Bip01_R_Hand" end - + if (v.type == "Model") then wep.w_panelCache[k] = CreateWorldModelPanel( k, v ) elseif (v.type == "Sprite") then wep.w_panelCache[k] = CreateWorldSpritePanel( k, v ) elseif (v.type == "Quad") then wep.w_panelCache[k] = CreateWorldQuadPanel( k, v ) - end + end wep.w_panelCache[k]:SetVisible(false) table.insert(w_relelements, k) - + mwlist:AddLine(k,v.type) end UpdateRelBoxes("w") -// import viewmodels +-- import viewmodels importbtn.DoClick = function() local num = 0 for k, v in pairs( wep.v_models ) do @@ -1498,26 +1498,26 @@ importbtn.DoClick = function() while(wep.w_models[name] != nil) do name = k..""..i i = i + 1 - - // changing names might mess up the relative transitions of some stuff - // but whatever. + + -- changing names might mess up the relative transitions of some stuff + -- but whatever. end - + local new_preset = table.Copy(v) - new_preset.bone = "ValveBiped.Bip01_R_Hand" // switch to hand bone by default - - if (new_preset.rel and new_preset.rel != "") then + new_preset.bone = "ValveBiped.Bip01_R_Hand" -- switch to hand bone by default + + --if (new_preset.rel and new_preset.rel != "") then new_preset.pos = Vector(v.pos.x, v.pos.y, v.pos.z) if (v.angle) then new_preset.angle = Angle(v.angle.p, v.angle.y, v.angle.r) end - else + --[[else new_preset.pos = Vector(num*5,0,-10) if (v.angle) then new_preset.angle = Angle(0,0,0) end - end - + end]] + if (v.color) then new_preset.color = Color(v.color.r,v.color.g,v.color.b,v.color.a) end @@ -1529,7 +1529,7 @@ importbtn.DoClick = function() if (v.bodygroup) then new_preset.bodygroup = table.Copy(v.bodygroup) end - + wep.w_models[name] = {} if (v.type == "Model") then wep.w_panelCache[name] = CreateWorldModelPanel( name, new_preset ) @@ -1537,29 +1537,29 @@ importbtn.DoClick = function() wep.w_panelCache[name] = CreateWorldSpritePanel( name, new_preset ) elseif (v.type == "Quad") then wep.w_panelCache[name] = CreateWorldQuadPanel( name, new_preset ) - end + end wep.w_panelCache[name]:SetVisible(false) - + table.insert(w_relelements, name) UpdateRelBoxes("w") - + mwlist:AddLine(name,v.type) - + num = num + 1 end end -// remove a line +-- remove a line rmbtn.DoClick = function() local line = mwlist:GetSelectedLine() if (line) then local name = mwlist:GetLine(line):GetValue(1) wep.w_models[name] = nil - // clear from panel cache - if (wep.w_panelCache[name]) then + -- clear from panel cache + if (wep.w_panelCache[name]) then wep.w_panelCache[name]:Remove() wep.w_panelCache[name] = nil - + table.RemoveByValue( w_relelements, name ) RemoveRelBox( "w", name ) UpdateRelBoxes( "w" ) @@ -1568,20 +1568,20 @@ rmbtn.DoClick = function() end end -// duplicate line +-- duplicate line copybtn.DoClick = function() local line = mwlist:GetSelectedLine() if (line) then local name = mwlist:GetLine(line):GetValue(1) local to_copy = wep.w_models[name] local new_preset = table.Copy(to_copy) - - // quickly generate a new unique name + + -- quickly generate a new unique name while(wep.w_models[name]) do name = name.."+" end - - // have to fix every sub-table as well because table.Copy copies references + + -- have to fix every sub-table as well because table.Copy copies references new_preset.pos = Vector(to_copy.pos.x, to_copy.pos.y, to_copy.pos.z) if (to_copy.angle) then new_preset.angle = Angle(to_copy.angle.p, to_copy.angle.y, to_copy.angle.r) @@ -1597,9 +1597,9 @@ copybtn.DoClick = function() if (to_copy.bodygroup) then new_preset.bodygroup = table.Copy(to_copy.bodygroup) end - + wep.w_models[name] = {} - + if (new_preset.type == "Model") then wep.w_panelCache[name] = CreateWorldModelPanel( name, new_preset ) elseif (new_preset.type == "Sprite") then @@ -1607,12 +1607,12 @@ copybtn.DoClick = function() elseif (new_preset.type == "Quad") then wep.w_panelCache[name] = CreateWorldQuadPanel( name, new_preset ) end - + wep.w_panelCache[name]:SetVisible(false) - + table.insert(w_relelements, name) UpdateRelBoxes("w") - + mwlist:AddLine(name,new_preset.type) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/tool.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/tool.lua index 79f2079..9b0561c 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/tool.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/tool.lua @@ -4,20 +4,20 @@ local wep = GetSCKSWEP( LocalPlayer() ) local ptool = wep.ptool local panim = SimplePanel(ptool) - // ***** Animations ***** - + -- ***** Animations ***** + local alabel = vgui.Create( "DLabel", panim ) alabel:SetTall( 18 ) alabel:SetText( "Play animation (only works properly in third person):" ) alabel:Dock( TOP ) - + local cols = 4 local agrid = vgui.Create( "DGrid", panim ) agrid:SetCols(cols) agrid:SetColWide( 106 ) agrid:SetRowHeight( 24 ) - - local animations = { + + local animations = { { "Primary attack", ACT_VM_PRIMARYATTACK, PLAYER_ATTACK1 }, { "Reload", ACT_VM_RELOAD, PLAYER_RELOAD }, { "Melee 1", ACT_VM_MISSCENTER, PLAYER_ATTACK1 }, @@ -28,9 +28,9 @@ local panim = SimplePanel(ptool) { "Throw grenade", ACT_VM_THROW, PLAYER_ATTACK1 }, { "Throw grenade", ACT_VM_IDLE, nil } } - + for k, anim in pairs( animations ) do - + local abtn = vgui.Create( "DButton", agrid ) abtn:SetSize( 100, 18 ) abtn:SetText( anim[1] ) @@ -41,9 +41,9 @@ local panim = SimplePanel(ptool) if (anim[3] != nil) then LocalPlayer():SetAnimation(anim[3]) end end agrid:AddItem(abtn) - + end - + agrid:SetTall( math.ceil(#animations / cols) * 24 ) agrid:DockMargin(0,5,0,0) agrid:Dock(TOP) @@ -54,28 +54,28 @@ panim:Dock( TOP ) local psettings = SimplePanel(ptool) - // ***** Settings saving / loading ***** + -- ***** Settings saving / loading ***** local function CreateSettingsNote( text ) local notiflabel = vgui.Create( "DLabel", psettings ) notiflabel:SetTall( 20 ) notiflabel:SetText( text ) notiflabel:SizeToContentsX() - + local notif = vgui.Create( "DNotify" , psettings ) - notif:SetPos( 150, 5 ) // just hack it in + notif:SetPos( 150, 5 ) -- just hack it in notif:SetSize( notiflabel:GetWide(), 20 ) notif:SetLife( 5 ) notif:AddItem(notiflabel) - + end - + local selabel = vgui.Create( "DLabel", psettings ) selabel:SetTall( 20 ) selabel:SetText( "Configuration:" ) selabel:Dock(TOP) - + local psave = SimplePanel(psettings) - + local satext = vgui.Create( "DTextEntry", psave ) satext:SetTall( 20 ) satext:SetMultiline(false) @@ -86,24 +86,24 @@ local psettings = SimplePanel(ptool) end satext:DockMargin(5,0,0,0) satext:Dock(FILL) - + local sabtn = vgui.Create( "DButton", psave ) sabtn:SetTall( 16 ) sabtn:SetText( "Save as:" ) sabtn.DoClick = function() - + if !IsValid(wep) then return end - + local text = string.Trim(satext:GetValue()) if (text == "") then return end - + local save_data = wep.save_data - - // collect all save data + + -- collect all save data save_data.v_models = table.Copy(wep.v_models) save_data.w_models = table.Copy(wep.w_models) save_data.v_bonemods = table.Copy(wep.v_bonemods) - // remove caches + -- remove caches for k, v in pairs(save_data.v_models) do v.createdModel = nil v.createdSprite = nil @@ -121,75 +121,75 @@ local psettings = SimplePanel(ptool) save_data.IronSightsPos, save_data.IronSightsAng = wep:GetIronSightCoordination() save_data.ShowViewModel = wep.ShowViewModel save_data.ShowWorldModel = wep.ShowWorldModel - + local filename = "swep_construction_kit/"..text..".txt" - + local succ, val = pcall(glon.encode, save_data) if (!succ || !val) then LocalPlayer():ChatPrint("Failed to encode settings!") return end - + file.Write(filename, val) LocalPlayer():ChatPrint("Saved file \""..text.."\"!") end - + sabtn:Dock(LEFT) - + psave:DockMargin(0,5,0,5) psave:Dock(TOP) - + local pload = SimplePanel(psettings) - + local lftext = vgui.Create( "DTextEntry", pload ) lftext:SetTall( 20 ) lftext:SetMultiline(false) lftext:SetText( "save1" ) - + lftext:DockMargin(5,0,0,0) lftext:Dock(FILL) - + local lfbtn = vgui.Create( "DButton", pload ) lfbtn:SetTall( 16 ) lfbtn:SetText( "Load file:" ) lfbtn.DoClick = function() local text = string.Trim(lftext:GetValue()) if (text == "") then return end - + local filename = "swep_construction_kit/"..text..".txt" - + if (!file.Exists(filename, "DATA")) then CreateSettingsNote( "No such file exists!" ) return end - + local glondata = file.Read(filename) local succ, new_preset = pcall(glon.decode, glondata) if (!succ || !new_preset) then LocalPlayer():ChatPrint("Failed to load settings!") return end - + new_preset._savename = text - + wep:CleanMenu() wep:OpenMenu( new_preset ) LocalPlayer():ChatPrint("Loaded file \""..text.."\"!") end lfbtn:Dock(LEFT) - + pload:Dock(TOP) psettings:SetTall(selabel:GetTall() + lftext:GetTall() + satext:GetTall() + 30) psettings:DockPadding(0,5,0,5) psettings:Dock(TOP) -// link to FP thread +-- link to FP thread local threadbtn = vgui.Create( "DButton", ptool ) threadbtn:SetTall( 30 ) threadbtn:SetText( "Open Tutorial (Facepunch thread)" ) threadbtn.DoClick = function() - gui.OpenURL(tutorialURL) // Removed in Gmod 13 - //SetClipboardText(tutorialURL) + gui.OpenURL(tutorialURL) -- Removed in Gmod 13 + --SetClipboardText(tutorialURL) end threadbtn:DockMargin(0,15,0,5) threadbtn:Dock(TOP) -// base code +-- base code local basecbtn = vgui.Create( "DButton", ptool ) basecbtn:SetTall( 30 ) basecbtn:SetText( "Copy SWEP base code to clipboard" ) diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/weapon.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/weapon.lua index 7c88bf0..b0005fb 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/weapon.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/menu/weapon.lua @@ -1,6 +1,6 @@ local function GetWeaponPrintText( wep ) - + str = "" str = str.."SWEP.HoldType = \""..wep.HoldType.."\"\n" str = str.."SWEP.ViewModelFOV = "..wep.ViewModelFOV.."\n" @@ -17,17 +17,17 @@ local function GetWeaponPrintText( wep ) if (i == 0) then str = str.."\n" end i = i + 1 str = str.."\t[\""..k.."\"] = { scale = "..PrintVec( v.scale )..", pos = "..PrintVec( v.pos )..", angle = "..PrintAngle( v.angle ).." }" - + if (i < num) then str = str.."," end str = str.."\n" end end str = str.."}" - - str = string.Replace(str,",\n}","\n}") // remove the last comma - + + str = string.Replace(str,",\n}","\n}") -- remove the last comma + return str - + end local function ClearViewModels() @@ -37,7 +37,7 @@ local function ClearViewModels() wep.v_models = {} if (wep.v_modelListing) then wep.v_modelListing:Clear() end for k, v in pairs( wep.v_panelCache ) do - if (v) then + if (v) then v:Remove() end end @@ -45,14 +45,14 @@ local function ClearViewModels() end local function ClearWorldModels() - + local wep = GetSCKSWEP( LocalPlayer() ) if (!IsValid(wep)) then return end wep.w_models = {} if (wep.w_modelListing) then wep.w_modelListing:Clear() end for k, v in pairs( wep.w_panelCache ) do - if (v) then + if (v) then v:Remove() end end @@ -63,14 +63,14 @@ local function RefreshViewModelBoneMods() local wep = GetSCKSWEP( LocalPlayer() ) if (!IsValid(wep)) then return end - + if (!IsValid(wep.v_modelbonebox)) then return end wep.v_bonemods = {} - + wep.v_modelbonebox:Clear() - - timer.Destroy("repop") - + + timer.Remove("repop") + timer.Create("repop", 1, 1, function() local option = PopulateBoneList( wep.v_modelbonebox, LocalPlayer():GetViewModel() ) if (option) then @@ -84,33 +84,33 @@ local wep = GetSCKSWEP( LocalPlayer() ) local pweapon = wep.pweapon local next_v_model = "" -// Weapon model +-- Weapon model local pweapon_vmodel = SimplePanel( pweapon ) local vlabel = vgui.Create( "DLabel", pweapon_vmodel ) vlabel:SetTall( 20 ) vlabel:SetText( "View model:" ) vlabel:Dock(LEFT) - + local vtext = vgui.Create( "DTextEntry", pweapon_vmodel) vtext:SetTall( 20 ) vtext:SetMultiline(false) vtext.OnTextChanged = function() local newmod = string.gsub(vtext:GetValue(), ".mdl", "") RunConsoleCommand("swepck_viewmodel", newmod) - - // clear view model additions + + -- clear view model additions if (newmod != next_v_model and file.Exists(newmod..".mdl", "GAME")) then next_v_model = newmod ClearViewModels() RefreshViewModelBoneMods() end - + end vtext:SetText( wep.save_data.ViewModel ) vtext:OnTextChanged() vtext:Dock(FILL) - + local vtbtn = vgui.Create( "DButton", pweapon_vmodel ) vtbtn:SetSize( 25, 20 ) vtbtn:SetText("...") @@ -128,24 +128,24 @@ local pweapon_wmodel = SimplePanel( pweapon ) wlabel:SetTall( 20 ) wlabel:SetText( "World model:" ) wlabel:Dock(LEFT) - + local wtext = vgui.Create( "DTextEntry", pweapon_wmodel) wtext:SetTall( 20 ) wtext:SetMultiline(false) wtext.OnTextChanged = function() local newmod = string.gsub(wtext:GetValue(), ".mdl", "") RunConsoleCommand("swepck_worldmodel", newmod) - - // clear world model additions + + -- clear world model additions if (newmod != wep.cur_wmodel) then ClearWorldModels() end - + end wtext:SetText( wep.save_data.CurWorldModel ) wtext:OnTextChanged() wtext:Dock(FILL) - + local wtbtn = vgui.Create( "DButton", pweapon_wmodel ) wtbtn:SetSize( 25, 20 ) wtbtn:SetText("...") @@ -153,18 +153,18 @@ local pweapon_wmodel = SimplePanel( pweapon ) wep:OpenBrowser( wep.CurWorldModel, "model", function( val ) wtext:SetText(val) wtext:OnTextChanged() end ) end wtbtn:Dock(RIGHT) - + pweapon_wmodel:DockMargin(0,0,0,5) pweapon_wmodel:Dock(TOP) local pweapon_holdtype = SimplePanel( pweapon ) - // Weapon hold type + -- Weapon hold type local hlabel = vgui.Create( "DLabel", pweapon_holdtype ) hlabel:SetSize( 150, 20 ) hlabel:SetText( "Hold type (3rd person):" ) hlabel:Dock(LEFT) - + local hbox = vgui.Create( "DComboBox", pweapon_holdtype ) hbox:SetTall( 20 ) for k, v in pairs( wep:GetHoldTypes() ) do @@ -184,7 +184,7 @@ pweapon_holdtype:DockMargin(0,0,0,5) pweapon_holdtype:Dock(TOP) -// Show viewmodel +-- Show viewmodel local vhbox = vgui.Create( "DCheckBoxLabel", pweapon ) vhbox:SetTall( 20 ) vhbox:SetText( "Show view model" ) @@ -195,9 +195,9 @@ local vhbox = vgui.Create( "DCheckBoxLabel", pweapon ) LocalPlayer():GetViewModel():SetMaterial("") else LocalPlayer():GetViewModel():SetColor(Color(255,0,0,255)) - // This should prevent the model from drawing, without stopping ViewModelDrawn from being called - // I tried Entity:SetRenderMode(1) with color alpha on 1 but the view model resets to render mode 0 every frame :/ - LocalPlayer():GetViewModel():SetMaterial("Debug/hsv") + -- This should prevent the model from drawing, without stopping ViewModelDrawn from being called + -- I tried Entity:SetRenderMode(1) with color alpha on 1 but the view model resets to render mode 0 every frame :/ + LocalPlayer():GetViewModel():SetMaterial("Debug/hsv") end end if (wep.save_data.ShowViewModel) then vhbox:SetValue(1) @@ -205,7 +205,7 @@ local vhbox = vgui.Create( "DCheckBoxLabel", pweapon ) vhbox:DockMargin(0,0,0,5) vhbox:Dock(TOP) -// Show worldmodel +-- Show worldmodel local whbox = vgui.Create( "DCheckBoxLabel", pweapon ) whbox:SetTall( 20 ) whbox:SetText( "Show world model" ) @@ -217,7 +217,7 @@ local whbox = vgui.Create( "DCheckBoxLabel", pweapon ) whbox:DockMargin(0,0,0,5) whbox:Dock(TOP) -// Flip viewmodel +-- Flip viewmodel local fcbox = vgui.Create( "DCheckBoxLabel", pweapon ) fcbox:SetTall( 20 ) fcbox:SetText( "Flip viewmodel" ) @@ -229,7 +229,18 @@ local fcbox = vgui.Create( "DCheckBoxLabel", pweapon ) fcbox:DockMargin(0,0,0,5) fcbox:Dock(TOP) -// View model FOV slider +-- Use hands +local usehands = vgui.Create( "DCheckBoxLabel", pweapon ) + usehands:SetTall( 20 ) + usehands:SetText( "Use hands" ) + usehands.OnChange = function() + wep.UseHands = usehands:GetChecked() + end + usehands:SetValue(0) +usehands:DockMargin(0,0,0,5) +usehands:Dock(TOP) + +-- View model FOV slider local fovslider = vgui.Create( "DNumSlider", pweapon ) fovslider:SetText( "View model FOV" ) fovslider:SetMin( 20 ) @@ -248,34 +259,34 @@ local pweapon_bone = SimplePanel( pweapon ) local pbone_left = SimplePanel( pweapon_bone ) pbone_left:SetWide( 200 ) - - // View model bone scaling + + -- View model bone scaling local vsbonelabel = vgui.Create( "DLabel", pbone_left ) vsbonelabel:SetText( "Viewmodel bone mods:" ) vsbonelabel:SizeToContentsX() vsbonelabel:SetTall( 20 ) vsbonelabel:Dock(TOP) - + local vsbonebox = vgui.Create( "DComboBox", pbone_left ) vsbonebox:SetTall( 20 ) vsbonebox:Dock(BOTTOM) - + pbone_left:Dock(LEFT) - + local pbone_right = SimplePanel( pweapon_bone ) - + local resbtn = vgui.Create( "DButton", pbone_right ) resbtn:SetTall( 20 ) resbtn:SetText("Reset all bone mods") resbtn:DockMargin(10,0,0,0) resbtn:Dock(TOP) - + local resselbtn = vgui.Create( "DButton", pbone_right ) resselbtn:SetTall( 20 ) resselbtn:SetText("Reset selected bone mod") resselbtn:DockMargin(10,0,0,0) resselbtn:Dock(BOTTOM) - + pbone_right:Dock(FILL) pweapon_bone:Dock(TOP) @@ -283,8 +294,8 @@ pweapon_bone:Dock(TOP) if (!wep.save_data.v_bonemods) then wep.save_data.v_bonemods = {} end - -// backwards compatability with old bone scales + +-- backwards compatability with old bone scales if (wep.save_data.v_bonescales) then for k, v in pairs(wep.save_data.v_bonescales) do if (v == Vector(1,1,1)) then continue end @@ -300,7 +311,7 @@ else curbone = "" wep.v_bonemods = {} end - + local bonepanel = vgui.Create( "DPanel", pweapon ) bonepanel:SetVisible( true ) bonepanel:SetPaintBackground( true ) @@ -308,54 +319,54 @@ local bonepanel = vgui.Create( "DPanel", pweapon ) bonepanel:DockMargin( 0, 5, 0, 5 ) bonepanel:DockPadding( 5, 5, 5, 5 ) bonepanel:Dock(FILL) - + local function CreateBoneMod( selbone, preset_data ) - + local data = wep.v_bonemods[selbone] if (!preset_data) then preset_data = {} end - + data.scale = preset_data.scale or Vector(1,1,1) data.pos = preset_data.pos or Vector(0,0,0) data.angle = preset_data.angle or Angle(0,0,0) - + local sliderw = 110 - + local pscale = SimplePanel( bonepanel ) pscale:SetTall(32*3) - + local vslabel = vgui.Create( "DLabel", pscale ) vslabel:SetText( "Scale" ) vslabel:SizeToContents() vslabel:SetWide(45) vslabel:Dock(LEFT) - + local vsxwang = vgui.Create( "DNumSlider", pscale ) vsxwang:SetText("x / y / z") vsxwang:SetWide(sliderw) - vsxwang:SetMinMax( 0.01, 3 ) + vsxwang:SetMinMax( 0.01, 3 ) vsxwang:SetDecimals( 3 ) - + local vsywang = vgui.Create( "DNumSlider", pscale ) vsywang:SetText("y") vsywang:SetWide(sliderw) vsywang:SetMinMax( 0.01, 3 ) vsywang:SetDecimals( 3 ) - vsywang.Wang.ConVarChanged = function( p, value ) + vsywang.Wang.ConVarChanged = function( p, value ) if (selbone != "") then wep.v_bonemods[selbone].scale.y = tonumber(value) end end vsywang:DockMargin(10,0,0,0) - + local vszwang = vgui.Create( "DNumSlider", pscale ) vszwang:SetText("z") vszwang:SetWide(sliderw) vszwang:SetMinMax( 0.01, 3 ) vszwang:SetDecimals( 3 ) - vszwang.Wang.ConVarChanged = function( p, value ) - if (selbone != "") then wep.v_bonemods[selbone].scale.z = tonumber(value) end + vszwang.Wang.ConVarChanged = function( p, value ) + if (selbone != "") then wep.v_bonemods[selbone].scale.z = tonumber(value) end end vszwang:DockMargin(10,0,0,0) - - // make the x numberwang set the total size + + -- make the x numberwang set the total size vsxwang.Wang.ConVarChanged = function( p, value ) if (selbone == "") then return end vszwang:SetValue( value ) @@ -363,29 +374,29 @@ local function CreateBoneMod( selbone, preset_data ) wep.v_bonemods[selbone].scale.x = tonumber(value) end vsxwang:DockMargin(10,0,0,0) - - pscale.PerformLayout = function() // scales the sliders with the panel + + pscale.PerformLayout = function() -- scales the sliders with the panel vszwang:SetWide(pscale:GetWide()*4/15) vsywang:SetWide(pscale:GetWide()*4/15) vsxwang:SetWide(pscale:GetWide()*4/15) end - + vsxwang:Dock(TOP) vsywang:Dock(TOP) vszwang:Dock(TOP) - + pscale:DockMargin(0,0,0, 5) pscale:Dock(TOP) - + local ppos = SimplePanel( bonepanel ) ppos:SetTall(32*3) - + local vposlabel = vgui.Create( "DLabel", ppos ) vposlabel:SetText( "Pos" ) vposlabel:SizeToContents() vposlabel:SetWide(45) vposlabel:Dock(LEFT) - + local vposxwang = vgui.Create( "DNumSlider", ppos ) vposxwang:SetText("x") vposxwang:SetWide(sliderw) @@ -395,49 +406,49 @@ local function CreateBoneMod( selbone, preset_data ) if (selbone != "") then wep.v_bonemods[selbone].pos.x = tonumber(value) end end vposxwang:DockMargin(10,0,0,0) - + local vposywang = vgui.Create( "DNumSlider", ppos ) vposywang:SetText("y") vposywang:SetWide(sliderw) vposywang:SetMinMax( -30, 30 ) vposywang:SetDecimals( 3 ) - vposywang.Wang.ConVarChanged = function( p, value ) + vposywang.Wang.ConVarChanged = function( p, value ) if (selbone != "") then wep.v_bonemods[selbone].pos.y = tonumber(value) end end vposywang:DockMargin(10,0,0,0) - + local vposzwang = vgui.Create( "DNumSlider", ppos ) vposzwang:SetText("z") vposzwang:SetWide(sliderw) vposzwang:SetMinMax( -30, 30 ) vposzwang:SetDecimals( 3 ) - vposzwang.Wang.ConVarChanged = function( p, value ) - if (selbone != "") then wep.v_bonemods[selbone].pos.z = tonumber(value) end + vposzwang.Wang.ConVarChanged = function( p, value ) + if (selbone != "") then wep.v_bonemods[selbone].pos.z = tonumber(value) end end vposzwang:DockMargin(10,0,0,0) - + ppos.PerformLayout = function() vposzwang:SetWide(ppos:GetWide()*4/15) vposywang:SetWide(ppos:GetWide()*4/15) vposxwang:SetWide(ppos:GetWide()*4/15) end - + vposxwang:Dock(TOP) vposywang:Dock(TOP) vposzwang:Dock(TOP) - + ppos:DockMargin(0,0,0, 5) ppos:Dock(TOP) - + local pang = SimplePanel( bonepanel ) pang:SetTall(32*3) - + local vanglabel = vgui.Create( "DLabel", pang ) vanglabel:SetText( "Angle" ) vanglabel:SizeToContents() vanglabel:SetWide(45) vanglabel:Dock(LEFT) - + local vangxwang = vgui.Create( "DNumSlider", pang ) vangxwang:SetText("pitch") vangxwang:SetWide(sliderw) @@ -447,101 +458,101 @@ local function CreateBoneMod( selbone, preset_data ) if (selbone != "") then wep.v_bonemods[selbone].angle.p = tonumber(value) end end vangxwang:DockMargin(10,0,0,0) - + local vangywang = vgui.Create( "DNumSlider", pang ) vangywang:SetText("yaw") vangywang:SetWide(sliderw) vangywang:SetMinMax( -180, 180 ) vangywang:SetDecimals( 3 ) - vangywang.Wang.ConVarChanged = function( p, value ) + vangywang.Wang.ConVarChanged = function( p, value ) if (selbone != "") then wep.v_bonemods[selbone].angle.y = tonumber(value) end end vangywang:DockMargin(10,0,0,0) - + local vangzwang = vgui.Create( "DNumSlider", pang ) vangzwang:SetText("roll") vangzwang:SetWide(sliderw) vangzwang:SetMinMax( -180, 180 ) vangzwang:SetDecimals( 3 ) - vangzwang.Wang.ConVarChanged = function( p, value ) - if (selbone != "") then wep.v_bonemods[selbone].angle.r = tonumber(value) end + vangzwang.Wang.ConVarChanged = function( p, value ) + if (selbone != "") then wep.v_bonemods[selbone].angle.r = tonumber(value) end end vangzwang:DockMargin(10,0,0,0) - + pang.PerformLayout = function() vangzwang:SetWide(pang:GetWide()*4/15) vangywang:SetWide(pang:GetWide()*4/15) vangxwang:SetWide(pang:GetWide()*4/15) end - + vangxwang:Dock(TOP) vangywang:Dock(TOP) vangzwang:Dock(TOP) - + pang:DockMargin(0,0,0, 5) pang:Dock(TOP) - + vsxwang:SetValue( data.scale.x ) vsywang:SetValue( data.scale.y ) vszwang:SetValue( data.scale.z ) - + vposxwang:SetValue( data.pos.x ) vposywang:SetValue( data.pos.y ) vposzwang:SetValue( data.pos.z ) - + vangxwang:SetValue( data.angle.p ) vangywang:SetValue( data.angle.y ) vangzwang:SetValue( data.angle.r ) - + end vsbonebox.OnSelect = function( p, index, value ) local selbone = value if (!selbone or selbone == "") then return end - + if (!wep.v_bonemods[selbone]) then wep.v_bonemods[selbone] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end - + for k, v in pairs( bonepanel:GetChildren() ) do v:Remove() end - + CreateBoneMod( selbone, wep.v_bonemods[selbone]) curbone = selbone end vsbonebox:SetText( curbone ) -vsbonebox.OnSelect( vsbonebox, 1, curbone ) - +vsbonebox.OnSelect( vsbonebox, 1, curbone ) + timer.Simple(1, function() local option = PopulateBoneList( vsbonebox, LocalPlayer():GetViewModel() ) - if (option and curbone == "") then + if (option and curbone == "") then vsbonebox:ChooseOptionID(1) end end) - + resbtn.DoClick = function() wep.v_bonemods = {} if (curbone == "") then return end - + wep.v_bonemods[curbone] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } - + for k, v in pairs( bonepanel:GetChildren() ) do v:Remove() end - + CreateBoneMod( curbone, wep.v_bonemods[curbone]) end resselbtn.DoClick = function() - + if (curbone == "") then return end wep.v_bonemods[curbone] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } - + for k, v in pairs( bonepanel:GetChildren() ) do v:Remove() end - + CreateBoneMod( curbone, wep.v_bonemods[curbone]) end diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/server.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/server.lua index 4fe4246..ed708d9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/server.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/server.lua @@ -1,14 +1,14 @@ local function CanPickup( pl, wep ) - + if (wep:GetClass() == sck_class) then return pl:KeyDown(IN_RELOAD) or !wep.Dropped end - + end hook.Add("PlayerCanPickupWeapon","SCKPickup",CanPickup) - + function SWEP:Deploy() - self.LastOwner = self.Owner + self.LastOwner = self:GetOwner() end function SWEP:Holster() @@ -31,7 +31,7 @@ local function Cmd_SetHoldType( pl, cmd, args ) if (IsValid(wep) and holdtype and table.HasValue( wep:GetHoldTypes(), holdtype )) then wep:SetWeaponHoldType( holdtype ) wep.HoldType = holdtype - end + end end concommand.Add("swepck_setholdtype", Cmd_SetHoldType) @@ -54,7 +54,7 @@ local function Cmd_PlayAnimation( pl, cmd, args ) wep:ResetSequenceInfo() wep:SendWeaponAnim( anim ) end - + end concommand.Add("swepck_playanimation", Cmd_PlayAnimation) @@ -74,7 +74,7 @@ local function Cmd_ViewModelFOV( pl, cmd, args ) if (IsValid(wep)) then wep.ViewModelFOV = tonumber(args[1] or wep.ViewModelFOV) end - + end concommand.Add("swepck_viewmodelfov", Cmd_ViewModelFOV) @@ -85,31 +85,31 @@ local function Cmd_ViewModel( pl, cmd, args ) local newmod = args[1] or wep.ViewModel newmod = newmod..".mdl" if !file.Exists(newmod, "GAME") then return end - - //util.PrecacheModel(newmod) + + --util.PrecacheModel(newmod) wep.ViewModel = newmod pl:GetViewModel():SetWeaponModel(Model(newmod), wep) pl:SendLua([[LocalPlayer():GetActiveWeapon().ViewModel = "]]..newmod..[["]]) - //pl:SendLua([[LocalPlayer():GetViewModel():SetModel("]]..newmod..[[")]]) + --pl:SendLua([[LocalPlayer():GetViewModel():SetModel("]]..newmod..[[")]]) pl:SendLua([[LocalPlayer():GetViewModel():SetWeaponModel(Model("]]..newmod..[["), Entity(]]..wep:EntIndex()..[[))]]) - + local quickswitch = nil for k, v in pairs( pl:GetWeapons() ) do - if (v:GetClass() != wep:GetClass()) then + if (v:GetClass() != wep:GetClass()) then quickswitch = v:GetClass() break end end - + if (quickswitch) then pl:SelectWeapon( quickswitch ) pl:SelectWeapon( wep:GetClass() ) else pl:ChatPrint("Switch weapons to make the new viewmodel show up") end - - //print("Changed viewmodel to \""..wep.ViewModel.."\"") - + + --print("Changed viewmodel to \""..wep.ViewModel.."\"") + end concommand.Add("swepck_viewmodel", Cmd_ViewModel) @@ -120,14 +120,14 @@ local function Cmd_WorldModel( pl, cmd, args ) local newmod = args[1] or wep.CurWorldModel newmod = newmod..".mdl" if !file.Exists(newmod, "GAME") then return end - + util.PrecacheModel(newmod) wep.CurWorldModel = newmod wep:SetModel(newmod) pl:SendLua([[LocalPlayer():GetActiveWeapon().CurWorldModel = "]]..newmod..[["]]) pl:SendLua([[LocalPlayer():GetActiveWeapon():CreateWeaponWorldModel()]]) - //print("Changed worldmodel to \""..wep.CurWorldModel.."\"") - + --print("Changed worldmodel to \""..wep.CurWorldModel.."\"") + end concommand.Add("swepck_worldmodel", Cmd_WorldModel) @@ -138,6 +138,6 @@ local function Cmd_DropWep( pl, cmd, args ) wep.Dropped = true pl:DropWeapon(wep) end - + end concommand.Add("swepck_dropwep", Cmd_DropWep) \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/shared.lua b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/shared.lua index e8fd247..1e140e2 100644 --- a/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/swep_construction_kit/shared.lua @@ -20,12 +20,12 @@ if CLIENT then SWEP.Slot = 5 SWEP.SlotPos = 10 SWEP.ViewModelFlip = false - + SWEP.DrawCrosshair = false - + SWEP.ShowViewModel = true SWEP.ShowWorldModel = true - + end local debugging = false @@ -49,8 +49,8 @@ end SWEP.HoldType = "pistol" -SWEP.HoldTypes = { "normal", "melee", "melee2", "fist", -"knife", "smg", "ar2", "pistol", "revolver", "rpg", "physgun", +SWEP.HoldTypes = { "normal", "melee", "melee2", "fist", +"knife", "smg", "ar2", "pistol", "revolver", "rpg", "physgun", "grenade", "shotgun", "crossbow", "slam", "duel", "passive", "camera" } @@ -59,7 +59,7 @@ SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl" -SWEP.CurWorldModel = "models/weapons/w_pistol.mdl" // this is where shit gets hacky +SWEP.CurWorldModel = "models/weapons/w_pistol.mdl" -- this is where shit gets hacky SWEP.ViewModelFOV = 70 SWEP.BobScale = 0 @@ -77,10 +77,10 @@ local sck_class = "" function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) - + self:SetIronSights( true ) self:ResetIronSights() - + if CLIENT then self:CreateWeaponWorldModel() self:ClientInit() @@ -88,11 +88,11 @@ function SWEP:Initialize() file.CreateDir("swep_construction_kit") end end - + self.Dropped = false - + sck_class = self:GetClass() - + end function SWEP:Equip() @@ -103,28 +103,28 @@ end function SWEP:PrimaryAttack() - self.Weapon:SetNextPrimaryFire(CurTime() + 0.2) + self:SetNextPrimaryFire(CurTime() + 0.2) if CLIENT then self:OpenMenu() end if game.SinglePlayer() then - self.Owner:SendLua("LocalPlayer():GetActiveWeapon():OpenMenu()") + self:GetOwner():SendLua("LocalPlayer():GetActiveWeapon():OpenMenu()") end - + end function SWEP:SecondaryAttack() - - self.Weapon:SetNextSecondaryFire(CurTime() + 0.2) - + + self:SetNextSecondaryFire(CurTime() + 0.2) + if CLIENT then self:OpenMenu() end if game.SinglePlayer() then - self.Owner:SendLua("LocalPlayer():GetActiveWeapon():OpenMenu()") + self:GetOwner():SendLua("LocalPlayer():GetActiveWeapon():OpenMenu()") end - + end @@ -132,7 +132,7 @@ function SWEP:SetupDataTables() self:DTVar( "Bool", 0, "ironsights" ) self:DTVar( "Bool", 1, "thirdperson" ) - + end function SWEP:ToggleIronSights() @@ -162,17 +162,17 @@ end function SWEP:SetThirdPerson( b ) self.dt.thirdperson = b - - local owner = self.Owner + + local owner = self:GetOwner() if (!IsValid(owner)) then owner = self.LastOwner end if (!IsValid(owner)) then return end - - if (self.dt.thirdperson) then + + if (self.dt.thirdperson) then owner:SetViewEntity(game.GetWorld()) owner:CrosshairDisable() - else + else owner:SetViewEntity(owner) - owner:CrosshairEnable() + owner:CrosshairEnable() end end @@ -181,17 +181,17 @@ function SWEP:GetThirdPerson() end function SWEP:GetViewModelPosition(pos, ang) - - //if true then return pos, ang end - //SCKDebugRepeat( "SWEP:VMPos", "Getting viewmodel pos" ) - + + --if true then return pos, ang end + --SCKDebugRepeat( "SWEP:VMPos", "Getting viewmodel pos" ) + local bIron = self.dt.ironsights local fIronTime = self.fIronTime or 0 if (not bIron and fIronTime < CurTime() - self.IronsightTime) then return pos, ang end - + self.IronSightsPos, self.IronSightsAng = self:GetIronSightCoordination() local Mul = 1.0 @@ -218,7 +218,7 @@ function SWEP:GetViewModelPosition(pos, ang) pos = pos + Offset.x * Right * Mul pos = pos + Offset.y * Forward * Mul pos = pos + Offset.z * Up * Mul - + return pos, ang end @@ -230,11 +230,11 @@ SWEP.ir_yw = CreateConVar( "_sp_ironsight_yaw", 0.0 ) SWEP.ir_r = CreateConVar( "_sp_ironsight_roll", 0.0 ) function SWEP:GetIronSightCoordination() - + local vec = Vector( self.ir_x:GetFloat(), self.ir_y:GetFloat(), self.ir_z:GetFloat() ) local ang = Vector( self.ir_p:GetFloat(), self.ir_yw:GetFloat(), self.ir_r:GetFloat() ) return vec, ang - + end function SWEP:GetHoldTypes() @@ -242,16 +242,16 @@ function SWEP:GetHoldTypes() end SWEP.LastOwner = nil -/*************************** +--[[************************** Helper functions -***************************/ +**************************]] SWEP.IsSCK = true function GetSCKSWEP( pl ) local wep = pl:GetActiveWeapon() if (IsValid(wep) and wep.IsSCK) then return wep end - //Error("Not holding SWEP Construction Kit!") + --Error("Not holding SWEP Construction Kit!") return NULL end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua index e44c5ce..ec69ea5 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/cl_init.lua @@ -2,7 +2,20 @@ include('shared.lua') SWEP.Slot = -1 SWEP.SlotPos = -1 -SWEP.DrawAmmo = false -SWEP.DrawCrosshair = true +SWEP.DrawAmmo = false +SWEP.DrawCrosshair = true SWEP.DrawWeaponInfoBox = false +local glowmat = Material("sprites/glow04_noz") +function SWEP:DrawWorldModel() + local owner = self:GetOwner() + if owner:IsValid() then return end + + local pos = self:GetPos() + local col = self:GetClass() == "weapon_knife" and Color(0, 255, 0, 200) or Color(255, 125, 63, 200) + + render.SetMaterial(glowmat) + render.DrawSprite(pos, math.abs(30 + 15 * math.sin(RealTime() * 7 + 1.5)), math.abs(30 + 15 * math.sin(RealTime() * 7)), col) +end + +SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua index ead09f0..d2edcce 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/init.lua @@ -1,12 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() SWEP.Undroppable = true - -function SWEP:OnDrop() - if self:IsValid() then - self.Weapon:Remove() - end -end +SWEP.SourceDrop = true diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua index 2139302..7473826 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_map_base/shared.lua @@ -1,4 +1,4 @@ -SWEP.Name = "Item" +SWEP.PrintName = "Item" SWEP.AnimPrefix = "none" SWEP.HoldType = "normal" @@ -19,13 +19,28 @@ SWEP.Secondary.Ammo = "none" SWEP.DrawCrosshair = false SWEP.Primary.Sound = Sound("") -SWEP.WorldModel = "" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" SWEP.WalkSpeed = SPEED_NORMAL function SWEP:Initialize() end +function SWEP:Equip() + local owner = self:GetOwner() + local children = self:GetChildren() + + if GAMEMODE.ZombieEscape then + if #children > 0 then + GAMEMODE:CenterNotifyAll(COLOR_GREEN, owner:GetName() .. " has picked up a ZE Weapon. ("..children[math.random(#children)]:GetName()..")") + PrintMessage(HUD_PRINTTALK, owner:GetName() .. " has picked up a ZE Weapon. ("..children[math.random(#children)]:GetName()..")") + if SERVER then + gamemode.Call("OnZEWeaponPickup", owner, self) + end + end + end +end + function SWEP:SetWeaponHoldType() end @@ -40,10 +55,12 @@ end function SWEP:Deploy() if SERVER then + local owner = self:GetOwner() + if GAMEMODE.ZombieEscape then - self.Owner:SelectWeapon("weapon_zs_zeknife") + owner:SelectWeapon("weapon_zs_zeknife") else - self.Owner:SelectWeapon("weapon_zs_fists") + owner:SelectWeapon("weapon_zs_fists") end end return true @@ -56,4 +73,3 @@ end function SWEP:CanSecondaryAttack() return false end - diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_agiledead.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_agiledead.lua new file mode 100644 index 0000000..986ea85 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_agiledead.lua @@ -0,0 +1,163 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Agile Dead" + +SWEP.MeleeDamage = 20 +SWEP.Primary.Delay = 1.2 + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +SWEP.NextClimbSound = 0 +function SWEP:Think() + local owner = self:GetOwner() + + if self:GetClimbing() then + if self:GetClimbSurface() and owner:KeyDown(IN_ATTACK2) then + if SERVER and CurTime() >= self.NextClimbSound then + local speed = owner:GetVelocity():LengthSqr() + if speed >= 1200 then + if speed >= 5000 then + self.NextClimbSound = CurTime() + 0.75 + else + self.NextClimbSound = CurTime() + 1 + end + owner:EmitSound("player/footsteps/metalgrate"..math.random(4)..".wav") + end + end + else + self:StopClimbing() + end + end + + return self.BaseClass.Think(self) +end + +local climblerp = 0 +function SWEP:GetViewModelPosition(pos, ang) + climblerp = math.Approach(climblerp, self:IsClimbing() and 1 or 0, FrameTime() * ((climblerp + 1) ^ 3)) + ang:RotateAroundAxis(ang:Right(), 64 * climblerp) + if climblerp > 0 then + pos = pos + -8 * climblerp * ang:Up() + -12 * climblerp * ang:Forward() + end + + return self.BaseClass.GetViewModelPosition(self, pos, ang) +end + +function SWEP:PrimaryAttack() + if self:IsClimbing() then return end + + self.BaseClass.PrimaryAttack(self) +end + +local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-5, -5, -5), maxs = Vector(5, 5, 5)} +function SWEP:GetClimbSurface() + local owner = self:GetOwner() + + local fwd = owner:SyncAngles():Forward() + local up = owner:GetUp() + local pos = owner:GetPos() + local height = owner:OBBMaxs().z + local tr + local ha + for i=5, height, 5 do + if not tr or not tr.Hit then + climbtrace.start = pos + up * i + climbtrace.endpos = climbtrace.start + fwd * 36 + tr = util.TraceHull(climbtrace) + ha = i + if tr.Hit and not tr.HitSky then break end + end + end + + if tr.Hit and not tr.HitSky then + climbtrace.start = pos + up * ha --tr.HitPos + tr.HitNormal + climbtrace.endpos = climbtrace.start + owner:SyncAngles():Up() * (height - ha) + local tr2 = util.TraceHull(climbtrace) + if tr2.Hit and not tr2.HitSky then + return tr2 + end + + return tr + end +end + +function SWEP:SecondaryAttack() + if self:IsClimbing() then return end + + if not self:GetOwner():IsOnGround() and self:GetOwner():GetVelocity():LengthSqr() < 40000 and self:GetClimbSurface() then + self:StartClimbing() + end +end + +function SWEP:StartClimbing() + if self:GetClimbing() then return end + + self:SetClimbing(true) + + self:SetNextPrimaryFire(math.huge) +end + +function SWEP:StopClimbing() + if not self:GetClimbing() then return end + + self:SetClimbing(false) + + self:SetNextPrimaryFire(CurTime() + 0.5) +end + +function SWEP:Move(mv) + if self:GetClimbing() then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + + local owner = self:GetOwner() + local tr = self:GetClimbSurface() + local angs = owner:SyncAngles() + local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) + local vel = Vector(0, 0, 4) + + if owner:KeyDown(IN_FORWARD) then + owner:SetGroundEntity(nil) + vel = vel + dir * 125 + end + if owner:KeyDown(IN_BACK) then + vel = vel + dir * -125 + end + + if vel.z == 4 then + if owner:KeyDown(IN_MOVERIGHT) then + vel = vel + angs:Right() * 50 + end + if owner:KeyDown(IN_MOVELEFT) then + vel = vel + angs:Right() * -50 + end + end + + mv:SetVelocity(vel) + + return true + end +end + +function SWEP:SetClimbing(climbing) + self:SetDTBool(1, climbing) +end + +function SWEP:GetClimbing() + return self:GetDTBool(1) +end +SWEP.IsClimbing = SWEP.GetClimbing diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_akbar.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_akbar.lua index dd09d51..0a99958 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_akbar.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_akbar.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Akbar' Assault Rifle" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Akbar' Assault Rifle" +SWEP.Description = "Reliable assault rifle with a very fast reload speed. Not quite as accurate as other assault rifles, but still precise enough nonetheless." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 @@ -24,18 +26,23 @@ SWEP.UseHands = true SWEP.ReloadSound = Sound("Weapon_AK47.Clipout") SWEP.Primary.Sound = Sound("Weapon_AK47.Single") -SWEP.Primary.Damage = 18 +SWEP.Primary.Damage = 21.75 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.12 -SWEP.Primary.ClipSize = 25 +SWEP.Primary.ClipSize = 30 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "ar2" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.055 -SWEP.ConeMin = 0.0275 +SWEP.ConeMax = 2.65 +SWEP.ConeMin = 1.275 SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 3 + SWEP.IronSightsPos = Vector(-6.6, 20, 3.1) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.344) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.172) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_amigo.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_amigo.lua new file mode 100644 index 0000000..9cf2362 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_amigo.lua @@ -0,0 +1,220 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Amigo' Assault Rifle" +SWEP.Description = "The Amigo gets extra headshot damage, but has a slow fire rate for an assault rifle." + +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 55 + + SWEP.HUD3DBone = "v_weapon.sg552_Parent" + SWEP.HUD3DPos = Vector(-2.12, -6.25, -2) + SWEP.HUD3DAng = Angle(0, -6, 0) + SWEP.HUD3DScale = 0.015 +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_rif_sg552.mdl" +SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl" +SWEP.UseHands = true + +SWEP.ReloadSound = Sound("Weapon_SG552.Clipout") +SWEP.Primary.Sound = Sound("Weapon_SG552.Single") +SWEP.Primary.Damage = 18.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.15 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "ar2" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 2 +SWEP.ConeMin = 0.8 +SWEP.HeadshotMulti = 2.1 + +SWEP.ReloadSpeed = 0.9 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 2 + +SWEP.IronSightsPos = Vector(-5, 1, 3) +SWEP.IronSightsAng = Vector(0, 0, 0) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.01, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEADSHOT_MULTI, 0.07) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Comrade' Micronaut Rifle", "Reduced accuracy, damage but increased clip size and fires additional projectiles", function(wept) + wept.ConeMax = wept.ConeMax * 1.5 + wept.ConeMin = wept.ConeMin * 1.5 + wept.Primary.Damage = wept.Primary.Damage * 0.8 + wept.Primary.ClipSize = 35 + + wept.ShootBullets = function(self, dmg, numbul, cone) + local owner = self:GetOwner() + + self:SendWeaponAnimation() + owner:DoAttackEvent() + + if SERVER and self:Clip1() % 10 == 1 then + local ent = ents.Create("projectile_juggernaut") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Up(), 90) + ent:SetAngles(angle) + + ent:SetOwner(owner) + ent.ProjDamage = self.Primary.Damage * 1.75 * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + ent.Team = owner:Team() + + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Forward(), math.Rand(0, 360)) + angle:RotateAroundAxis(angle:Up(), math.Rand(-cone/1.5, cone/1.5)) + phys:SetVelocityInstantaneous(angle:Forward() * 700 * (owner.ProjectileSpeedMul or 1)) + end + end + end + + owner:LagCompensation(true) + owner:FireBulletsLua(owner:GetShootPos(), owner:GetAimVector(), cone, numbul, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + owner:LagCompensation(false) + end +end) +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Horizon' Battle Rifle", "Extremely accurate, more damage and fires in slow bursts", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.12 + wept.Primary.Delay = wept.Primary.Delay * 6 + wept.Primary.BurstShots = 3 + wept.ConeMin = wept.ConeMin * 0.6 + wept.ConeMax = wept.ConeMax * 0.85 + + wept.PrimaryAttack = function(self) + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + end + + wept.Think = function(self) + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/12) + + if self:Clip1() > 0 and self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end + end + + wept.ViewModel = "models/weapons/cstrike/c_rif_famas.mdl" + wept.WorldModel = "models/weapons/w_rif_famas.mdl" + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/famas/famas-1.wav", 75, math.random(80, 85), 0.8) + self:EmitSound("npc/sniper/echo1.wav", 75, math.random(81, 85), 1, CHAN_WEAPON+20) + end + + if CLIENT then + wept.VElements = { + ["underside"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 5.438, 8.074), angle = Angle(0, 0, 88), size = Vector(0.024, 0.021, 0.013), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scopeback+"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 0, 4.012), angle = Angle(0, 0, 0), size = Vector(0.025, 0.025, 0.017), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["mid"] = { type = "Model", model = "models/props_phx/trains/double_wheels.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0.726, 0.008, 1.82), angle = Angle(90, 90, -90), size = Vector(0.02, 0.02, 0.016), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_borealis/mooring_cleat01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 0, 1.815), angle = Angle(0, 0, -90), size = Vector(0.048, 0.039, 0.034), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scopeback"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 0, -0.29), angle = Angle(180, 0, 0), size = Vector(0.025, 0.025, 0.017), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["glass"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 0, -0.285), angle = Angle(90, 0, 0), size = Vector(0.123, 0.023, 0.023), color = Color(0, 0, 115, 255), surpresslightning = false, material = "models/props/cs_office/snowmana", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "v_weapon.famas", rel = "", pos = Vector(0.082, -5.666, 9.55), angle = Angle(0, 0, 1.254), size = Vector(0.025, 0.025, 0.039), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "v_weapon.famas", rel = "", pos = Vector(0.104, -1.573, 10.755), angle = Angle(90, 90.005, 0), size = Vector(0.361, 0.476, 0.597), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["hold"] = { type = "Model", model = "models/props_c17/playgroundTick-tack-toe_post01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 0.694, 1.85), angle = Angle(0, 0, -90), size = Vector(0.152, 0.041, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["midsection"] = { type = "Model", model = "models/props_combine/eli_pod_inner.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0, 3.048, 13.31), angle = Angle(0.15, 90, 180), size = Vector(0.15, 0.107, 0.194), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } + } + wept.WElements = { + ["underside"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 6.301, 10.373), angle = Angle(0, 0, 88), size = Vector(0.025, 0.027, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scopeback+"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0, 4.012), angle = Angle(0, 0, 0), size = Vector(0.025, 0.025, 0.017), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["mid"] = { type = "Model", model = "models/props_phx/trains/double_wheels.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0.811, -0.03, 1.82), angle = Angle(90, 90, -90), size = Vector(0.02, 0.02, 0.017), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_borealis/mooring_cleat01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0, 1.815), angle = Angle(0, 0, -90), size = Vector(0.048, 0.039, 0.034), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scopeback"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0, -0.29), angle = Angle(180, 0, 0), size = Vector(0.025, 0.025, 0.017), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["glass"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0, -0.424), angle = Angle(90, 0, 0), size = Vector(0.123, 0.023, 0.023), color = Color(0, 0, 115, 255), surpresslightning = false, material = "models/props/cs_office/snowmana", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-0.99, 0.794, -8.33), angle = Angle(0, -90, -99.326), size = Vector(0.025, 0.025, 0.039), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 4.708, 1.435), angle = Angle(90, 90.005, 0), size = Vector(0.361, 0.583, 0.708), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["hold"] = { type = "Model", model = "models/props_c17/playgroundTick-tack-toe_post01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0.694, 1.85), angle = Angle(0, 0, -90), size = Vector(0.152, 0.041, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["midsection"] = { type = "Model", model = "models/props_combine/eli_pod_inner.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 3.368, 17.281), angle = Angle(0.15, 90, 180), size = Vector(0.185, 0.151, 0.245), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["glass+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0, 0, 4.243), angle = Angle(90, 0, 0), size = Vector(0.123, 0.023, 0.023), color = Color(0, 0, 115, 255), surpresslightning = false, material = "models/props/cs_office/snowmana", skin = 0, bodygroup = {} } + } + + wept.HUD3DBone = "v_weapon.famas" + wept.HUD3DPos = Vector(-0.2, -4, 8.6) + wept.HUD3DAng = BaseClass.HUD3DAng + + wept.IronsightsMultiplier = 0.25 + + wept.GetViewModelPosition = function(self, pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) + end + + wept.DrawHUDBackground = function(self) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + self:DrawRegularScope() + end + end + end +end) +branch.Colors = {Color(110, 160, 170), Color(90, 140, 150), Color(70, 120, 130)} +branch.NewNames = {"Focused", "Transfixed", "Orphic"} +branch.Killicon = "weapon_zs_battlerifle" + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_anightmare.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_anightmare.lua new file mode 100644 index 0000000..6a01612 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_anightmare.lua @@ -0,0 +1,32 @@ +AddCSLuaFile() + +SWEP.PrintName = "Ancient Nightmare" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 55 +SWEP.SlowDownScale = 1 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:EmitSound("npc/barnacle/barnacle_bark"..math.random(2)..".wav", 75, 85) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) +end + +local matSheet = Material("Models/Charple/Charple1_sheet") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_annabelle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_annabelle.lua index 548599f..60f0754 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_annabelle.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_annabelle.lua @@ -1,161 +1,77 @@ AddCSLuaFile() +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.PrintName = "'Annabelle' Rifle" +SWEP.Description = "This rifle loads rounds individually, at the cost of being not perfectly accurate." + if CLIENT then - SWEP.PrintName = "'Annabelle' Rifle" - SWEP.Description = "This modified hunting rifle's bullets will explode in to smaller bullets upon hitting a hard surface." - SWEP.Slot = 3 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false + SWEP.IronSightsPos = Vector(-8.8, 10, 4.32) + SWEP.IronSightsAng = Vector(1.4, 0.1, 5) + SWEP.HUD3DBone = "ValveBiped.Gun" SWEP.HUD3DPos = Vector(1.75, 1, -5) SWEP.HUD3DAng = Angle(180, 0, 0) SWEP.HUD3DScale = 0.015 end -SWEP.Base = "weapon_zs_base" - SWEP.HoldType = "ar2" -SWEP.ViewModel = "models/weapons/v_annabelle.mdl" +SWEP.ViewModel = "models/weapons/c_annabelle.mdl" SWEP.WorldModel = "models/weapons/w_annabelle.mdl" +SWEP.UseHands = true SWEP.CSMuzzleFlashes = false SWEP.Primary.Sound = Sound("Weapon_Shotgun.Single") -SWEP.Primary.Damage = 90 +SWEP.Primary.Damage = 74 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 1 +SWEP.Primary.Delay = 0.9 + SWEP.ReloadDelay = 0.4 -SWEP.Primary.ClipSize = 4 +SWEP.Primary.ClipSize = 5 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "357" -SWEP.Primary.DefaultClip = 24 +SWEP.Primary.DefaultClip = 25 -SWEP.ConeMax = 0.1 -SWEP.ConeMin = 0.015 +SWEP.ConeMax = 4 +SWEP.ConeMin = 0.25 + +SWEP.ReloadSound = Sound("Weapon_Shotgun.Reload") +SWEP.PumpSound = Sound("Weapon_Shotgun.Special1") SWEP.WalkSpeed = SPEED_SLOW -SWEP.reloadtimer = 0 -SWEP.nextreloadfinish = 0 +SWEP.Tier = 2 -SWEP.IronSightsPos = Vector(-8.8, 10, 4.32) -SWEP.IronSightsAng = Vector(1.4,0.1,5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.5, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.05, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Annabelle' Birdshot Rifle", "Fires a spread of less accurate shots that deal more total damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage / 5 + wept.Primary.NumShots = 6 + wept.ConeMin = wept.ConeMin * 8 + wept.ConeMax = wept.ConeMax * 2 +end) -function SWEP:Reload() - if self.reloading then return end +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 75, math.random(95, 103), 0.8) + self:EmitSound("weapons/shotgun/shotgun_fire6.wav", 75, math.random(78, 81), 0.65, CHAN_WEAPON + 20) +end - if self:Clip1() < self.Primary.ClipSize and 0 < self.Owner:GetAmmoCount(self.Primary.Ammo) then - self:SetNextPrimaryFire(CurTime() + self.ReloadDelay) - self.reloading = true - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) - self.Owner:DoReloadEvent() +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then + self:SetIronsights(true) end end -if SERVER then function SWEP:Think() - if self.reloading and self.reloadtimer < CurTime() then - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_VM_RELOAD) - - self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) - self:SetClip1(self:Clip1() + 1) - self:EmitSound("Weapon_Shotgun.Reload") - - if self.Primary.ClipSize <= self:Clip1() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 then - self.nextreloadfinish = CurTime() + self.ReloadDelay - self.reloading = false - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - end - end - - local nextreloadfinish = self.nextreloadfinish - if nextreloadfinish ~= 0 and nextreloadfinish < CurTime() then - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self:EmitSound("Weapon_Shotgun.Special1") - self.nextreloadfinish = 0 - end - - if self.IdleAnimation and self.IdleAnimation <= CurTime() then - self.IdleAnimation = nil - self:SendWeaponAnim(ACT_VM_IDLE) - end - - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then + if self:GetIronsights() and not self:GetOwner():KeyDown(IN_ATTACK2) then self:SetIronsights(false) end -end -end - -if CLIENT then -function SWEP:Think() - if self.reloading and self.reloadtimer < CurTime() then - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_VM_RELOAD) - - self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) - self:SetClip1(self:Clip1() + 1) - self:EmitSound("Weapon_Shotgun.Reload") - - if self.Primary.ClipSize <= self:Clip1() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 then - self.nextreloadfinish = CurTime() + self.ReloadDelay - self.reloading = false - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - end - end - - local nextreloadfinish = self.nextreloadfinish - if nextreloadfinish ~= 0 and nextreloadfinish < CurTime() then - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self:EmitSound("Weapon_Shotgun.Special1") - self.nextreloadfinish = 0 - end - - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then - self:SetIronsights(false) - end -end -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:Clip1() <= 0 then - self:EmitSound("Weapon_Shotgun.Empty") - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - if self.reloading then - if 0 < self:Clip1() then - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self:EmitSound("Weapon_Shotgun.Special1") - else - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - end - self.reloading = false - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - return true -end - -local function DoRicochet(attacker, hitpos, hitnormal, normal, damage) - attacker.RicochetBullet = true - attacker:FireBullets({Num = 8, Src = hitpos, Dir = hitnormal, Spread = Vector(0.2, 0.2, 0), Tracer = 1, TracerName = "rico_trace", Force = damage * 0.15, Damage = damage, Callback = GenericBulletCallback}) - attacker.RicochetBullet = nil -end -function SWEP.BulletCallback(attacker, tr, dmginfo) - if SERVER and tr.HitWorld and not tr.HitSky then - local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() / 5 - timer.Simple(0, function() DoRicochet(attacker, hitpos, hitnormal, normal, dmg) end) - end - - GenericBulletCallback(attacker, tr, dmginfo) + + self.BaseClass.Think(self) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/cl_init.lua new file mode 100644 index 0000000..37f062b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/cl_init.lua @@ -0,0 +1,53 @@ +INC_CLIENT() + +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 56 + +SWEP.HUD3DBone = "v_weapon.Deagle_Parent" +SWEP.HUD3DPos = Vector(0.1, -4.2, 2.22) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.016 + +SWEP.VElements = { + ["novacolt++++++"] = { type = "Model", model = "models/props_c17/furnituredrawer003a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0.3, 6, 3), angle = Angle(90, -90, 0), size = Vector(0.15, 0.15, 0.15), color = Color(148, 152, 183, 255), surpresslightning = false, material = "models/props_c17/clockwood01", skin = 0, bodygroup = {} }, + ["novacolt++++++++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(3.2, 2.299, 0), angle = Angle(0, -43, 0), size = Vector(0.09, 0.129, 0.09), color = Color(59, 130, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(-0.5, 3.5, 3.5), angle = Angle(0, 0, 180), size = Vector(0.039, 0.059, 0.059), color = Color(92, 108, 118, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["novacolt+++"] = { type = "Model", model = "models/props_trainstation/boxcar.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0.1, 2.9, -4.6), angle = Angle(90, 0, -90), size = Vector(0.035, 0.014, 0.032), color = Color(148, 171, 181, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["novacolt"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "", pos = Vector(0, -4.401, -1.5), angle = Angle(0, 0, 0), size = Vector(0.039, 0.029, 0.059), color = Color(175, 200, 231, 0), surpresslightning = false, material = "models/weapons/v_shotgun/vshotgun_albedo", skin = 0, bodygroup = {} }, + ["novacolt+++++++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(-3, 2.299, 0), angle = Angle(0, 43.247, 0), size = Vector(0.09, 0.129, 0.09), color = Color(59, 130, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt+++++"] = { type = "Model", model = "models/props_wasteland/laundry_dryer001.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 0.6, 3), angle = Angle(110, -90, 0), size = Vector(0.019, 0.03, 0.034), color = Color(105, 115, 130, 255), surpresslightning = false, material = "models/props_c17/column02a", skin = 0, bodygroup = {} }, + ["novacolt+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.05), color = Color(92, 108, 118, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} }, + ["novacolt+++++++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, -1.601, 2.2), angle = Angle(66.623, 90, 0), size = Vector(0.129, 0.15, 0.17), color = Color(47, 67, 82, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0.1, -0.9, -4.6), angle = Angle(0, 180, 90), size = Vector(0.019, 0.019, 0.012), color = Color(127, 145, 163, 255), surpresslightning = false, material = "models/weapons/w_irifle/w_irifle", skin = 0, bodygroup = {} }, + ["novacolt++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.009, 0.009, 0.079), color = Color(156, 180, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} } +} +SWEP.WElements = { + ["novacolt++++++"] = { type = "Model", model = "models/props_c17/furnituredrawer003a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0.3, 6, 3), angle = Angle(90, -90, 0), size = Vector(0.15, 0.15, 0.15), color = Color(148, 152, 183, 255), surpresslightning = false, material = "models/props_c17/clockwood01", skin = 0, bodygroup = {} }, + ["novacolt++++++++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(3.2, 2.299, 0), angle = Angle(0, -43, 0), size = Vector(0.09, 0.129, 0.09), color = Color(59, 130, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 3.635, 3.5), angle = Angle(0, 0, 180), size = Vector(0.039, 0.059, 0.059), color = Color(201, 229, 248, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["novacolt+++"] = { type = "Model", model = "models/props_trainstation/boxcar.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0.1, 2.9, -4.6), angle = Angle(90, 0, -90), size = Vector(0.035, 0.014, 0.032), color = Color(148, 171, 181, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["novacolt"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 2, -5), angle = Angle(0, 90, -85.325), size = Vector(0.039, 0.029, 0.059), color = Color(175, 200, 231, 0), surpresslightning = false, material = "models/weapons/v_shotgun/vshotgun_albedo", skin = 0, bodygroup = {} }, + ["novacolt+++++++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(-3, 2.299, 0), angle = Angle(0, 43.247, 0), size = Vector(0.09, 0.129, 0.09), color = Color(59, 130, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt+++++"] = { type = "Model", model = "models/props_wasteland/laundry_dryer001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 0.6, 3), angle = Angle(110, -90, 0), size = Vector(0.019, 0.03, 0.034), color = Color(105, 115, 130, 255), surpresslightning = false, material = "models/props_c17/column02a", skin = 0, bodygroup = {} }, + ["novacolt+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.05), color = Color(92, 108, 118, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} }, + ["novacolt+++++++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, -1.601, 2.2), angle = Angle(66.623, 90, 0), size = Vector(0.129, 0.15, 0.17), color = Color(47, 67, 82, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0.1, -0.9, -4.6), angle = Angle(0, 180, 90), size = Vector(0.019, 0.019, 0.012), color = Color(127, 145, 163, 255), surpresslightning = false, material = "models/weapons/w_irifle/w_irifle", skin = 0, bodygroup = {} }, + ["novacolt++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.009, 0.009, 0.079), color = Color(156, 180, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} } +} + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 0.1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 0.9) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -65 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/init.lua new file mode 100644 index 0000000..bd499ae --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_purger" +SWEP.Primary.ProjVelocity = 500 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/shared.lua new file mode 100644 index 0000000..a038293 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_antidoteshot/shared.lua @@ -0,0 +1,89 @@ +SWEP.PrintName = "'Purger' Antidote Handgun" +SWEP.Description = "Fires piercing antidote blasts. Heals poison and cleanses statuses." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") + +SWEP.Primary.Delay = 0.4 + +SWEP.Primary.ClipSize = 21 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Ammo = "Battery" +SWEP.RequiredClip = 3 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.ReloadSpeed = 0.43 +SWEP.FireAnimSpeed = 1.3 + +SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) +SWEP.IronSightsAng = Vector(-0.15, -1, 2) + +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_PROJECTILE_VELOCITY, 50) + +function SWEP:EmitFireSound() + self:EmitSound("items/smallmedkit1.wav", 70, math.random(135, 140), 0.65, CHAN_WEAPON + 21) + self:EmitSound("weapons/galil/galil-1.wav", 75, math.random(122, 128), 0.7, CHAN_WEAPON + 20) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/357/357_reload1.wav", 75, 75, 1, CHAN_WEAPON + 21) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/357/357_spin1.wav", 70, 90) + end +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:Deploy() + if CLIENT then + hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical) + GAMEMODE.MedicalAura = true + end + + return BaseClass.Deploy(self) +end + +function SWEP:Holster() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end + + return true +end + +function SWEP:OnRemove() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/cl_init.lua index 822844c..7b1b492 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/cl_init.lua @@ -1,35 +1,33 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Arsenal Crate" -SWEP.Description = "This crate is invaluable to survival. It allows people to purchase new weapons, tools, ammunition, etc.\nThe deployer gets a 7% commission on purchases not made by themselves.\nPress PRIMARY ATTACK to deploy the crate.\nPress SECONDARY ATTACK and RELOAD to rotate the crate." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end @@ -41,5 +39,5 @@ function SWEP:RotateGhost(amount) nextclick = RealTime() + 0.3 end - RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/init.lua index 2ba7f1c..8815802 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_arsenalcrate") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_arsenalcrate", false, true) end @@ -37,7 +34,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_arsenalcrate if not (status and status:IsValid()) then return end @@ -56,6 +53,7 @@ function SWEP:PrimaryAttack() ent:Spawn() ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() ent:EmitSound("npc/dog/dog_servo12.wav") @@ -78,6 +76,6 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/shared.lua index 5bd9e79..e952dc2 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/shared.lua @@ -1,3 +1,6 @@ +SWEP.PrintName = "Arsenal Crate" +SWEP.Description = "This crate is invaluable to survival. It allows people to purchase new weapons, tools, ammunition, etc.\nThe deployer gets a 5% commission on purchases not made by themselves.\nPress PRIMARY ATTACK to deploy the crate.\nPress SECONDARY ATTACK and RELOAD to rotate the crate." + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/Items/item_item_crate.mdl") @@ -12,14 +15,17 @@ SWEP.Primary.Automatic = true SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Ammo = "dummy" -SWEP.Secondary.Automatic = false + +SWEP.MaxStock = 5 SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOWEST +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + self:SetDeploySpeed(10) self:HideViewAndWorldModel() end @@ -44,7 +50,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/cl_init.lua new file mode 100644 index 0000000..c5a0275 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/cl_init.lua @@ -0,0 +1,62 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.slide_right" +SWEP.HUD3DPos = Vector(1, 0.1, -1) +SWEP.HUD3DScale = 0.015 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 55 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +--[[SWEP.VElements = { + ["body_right"] = { type = "Model", model = "models/props_c17/utilityconnecter006b.mdl", bone = "v_weapon.elite_right", rel = "", pos = Vector(0.167, -2.628, 4.847), angle = Angle(0.563, -106.55, 1.19), size = Vector(0.126, 0.126, 0.268), color = Color(163, 139, 128, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle_left"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "v_weapon.elite_left", rel = "", pos = Vector(-0.163, -1.935, 0), angle = Angle(-81.335, 0, 1.641), size = Vector(0.072, 0.072, 0.072), color = Color(92, 92, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["crossbow_left"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "v_weapon.elite_left", rel = "", pos = Vector(-0.879, -1.693, -1.333), angle = Angle(89.291, -88.288, 0), size = Vector(0.3, 0.3, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["crossbow_right"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "v_weapon.elite_right", rel = "", pos = Vector(-0.478, -1.316, -1.604), angle = Angle(90.704, -91.261, 0), size = Vector(0.298, 0.298, 0.298), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["body_left"] = { type = "Model", model = "models/props_c17/utilityconnecter006b.mdl", bone = "v_weapon.elite_left", rel = "", pos = Vector(-0.329, -2.794, 5.043), angle = Angle(-1.196, -106.321, -0.828), size = Vector(0.123, 0.123, 0.268), color = Color(163, 139, 128, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle_right"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "v_weapon.elite_right", rel = "", pos = Vector(0.122, -1.599, -0.08), angle = Angle(-90.381, 0.898, 2.684), size = Vector(0.072, 0.072, 0.072), color = Color(92, 92, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}]] + +SWEP.VElements = { + ["artemis_right++++"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "v_weapon.elite_right", rel = "artemis_right+++", pos = Vector(-0.9, 4.099, 0.899), angle = Angle(0, 90, 180), size = Vector(0.649, 0.449, 0.36), color = Color(165, 183, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right++"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "v_weapon.elite_right", rel = "artemis_right", pos = Vector(0, 3, 2), angle = Angle(-90, 0, 0), size = Vector(0.129, 0.059, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "v_weapon.elite_right", rel = "", pos = Vector(0, -1.8, 4), angle = Angle(0, 0, 90), size = Vector(0.37, 0.4, 0.79), color = Color(64, 69, 77, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["artemis_right+++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "v_weapon.elite_left", rel = "", pos = Vector(0, -1.8, 4), angle = Angle(0, 0, 90), size = Vector(0.37, 0.4, 0.79), color = Color(64, 69, 77, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["artemis_right+"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "v_weapon.elite_right", rel = "artemis_right", pos = Vector(-0.9, 4.099, 0.899), angle = Angle(0, 90, 180), size = Vector(0.649, 0.449, 0.36), color = Color(165, 183, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right+++++"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "v_weapon.elite_right", rel = "artemis_right+++", pos = Vector(0, 3, 2), angle = Angle(-90, 0, 0), size = Vector(0.129, 0.059, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} } +} + +--[[SWEP.WElements = { + ["body_right"] = { type = "Model", model = "models/props_c17/utilityconnecter006b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(9.178, 2.211, -4.311), angle = Angle(-90.067, -11.381, 0), size = Vector(0.126, 0.126, 0.268), color = Color(163, 139, 128, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle_left"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(3.846, 0.948, 2.664), angle = Angle(169.447, -9.483, -80.786), size = Vector(0.133, 0.182, 0.133), color = Color(92, 100, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["crossbow_left"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(2.891, 2.073, 2.49), angle = Angle(-0.891, -8.582, -3.764), size = Vector(0.354, 0.582, 0.549), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["crossbow_right"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.293, -0.295, -2.323), angle = Angle(0.202, -12.063, -180), size = Vector(0.352, 0.587, 0.546), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle_right"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.701, 1.195, -2.6), angle = Angle(9.09, -13.66, -82.725), size = Vector(0.133, 0.182, 0.133), color = Color(92, 100, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["body_left"] = { type = "Model", model = "models/props_c17/utilityconnecter006b.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(9.201, 1.623, 4.335), angle = Angle(-90.061, -9.018, 0), size = Vector(0.123, 0.123, 0.268), color = Color(163, 139, 128, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}]] + +SWEP.WElements = { + ["artemis_right++++"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "artemis_right+++", pos = Vector(-0.9, 4.099, 0.899), angle = Angle(0, 90, 180), size = Vector(0.649, 0.449, 0.36), color = Color(165, 183, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right++"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "artemis_right", pos = Vector(0, 3, 2), angle = Angle(-90, 0, 0), size = Vector(0.129, 0.059, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7.9, 1.299, -4), angle = Angle(0, -90, 0), size = Vector(0.37, 0.4, 0.79), color = Color(64, 69, 77, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["artemis_right+++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(7.8, 1.799, 4), angle = Angle(180, -100, -5.844), size = Vector(0.37, 0.4, 0.79), color = Color(64, 69, 77, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["artemis_right+"] = { type = "Model", model = "models/weapons/w_crossbow.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "artemis_right", pos = Vector(-0.9, 4.099, 0.899), angle = Angle(0, 90, 180), size = Vector(0.649, 0.449, 0.36), color = Color(165, 183, 206, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} }, + ["artemis_right+++++"] = { type = "Model", model = "models/props_pipes/pipe03_tjoint01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "artemis_right+++", pos = Vector(0, 3, 2), angle = Angle(-90, 0, 0), size = Vector(0.129, 0.059, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} } +} + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -35 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/init.lua new file mode 100644 index 0000000..c1105a6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_mini" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/shared.lua new file mode 100644 index 0000000..6c0a362 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_artemis/shared.lua @@ -0,0 +1,89 @@ +SWEP.PrintName = "'Artemis' Dual Crossbows" +SWEP.Description = "A pair of miniature crossbows. Fires quick successions of explosive bolts." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" + +sound.Add({ + name = "Weapon_Artemis_Reload.Single", + channel = CHAN_WEAPON, + volume = 1.0, + soundlevel = 100, + pitch = {80, 85}, + sound = "weapons/crossbow/reload1.wav" +}) + +sound.Add({ + name = "Weapon_Artemis_Fire.Single", + channel = CHAN_WEAPON, + volume = 1.0, + soundlevel = 100, + pitch = {150, 160}, + sound = "weapons/crossbow/fire1.wav" +}) + +sound.Add({ + name = "Weapon_Artemis_Empty.Single", + channel = CHAN_WEAPON, + volume = 1.0, + soundlevel = 100, + pitch = {80, 85}, + sound = "weapons/ar2/ar2_empty.wav" +}) + +SWEP.HoldType = "duel" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_elite.mdl" +SWEP.WorldModel = "models/weapons/w_pist_elite.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Delay = 0.5 +SWEP.Primary.Damage = 85 + +SWEP.Primary.ClipSize = 4 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.DefaultClip = 15 + +SWEP.ReloadDelay = 3.5 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Primary.Sound = Sound("Weapon_Artemis_Fire.Single") +SWEP.ReloadSound = Sound("Weapon_Artemis_Reload.Single") +SWEP.DryFireSound = Sound("Weapon_Artemis_Empty.Single") + +SWEP.DontScaleReloadSpeed = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Actaeon' Dual Crossbows", "Bolts pierce slightly instead of exploding, and inflict damage vulnerability, less damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.75 + wept.Primary.Projectile = "projectile_arrow_inq" + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + end +end) + +function SWEP:SecondaryAttack() +end + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(self:Clip1() % 2 == 0 and ACT_VM_PRIMARYATTACK or ACT_VM_SECONDARYATTACK) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:ProcessReloadEndTime() + local reloadspeed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + self:SetReloadFinish(CurTime() + self.ReloadDelay / reloadspeed) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/cl_init.lua new file mode 100644 index 0000000..bd1cf69 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/cl_init.lua @@ -0,0 +1,43 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModelFOV = 70 + +SWEP.HUD3DBone = "v_weapon.awm_parent" +SWEP.HUD3DPos = Vector(-1.75, -4.5, -10) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.02 + +SWEP.VElements = { + ["FRONT2FONT"] = { type = "Model", model = "models/props_junk/wood_crate001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT2+", pos = Vector(5.882, -0.225, 0), angle = Angle(0, 0, 0), size = Vector(0.05, 0.021, 0.041), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONTbacklol"] = { type = "Model", model = "models/weapons/w_smg_p90.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONTBACK", pos = Vector(3.255, -4.786, -0.195), angle = Angle(0, -90, 90), size = Vector(0.512, 1.407, 0.584), color = Color(145, 145, 145, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONTBACK"] = { type = "Model", model = "models/props_lab/reciever01b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT", pos = Vector(0, 1.042, 8.17), angle = Angle(0, -90, 90), size = Vector(0.323, 0.409, 0.333), color = Color(145, 145, 145, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONTscope"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONTBACK", pos = Vector(-3.201, 0.575, 0), angle = Angle(180, 0, 90), size = Vector(0.453, 0.532, 0.414), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONT2+"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT", pos = Vector(0, -0.473, -0.285), angle = Angle(-90, 0, 0), size = Vector(0.093, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONTscope+"] = { type = "Model", model = "models/props_c17/gravestone004a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONTBACK", pos = Vector(-2.722, -3.057, 0), angle = Angle(180, -90, 90), size = Vector(0.048, 0.028, 0.09), color = Color(165, 165, 150, 255), surpresslightning = false, material = "models/props_combine/combine_interface_disp", skin = 0, bodygroup = {} }, + ["FRONTENERGY+++"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONTBACK", pos = Vector(-1.471, -5.29, 0), angle = Angle(0, 90, 90), size = Vector(0.123, 0.056, 0.067), color = Color(255, 0, 150, 255), surpresslightning = false, material = "models/props_combine/masterinterface01c", skin = 0, bodygroup = {} }, + ["FRONTcanisters"] = { type = "Model", model = "models/props_borealis/mooring_cleat01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT", pos = Vector(0, 2.069, 2.289), angle = Angle(0, 80, -90), size = Vector(0.085, 0.104, 0.078), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONT2"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT", pos = Vector(0, 0.398, -0.285), angle = Angle(-90, 0, 0), size = Vector(0.093, 0.019, 0.019), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONT"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "v_weapon.awm_parent", rel = "", pos = Vector(0, -4.375, -18.455), angle = Angle(0, 0, 0), size = Vector(0.059, 0.054, 0.179), color = Color(235, 235, 235, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["FRONTbottom"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "FRONT", pos = Vector(0, 0.787, 1.118), angle = Angle(90, -90, 180), size = Vector(0.014, 0.016, 0.009), color = Color(165, 165, 150, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["FRONTENERGY+++++++++++"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONTBACK", pos = Vector(-1.471, -6.709, 0), angle = Angle(0, 90, 90), size = Vector(0.153, 0.065, 0.067), color = Color(255, 0, 150, 255), surpresslightning = false, material = "models/props_combine/masterinterface01c", skin = 0, bodygroup = {} }, + ["FRONT2FONT"] = { type = "Model", model = "models/props_junk/wood_crate001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT2+", pos = Vector(7.397, -0.08, 0), angle = Angle(0, 0, 0), size = Vector(0.039, 0.032, 0.046), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONTbacklol"] = { type = "Model", model = "models/weapons/w_smg_p90.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONTBACK", pos = Vector(3.872, -6.269, -0.195), angle = Angle(0, -90, 90), size = Vector(0.639, 1.473, 0.649), color = Color(145, 145, 145, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONT"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(18.645, 0.907, -5.737), angle = Angle(0, 91.977, -79.036), size = Vector(0.064, 0.059, 0.224), color = Color(235, 235, 235, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["FRONTscope"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONTBACK", pos = Vector(-3.201, 0.505, 0), angle = Angle(180, 0, 90), size = Vector(0.568, 0.665, 0.518), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONT2+"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(0, -0.7, -0.285), angle = Angle(-90, 0, 0), size = Vector(0.119, 0.014, 0.014), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONTscope+"] = { type = "Model", model = "models/props_c17/gravestone004a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONTBACK", pos = Vector(-2.563, -4.066, 0), angle = Angle(180, -90, 90), size = Vector(0.061, 0.035, 0.112), color = Color(165, 165, 150, 255), surpresslightning = false, material = "models/props_combine/combine_interface_disp", skin = 0, bodygroup = {} }, + ["FRONT2"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(0, 0.398, -0.285), angle = Angle(-90, 0, 0), size = Vector(0.116, 0.025, 0.025), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/V_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["FRONTcanisters"] = { type = "Model", model = "models/props_borealis/mooring_cleat01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(0, 2.069, 0.37), angle = Angle(0, 80, -90), size = Vector(0.128, 0.158, 0.118), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONTBACK"] = { type = "Model", model = "models/props_lab/reciever01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(0, 1.042, 8.17), angle = Angle(0, -90, 90), size = Vector(0.393, 0.49, 0.4), color = Color(145, 145, 145, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["FRONTbottom"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(0, 0.787, 1.118), angle = Angle(90, -90, 180), size = Vector(0.018, 0.019, 0.009), color = Color(165, 165, 150, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["v_weapon.awm_parent"] = { scale = Vector(1, 1, 1), pos = Vector(-10.822, 0, 0), angle = Angle(0, 0, 0) } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/init.lua new file mode 100644 index 0000000..6c107cb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/init.lua @@ -0,0 +1,34 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_asmd" +SWEP.Primary.ProjVelocity = 400 + +function SWEP:ShootSecondary(damage, numshots, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + for i = 0,numshots-1 do + local ent = ents.Create(self.Primary.Projectile) + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(owner:EyeAngles()) + ent:SetOwner(owner) + ent.ProjDamage = damage * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + ent.Team = owner:Team() + + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Forward(), math.Rand(0, 360)) + angle:RotateAroundAxis(angle:Up(), math.Rand(-cone, cone)) + phys:SetVelocityInstantaneous(angle:Forward() * self.Primary.ProjVelocity * (owner.ProjectileSpeedMul or 1)) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/shared.lua new file mode 100644 index 0000000..4c5ae84 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asmd/shared.lua @@ -0,0 +1,87 @@ +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'ASMD' Shock Rifle" + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl" +SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" +SWEP.UseHands = true + +SWEP.Primary.Damage = 53.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.45 + +SWEP.Primary.ClipSize = 28 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 25 + +SWEP.ConeMax = 0.65 +SWEP.ConeMin = 0.5 + +SWEP.WalkSpeed = SPEED_SLOW + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.03) + +SWEP.Tier = 5 +SWEP.ASMD = true + +SWEP.TracerName = "tracer_cosmos" + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed * 0.35) + + timer.Simple(0.2, function() + if IsValid(self) then + self:SendWeaponAnim(ACT_VM_DRAW) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed * 10.5) + end + end) +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + if self:Clip1() < 2 then + self:EmitSound(self.DryFireSound) + self:SetNextPrimaryFire(CurTime() + math.max(0.25, self.Primary.Delay)) + return false + end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:EmitFireSound(secondary) + self:EmitSound(secondary and "weapons/zs_asmd/secondary2.wav" or "weapons/zs_asmd/main3.wav", 75, math.random(105, 110)) + self:EmitSound("weapons/zs_inner/innershot.ogg", 72, 231, 0.45, CHAN_AUTO) +end + +function SWEP:TakeAmmo(secondary) + self:TakePrimaryAmmo(secondary and 5 or 2) +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + dmginfo:SetDamageType(DMG_GENERIC) + return {impact = false} +end + +function SWEP:SecondaryAttack() + if self:Clip1() < 5 or not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * 1.35) + self:EmitFireSound(true) + self:TakeAmmo(true) + + if SERVER then + self:ShootSecondary(self.Primary.Damage * 1.67, 1, self:GetCone()/3) + end + + self.IdleAnimation = CurTime() + self:SequenceDuration() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/init.lua new file mode 100644 index 0000000..1c7f234 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/init.lua @@ -0,0 +1,23 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsValid() then + --[[local vel = ent:GetPos() - self:GetOwner():GetPos() + vel.z = 0 + vel:Normalize() + vel = vel * 800 + vel.z = 350 + + ent:KnockDown() + ent:SetGroundEntity(NULL) + ent:SetVelocity(vel)]] + local noknockdown = true + if CurTime() >= (ent.NextKnockdown or 0) then + noknockdown = false + ent.NextKnockdown = CurTime() + 4 + end + ent:ThrowFromPositionSetZ(trace.StartPos, ent:IsPlayer() and 600 or 1600, nil, noknockdown) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/shared.lua new file mode 100644 index 0000000..ff1041e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_asskicker/shared.lua @@ -0,0 +1,59 @@ +SWEP.PrintName = "Giant Zombie Kung Fu" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDelay = 0.32 +SWEP.MeleeReach = 70 +SWEP.MeleeSize = 16 +SWEP.MeleeDamage = 35 + +SWEP.DelayWhenDeployed = true + +--[[function SWEP:Move(mv) + if self:IsSwinging() then + mv:SetMaxSpeed(50) + mv:SetMaxClientSpeed(50) + end +end]] + +function SWEP:PrimaryAttack(fromsecondary) + local n = self:GetNextPrimaryAttack() + + local owner = self:GetOwner() + if owner:IsOnGround() or owner:WaterLevel() >= 2 or owner:GetMoveType() ~= MOVETYPE_WALK then + self.BaseClass.PrimaryAttack(self) + end + + if not fromsecondary and n ~= self:GetNextPrimaryAttack() then + self:SetDTBool(3, false) + end +end + +function SWEP:SecondaryAttack() + local n = self:GetNextPrimaryAttack() + self:PrimaryAttack(true) + if n ~= self:GetNextPrimaryAttack() then + self:SetDTBool(3, true) + end +end + +function SWEP:PlayHitSound() + self:EmitSound("npc/zombie/zombie_pound_door.wav", 77, 65, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie/foot_slide"..math.random(3)..".wav", 77, 65, nil, CHAN_AUTO) +end + +function SWEP:Reload() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/cl_init.lua new file mode 100644 index 0000000..6b50176 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/cl_init.lua @@ -0,0 +1,41 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.Glock_Slide" +SWEP.HUD3DPos = Vector(1, 0, -1) +SWEP.HUD3DAng = Angle(90, 0, -10) + +SWEP.ViewModelFOV = 49 +SWEP.ViewModelFlip = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["t2_xbow+++++++++++"] = { type = "Model", model = "models/props_c17/lampfixture01a.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(3, 0, -2), angle = Angle(0, 0, 0), size = Vector(0.4, 0.15, 0.15), color = Color(156, 103, 92, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow++"] = { type = "Model", model = "models/weapons/w_pist_p228.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-0.201, 0, -5.7), angle = Angle(0, 180, 0), size = Vector(0.699, 0.86, 0.899), color = Color(72, 37, 6, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-10, 0, -1), angle = Angle(0, 0, 0), size = Vector(0.079, 0.189, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow+"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6.753, 0, -0.301), angle = Angle(90, 90, 0), size = Vector(0.449, 0.43, 0.25), color = Color(137, 89, 67, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.079, 0.159, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow++++++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-14, 0, -0.5), angle = Angle(0, 0, 0), size = Vector(0.009, 0.38, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow+++"] = { type = "Model", model = "models/props_c17/lampfixture01a.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6, 0, -4), angle = Angle(-90, 0, 0), size = Vector(0.2, 0.1, 0.2), color = Color(156, 103, 92, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-14, 0, -0.5), angle = Angle(0, 0, 0), size = Vector(0.079, 0.209, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow++++"] = { type = "Model", model = "models/props_c17/metalladder001.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-19, 0, -1.5), angle = Angle(0, 90, 92), size = Vector(0.2, 0.05, 0.119), color = Color(105, 77, 59, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow++++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-10, 0, -1), angle = Angle(0, 0, 0), size = Vector(0.009, 0.35, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow"] = { type = "Model", model = "models/props_wasteland/laundry_cart001.mdl", bone = "v_weapon.Glock_Parent", rel = "", pos = Vector(2.5, -3.201, 0.649), angle = Angle(-3, -17, -79), size = Vector(0.059, 0.012, 0.025), color = Color(198, 150, 115, 255), surpresslightning = false, material = "models/weapons/v_crowbar/head_uvw", skin = 0, bodygroup = {} }, + ["t2_xbow++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6.2, 0, -1.4), angle = Angle(0, 0, 0), size = Vector(0.009, 0.3, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["t2_xbow+++++++++++"] = { type = "Model", model = "models/props_c17/lampfixture01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(3, 0, -2), angle = Angle(0, 0, 0), size = Vector(0.4, 0.15, 0.15), color = Color(156, 103, 92, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow++"] = { type = "Model", model = "models/weapons/w_pist_p228.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-0.201, 0, -5.7), angle = Angle(0, 180, 0), size = Vector(0.699, 0.86, 0.899), color = Color(72, 37, 6, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-10, 0, -1), angle = Angle(0, 0, 0), size = Vector(0.079, 0.189, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow+"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6.753, 0, -0.301), angle = Angle(90, 90, 0), size = Vector(0.449, 0.43, 0.25), color = Color(137, 89, 67, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.079, 0.159, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++"] = { type = "Model", model = "models/props_c17/lampfixture01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6, 0, -4), angle = Angle(-90, 0, 0), size = Vector(0.2, 0.1, 0.2), color = Color(156, 103, 92, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-5.5, 0, -1.4), angle = Angle(0, 1.169, 0), size = Vector(0.009, 0.28, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow++++"] = { type = "Model", model = "models/props_c17/metalladder001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-19, 0, -1.5), angle = Angle(0, 90, 92), size = Vector(0.2, 0.05, 0.119), color = Color(105, 77, 59, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["t2_xbow"] = { type = "Model", model = "models/props_wasteland/laundry_cart001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.199, 0, -5.5), angle = Angle(0, 180, 180), size = Vector(0.059, 0.012, 0.025), color = Color(198, 150, 115, 255), surpresslightning = false, material = "models/weapons/v_crowbar/head_uvw", skin = 0, bodygroup = {} }, + ["t2_xbow++++++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-14, 0, -0.5), angle = Angle(0, 1.169, 0), size = Vector(0.009, 0.379, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow++++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-10, 0, -1), angle = Angle(0, 1.169, 0), size = Vector(0.009, 0.34, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow+++++++++"] = { type = "Model", model = "models/hunter/tubes/tube2x2x025c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-14, 0, -0.5), angle = Angle(0, 0, 0), size = Vector(0.079, 0.209, 0.039), color = Color(255, 178, 148, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/init.lua new file mode 100644 index 0000000..ffb2143 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_cha" +SWEP.Primary.ProjVelocity = 1400 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/shared.lua new file mode 100644 index 0000000..2dcd9ea --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_avelyn/shared.lua @@ -0,0 +1,106 @@ +SWEP.PrintName = "'Avelyn' Multi Crossbow" +SWEP.Description = "A triple loaded crossbow. Slow to reload, but very high burst damage." + +SWEP.Base = "weapon_zs_baseproj" +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("weapons/crossbow/fire1.wav") +SWEP.Primary.ClipSize = 3 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.Delay = 0.75 +SWEP.Primary.DefaultClip = 15 +SWEP.Primary.Damage = 74 +SWEP.Primary.BurstShots = 3 + +SWEP.ConeMax = 2.25 +SWEP.ConeMin = 2 + +SWEP.Recoil = 1 + +SWEP.ReloadSpeed = 0.4 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.04) + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:Think() + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/6) + + if self:Clip1() > 0 and self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end +end + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/crossbow/reload1.wav", 70, 110) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/galil/galil_boltpull.wav", 70, 110) + end +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/crossbow/fire1.wav", 70, 120, 0.7) + self:EmitSound("weapons/crossbow/bolt_skewer1.wav", 70, 193, 0.7, CHAN_AUTO) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_axe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_axe.lua index 70b26ea..e3f3d6d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_axe.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_axe.lua @@ -1,8 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Axe" +SWEP.PrintName = "Axe" +SWEP.Description = "A simple axe, with balanced stats across the board in terms of damage, range and swing speed." +if CLIENT then SWEP.ViewModelFOV = 55 SWEP.ViewModelFlip = false @@ -27,7 +28,7 @@ SWEP.HoldType = "melee2" SWEP.MeleeDamage = 45 SWEP.MeleeRange = 55 SWEP.MeleeSize = 1.5 -SWEP.MeleeKnockBack = 32 +SWEP.MeleeKnockBack = 125 SWEP.WalkSpeed = SPEED_FAST @@ -38,6 +39,10 @@ SWEP.SwingHoldType = "melee" SWEP.HitDecal = "Manhackcut" +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 70)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/shared.lua new file mode 100644 index 0000000..2925386 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barbedheadcrab/shared.lua @@ -0,0 +1,133 @@ +SWEP.Base = "weapon_zs_poisonheadcrab" + +SWEP.PrintName = "Barbed Headcrab" + +SWEP.PounceDamage = 36 + +function SWEP:Think() + local curtime = CurTime() + local owner = self:GetOwner() + + if self:IsGoingToSpit() and self:GetNextSpit() <= curtime then + self:SetNextSpit(0) + self:SetNextPrimaryFire(curtime + 2.5) + self:SetNextSecondaryFire(self:GetNextPrimaryFire()) + + if SERVER then + owner:EmitSound("npc/roller/mine/rmine_blades_out2.wav", 74, 220) + owner.LastRangedAttack = CurTime() + + local ent = ents.Create("projectile_bristle") + if ent:IsValid() then + ent:SetOwner(owner) + local aimvec = owner:GetAimVector() + local vStart = owner:GetShootPos() + local tr = util.TraceLine({start=vStart, endpos=vStart + owner:GetAimVector() * 30, filter=owner}) + if tr.Hit then + ent:SetPos(tr.HitPos + tr.HitNormal * 4) + else + ent:SetPos(tr.HitPos) + end + + local angs = owner:EyeAngles() + angs:RotateAroundAxis(owner:EyeAngles():Up(), 90) + ent:SetAngles(angs) + + ent:Spawn() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(aimvec * 900) + end + end + end + elseif self:IsGoingToLeap() and self:GetNextLeap() <= curtime then + self:SetNextLeap(0) + if owner:IsOnGround() then + local vel = owner:GetAimVector() + vel.z = math.max(0.45, vel.z) + vel:Normalize() + + owner:SetGroundEntity(NULL) + owner:SetLocalVelocity(vel * 470) + + self:SetLeaping(true) + + if SERVER then + owner:EmitSound("NPC_BlackHeadcrab.Attack") + end + end + elseif self:IsLeaping() then + if owner:IsOnGround() or 1 < owner:WaterLevel() then + self:SetLeaping(false) + self:SetNextPrimaryFire(curtime + 0.8) + else + --owner:LagCompensation(true) + + local vStart = owner:LocalToWorld(owner:OBBCenter()) + local trace = owner:CompensatedMeleeTrace(owner:BoundingRadius() + 8, 12, vStart, owner:GetForward()) + local ent = trace.Entity + + if ent:IsValid() then + local phys = ent:GetPhysicsObject() + + if phys:IsValid() and not ent:IsPlayer() and phys:IsMoveable() then + local vel = 12000 * owner:EyeAngles():Forward() + + phys:ApplyForceOffset(vel, (ent:NearestPoint(vStart) + ent:GetPos() * 2) / 3) + ent:SetPhysicsAttacker(owner) + end + + self:SetLeaping(false) + self:SetNextPrimaryFire(curtime + 1) + + if SERVER then + owner:EmitSound("NPC_BlackHeadcrab.Bite") + end + owner:ViewPunch(Angle(math.Rand(-20, 20), math.Rand(-20, 20), math.Rand(-20, 20))) + + if ent:IsPlayer() then + ent:MeleeViewPunch(self.PounceDamage) + end + + if ent:IsPlayer() then + local bleed = ent:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(self.PounceDamage / 2) + bleed.Damager = owner + end + + ent:TakeSpecialDamage(self.PounceDamage / 2, DMG_SLASH, owner, self) + else + ent:TakeSpecialDamage(self.PounceDamage, DMG_SLASH, owner, self) + end + elseif trace.HitWorld then + if SERVER then + owner:EmitSound("NPC_BlackHeadcrab.Impact") + end + self:SetLeaping(false) + self:SetNextPrimaryFire(curtime + 1) + end + + --owner:LagCompensation(false) + end + end + + self:NextThink(curtime) + return true +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if self:IsLeaping() or self:IsGoingToSpit() or self:IsGoingToLeap() or CurTime() < self:GetNextSecondaryFire() or not self:GetOwner():IsOnGround() then return end + + self:SetNextSpit(CurTime() + self.SpitWindUp) + + if SERVER then + local sndname = "npc/headcrab_poison/ph_scream"..math.random(3)..".wav" + for i = 1, 3 do + timer.Simple(0.02 * i, function() + if owner:IsValid() then owner:EmitSound(sndname, 75, 140 - i*2, 0.8) end + end) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/cl_init.lua new file mode 100644 index 0000000..83e289d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/cl_init.lua @@ -0,0 +1,44 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.ump45_Release" +SWEP.HUD3DPos = Vector(-1.6, -4.4, 2) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.02 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModelFOV = 50 +SWEP.ViewModelFlip = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["base+++++"] = { type = "Model", model = "models/props_combine/combine_teleportplatform.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(1.044, 0, -2.02), angle = Angle(-2.439, 0, -180), size = Vector(0.079, 0.029, 0.061), color = Color(255, 205, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(2.262, 0, 17.344), angle = Angle(0, 0, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(-1.586, 0, 10.791), angle = Angle(0, 0, 0), size = Vector(0.064, 0.03, 0.032), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["baseclip"] = { type = "Model", model = "models/items/boxmrounds.mdl", bone = "v_weapon.ump45_Clip", rel = "", pos = Vector(0.096, 8.571, -2.461), angle = Angle(0, 0, -81.718), size = Vector(0.174, 0.236, 0.92), color = Color(210, 160, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["baseclip+"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "v_weapon.ump45_Clip", rel = "baseclip", pos = Vector(0.975, 0.144, 2.572), angle = Angle(90, -90, 90), size = Vector(0.144, 0.27, 0.126), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(1.399, 0.55, 17.344), angle = Angle(0, -120, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(-3.069, 0, -2.309), angle = Angle(0, -90, 23.74), size = Vector(0.008, 0.012, 0.009), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(0.904, 1.027, 10.27), angle = Angle(0, -90, 0), size = Vector(0.335, 0.344, 0.207), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.ump45_Parent", rel = "", pos = Vector(0.25, -5.16, -1.106), angle = Angle(180, -90, 0), size = Vector(0.061, 0.019, 0.1), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(-1.397, -0.396, 1.409), angle = Angle(0, -180, -90), size = Vector(0.061, 0.054, 0.076), color = Color(127, 122, 113, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(1.399, -0.551, 17.344), angle = Angle(0, 120, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "v_weapon.ump45_Parent", rel = "base", pos = Vector(2.426, 0, 0.414), angle = Angle(90, -90, 90), size = Vector(0.012, 0.014, 0.014), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/props_combine/combine_teleportplatform.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.044, 0, -2.02), angle = Angle(-2.439, 0, -180), size = Vector(0.079, 0.029, 0.061), color = Color(255, 205, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(2.262, 0, 17.344), angle = Angle(0, 0, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.586, 0, 10.791), angle = Angle(0, 0, 0), size = Vector(0.064, 0.03, 0.032), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.904, 1.027, 10.27), angle = Angle(0, -90, 0), size = Vector(0.335, 0.344, 0.207), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(2.426, 0, 0.414), angle = Angle(90, -90, 90), size = Vector(0.012, 0.014, 0.014), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.399, 0.55, 17.344), angle = Angle(0, -120, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["baseclip+"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-6.913, -0.778, 6.288), angle = Angle(173.302, 0, 90), size = Vector(0.144, 0.27, 0.126), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.399, -0.551, 17.344), angle = Angle(0, 120, 180), size = Vector(0.039, 0.024, 0.059), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.832, 1.029, -3.483), angle = Angle(-101.709, 0, 0), size = Vector(0.061, 0.019, 0.1), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.397, -0.396, 1.409), angle = Angle(0, -180, -90), size = Vector(0.061, 0.054, 0.076), color = Color(127, 122, 113, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["baseclip"] = { type = "Model", model = "models/items/boxmrounds.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-9.65, 0, 6.611), angle = Angle(180, -90, -83.763), size = Vector(0.174, 0.236, 0.92), color = Color(210, 160, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-3.069, 0, -2.309), angle = Angle(0, -90, 23.74), size = Vector(0.008, 0.012, 0.009), color = Color(255, 225, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/init.lua new file mode 100644 index 0000000..7ceb852 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/init.lua @@ -0,0 +1,7 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_grenade_bouncy" +SWEP.Primary.ProjVelocity = 600 + +function SWEP:PhysModify(physobj) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/shared.lua new file mode 100644 index 0000000..c2cc374 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barrage/shared.lua @@ -0,0 +1,35 @@ +SWEP.PrintName = "'Barrage' Grenade Launcher" +SWEP.Description = "Fires multiple grenades that detonate on impact with enemies or on the third bounce." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "smg" + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_ump45.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.ClipSize = 4 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.Delay = 0.7 +SWEP.Primary.DefaultClip = 4 +SWEP.Primary.Damage = 31 +SWEP.Primary.NumShots = 3 + +SWEP.ConeMax = 8 +SWEP.ConeMin = 7.5 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.05) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/grenade_launcher1.wav", 70, math.random(118, 124), 0.3) + self:EmitSound("npc/attack_helicopter/aheli_mine_drop1.wav", 70, 100, 0.7, CHAN_AUTO + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/cl_init.lua index a1d662f..34a3a8f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/cl_init.lua @@ -1,17 +1,23 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "'Aegis' Barricade Kit" -SWEP.Description = "A ready-to-go, all-in-one board deployer.\nIt automatically deploys the board and then firmly attaches it to almost any surface.\nUse PRIMARY FIRE to deploy boards.\nUse SECONADRY FIRE and RELOAD to rotate the board.\nA ghost of the board shows you if placement is valid or not." SWEP.DrawCrosshair = false SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false -SWEP.Slot = 4 - SWEP.SlotPos = 0 - - function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + local wid, hei = 384, 16 + local x, y = ScrW() - wid - 64, ScrH() - hei - 72 + local texty = y - 4 - draw.GetFontHeight("ZSHUDFont") + + local charges = self:GetPrimaryAmmoCount() + local chargetxt = "Boards: " .. charges + if charges > 0 then + draw.SimpleText(chargetxt, "ZSHUDFont", x + wid, texty, COLOR_GREEN, TEXT_ALIGN_RIGHT) + else + draw.SimpleText(chargetxt, "ZSHUDFont", x + wid, texty, COLOR_DARKRED, TEXT_ALIGN_RIGHT) + end + + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end @@ -25,18 +31,18 @@ function SWEP:GetViewModelPosition(pos, ang) return pos, ang end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:PrimaryAttack() end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/init.lua index b2387cf..9ac7883 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -23,14 +20,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_barricadekit") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_barricadekit", false, true) end @@ -46,7 +43,8 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() + if not gamemode.Call("CanPlaceNail", owner) then return false end local status = owner.status_ghost_barricadekit if not (status and status:IsValid()) then return end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/shared.lua index ebe20da..9a91451 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_barricadekit/shared.lua @@ -1,3 +1,8 @@ +SWEP.PrintName = "'Aegis' Barricade Kit" +SWEP.Description = "A ready-to-go, all-in-one board deployer.\nIt automatically deploys the board and then firmly attaches it to almost any surface.\nUse PRIMARY FIRE to deploy boards.\nUse SECONADRY FIRE and RELOAD to rotate the board.\nA ghost of the board shows you if placement is valid or not." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + SWEP.ViewModel = "models/weapons/c_rpg.mdl" SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" @@ -14,6 +19,8 @@ SWEP.Secondary.Automatic = false SWEP.UseHands = true +SWEP.MaxStock = 5 + if CLIENT then SWEP.ViewModelFOV = 60 end @@ -22,11 +29,19 @@ SWEP.WalkSpeed = SPEED_SLOWEST function SWEP:Initialize() self:SetWeaponHoldType("rpg") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) +end + +function SWEP:Deploy() + GAMEMODE:DoChangeDeploySpeed(self) + + return true end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + local owner = self:GetOwner() + + if owner:IsHolding() or owner:GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:EmitSound("Weapon_Shotgun.Empty") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/animations.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/animations.lua index 11b7734..153168f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/animations.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/animations.lua @@ -3,16 +3,16 @@ Created by Clavus Available for public use, thread at: facepunch.com/threads/1032378 - - + + DESCRIPTION: - This script is meant for experienced scripters - that KNOW WHAT THEY ARE DOING. Don't come to me + This script is meant for experienced scripters + that KNOW WHAT THEY ARE DOING. Don't come to me with basic Lua questions. - + Just copy into your SWEP or SWEP base of choice and merge with your own code. - + The SWEP.VElements, SWEP.WElements and SWEP.ViewModelBoneMods tables are all optional and only have to be visible to the client. @@ -20,50 +20,50 @@ function SWEP:Anim_Initialize() - // other initialize code goes here + -- other initialize code goes here if CLIENT then - - // Create a new table for every weapon instance + + -- Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) - self:CreateModels(self.VElements) // create viewmodels - self:CreateModels(self.WElements) // create worldmodels - - // init view model bone build function - if IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + self:CreateModels(self.VElements) -- create viewmodels + self:CreateModels(self.WElements) -- create worldmodels + + -- init view model bone build function + if IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) - - // Init viewmodel visibility + + -- Init viewmodel visibility --[[if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else - // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called + -- we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called vm:SetColor(Color(255,255,255,1)) - // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in - // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing - vm:SetMaterial("Debug/hsv") + -- ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in + -- however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing + vm:SetMaterial("Debug/hsv") end]] end end - + end end function SWEP:Anim_Holster() - - if CLIENT and IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + + if CLIENT and IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end - + return true end @@ -75,17 +75,16 @@ if CLIENT then SWEP.vRenderOrder = nil function SWEP:Anim_ViewModelDrawn() - - local vm = self.Owner:GetViewModel() + + local vm = self:GetOwner():GetViewModel() if !IsValid(vm) then return end - - if (!self.VElements) then return end - + self:UpdateBonePositions(vm) + if (!self.VElements) then return end if (!self.vRenderOrder) then - - // we build a render order because sprites need to be drawn after models + + -- we build a render order because sprites need to be drawn after models self.vRenderOrder = {} for k, v in pairs( self.VElements ) do @@ -95,24 +94,24 @@ if CLIENT then table.insert(self.vRenderOrder, k) end end - + end for k, name in ipairs( self.vRenderOrder ) do - + local v = self.VElements[name] if (!v) then self.vRenderOrder = nil break end if (v.hide) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (!v.bone) then continue end - + local pos, ang = self:GetBoneOrientation( self.VElements, v, vm ) - + if (!pos) then continue end - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -121,75 +120,75 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then - for k, v in pairs( v.bodygroup ) do + for k, v in ipairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end SWEP.wRenderOrder = nil function SWEP:Anim_DrawWorldModel() - + if (self.ShowWorldModel == nil or self.ShowWorldModel) then self:DrawModel() end - + if (!self.WElements) then return end - + if (!self.wRenderOrder) then self.wRenderOrder = {} @@ -203,33 +202,33 @@ if CLIENT then end end - - if (IsValid(self.Owner)) then - bone_ent = self.Owner + + if (IsValid(self:GetOwner())) then + bone_ent = self:GetOwner() else - // when the weapon is dropped + -- when the weapon is dropped bone_ent = self end - + for k, name in pairs( self.wRenderOrder ) do - + local v = self.WElements[name] if (!v) then self.wRenderOrder = nil break end if (v.hide) then continue end - + local pos, ang - + if (v.bone) then pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent ) else pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" ) end - + if (!pos) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -238,105 +237,105 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then - for k, v in pairs( v.bodygroup ) do + for k, v in ipairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override ) - + local bone, pos, ang if (tab.rel and tab.rel != "") then - + local v = basetab[tab.rel] - + if (!v) then return end - - // Technically, if there exists an element with the same name as a bone - // you can get in an infinite loop. Let's just hope nobody's that stupid. + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. pos, ang = self:GetBoneOrientation( basetab, v, ent ) - + if (!pos) then return end - + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + else - + bone = ent:LookupBone(bone_override or tab.bone) if (!bone) then return end - + pos, ang = Vector(0,0,0), Angle(0,0,0) local m = ent:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end - - if (IsValid(self.Owner) and self.Owner:IsPlayer() and - ent == self.Owner:GetViewModel() and self.ViewModelFlip) then - ang.r = -ang.r // Fixes mirrored models + + if (IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() and + ent == self:GetOwner():GetViewModel() and self.ViewModelFlip) then + ang.r = -ang.r -- Fixes mirrored models end - + end - + return pos, ang end @@ -344,11 +343,11 @@ if CLIENT then if (!tab) then return end - // Create the clientside models here because Garry says we can't do it in the render hook + -- Create the clientside models here because Garry says we can't do it in the render hook for k, v in pairs( tab ) do - if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then - + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) @@ -359,13 +358,13 @@ if CLIENT then else v.modelEnt = nil end - - elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then - + local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } - // make sure we create a unique name based on the selected options + -- make sure we create a unique name based on the selected options local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then @@ -378,48 +377,48 @@ if CLIENT then v.createdSprite = v.sprite v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) - + end end - + end - + local allbones - local hasGarryFixedBoneScalingYet = false + local hasGarryFixedBoneScalingYet = true function SWEP:UpdateBonePositions(vm) - + if self.ViewModelBoneMods then - + if (!vm:GetBoneCount()) then return end - - // !! WORKAROUND !! // - // We need to check all model names :/ + + -- !! WORKAROUND !! -- + -- We need to check all model names :/ local loopthrough = self.ViewModelBoneMods if (!hasGarryFixedBoneScalingYet) then allbones = {} for i=0, vm:GetBoneCount() do local bonename = vm:GetBoneName(i) - if (self.ViewModelBoneMods[bonename]) then + if (self.ViewModelBoneMods[bonename]) then allbones[bonename] = self.ViewModelBoneMods[bonename] else - allbones[bonename] = { + allbones[bonename] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end end - + loopthrough = allbones end - // !! ----------- !! // - + -- !! ----------- !! -- + for k, v in pairs( loopthrough ) do local bone = vm:LookupBone(k) if (!bone) then continue end - - // !! WORKAROUND !! // + + -- !! WORKAROUND !! -- local s = Vector(v.scale.x,v.scale.y,v.scale.z) local p = Vector(v.pos.x,v.pos.y,v.pos.z) local ms = Vector(1,1,1) @@ -431,10 +430,10 @@ if CLIENT then cur = vm:GetBoneParent(cur) end end - + s = s * ms - // !! ----------- !! // - + -- !! ----------- !! -- + if vm:GetManipulateBoneScale(bone) != s then vm:ManipulateBoneScale( bone, s ) end @@ -448,9 +447,9 @@ if CLIENT then else self:ResetBonePositions(vm) end - + end - + function SWEP:ResetBonePositions(vm) -- New code vm:SetColor(color_white) @@ -463,24 +462,24 @@ if CLIENT then vm:ManipulateBoneAngles( i, Angle(0, 0, 0) ) vm:ManipulateBonePosition( i, Vector(0, 0, 0) ) end - + end - /************************** + --[[************************* Global utility code - **************************/ + *************************]] - // Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). - // Does not copy entities of course, only copies their reference. - // WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop + -- Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). + -- Does not copy entities of course, only copies their reference. + -- WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop function table.FullCopy( tab ) if (!tab) then return nil end - + local res = {} for k, v in pairs( tab ) do if (type(v) == "table") then - res[k] = table.FullCopy(v) // recursion ho! + res[k] = table.FullCopy(v) -- recursion ho! elseif (type(v) == "Vector") then res[k] = Vector(v.x, v.y, v.z) elseif (type(v) == "Angle") then @@ -489,11 +488,11 @@ if CLIENT then res[k] = v end end - + return res - + end - + end ---------------- diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/cl_init.lua index cfc4299..70dcfd9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/cl_init.lua @@ -1,4 +1,5 @@ -include("shared.lua") +INC_CLIENT() + include("animations.lua") SWEP.DrawAmmo = true @@ -20,11 +21,11 @@ function SWEP:Deploy() end function SWEP:TranslateFOV(fov) - return GAMEMODE.FOVLerp * fov + return (GAMEMODE.FOVLerp + (self.IsScoped and not GAMEMODE.DisableScopes and 0 or (1 - GAMEMODE.FOVLerp) * (1 - GAMEMODE.IronsightZoomScale))) * fov end function SWEP:AdjustMouseSensitivity() - if self:GetIronsights() then return GAMEMODE.FOVLerp end + if self:GetIronsights() then return GAMEMODE.FOVLerp + (self.IsScoped and not GAMEMODE.DisableScopes and 0 or (1 - GAMEMODE.FOVLerp) * (1 - GAMEMODE.IronsightZoomScale)) end end function SWEP:PreDrawViewModel(vm) @@ -38,11 +39,11 @@ function SWEP:PostDrawViewModel(vm) render.SetBlend(1) end - if not self.HUD3DPos or GAMEMODE.WeaponHUDMode == 1 then return end - - local pos, ang = self:GetHUD3DPos(vm) - if pos then - self:Draw3DHUD(vm, pos, ang) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end end end @@ -87,29 +88,41 @@ local function GetAmmoColor(clip, maxclip) end end -function SWEP:Draw3DHUD(vm, pos, ang) - local wid, hei = 180, 200 - local x, y = wid * -0.6, hei * -0.5 - local clip = self:Clip1() - local spare = self.Owner:GetAmmoCount(self:GetPrimaryAmmoType()) - local maxclip = self.Primary.ClipSize - +function SWEP:GetDisplayAmmo(clip, spare, maxclip) if self.RequiredClip ~= 1 then clip = math.floor(clip / self.RequiredClip) spare = math.floor(spare / self.RequiredClip) maxclip = math.ceil(maxclip / self.RequiredClip) end + if self.AmmoUse then + clip = math.floor(clip / self.AmmoUse) + spare = math.floor(spare / self.AmmoUse) + maxclip = math.ceil(maxclip / self.AmmoUse) + end + + return clip, spare, maxclip +end + +function SWEP:Draw3DHUD(vm, pos, ang) + local wid, hei = 180, 200 + local x, y = wid * -0.6, hei * -0.5 + local clip = self:Clip1() + local spare = self:GetOwner():GetAmmoCount(self:GetPrimaryAmmoType()) + local maxclip = self.Primary.ClipSize + + local dclip, dspare, dmaxclip = self:GetDisplayAmmo(clip, spare, maxclip) + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) draw.RoundedBoxEx(32, x, y, wid, hei, colBG, true, false, true, false) - local displayspare = maxclip > 0 and self.Primary.DefaultClip ~= 99999 + local displayspare = dmaxclip > 0 and self.Primary.DefaultClip ~= 99999 if displayspare then - draw.SimpleTextBlurry(spare, spare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.75, spare == 0 and colRed or spare <= maxclip and colYellow or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + draw.SimpleTextBlurry(dspare, dspare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.75, dspare == 0 and colRed or dspare <= dmaxclip and colYellow or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end - GetAmmoColor(clip, maxclip) - draw.SimpleTextBlurry(clip, clip >= 100 and "ZS3D2DFont" or "ZS3D2DFontBig", x + wid * 0.5, y + hei * (displayspare and 0.3 or 0.5), colAmmo, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + GetAmmoColor(dclip, dmaxclip) + draw.SimpleTextBlurry(dclip, dclip >= 100 and "ZS3D2DFont" or "ZS3D2DFontBig", x + wid * 0.5, y + hei * (displayspare and 0.3 or 0.5), colAmmo, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) cam.End3D2D() end @@ -119,37 +132,44 @@ function SWEP:Draw2DHUD() local wid, hei = 180 * screenscale, 64 * screenscale local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 local clip = self:Clip1() - local spare = self.Owner:GetAmmoCount(self:GetPrimaryAmmoType()) + local spare = self:GetOwner():GetAmmoCount(self:GetPrimaryAmmoType()) local maxclip = self.Primary.ClipSize - if self.RequiredClip ~= 1 then - clip = math.floor(clip / self.RequiredClip) - spare = math.floor(spare / self.RequiredClip) - maxclip = math.ceil(maxclip / self.RequiredClip) - end + local dclip, dspare, dmaxclip = self:GetDisplayAmmo(clip, spare, maxclip) draw.RoundedBox(16, x, y, wid, hei, colBG) - local displayspare = maxclip > 0 and self.Primary.DefaultClip ~= 99999 + local displayspare = dmaxclip > 0 and self.Primary.DefaultClip ~= 99999 if displayspare then - draw.SimpleTextBlurry(spare, spare >= 1000 and "ZSHUDFontSmall" or "ZSHUDFont", x + wid * 0.75, y + hei * 0.5, spare == 0 and colRed or spare <= maxclip and colYellow or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + draw.SimpleTextBlurry(dspare, dspare >= 1000 and "ZSHUDFontSmall" or "ZSHUDFont", x + wid * 0.75, y + hei * 0.5, dspare == 0 and colRed or dspare <= dmaxclip and colYellow or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end - GetAmmoColor(clip, maxclip) - draw.SimpleTextBlurry(clip, clip >= 100 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * (displayspare and 0.25 or 0.5), y + hei * 0.5, colAmmo, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + GetAmmoColor(dclip, dmaxclip) + draw.SimpleTextBlurry(dclip, dclip >= 100 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * (displayspare and 0.25 or 0.5), y + hei * 0.5, colAmmo, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end function SWEP:Think() - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then + if self:GetIronsights() and not self:GetOwner():KeyDown(IN_ATTACK2) then self:SetIronsights(false) end + + if self:GetReloadFinish() > 0 then + if CurTime() >= self:GetReloadFinish() then + self:FinishReload() + end + + return + elseif self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(self.IdleActivity) + end end function SWEP:GetIronsightsDeltaMultiplier() local bIron = self:GetIronsights() local fIronTime = self.fIronTime or 0 - if not bIron and fIronTime < CurTime() - 0.25 then + if not bIron and fIronTime < CurTime() - 0.25 then return 0 end @@ -165,16 +185,16 @@ end local ghostlerp = 0 function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) - local bIron = self:GetIronsights() + local bIron = self:GetIronsights() and not GAMEMODE.NoIronsights if bIron ~= self.bLastIron then self.bLastIron = bIron self.fIronTime = CurTime() - if bIron then + if bIron then self.SwayScale = 0.3 self.BobScale = 0.1 - else + else self.SwayScale = 2.0 self.BobScale = 1.5 end @@ -195,7 +215,7 @@ function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) pos = pos + Offset.x * Mul * ang:Right() + Offset.y * Mul * ang:Forward() + Offset.z * Mul * ang:Up() end - if self.Owner:GetBarricadeGhosting() then + if self:GetOwner():GetBarricadeGhosting() then ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) elseif ghostlerp > 0 then ghostlerp = math.max(0, ghostlerp - FrameTime() * 5) @@ -209,14 +229,14 @@ function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) return pos, ang end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:DrawHUD() - self:DrawCrosshair() + self:DrawWeaponCrosshair() - if GAMEMODE.WeaponHUDMode >= 1 then + if GAMEMODE:ShouldDraw2DWeaponHUD() then self:Draw2DHUD() end end @@ -265,7 +285,7 @@ end function SWEP:DrawWorldModel() local owner = self:GetOwner() - if owner:IsValid() and owner.ShadowMan then return end + if owner:IsValid() and (owner.ShadowMan or owner.SpawnProtection) then return end self:Anim_DrawWorldModel() end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/init.lua index ea3565c..e4605c3 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/init.lua @@ -1,15 +1,18 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() + AddCSLuaFile("animations.lua") -include("shared.lua") - function SWEP:Think() - if self.IdleAnimation and self.IdleAnimation <= CurTime() then - self.IdleAnimation = nil - self:SendWeaponAnim(ACT_VM_IDLE) - end - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then + if self:GetIronsights() and not self:GetOwner():KeyDown(IN_ATTACK2) then self:SetIronsights(false) end + + if self:GetReloadFinish() > 0 then + if CurTime() >= self:GetReloadFinish() then + self:FinishReload() + end + elseif self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(self.IdleActivity) + end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/shared.lua index 43f943c..9099aa9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_base/shared.lua @@ -1,11 +1,12 @@ SWEP.Primary.Sound = Sound("Weapon_Pistol.Single") +SWEP.DryFireSound = Sound("Weapon_Pistol.Empty") SWEP.Primary.Damage = 30 SWEP.Primary.KnockbackScale = 1 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.15 -SWEP.ConeMax = 0.03 -SWEP.ConeMin = 0.01 +SWEP.ConeMax = 1.5 +SWEP.ConeMin = 0.5 SWEP.ConeRamp = 2 SWEP.CSMuzzleFlashes = true @@ -29,12 +30,27 @@ SWEP.IronSightsHoldType = "ar2" SWEP.IronSightsPos = Vector(0, 0, 0) SWEP.EmptyWhenPurchased = true +SWEP.AllowQualityWeapons = true + +SWEP.Recoil = 0 + +SWEP.ReloadSpeed = 1.0 +SWEP.FireAnimSpeed = 1.0 + +SWEP.IdleActivity = ACT_VM_IDLE + +SWEP.Weight = 5 function SWEP:Initialize() if not self:IsValid() then return end --??? self:SetWeaponHoldType(self.HoldType) - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) + + -- Higher tier guns auto swap to with a higher priority than low tier ones. + if self.Weight and self.Tier then + self.Weight = self.Weight + self.Tier + end -- Maybe we didn't want to convert the weapon to the new system... if self.Cone then @@ -49,22 +65,10 @@ function SWEP:Initialize() end end -function SWEP:GetCone() - if not self.Owner:OnGround() or self.ConeMax == self.ConeMin then return self.ConeMax end - - local basecone = self.ConeMin - local conedelta = self.ConeMax - basecone - - local multiplier = math.min(self.Owner:GetVelocity():Length() / self.WalkSpeed, 1) * 0.5 - if not self.Owner:Crouching() then multiplier = multiplier + 0.25 end - if not self:GetIronsights() then multiplier = multiplier + 0.25 end - - return basecone + conedelta * multiplier ^ self.ConeRamp -end - function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) self:EmitFireSound() self:TakeAmmo() @@ -72,9 +76,116 @@ function SWEP:PrimaryAttack() self.IdleAnimation = CurTime() + self:SequenceDuration() end -function SWEP:GetWalkSpeed() +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then + self:SetIronsights(true) + end +end + +function SWEP:Reload() + local owner = self:GetOwner() + if owner:IsHolding() then return end + if self:GetIronsights() then - return math.min(self.WalkSpeed, math.max(90, self.WalkSpeed * 0.5)) + self:SetIronsights(false) + end + + -- Custom reload function to change reload speed. + if self:CanReload() then + self.IdleAnimation = CurTime() + self:SequenceDuration() + self:SetNextReload(self.IdleAnimation) + self:SetReloadStart(CurTime()) + + self:SendReloadAnimation() + self:ProcessReloadEndTime() + + owner:DoReloadEvent() + + self:EmitReloadSound() + end +end + +function SWEP:GetPrimaryClipSize() + local owner = self:GetOwner() + local multi = self.Primary.ClipSize/self.RequiredClip >= 8 and owner:HasTrinket("extendedmag") and 1.15 or 1 + + return math.floor(self:GetMaxClip1() * multi) +end + +function SWEP:FinishReload() + self:SendWeaponAnim(ACT_VM_IDLE) + self:SetNextReload(0) + self:SetReloadStart(0) + self:SetReloadFinish(0) + self:EmitReloadFinishSound() + + local owner = self:GetOwner() + if not owner:IsValid() then return end + + local max1 = self:GetPrimaryClipSize() + local max2 = self:GetMaxClip2() + + if max1 > 0 then + local ammotype = self:GetPrimaryAmmoType() + local spare = owner:GetAmmoCount(ammotype) + local current = self:Clip1() + local needed = max1 - current + + needed = math.min(spare, needed) + + self:SetClip1(current + needed) + if SERVER then + owner:RemoveAmmo(needed, ammotype) + end + end + + if max2 > 0 then + local ammotype = self:GetSecondaryAmmoType() + local spare = owner:GetAmmoCount(ammotype) + local current = self:Clip2() + local needed = max2 - current + + needed = math.min(spare, needed) + + self:SetClip2(current + needed) + if SERVER then + owner:RemoveAmmo(needed, ammotype) + end + end +end + +function SWEP:GetCone() + local owner = self:GetOwner() + + local basecone = self.ConeMin + local conedelta = self.ConeMax - basecone + + local orphic = not owner.Orphic and 1 or self:GetIronsights() and 0.9 or 1.1 + local tiervalid = (self.Tier or 1) <= 3 + local spreadmul = (owner.AimSpreadMul or 1) - ((tiervalid and owner:HasTrinket("refinedsub")) and 0.27 or 0) + + if owner.TrueWooism then + return (basecone + conedelta * 0.5 ^ self.ConeRamp) * spreadmul * orphic + end + + if not owner:OnGround() or self.ConeMax == basecone then return self.ConeMax end + + local multiplier = math.min(owner:GetVelocity():Length() / self.WalkSpeed, 1) * 0.5 + + local ironsightmul = 0.25 * (owner.IronsightEffMul or 1) + local ironsightdiff = 0.25 - ironsightmul + multiplier = multiplier + ironsightdiff + + if not owner:Crouching() then multiplier = multiplier + 0.25 end + if not self:GetIronsights() then multiplier = multiplier + ironsightmul end + + return (basecone + conedelta * (self.FixedAccuracy and 0.6 or multiplier) ^ self.ConeRamp) * spreadmul * orphic +end + +function SWEP:GetWalkSpeed() + local owner = self:GetOwner() + if self:GetIronsights() then + return math.min(self.WalkSpeed, math.max(90, self.WalkSpeed * (owner.Wooism and 0.75 or 0.5))) end return self.WalkSpeed @@ -95,30 +206,16 @@ function SWEP:SetIronsights(b) end end - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) end function SWEP:Deploy() self:SetNextReload(0) - gamemode.Call("WeaponDeployed", self.Owner, self) - self:SetIronsights(false) + self:SetReloadFinish(0) - if self.PreHolsterClip1 then - local diff = self:Clip1() - self.PreHolsterClip1 - self:SetClip1(self.PreHolsterClip1) - if SERVER then - self.Owner:GiveAmmo(diff, self.Primary.Ammo, true) - end - self.PreHolsterClip1 = nil - end - if self.PreHolsterClip2 then - local diff = self:Clip2() - self.PreHolsterClip2 - self:SetClip2(self.PreHolsterClip2) - if SERVER then - self.Owner:GiveAmmo(diff, self.Secondary.Ammo, true) - end - self.PreHolsterClip2 = nil - end + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self:SetIronsights(false) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -130,13 +227,6 @@ function SWEP:Deploy() end function SWEP:Holster() - if self:ValidPrimaryAmmo() then - self.PreHolsterClip1 = self:Clip1() - end - if self:ValidSecondaryAmmo() then - self.PreHolsterClip2 = self:Clip2() - end - if CLIENT then self:Anim_Holster() end @@ -144,36 +234,49 @@ function SWEP:Holster() return true end +SWEP.AU = 0 function SWEP:TakeAmmo() - self:TakePrimaryAmmo(self.RequiredClip) + if self.AmmoUse then + self.AU = self.AU + self.AmmoUse + if self.AU >= 1 then + local use = math.floor(self.AU) + self:TakePrimaryAmmo(use) + self.AU = self.AU - use + end + else + self:TakePrimaryAmmo(self.RequiredClip) + end end -function SWEP:Reload() - if self.Owner:IsHolding() then return end - - if self:GetIronsights() then - self:SetIronsights(false) +function SWEP:EmitReloadSound() + if self.ReloadSound and IsFirstTimePredicted() then + self:EmitSound(self.ReloadSound, 75, 100, 1, CHAN_WEAPON + 21) end +end - if self:GetNextReload() <= CurTime() and self:DefaultReload(ACT_VM_RELOAD) then - self.IdleAnimation = CurTime() + self:SequenceDuration() - self:SetNextReload(self.IdleAnimation) - self.Owner:DoReloadEvent() - if self.ReloadSound then - self:EmitSound(self.ReloadSound) - end +function SWEP:EmitReloadFinishSound() + if self.ReloadFinishSound and IsFirstTimePredicted() then + self:EmitSound(self.ReloadFinishSound, 75, 100, 1, CHAN_WEAPON + 21) end end +function SWEP:CanReload() + return self:GetNextReload() <= CurTime() and self:GetReloadFinish() == 0 and + ( + self:GetMaxClip1() > 0 and self:Clip1() < self:GetPrimaryClipSize() and self:ValidPrimaryAmmo() and self:GetOwner():GetAmmoCount(self:GetPrimaryAmmoType()) > 0 + or self:GetMaxClip2() > 0 and self:Clip1() < self:GetMaxClip2() and self:ValidSecondaryAmmo() and self:GetOwner():GetAmmoCount(self:GetSecondaryAmmoType()) > 0 + ) +end + function SWEP:GetIronsights() return self:GetDTBool(0) end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end if self:Clip1() < self.RequiredClip then - self:EmitSound("Weapon_Pistol.Empty") + self:EmitSound(self.DryFireSound) self:SetNextPrimaryFire(CurTime() + math.max(0.25, self.Primary.Delay)) return false end @@ -181,63 +284,66 @@ function SWEP:CanPrimaryAttack() return self:GetNextPrimaryFire() <= CurTime() end -function SWEP:SecondaryAttack() - if self:GetNextSecondaryFire() <= CurTime() and not self.Owner:IsHolding() then - self:SetIronsights(true) - end -end - function SWEP:OnRestore() self:SetIronsights(false) end -local tempknockback -function SWEP:StartBulletKnockback() - tempknockback = {} -end - -function SWEP:EndBulletKnockback() - tempknockback = nil -end - -function SWEP:DoBulletKnockback(scale) - for ent, prevvel in pairs(tempknockback) do - local curvel = ent:GetVelocity() - ent:SetVelocity(curvel * -1 + (curvel - prevvel) * scale + prevvel) - end -end - -function GenericBulletCallback(attacker, tr, dmginfo) - local ent = tr.Entity - if ent:IsValid() then - if ent:IsPlayer() then - if ent:Team() == TEAM_UNDEAD and tempknockback then - tempknockback[ent] = ent:GetVelocity() - end - else - local phys = ent:GetPhysicsObject() - if ent:GetMoveType() == MOVETYPE_VPHYSICS and phys:IsValid() and phys:IsMoveable() then - ent:SetPhysicsAttacker(attacker) - end - end - end -end - function SWEP:SendWeaponAnimation() self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed) +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_RELOAD) +end + +function SWEP:GetReloadSpeedMultiplier() + local owner = self:GetOwner() + local primstring = self:GetPrimaryAmmoTypeString() + local reloadspecmulti = primstring and "ReloadSpeedMultiplier" .. string.upper(primstring) or nil + + local extramulti = 1 + if owner:HasTrinket("supasm") and (self.Tier or 1) <= 2 and not self.PrimaryRemantleModifier and self.QualityTier then + extramulti = GAMEMODE.WeaponQualities[self.QualityTier][2] + end + + return self:GetOwner():GetTotalAdditiveModifier("ReloadSpeedMultiplier", reloadspecmulti) * (owner:GetStatus("frost") and 0.7 or 1) * extramulti +end + +function SWEP:ProcessReloadEndTime() + local reloadspeed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + + self:SetReloadFinish(CurTime() + self:SequenceDuration() / reloadspeed) + if not self.DontScaleReloadSpeed then + self:GetOwner():GetViewModel():SetPlaybackRate(reloadspeed) + end +end + +function SWEP:GetFireDelay() + local owner = self:GetOwner() + return self.Primary.Delay / (owner:GetStatus("frost") and 0.7 or 1) end -SWEP.BulletCallback = GenericBulletCallback function SWEP:ShootBullets(dmg, numbul, cone) - local owner = self.Owner - --owner:MuzzleFlash() + local owner = self:GetOwner() self:SendWeaponAnimation() owner:DoAttackEvent() + if self.Recoil > 0 then + local r = math.Rand(0.8, 1) + owner:ViewPunch(Angle(r * -self.Recoil, 0, (1 - r) * (math.random(2) == 1 and -1 or 1) * self.Recoil)) + end - self:StartBulletKnockback() - owner:FireBullets({Num = numbul, Src = owner:GetShootPos(), Dir = owner:GetAimVector(), Spread = Vector(cone, cone, 0), Tracer = 1, TracerName = self.TracerName, Force = dmg * 0.1, Damage = dmg, Callback = self.BulletCallback}) - self:DoBulletKnockback(self.Primary.KnockbackScale * 0.05) - self:EndBulletKnockback() + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + + owner:LagCompensation(true) + owner:FireBulletsLua(owner:GetShootPos(), owner:GetAimVector(), cone, numbul, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + owner:LagCompensation(false) + + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end end local ActIndex = { @@ -256,15 +362,16 @@ local ActIndex = { [ "melee2" ] = ACT_HL2MP_IDLE_MELEE2, [ "passive" ] = ACT_HL2MP_IDLE_PASSIVE, [ "knife" ] = ACT_HL2MP_IDLE_KNIFE, - [ "duel" ] = ACT_HL2MP_IDLE_DUEL, - [ "revolver" ] = ACT_HL2MP_IDLE_REVOLVER + [ "duel" ] = ACT_HL2MP_IDLE_DUEL, + [ "revolver" ] = ACT_HL2MP_IDLE_REVOLVER, + [ "camera" ] = ACT_HL2MP_IDLE_CAMERA } function SWEP:SetWeaponHoldType( t ) t = string.lower( t ) local index = ActIndex[ t ] - + if ( index == nil ) then Msg( "SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set! (defaulting to normal) (from "..self:GetClass()..")\n" ) t = "normal" @@ -285,14 +392,14 @@ function SWEP:SetWeaponHoldType( t ) self.ActivityTranslate [ ACT_RANGE_ATTACK1 ] = index+8 self.ActivityTranslate [ ACT_MP_SWIM_IDLE ] = index+8 self.ActivityTranslate [ ACT_MP_SWIM ] = index+9 - + -- "normal" jump animation doesn't exist if t == "normal" then self.ActivityTranslate [ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM end - + -- these two aren't defined in ACTs for whatever reason - if t == "knife" || t == "melee2" then + if t == "knife" or t == "melee2" then self.ActivityTranslate [ ACT_MP_CROUCH_IDLE ] = nil end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood.lua deleted file mode 100644 index 5a59e85..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood.lua +++ /dev/null @@ -1,30 +0,0 @@ -AddCSLuaFile() - -SWEP.Base = "weapon_zs_basemelee" - -if CLIENT then - SWEP.PrintName = "Food" - - SWEP.ViewModelFOV = 55 - SWEP.ViewModelFlip = false - - SWEP.ShowViewModel = false - SWEP.ShowWorldModel = false -end - -SWEP.ViewModel = "models/weapons/c_stunstick.mdl" -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" -SWEP.UseHands = true - -SWEP.HoldType = "slam" - -SWEP.Primary.ClipSize = 1 -SWEP.Primary.Automatic = false -SWEP.Primary.Ammo = "watermelon" -SWEP.Primary.Delay = 1 -SWEP.Primary.DefaultClip = 1 - -SWEP.HealthValue = 15 -SWEP.EatTime = 1 - -SWEP.AmmoIfHas = true \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/cl_init.lua new file mode 100644 index 0000000..50a50c9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/cl_init.lua @@ -0,0 +1,31 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + local eattime = self:GetEatEndTime() + if eattime == 0 then return end + + local delta = math.Clamp((CurTime() - self:GetEatStartTime()) / self:GetFoodEatTime(), 0, 1) + if delta > 0 then + local lerp = math.sin(6 * math.pi * delta) + lerp = math.abs(lerp) + + local Offset = self.EatViewOffset + + if self.EatViewAngles then + ang = Angle(ang.p, ang.y, ang.r) + ang:RotateAroundAxis(ang:Right(), self.EatViewAngles.x * lerp) + ang:RotateAroundAxis(ang:Up(), self.EatViewAngles.y * lerp) + ang:RotateAroundAxis(ang:Forward(), self.EatViewAngles.z * lerp) + end + + pos = pos + Offset.x * lerp * ang:Right() + Offset.y * lerp * ang:Forward() + Offset.z * lerp * ang:Up() + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/init.lua new file mode 100644 index 0000000..8cf7bde --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/init.lua @@ -0,0 +1,30 @@ +INC_SERVER() + +function SWEP:Eat() + local owner = self:GetOwner() + + if owner:IsSkillActive(SKILL_SUGARRUSH) then + local boost = owner:GiveStatus("adrenalineamp", 14) + if boost and boost:IsValid() then + boost:SetSpeed(35) + end + end + + local max = owner:IsSkillActive(SKILL_D_FRAIL) and math.floor(owner:GetMaxHealth() * 0.25) or owner:GetMaxHealth() + + if owner:IsSkillActive(SKILL_GLUTTON) then + local healing = self.FoodHealth * (owner.FoodRecoveryMul or 1) + + owner:SetBloodArmor(math.min(owner:GetBloodArmor() + (math.min(30, healing) * owner.BloodarmorGainMul), owner.MaxBloodArmor + (40 * owner.MaxBloodArmorMul))) + else + local healing = self.FoodHealth * (owner:GetTotalAdditiveModifier("FoodRecoveryMul", "HealingReceived") - (owner:GetPhantomHealth() > 0.5 and 0.5 or 0)) + + owner:SetHealth(math.min(owner:Health() + healing, max)) + owner:SetPhantomHealth(math.max(0, math.floor(owner:GetPhantomHealth() - healing))) + end + + self:TakePrimaryAmmo(1) + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/shared.lua new file mode 100644 index 0000000..2965a40 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/shared.lua @@ -0,0 +1,143 @@ +SWEP.Base = "weapon_zs_basemelee" + +SWEP.PrintName = "Food" +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "slam" +SWEP.SwingHoldType = "camera" + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "watermelon" +SWEP.Primary.Delay = 1 +SWEP.Primary.DefaultClip = 1 + +SWEP.FoodHealth = 15 +SWEP.FoodEatTime = 4 +SWEP.EatViewAngles = Angle(80, 0, 15) +SWEP.EatViewOffset = Vector(-8, -40, 0) + +SWEP.AmmoIfHas = true +SWEP.NoPickupIfHas = true +SWEP.NoMagazine = true + +SWEP.DroppedColorModulation = Color(1, 0, 1) + +SWEP.NeedToPlayEatSound = true +SWEP.SugarRushFood = false + +SWEP.WalkSpeed = SPEED_NORMAL + +AccessorFuncDT(SWEP, "EatEndTime", "Float", 0) +AccessorFuncDT(SWEP, "EatStartTime", "Float", 1) + +SWEP.Weight = 1 + +function SWEP:CanEat() + local owner = self:GetOwner() + + if owner:GetStatus("sickness") then return false end + + if owner:IsSkillActive(SKILL_SUGARRUSH) then + return true + end + + if owner:IsSkillActive(SKILL_GLUTTON) then + return owner:GetBloodArmor() < owner.MaxBloodArmor + (40 * owner.MaxBloodArmorMul) + end + + local max = owner:IsSkillActive(SKILL_D_FRAIL) and math.floor(owner:GetMaxHealth() * 0.25) or owner:GetMaxHealth() + return owner:Health() < max +end + +function SWEP:PrimaryAttack() + if self:GetEatEndTime() == 0 and self:CanEat() then + self:SetEatStartTime(CurTime()) + self:SetEatEndTime(CurTime() + self:GetFoodEatTime()) + end +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + local owner = self:GetOwner() + + if owner:HasTrinket("processor") then + owner:EmitSound("weapons/bugbait/bugbait_squeeze1.wav", 65, 150) + + if SERVER then + owner:GiveAmmo(self.FoodHealth * 2, "Battery") + owner:StripWeapon(self:GetClass()) + end + end +end + +function SWEP:Reload() +end + +function SWEP:Think() + if self:GetEatEndTime() > 0 then + local time = CurTime() + + if math.cos(12 * math.pi * (time - self:GetEatStartTime()) / self:GetFoodEatTime()) < 0 then -- Derivitive of sin(x) = cos(x/2) + if self.NeedToPlayEatSound then + self.NeedToPlayEatSound = false + local snd + if self.FoodIsLiquid then + snd = "zombiesurvival/drink"..math.random(3)..".ogg" + else + snd = "zombiesurvival/eat1.ogg" + end + self:EmitSound(snd, 60, math.random(90, 110)) + end + else + self.NeedToPlayEatSound = true + end + + if time >= self:GetEatEndTime() then + self:SetEatEndTime(0) + + if SERVER then + self:Eat() + + return + end + end + + local owner = self:GetOwner() + if not owner:IsValid() then return end + + if owner:GetStatus("sickness") then + self:SetEatEndTime(0) + end + + if owner:IsSkillActive(SKILL_GLUTTON) or owner:IsSkillActive(SKILL_SUGARRUSH) then return end + + local max = owner:IsSkillActive(SKILL_D_FRAIL) and math.floor(owner:GetMaxHealth() * 0.25) or owner:GetMaxHealth() + if owner:Health() >= max then + self:SetEatEndTime(0) + end + end +end + +function SWEP:Holster() + self:SetEatStartTime(0) + self:SetEatEndTime(0) + + return true +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + return true +end + +function SWEP:GetFoodEatTime() + return self.FoodEatTime * (self:GetOwner():IsValid() and self:GetOwner().FoodEatTimeMul or 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/animations.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/animations.lua index 11b7734..153168f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/animations.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/animations.lua @@ -3,16 +3,16 @@ Created by Clavus Available for public use, thread at: facepunch.com/threads/1032378 - - + + DESCRIPTION: - This script is meant for experienced scripters - that KNOW WHAT THEY ARE DOING. Don't come to me + This script is meant for experienced scripters + that KNOW WHAT THEY ARE DOING. Don't come to me with basic Lua questions. - + Just copy into your SWEP or SWEP base of choice and merge with your own code. - + The SWEP.VElements, SWEP.WElements and SWEP.ViewModelBoneMods tables are all optional and only have to be visible to the client. @@ -20,50 +20,50 @@ function SWEP:Anim_Initialize() - // other initialize code goes here + -- other initialize code goes here if CLIENT then - - // Create a new table for every weapon instance + + -- Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) - self:CreateModels(self.VElements) // create viewmodels - self:CreateModels(self.WElements) // create worldmodels - - // init view model bone build function - if IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + self:CreateModels(self.VElements) -- create viewmodels + self:CreateModels(self.WElements) -- create worldmodels + + -- init view model bone build function + if IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) - - // Init viewmodel visibility + + -- Init viewmodel visibility --[[if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else - // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called + -- we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called vm:SetColor(Color(255,255,255,1)) - // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in - // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing - vm:SetMaterial("Debug/hsv") + -- ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in + -- however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing + vm:SetMaterial("Debug/hsv") end]] end end - + end end function SWEP:Anim_Holster() - - if CLIENT and IsValid(self.Owner) then - local vm = self.Owner:GetViewModel() + + if CLIENT and IsValid(self:GetOwner()) then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end - + return true end @@ -75,17 +75,16 @@ if CLIENT then SWEP.vRenderOrder = nil function SWEP:Anim_ViewModelDrawn() - - local vm = self.Owner:GetViewModel() + + local vm = self:GetOwner():GetViewModel() if !IsValid(vm) then return end - - if (!self.VElements) then return end - + self:UpdateBonePositions(vm) + if (!self.VElements) then return end if (!self.vRenderOrder) then - - // we build a render order because sprites need to be drawn after models + + -- we build a render order because sprites need to be drawn after models self.vRenderOrder = {} for k, v in pairs( self.VElements ) do @@ -95,24 +94,24 @@ if CLIENT then table.insert(self.vRenderOrder, k) end end - + end for k, name in ipairs( self.vRenderOrder ) do - + local v = self.VElements[name] if (!v) then self.vRenderOrder = nil break end if (v.hide) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (!v.bone) then continue end - + local pos, ang = self:GetBoneOrientation( self.VElements, v, vm ) - + if (!pos) then continue end - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -121,75 +120,75 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then - for k, v in pairs( v.bodygroup ) do + for k, v in ipairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end SWEP.wRenderOrder = nil function SWEP:Anim_DrawWorldModel() - + if (self.ShowWorldModel == nil or self.ShowWorldModel) then self:DrawModel() end - + if (!self.WElements) then return end - + if (!self.wRenderOrder) then self.wRenderOrder = {} @@ -203,33 +202,33 @@ if CLIENT then end end - - if (IsValid(self.Owner)) then - bone_ent = self.Owner + + if (IsValid(self:GetOwner())) then + bone_ent = self:GetOwner() else - // when the weapon is dropped + -- when the weapon is dropped bone_ent = self end - + for k, name in pairs( self.wRenderOrder ) do - + local v = self.WElements[name] if (!v) then self.wRenderOrder = nil break end if (v.hide) then continue end - + local pos, ang - + if (v.bone) then pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent ) else pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" ) end - + if (!pos) then continue end - + local model = v.modelEnt local sprite = v.spriteMaterial - + if (v.type == "Model" and IsValid(model)) then model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ) @@ -238,105 +237,105 @@ if CLIENT then ang:RotateAroundAxis(ang:Forward(), v.angle.r) model:SetAngles(ang) - //model:SetModelScale(v.size) + --model:SetModelScale(v.size) local matrix = Matrix() matrix:Scale(v.size) model:EnableMatrix( "RenderMultiply", matrix ) - + if (v.material == "") then model:SetMaterial("") elseif (model:GetMaterial() != v.material) then model:SetMaterial( v.material ) end - + if (v.skin and v.skin != model:GetSkin()) then model:SetSkin(v.skin) end - + if (v.bodygroup) then - for k, v in pairs( v.bodygroup ) do + for k, v in ipairs( v.bodygroup ) do if (model:GetBodygroup(k) != v) then model:SetBodygroup(k, v) end end end - + if (v.surpresslightning) then render.SuppressEngineLighting(true) end - + render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255) render.SetBlend(v.color.a/255) model:DrawModel() render.SetBlend(1) render.SetColorModulation(1, 1, 1) - + if (v.surpresslightning) then render.SuppressEngineLighting(false) end - + elseif (v.type == "Sprite" and sprite) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z render.SetMaterial(sprite) render.DrawSprite(drawpos, v.size.x, v.size.y, v.color) - + elseif (v.type == "Quad" and v.draw_func) then - + local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + cam.Start3D2D(drawpos, ang, v.size) v.draw_func( self ) cam.End3D2D() end - + end - + end function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override ) - + local bone, pos, ang if (tab.rel and tab.rel != "") then - + local v = basetab[tab.rel] - + if (!v) then return end - - // Technically, if there exists an element with the same name as a bone - // you can get in an infinite loop. Let's just hope nobody's that stupid. + + -- Technically, if there exists an element with the same name as a bone + -- you can get in an infinite loop. Let's just hope nobody's that stupid. pos, ang = self:GetBoneOrientation( basetab, v, ent ) - + if (!pos) then return end - + pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z ang:RotateAroundAxis(ang:Up(), v.angle.y) ang:RotateAroundAxis(ang:Right(), v.angle.p) ang:RotateAroundAxis(ang:Forward(), v.angle.r) - + else - + bone = ent:LookupBone(bone_override or tab.bone) if (!bone) then return end - + pos, ang = Vector(0,0,0), Angle(0,0,0) local m = ent:GetBoneMatrix(bone) if (m) then pos, ang = m:GetTranslation(), m:GetAngles() end - - if (IsValid(self.Owner) and self.Owner:IsPlayer() and - ent == self.Owner:GetViewModel() and self.ViewModelFlip) then - ang.r = -ang.r // Fixes mirrored models + + if (IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() and + ent == self:GetOwner():GetViewModel() and self.ViewModelFlip) then + ang.r = -ang.r -- Fixes mirrored models end - + end - + return pos, ang end @@ -344,11 +343,11 @@ if CLIENT then if (!tab) then return end - // Create the clientside models here because Garry says we can't do it in the render hook + -- Create the clientside models here because Garry says we can't do it in the render hook for k, v in pairs( tab ) do - if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and + if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then - + v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE) if (IsValid(v.modelEnt)) then v.modelEnt:SetPos(self:GetPos()) @@ -359,13 +358,13 @@ if CLIENT then else v.modelEnt = nil end - - elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) + + elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then - + local name = v.sprite.."-" local params = { ["$basetexture"] = v.sprite } - // make sure we create a unique name based on the selected options + -- make sure we create a unique name based on the selected options local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" } for i, j in pairs( tocheck ) do if (v[j]) then @@ -378,48 +377,48 @@ if CLIENT then v.createdSprite = v.sprite v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params) - + end end - + end - + local allbones - local hasGarryFixedBoneScalingYet = false + local hasGarryFixedBoneScalingYet = true function SWEP:UpdateBonePositions(vm) - + if self.ViewModelBoneMods then - + if (!vm:GetBoneCount()) then return end - - // !! WORKAROUND !! // - // We need to check all model names :/ + + -- !! WORKAROUND !! -- + -- We need to check all model names :/ local loopthrough = self.ViewModelBoneMods if (!hasGarryFixedBoneScalingYet) then allbones = {} for i=0, vm:GetBoneCount() do local bonename = vm:GetBoneName(i) - if (self.ViewModelBoneMods[bonename]) then + if (self.ViewModelBoneMods[bonename]) then allbones[bonename] = self.ViewModelBoneMods[bonename] else - allbones[bonename] = { + allbones[bonename] = { scale = Vector(1,1,1), pos = Vector(0,0,0), angle = Angle(0,0,0) } end end - + loopthrough = allbones end - // !! ----------- !! // - + -- !! ----------- !! -- + for k, v in pairs( loopthrough ) do local bone = vm:LookupBone(k) if (!bone) then continue end - - // !! WORKAROUND !! // + + -- !! WORKAROUND !! -- local s = Vector(v.scale.x,v.scale.y,v.scale.z) local p = Vector(v.pos.x,v.pos.y,v.pos.z) local ms = Vector(1,1,1) @@ -431,10 +430,10 @@ if CLIENT then cur = vm:GetBoneParent(cur) end end - + s = s * ms - // !! ----------- !! // - + -- !! ----------- !! -- + if vm:GetManipulateBoneScale(bone) != s then vm:ManipulateBoneScale( bone, s ) end @@ -448,9 +447,9 @@ if CLIENT then else self:ResetBonePositions(vm) end - + end - + function SWEP:ResetBonePositions(vm) -- New code vm:SetColor(color_white) @@ -463,24 +462,24 @@ if CLIENT then vm:ManipulateBoneAngles( i, Angle(0, 0, 0) ) vm:ManipulateBonePosition( i, Vector(0, 0, 0) ) end - + end - /************************** + --[[************************* Global utility code - **************************/ + *************************]] - // Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). - // Does not copy entities of course, only copies their reference. - // WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop + -- Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference). + -- Does not copy entities of course, only copies their reference. + -- WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop function table.FullCopy( tab ) if (!tab) then return nil end - + local res = {} for k, v in pairs( tab ) do if (type(v) == "table") then - res[k] = table.FullCopy(v) // recursion ho! + res[k] = table.FullCopy(v) -- recursion ho! elseif (type(v) == "Vector") then res[k] = Vector(v.x, v.y, v.z) elseif (type(v) == "Angle") then @@ -489,11 +488,11 @@ if CLIENT then res[k] = v end end - + return res - + end - + end ---------------- diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua index c760b23..c89bf4d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua @@ -1,4 +1,5 @@ -include("shared.lua") +INC_CLIENT() + include("animations.lua") SWEP.DrawAmmo = false @@ -12,12 +13,12 @@ function SWEP:TranslateFOV(fov) return GAMEMODE.FOVLerp * fov end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end @@ -43,22 +44,25 @@ end function SWEP:DrawWorldModel() local owner = self:GetOwner() - if owner:IsValid() and owner.ShadowMan then return end + if owner:IsValid() and (owner.ShadowMan or owner.SpawnProtection) then return end self:Anim_DrawWorldModel() end local ghostlerp = 0 function SWEP:GetViewModelPosition(pos, ang) + local owner = self:GetOwner() if self:IsSwinging() then local rot = self.SwingRotation local offset = self.SwingOffset + local armdelay = owner:GetMeleeSpeedMul() + local swingtime = self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy local swingend = self:GetSwingEnd() - local delta = self.SwingTime - math.Clamp(swingend - CurTime(), 0, self.SwingTime) - local power = CosineInterpolation(0, 1, delta / self.SwingTime) + local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime) + local power = CosineInterpolation(0, 1, delta / swingtime) if power >= 0.9 then power = (1 - power) ^ 0.4 * 2 @@ -71,7 +75,7 @@ function SWEP:GetViewModelPosition(pos, ang) ang:RotateAroundAxis(ang:Forward(), rot.roll * power) end - if self.Owner:GetBarricadeGhosting() then + if owner:GetBarricadeGhosting() then ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) elseif ghostlerp > 0 then ghostlerp = math.max(0, ghostlerp - FrameTime() * 5) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/init.lua new file mode 100644 index 0000000..ccaecf5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/init.lua @@ -0,0 +1,34 @@ +INC_SERVER() + +AddCSLuaFile("animations.lua") + +function SWEP:ServerMeleeHitEntity(tr, hitent, damagemultiplier) + if not hitent or not hitent:IsValid() then return end + + local phys = hitent:GetPhysicsObject() + if hitent:GetMoveType() == MOVETYPE_VPHYSICS and phys:IsValid() and phys:IsMoveable() then + hitent:SetPhysicsAttacker(self:GetOwner()) + end +end + +function SWEP:ServerMeleePostHitEntity(tr, hitent, damagemultiplier) + local owner = self:GetOwner() + + if owner.GlassWeaponShouldBreak and hitent:IsPlayer() and not self.NoGlassWeapons and owner:IsSkillActive(SKILL_GLASSWEAPONS) and owner.GlassWeaponShouldBreak then + local effectdata = EffectData() + effectdata:SetOrigin(owner:EyePos()) + effectdata:SetEntity(owner) + util.Effect("weapon_shattered", effectdata, true, true) + + owner:StripWeapon(self:GetClass()) + end +end + +function SWEP:ServerHitFleshEffects(hitent, tr, damagemultiplier) + local owner = self:GetOwner() + local damage = self.MeleeDamage * damagemultiplier + + if hitent:IsValid() and hitent:IsPlayer() and hitent:Team() == owner:Team() then return end + + util.Blood(tr.HitPos, math.Rand(damage * 0.25, damage * 0.6), (tr.HitPos - owner:GetShootPos()):GetNormalized(), math.min(400, math.Rand(damage * 6, damage * 12)), true) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/shared.lua index 925694c..faee944 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/shared.lua @@ -1,9 +1,3 @@ -if SERVER then - AddCSLuaFile("shared.lua") - AddCSLuaFile("cl_init.lua") - AddCSLuaFile("animations.lua") -end - SWEP.ViewModel = "models/weapons/v_axe/v_axe.mdl" SWEP.WorldModel = "models/weapons/w_axe.mdl" @@ -26,6 +20,7 @@ SWEP.Secondary.Automatic = true SWEP.WalkSpeed = SPEED_FAST SWEP.IsMelee = true +SWEP.MeleeFlagged = false SWEP.HoldType = "melee" SWEP.SwingHoldType = "grenade" @@ -42,8 +37,17 @@ SWEP.SwingTime = 0 SWEP.SwingRotation = Angle(0, 0, 0) SWEP.SwingOffset = Vector(0, 0, 0) +SWEP.AllowQualityWeapons = false + +SWEP.Weight = 4 + +local MAT_FLESH = MAT_FLESH +local MAT_BLOODYFLESH = MAT_BLOODYFLESH +local MAT_ANTLION = MAT_ANTLION +local MAT_ALIENFLESH = MAT_ALIENFLESH + function SWEP:Initialize() - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:SetWeaponHoldType(self.HoldType) self:SetWeaponSwingHoldType(self.SwingHoldType) @@ -52,6 +56,10 @@ function SWEP:Initialize() end end +function SWEP:SetupDataTables() + self:NetworkVar("Int", 0, "PowerCombo") +end + function SWEP:SetWeaponSwingHoldType(t) local old = self.ActivityTranslate self:SetWeaponHoldType(t) @@ -61,7 +69,7 @@ function SWEP:SetWeaponSwingHoldType(t) end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() return true @@ -77,10 +85,6 @@ function SWEP:Think() self:StopSwinging() self:MeleeSwing() end - - --[[if CLIENT then - self:Anim_Think() - end]] end function SWEP:SecondaryAttack() @@ -91,7 +95,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end return self:GetNextPrimaryFire() <= CurTime() and not self:IsSwinging() end @@ -113,7 +117,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + self:SetNextAttack() if self.SwingTime == 0 then self:MeleeSwing() @@ -122,6 +126,12 @@ function SWEP:PrimaryAttack() end end +function SWEP:SetNextAttack() + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * armdelay) +end + function SWEP:Holster() if CurTime() >= self:GetSwingEnd() then if CLIENT then @@ -135,119 +145,204 @@ function SWEP:Holster() end function SWEP:StartSwinging() + local owner = self:GetOwner() + if self.StartSwingAnimation then self:SendWeaponAnim(self.StartSwingAnimation) self.IdleAnimation = CurTime() + self:SequenceDuration() end self:PlayStartSwingSound() - self:SetSwingEnd(CurTime() + self.SwingTime) + + local armdelay = owner:GetMeleeSpeedMul() + self:SetSwingEnd(CurTime() + self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay) +end + +function SWEP:DoMeleeAttackAnim() + self:GetOwner():DoAttackEvent() end function SWEP:MeleeSwing() - local owner = self.Owner + local owner = self:GetOwner() - owner:DoAttackEvent() + self:DoMeleeAttackAnim() - local filter = owner:GetMeleeFilter() + local tr = owner:CompensatedMeleeTrace(self.MeleeRange * (owner.MeleeRangeMul or 1), self.MeleeSize) - --owner:LagCompensation(true) - - local tr = owner:ClipHullMeleeTrace(self.MeleeRange, self.MeleeSize, filter) - if tr.Hit then - local damagemultiplier = (owner.BuffMuscular and owner:Team()==TEAM_HUMAN) and 1.2 or 1 - local damage = self.MeleeDamage * damagemultiplier - local hitent = tr.Entity - local hitflesh = tr.MatType == MAT_FLESH or tr.MatType == MAT_BLOODYFLESH or tr.MatType == MAT_ANTLION or tr.MatType == MAT_ALIENFLESH - - if self.HitAnim then - self:SendWeaponAnim(self.HitAnim) - end - self.IdleAnimation = CurTime() + self:SequenceDuration() - - if hitflesh then - util.Decal(self.BloodDecal, tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) - self:PlayHitFleshSound() - if SERVER and not (hitent:IsValid() and hitent:IsPlayer() and hitent:Team() == owner:Team()) then - util.Blood(tr.HitPos, math.Rand(damage * 0.25, damage * 0.6), (tr.HitPos - owner:GetShootPos()):GetNormalized(), math.Rand(damage * 6, damage * 12), true) - end - if not self.NoHitSoundFlesh then - self:PlayHitSound() - end - else - util.Decal(self.HitDecal, tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) - self:PlayHitSound() - end - - if self.OnMeleeHit and self:OnMeleeHit(hitent, hitflesh, tr) then - --owner:LagCompensation(false) - return - end - - if SERVER and hitent:IsValid() then - damage = self.MeleeDamage * damagemultiplier - - if hitent:GetClass() == "func_breakable_surf" then - hitent:Fire("break", "", 0.01) -- Delayed because no way to do prediction. - else - local dmginfo = DamageInfo() - dmginfo:SetDamagePosition(tr.HitPos) - dmginfo:SetDamage(damage) - dmginfo:SetAttacker(owner) - dmginfo:SetInflictor(self) - dmginfo:SetDamageType(self.DamageType) - if hitent:IsPlayer() then - hitent:MeleeViewPunch(damage) - if hitent:IsHeadcrab() then - damage = damage * 2 - dmginfo:SetDamage(damage) - end - gamemode.Call("ScalePlayerDamage", hitent, tr.HitGroup, dmginfo) - - if self.MeleeKnockBack > 0 then - hitent:ThrowFromPositionSetZ(tr.HitPos, self.MeleeKnockBack, nil, true) - end - if hitent:IsPlayer() and hitent:WouldDieFrom(damage, dmginfo:GetDamagePosition()) then - dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 400 * owner:GetAimVector()) - end - end - - if hitent:IsPlayer() then - hitent:TakeDamageInfo(dmginfo) - else - -- Again, no way to do prediction. - timer.Simple(0, function() - if hitent:IsValid() then - -- Workaround for propbroken not calling. - local h = hitent:Health() - - hitent:TakeDamageInfo(dmginfo) - - if hitent:Health() <= 0 and h ~= hitent:Health() then - gamemode.Call("PropBroken", hitent, owner) - end - - local phys = hitent:GetPhysicsObject() - if hitent:GetMoveType() == MOVETYPE_VPHYSICS and phys:IsValid() and phys:IsMoveable() then - hitent:SetPhysicsAttacker(owner) - end - end - end) - end - end - end - - if self.PostOnMeleeHit then self:PostOnMeleeHit(hitent, hitflesh, tr) end - else + if not tr.Hit then if self.MissAnim then self:SendWeaponAnim(self.MissAnim) end self.IdleAnimation = CurTime() + self:SequenceDuration() self:PlaySwingSound() + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + if self.PostOnMeleeMiss then self:PostOnMeleeMiss(tr) end + + return end - --owner:LagCompensation(false) + local damagemultiplier = owner:Team() == TEAM_HUMAN and owner.MeleeDamageMultiplier or 1 --(owner.BuffMuscular and owner:Team()==TEAM_HUMAN) and 1.2 or 1 + if owner:IsSkillActive(SKILL_LASTSTAND) then + if owner:Health() <= owner:GetMaxHealth() * 0.25 then + damagemultiplier = damagemultiplier * 2 + else + damagemultiplier = damagemultiplier * 0.85 + end + end + + local hitent = tr.Entity + local hitflesh = tr.MatType == MAT_FLESH or tr.MatType == MAT_BLOODYFLESH or tr.MatType == MAT_ANTLION or tr.MatType == MAT_ALIENFLESH + + if self.HitAnim then + self:SendWeaponAnim(self.HitAnim) + end + self.IdleAnimation = CurTime() + self:SequenceDuration() + + if hitflesh then + util.Decal(self.BloodDecal, tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) + self:PlayHitFleshSound() + + if SERVER then + self:ServerHitFleshEffects(hitent, tr, damagemultiplier) + end + + if not self.NoHitSoundFlesh then + self:PlayHitSound() + end + else + --util.Decal(self.HitDecal, tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) + self:PlayHitSound() + end + + if self.OnMeleeHit and self:OnMeleeHit(hitent, hitflesh, tr) then + return + end + + if SERVER then + self:ServerMeleeHitEntity(tr, hitent, damagemultiplier) + end + + self:MeleeHitEntity(tr, hitent, damagemultiplier) + + if self.PostOnMeleeHit then self:PostOnMeleeHit(hitent, hitflesh, tr) end + + if SERVER then + self:ServerMeleePostHitEntity(tr, hitent, damagemultiplier) + end +end + +function SWEP:PlayerHitUtil(owner, damage, hitent, dmginfo) + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(self:GetPowerCombo() + 1) + + damage = damage + damage * (owner.MeleePowerAttackMul - 1) * (self:GetPowerCombo()/4) + dmginfo:SetDamage(damage) + + if self:GetPowerCombo() >= 4 then + self:SetPowerCombo(0) + if SERVER then + local pitch = math.Clamp(math.random(90, 110) + 15 * (1 - damage/45), 50 , 200) + owner:EmitSound("npc/strider/strider_skewer1.wav", 75, pitch) + end + end + end + + hitent:MeleeViewPunch(damage * (self.MeleeViewPunchScale or 1)) + if hitent:IsHeadcrab() then + damage = damage * 2 + dmginfo:SetDamage(damage) + end +end + +function SWEP:PostHitUtil(owner, hitent, dmginfo, tr, vel) + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + hitent:DispatchTraceAttack(dmginfo, tr, owner:GetAimVector()) + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + if vel then + hitent:SetLocalVelocity(vel) + end + + -- Perform our own knockback vs. players + if hitent:IsPlayer() then + local knockback = self.MeleeKnockBack * (owner.MeleeKnockbackMultiplier or 1) + if knockback > 0 then + hitent:ThrowFromPositionSetZ(tr.StartPos, knockback, nil, true) + end + + if owner.MeleeLegDamageAdd and owner.MeleeLegDamageAdd > 0 then + hitent:AddLegDamage(owner.MeleeLegDamageAdd) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetStart(tr.StartPos) + effectdata:SetNormal(tr.HitNormal) + util.Effect("RagdollImpact", effectdata) + if not tr.HitSky then + effectdata:SetSurfaceProp(tr.SurfaceProps) + effectdata:SetDamageType(self.DamageType) + effectdata:SetHitBox(tr.HitBox) + effectdata:SetEntity(hitent) + util.Effect("Impact", effectdata) + end + + if self.MeleeFlagged then self.IsMelee = nil end +end + +function SWEP:MeleeHitEntity(tr, hitent, damagemultiplier) + if not IsFirstTimePredicted() then return end + + if self.MeleeFlagged then self.IsMelee = true end + + local owner = self:GetOwner() + + if SERVER and hitent:IsPlayer() and not self.NoGlassWeapons and owner:IsSkillActive(SKILL_GLASSWEAPONS) then + damagemultiplier = damagemultiplier * 3.5 + owner.GlassWeaponShouldBreak = not owner.GlassWeaponShouldBreak + end + + local damage = self.MeleeDamage * damagemultiplier + + local dmginfo = DamageInfo() + dmginfo:SetDamagePosition(tr.HitPos) + dmginfo:SetAttacker(owner) + dmginfo:SetInflictor(self) + dmginfo:SetDamageType(self.DamageType) + dmginfo:SetDamage(damage) + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 50 * owner:GetAimVector()) + + local vel + if hitent:IsPlayer() then + self:PlayerHitUtil(owner, damage, hitent, dmginfo) + + if SERVER then + hitent:SetLastHitGroup(tr.HitGroup) + if tr.HitGroup == HITGROUP_HEAD then + hitent:SetWasHitInHead() + end + + if hitent:WouldDieFrom(damage, tr.HitPos) then + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 400 * owner:GetAimVector()) + end + end + + vel = hitent:GetVelocity() + else + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + + self:PostHitUtil(owner, hitent, dmginfo, tr, vel) end function SWEP:StopSwinging() @@ -282,14 +377,16 @@ local ActIndex = { [ "melee2" ] = ACT_HL2MP_IDLE_MELEE2, [ "passive" ] = ACT_HL2MP_IDLE_PASSIVE, [ "knife" ] = ACT_HL2MP_IDLE_KNIFE, - [ "duel" ] = ACT_HL2MP_IDLE_DUEL + [ "duel" ] = ACT_HL2MP_IDLE_DUEL, + [ "revolver" ] = ACT_HL2MP_IDLE_REVOLVER, + [ "camera" ] = ACT_HL2MP_IDLE_CAMERA } function SWEP:SetWeaponHoldType( t ) t = string.lower( t ) local index = ActIndex[ t ] - + if ( index == nil ) then Msg( "SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set! (defaulting to normal)\n" ) t = "normal" @@ -310,19 +407,19 @@ function SWEP:SetWeaponHoldType( t ) self.ActivityTranslate [ ACT_RANGE_ATTACK1 ] = index+8 self.ActivityTranslate [ ACT_MP_SWIM_IDLE ] = index+8 self.ActivityTranslate [ ACT_MP_SWIM ] = index+9 - + -- "normal" jump animation doesn't exist if t == "normal" then self.ActivityTranslate [ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM end - + -- these two aren't defined in ACTs for whatever reason - if t == "knife" || t == "melee2" then + if t == "knife" or t == "melee2" then self.ActivityTranslate [ ACT_MP_CROUCH_IDLE ] = nil end end -SWEP:SetWeaponHoldType("pistol") +SWEP:SetWeaponHoldType("melee") function SWEP:TranslateActivity( act ) if self:GetSwingEnd() ~= 0 and self.ActivityTranslateSwing[act] then diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/cl_init.lua new file mode 100644 index 0000000..6962303 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false + +function SWEP:ShootBullets(damage, numshots, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + if self.Recoil > 0 then + local r = math.Rand(0.8, 1) + owner:ViewPunch(Angle(r * -self.Recoil, 0, (1 - r) * (math.random(2) == 1 and -1 or 1) * self.Recoil)) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/init.lua new file mode 100644 index 0000000..496d135 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/init.lua @@ -0,0 +1,55 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow" + +function SWEP:EntModify(ent) +end + +function SWEP:PhysModify(physobj) +end + +function SWEP:ShootBullets(damage, numshots, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + if self.Recoil > 0 then + local r = math.Rand(0.8, 1) + owner:ViewPunch(Angle(r * -self.Recoil, 0, (1 - r) * (math.random(2) == 1 and -1 or 1) * self.Recoil)) + end + + local ssfw, ssup + if self.SameSpread then + ssfw, ssup = math.Rand(0, 360), math.Rand(-cone, cone) + end + + for i = 0,numshots-1 do + local ent = ents.Create(self.Primary.Projectile) + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(owner:EyeAngles()) + ent:SetOwner(owner) + ent.ProjDamage = self.Primary.Damage * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + ent.ShotMarker = i + ent.Team = owner:Team() + + self:EntModify(ent) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Forward(), ssfw or math.Rand(0, 360)) + angle:RotateAroundAxis(angle:Up(), ssup or math.Rand(-cone, cone)) + + ent.PreVel = angle:Forward() * self.Primary.ProjVelocity * (owner.ProjectileSpeedMul or 1) + phys:SetVelocityInstantaneous(ent.PreVel) + + self:PhysModify(phys) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/shared.lua new file mode 100644 index 0000000..cb91429 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseproj/shared.lua @@ -0,0 +1,12 @@ +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.ConeMax = 2 +SWEP.ConeMin = 1 + +SWEP.Primary.ProjVelocity = 1400 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseshotgun.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseshotgun.lua new file mode 100644 index 0000000..a05539d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_baseshotgun.lua @@ -0,0 +1,154 @@ +AddCSLuaFile() + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" +SWEP.UseHands = true + +SWEP.ReloadDelay = 0.45 + +SWEP.Primary.Sound = Sound("Weapon_M3.Single") +SWEP.Primary.Damage = 8 +SWEP.Primary.NumShots = 6 +SWEP.Primary.Delay = 1 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 7 +SWEP.ConeMin = 5.25 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.ReloadActivity = ACT_VM_RELOAD +SWEP.PumpActivity = ACT_SHOTGUN_RELOAD_FINISH +SWEP.ReloadStartActivity = ACT_SHOTGUN_RELOAD_START +SWEP.ReloadStartGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() + if not self:IsReloading() and self:CanReload() then + self:StartReloading() + end +end + +function SWEP:Think() + if self:ShouldDoReload() then + self:DoReload() + end + + self:NextThink(CurTime()) + return true +end + +function SWEP:StartReloading() + local delay = self:GetReloadDelay() + self:SetDTFloat(3, CurTime() + delay) + self:SetDTBool(2, true) -- force one shell load + self:SetNextPrimaryFire(CurTime() + math.max(self.Primary.Delay, delay)) + + self:GetOwner():DoReloadEvent() + + if self.ReloadStartActivity then + self:SendWeaponAnim(self.ReloadStartActivity) + self:ProcessReloadAnim() + end +end + +function SWEP:StopReloading() + self:SetDTFloat(3, 0) + self:SetDTBool(2, false) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * 0.75) + + -- do the pump stuff if we need to + if self:Clip1() > 0 then + if self.PumpSound then + self:EmitSound(self.PumpSound) + end + if self.PumpActivity then + self:SendWeaponAnim(self.PumpActivity) + self:ProcessReloadAnim() + end + end +end + +function SWEP:DoReload() + if not self:CanReload() or self:GetOwner():KeyDown(IN_ATTACK) or not self:GetDTBool(2) and not self:GetOwner():KeyDown(IN_RELOAD) then + self:StopReloading() + return + end + + local delay = self:GetReloadDelay() + if self.ReloadActivity then + self:SendWeaponAnim(self.ReloadActivity) + self:ProcessReloadAnim() + end + if self.ReloadSound then + self:EmitSound(self.ReloadSound) + end + + self:GetOwner():RemoveAmmo(1, self.Primary.Ammo, false) + self:SetClip1(self:Clip1() + 1) + + self:SetDTBool(2, false) + -- We always wanna call the reload function one more time. Forces a pump to take place. + self:SetDTFloat(3, CurTime() + delay) + + self:SetNextPrimaryFire(CurTime() + math.max(self.Primary.Delay, delay)) +end + +function SWEP:ProcessReloadAnim() + local reloadspeed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + if not self.DontScaleReloadSpeed then + self:GetOwner():GetViewModel():SetPlaybackRate(reloadspeed) + end +end + +function SWEP:GetReloadDelay() + local reloadspeed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + return self.ReloadDelay / reloadspeed +end + +function SWEP:ShouldDoReload() + return self:GetDTFloat(3) > 0 and CurTime() >= self:GetDTFloat(3) +end + +function SWEP:IsReloading() + return self:GetDTFloat(3) > 0 +end + +function SWEP:CanReload() + return self:Clip1() < self.Primary.ClipSize and 0 < self:GetOwner():GetAmmoCount(self.Primary.Ammo) +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:Clip1() < self.RequiredClip then + self:EmitSound("Weapon_Shotgun.Empty") + self:SetNextPrimaryFire(CurTime() + 0.25) + + return false + end + + if self:IsReloading() then + self:StopReloading() + return false + end + + return self:GetNextPrimaryFire() <= CurTime() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/cl_init.lua new file mode 100644 index 0000000..81e0321 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/cl_init.lua @@ -0,0 +1,67 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:ShootBullets() + local owner = self:GetOwner() + self:SendWeaponAnim(ACT_VM_THROW) + owner:DoAttackEvent() +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end + +local colBG = Color(16, 16, 16, 90) +local colWhite = Color(220, 220, 220, 230) + +function SWEP:DrawHUD() + self:DrawWeaponCrosshair() + + if not GAMEMODE:ShouldDraw2DWeaponHUD() then return end + + local screenscale = BetterScreenScale() + + local wid, hei = 180 * screenscale, 64 * screenscale + local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 + local clip = self:GetPrimaryAmmoCount() + + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleTextBlurry(clip, clip >= 100 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) +end + +function SWEP:PostDrawViewModel(vm) + if GAMEMODE.WeaponHUDMode == 1 then return end + + local bone = vm:LookupBone("ValveBiped.Bip01_R_Hand") + if not bone then return end + + local m = vm:GetBoneMatrix(bone) + if not m then return end + + local pos, ang = m:GetTranslation(), m:GetAngles() + + pos = pos + ang:Up() * -3 + + local time = CurTime() + ang:RotateAroundAxis(ang:Right(), math.sin(time * math.pi) * 20) + ang:RotateAroundAxis(ang:Up(), time * 180) + + pos = pos + ang:Forward() * 5 + + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 270) + + local wid, hei = 144, 144 + local x, y = wid * -0.5, hei * -0.5 + local clip = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, 0.01) + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleText(clip, "ZS3D2DFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/init.lua new file mode 100644 index 0000000..d4a4da5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/init.lua @@ -0,0 +1,33 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_zsgrenade" +SWEP.ThrowAngVel = 5 +SWEP.ThrowVel = 800 + +function SWEP:ShootBullets(damage, numshots, cone) + local owner = self:GetOwner() + self:SendWeaponAnim(ACT_VM_THROW) + owner:DoAttackEvent() + + local ent = ents.Create(self.ThrownProjectile) + if ent:IsValid() then + local pos = owner:GetShootPos() + pos.z = pos.z - (damage and 16 or 0) + ent:SetPos(pos) + ent:SetOwner(owner) + ent:Spawn() + + ent.GrenadeDamage = self.GrenadeDamage + ent.GrenadeRadius = self.GrenadeRadius + ent.Team = owner:Team() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:AddAngleVelocity(VectorRand() * self.ThrowAngVel) + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * self.ThrowVel * (damage and 0.4 or 1) * (owner.ObjectThrowStrengthMul or 1)) + end + + ent:SetPhysicsAttacker(owner) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/shared.lua new file mode 100644 index 0000000..d0a413f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basethrown/shared.lua @@ -0,0 +1,101 @@ +SWEP.Base = "weapon_zs_base" + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/weapons/w_grenade.mdl" +SWEP.UseHands = true + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "grenade" +SWEP.Primary.Delay = 1.25 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Sound = Sound("WeaponFrag.Throw") + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Ammo = "dummy" + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.AllowQualityWeapons = false + +function SWEP:Initialize() + self:SetWeaponHoldType("grenade") + GAMEMODE:DoChangeDeploySpeed(self) + + if CLIENT then + self:Anim_Initialize() + end +end + +function SWEP:Precache() + util.PrecacheSound("WeaponFrag.Throw") +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:PrimaryAttack(secondary) + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:EmitSound(self.Primary.Sound) + self:TakePrimaryAmmo(1) + self:ShootBullets(secondary) + self.NextDeploy = CurTime() + 1 +end + +function SWEP:SecondaryAttack() + self:PrimaryAttack(true) +end + +function SWEP:CanSecondaryAttack() + return false +end + +function SWEP:Reload() + return false +end + +function SWEP:Deploy() + GAMEMODE:WeaponDeployed(self:GetOwner(), self) + + if self:GetPrimaryAmmoCount() <= 0 then + self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) + end + + return true +end + +function SWEP:Holster() + self.NextDeploy = nil + return true +end + +function SWEP:Think() + if self.NextDeploy and self.NextDeploy <= CurTime() then + self.NextDeploy = nil + + if 0 < self:GetPrimaryAmmoCount() then + self:SendWeaponAnim(ACT_VM_DRAW) + else + self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) + + if SERVER then + self:GetOwner():StripWeapon(self:GetClass()) + end + end + elseif SERVER and self:GetPrimaryAmmoCount() <= 0 then + self:GetOwner():StripWeapon(self:GetClass()) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/cl_init.lua new file mode 100644 index 0000000..395d18b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/cl_init.lua @@ -0,0 +1,3 @@ +INC_CLIENT() + +SWEP.Slot = 5 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/init.lua new file mode 100644 index 0000000..44caab1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/init.lua @@ -0,0 +1,44 @@ +INC_SERVER() +DEFINE_BASECLASS("weapon_zs_basemelee") + +SWEP.TrinketStatus = "" + +function SWEP:Initialize() + BaseClass.Initialize(self) + + timer.Simple(0, function() + if IsValid(self) then + if self.TrinketStatus ~= "" then + self:CreateTrinketStatus() + end + end + end) +end + +function SWEP:Deploy() + BaseClass.Deploy(self) + + if self.TrinketStatus ~= "" then + self:CreateTrinketStatus() + end + + return true +end + +function SWEP:CreateTrinketStatus() + local owner = self:GetOwner() + if not owner:IsValid() then return end + + local status = self.TrinketStatus + for _, ent in pairs(ents.FindByClass(status)) do + if ent:GetOwner() == owner then return end + end + + local ent = ents.Create(status) + if ent:IsValid() then + ent:SetPos(owner:EyePos()) + ent:SetParent(owner) + ent:SetOwner(owner) + ent:Spawn() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/shared.lua new file mode 100644 index 0000000..6c6b783 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basetrinket/shared.lua @@ -0,0 +1,38 @@ +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/weapons/w_grenade.mdl" +SWEP.UseHands = true + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.IsMelee = false + +SWEP.HoldType = "slam" + +SWEP.DroppedColorModulation = Color(1, 0.5, 0) + +SWEP.NoDismantle = true +SWEP.Undroppable = true +SWEP.NoPickupNotification = true +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + +function SWEP:PrimaryAttack() +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_battleaxe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_battleaxe.lua index e6182a3..6e6f89f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_battleaxe.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_battleaxe.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Battleaxe' Handgun" - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Battleaxe' Handgun" +SWEP.Description = "An accurate, reliable pistol with considerable damage." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -22,7 +24,7 @@ SWEP.WorldModel = "models/weapons/w_pist_usp.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_USP.Single") -SWEP.Primary.Damage = 22 +SWEP.Primary.Damage = 24 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.2 @@ -33,5 +35,8 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.IronSightsPos = Vector(-5.9, 12, 2.3) -SWEP.ConeMax = 0.05 -SWEP.ConeMin = 0.015 +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 0.75 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.0175, 1) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blareduct.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blareduct.lua new file mode 100644 index 0000000..489b613 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blareduct.lua @@ -0,0 +1,91 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Blareduct' Zip Gun" +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.HUD3DBone = "ValveBiped.Gun" + SWEP.HUD3DPos = Vector(1.65, 0, -8) + SWEP.HUD3DScale = 0.025 + + SWEP.ViewModelFlip = false + + SWEP.VElements = { + ["pipe++"] = { type = "Model", model = "models/props_vehicles/carparts_axel01a.mdl", bone = "ValveBiped.Gun", rel = "pipe", pos = Vector(0.699, 0, 0), angle = Angle(0, 0, 90), size = Vector(0.15, 0.4, 0.2), color = Color(105, 115, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["pipe+"] = { type = "Model", model = "models/props_vehicles/carparts_muffler01a.mdl", bone = "ValveBiped.Gun", rel = "pipe", pos = Vector(1, -0.201, -15), angle = Angle(90, -90, 0), size = Vector(0.2, 0.3, 0.25), color = Color(105, 115, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["pipe+++"] = { type = "Model", model = "models/props_vehicles/carparts_axel01a.mdl", bone = "ValveBiped.Gun", rel = "pipe", pos = Vector(0, 0, -10), angle = Angle(0, 0, 90), size = Vector(0.25, 0.3, 0.15), color = Color(77, 77, 82, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["pipe"] = { type = "Model", model = "models/props_canal/mattpipe.mdl", bone = "ValveBiped.Gun", rel = "", pos = Vector(0, 0.5, 7), angle = Angle(0, -90, 0), size = Vector(1, 1, 0.899), color = Color(65, 69, 84, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["pipe++"] = { type = "Model", model = "models/props_vehicles/carparts_axel01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pipe", pos = Vector(0.699, 0, 0), angle = Angle(0, 0, 90), size = Vector(0.15, 0.4, 0.2), color = Color(105, 115, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["pipe+"] = { type = "Model", model = "models/props_vehicles/carparts_muffler01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pipe", pos = Vector(1, -0.201, -15), angle = Angle(90, -90, 0), size = Vector(0.2, 0.3, 0.25), color = Color(105, 115, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["pipe+++"] = { type = "Model", model = "models/props_vehicles/carparts_axel01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pipe", pos = Vector(0, 0, -10), angle = Angle(0, 0, 90), size = Vector(0.25, 0.3, 0.15), color = Color(77, 77, 82, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["pipe"] = { type = "Model", model = "models/props_canal/mattpipe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(19, 1, -5), angle = Angle(85.324, 0, 180), size = Vector(1, 1, 0.899), color = Color(65, 69, 84, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_baseshotgun" +DEFINE_BASECLASS("weapon_zs_baseshotgun") + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" +SWEP.UseHands = true + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Sound = Sound("weapons/shotgun/shotgun_dbl_fire.wav") +SWEP.Primary.Damage = 7.7625 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Delay = 0.75 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "buckshot" +SWEP.ReloadSound = Sound("weapons/aug/aug_boltslap.wav") +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ReloadSpeed = 0.45 +SWEP.ReloadDelay = 0.45 + +SWEP.Recoil = 70 + +SWEP.FireAnimSpeed = 0.5 + +SWEP.ConeMax = 8 +SWEP.ConeMin = 7 + +SWEP.WalkSpeed = SPEED_NORMAL + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.19, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RECOIL, -32.5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -1) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 75, math.random(187, 193), 0.7) + self:EmitSound("weapons/shotgun/shotgun_fire6.wav", 75, math.random(102, 148), 0.6, CHAN_WEAPON + 20) +end + +function SWEP:SecondaryAttack() +end + +if not CLIENT then return end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:IsReloading() then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 0.5) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 0.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -35 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua index c12eddb..1422f16 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua @@ -1,10 +1,11 @@ AddCSLuaFile() +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.PrintName = "'Blaster' Shotgun" +SWEP.Description = "A basic shotgun that can deal significant amounts of damage at close range." + if CLIENT then - SWEP.PrintName = "'Blaster' Shotgun" - SWEP.Slot = 3 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.HUD3DPos = Vector(4, -3.5, -1.2) @@ -13,18 +14,17 @@ if CLIENT then SWEP.HUD3DBone = "SS.Grip.Dummy" end -SWEP.Base = "weapon_zs_base" - SWEP.HoldType = "shotgun" SWEP.ViewModel = "models/weapons/v_supershorty/v_supershorty.mdl" SWEP.WorldModel = "models/weapons/w_supershorty.mdl" +SWEP.UseHands = false SWEP.ReloadDelay = 0.4 -SWEP.Primary.Sound = Sound("Weapon_Shotgun.Single") -SWEP.Primary.Damage = 12 -SWEP.Primary.NumShots = 7 +SWEP.Primary.Sound = Sound("Weapon_Shotgun.NPC_Single") +SWEP.Primary.Damage = 8.325 +SWEP.Primary.NumShots = 8 SWEP.Primary.Delay = 0.8 SWEP.Primary.ClipSize = 5 @@ -32,78 +32,36 @@ SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "buckshot" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.18 -SWEP.ConeMin = 0.155 +SWEP.ConeMax = 8.75 +SWEP.ConeMin = 5 SWEP.WalkSpeed = SPEED_SLOWER -SWEP.reloadtimer = 0 -SWEP.nextreloadfinish = 0 +SWEP.PumpSound = Sound("Weapon_M3.Pump") +SWEP.ReloadSound = Sound("Weapon_Shotgun.Reload") -function SWEP:Reload() - if self.reloading then return end +SWEP.PumpActivity = ACT_SHOTGUN_PUMP - if self:Clip1() < self.Primary.ClipSize and 0 < self.Owner:GetAmmoCount(self.Primary.Ammo) then - self:SetNextPrimaryFire(CurTime() + self.ReloadDelay) - self.reloading = true - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RELOAD_SHOTGUN) - end +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Blaster' Slug Gun", "Single accurate slug round, less total damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 5.5 + wept.Primary.NumShots = 1 + wept.ConeMin = wept.ConeMin * 0.15 + wept.ConeMax = wept.ConeMax * 0.3 +end) - self:SetIronsights(false) -end +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed) -function SWEP:Think() - if self.reloading and self.reloadtimer < CurTime() then - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_VM_RELOAD) + timer.Simple(0.15, function() + if IsValid(self) then + self:SendWeaponAnim(ACT_SHOTGUN_PUMP) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed) - self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) - self:SetClip1(self:Clip1() + 1) - self:EmitSound("Weapon_Shotgun.Reload") - - if self.Primary.ClipSize <= self:Clip1() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 then - self.nextreloadfinish = CurTime() + self.ReloadDelay - self.reloading = false - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + if CLIENT and self:GetOwner() == MySelf then + self:EmitSound("weapons/m3/m3_pump.wav", 65, 100, 0.4, CHAN_AUTO) + end end - end - - local nextreloadfinish = self.nextreloadfinish - if nextreloadfinish ~= 0 and nextreloadfinish < CurTime() then - self:EmitSound("Weapon_M3.Pump") - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self.nextreloadfinish = 0 - end - - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then - self:SetIronsights(false) - end -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:Clip1() <= 0 then - self:EmitSound("Weapon_Shotgun.Empty") - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - if self.reloading then - if 0 < self:Clip1() then - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - else - self:SendWeaponAnim(ACT_VM_IDLE) - end - self.reloading = false - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - return true -end - -function SWEP:SecondaryAttack() + end) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloatedzombie.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloatedzombie.lua index f47932d..f57e1e2 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloatedzombie.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloatedzombie.lua @@ -1,15 +1,13 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Bloated Zombie" -end +SWEP.PrintName = "Bloated Zombie" SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDamage = 30 +SWEP.MeleeDamage = 31 SWEP.MeleeForceScale = 1.25 -SWEP.Primary.Delay = 1.5 +SWEP.Primary.Delay = 1.4 function SWEP:Reload() self.BaseClass.SecondaryAttack(self) @@ -20,11 +18,11 @@ function SWEP:PlayAlertSound() end function SWEP:PlayIdleSound() - self.Owner:EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") + self:GetOwner():EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") end function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/ichthyosaur/attack_growl"..math.random(3)..".wav", 70, math.Rand(145, 155)) + self:EmitSound("npc/ichthyosaur/attack_growl"..math.random(3)..".wav", 70, math.Rand(145, 155)) end if not CLIENT then return end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/cl_init.lua new file mode 100644 index 0000000..74a229d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/cl_init.lua @@ -0,0 +1,13 @@ +INC_CLIENT() + +SWEP.VElements = { + ["corrosive_nade++"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Grenade_body", rel = "corrosive_nade", pos = Vector(0, -7, 0.4), angle = Angle(0, 0, 90), size = Vector(0.75, 0.75, 1.299), color = Color(255, 59, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Grenade_body", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.119, 0.019, 0.019), color = Color(100, 100, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Grenade_body", rel = "", pos = Vector(0, 0, -1), angle = Angle(0, 0, 90), size = Vector(0.449, 0.55, 0.5), color = Color(200, 200, 200, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.119, 0.019, 0.019), color = Color(100, 100, 100, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade++"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "corrosive_nade", pos = Vector(0, -7, 0.4), angle = Angle(0, 0, 90), size = Vector(0.75, 0.75, 1.299), color = Color(255, 59, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.5, 2, 0), angle = Angle(0, 0, 99.35), size = Vector(0.449, 0.55, 0.5), color = Color(200, 200, 200, 255), surpresslightning = false, material = "models/weapons/v_smg1/v_smg1_sheet", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/init.lua new file mode 100644 index 0000000..fe8183f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_bloodshot" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/shared.lua new file mode 100644 index 0000000..db15375 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodshotbomb/shared.lua @@ -0,0 +1,11 @@ +SWEP.PrintName = "Bloodshot Bomb" +SWEP.Description = "A cloud of strength and defence boosting gas affecting all humans in the radius, also providing a small amount of blood armor." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "bloodshot" + +SWEP.MaxStock = 3 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodsucker_headcrab.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodsucker_headcrab.lua new file mode 100644 index 0000000..951829e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodsucker_headcrab.lua @@ -0,0 +1,126 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_headcrab" + +SWEP.PrintName = "Bloodsucker Headcrab" + +SWEP.PounceDamage = 6 + +SWEP.NoHitRecovery = 0.6 +SWEP.HitRecovery = 0.75 + +function SWEP:Initialize() + self:HideViewAndWorldModel() +end + +if SERVER then SWEP.NextHeal = 0 end +function SWEP:Think() + local curtime = CurTime() + local owner = self:GetOwner() + + if self:GetBurrowTime() > 0 and curtime >= self:GetBurrowTime() then + if not self:CanBurrow() then + self:SetBurrowTime(-(curtime + self.BurrowTime)) + else + owner:DrawShadow(false) + if SERVER and curtime >= self.NextHeal then + self.NextHeal = curtime + 0.333 + + if owner:GetVelocity():LengthSqr() > 8 then + local effectdata = EffectData() + effectdata:SetOrigin(owner:GetPos() % 2) + util.Effect("headcrab_dust", effectdata, true, true) + end + + if owner:Health() < owner:GetMaxHealth() then + owner:SetHealth(owner:Health() + 1) + end + end + end + elseif self:GetBurrowTime() < 0 and curtime >= -self:GetBurrowTime() then + self:SetBurrowTime(0) + elseif self:GetPouncing() then + if owner:IsOnGround() or 1 < owner:WaterLevel() then + self:SetPouncing(false) + self:SetNextPrimaryFire(curtime + self.NoHitRecovery) + else + --owner:LagCompensation(true) + + local shootpos = owner:GetShootPos() + local trace = owner:CompensatedMeleeTrace(8, 12, shootpos, owner:GetForward()) + local ent = trace.Entity + + if trace.Hit then + self:SetPouncing(false) + self:SetNextPrimaryFire(curtime + self.HitRecovery) + end + + if ent:IsValid() then + self:SetPouncing(false) + + local damage = self.PounceDamage + + local phys = ent:GetPhysicsObject() + if ent:IsPlayer() then + ent:MeleeViewPunch(damage) + if SERVER then + local nearest = ent:NearestPoint(shootpos) + util.Blood(nearest, math.Rand(damage * 0.5, damage * 0.75), (nearest - shootpos):GetNormalized(), math.Rand(damage * 5, damage * 10), true) + end + + owner:AirBrake() + elseif phys:IsValid() and phys:IsMoveable() then + phys:ApplyForceOffset(damage * 600 * owner:EyeAngles():Forward(), (ent:NearestPoint(shootpos) + ent:GetPos() * 2) / 3) + ent:SetPhysicsAttacker(owner) + end + + ent:TakeSpecialDamage(damage, self.PounceDamageType, owner, self, trace.HitPos) + if ent:IsPlayer() then + if SERVER then + self:EmitBiteSound() + ent:AddLegDamage(7.2) + end + + if owner:Health() < owner:GetMaxHealth() then + owner:SetHealth(math.min(owner:Health() + self.PounceDamage, owner:GetMaxHealth())) + end + + ent:GiveStatus("sickness", 5) + elseif SERVER then + self:EmitBiteObjectSound() + end + + owner:ViewPunch(Angle(math.Rand(-20, 20), math.Rand(-20, 20), math.Rand(-20, 20))) + elseif trace.HitWorld then + if SERVER then + self:EmitHitSound() + end + end + + --owner:LagCompensation(false) + end + end + + self:NextThink(curtime) + return true +end + +function SWEP:EmitBiteSound() + self:GetOwner():EmitSound("NPC_FastHeadcrab.Bite") + self:GetOwner():EmitSound("npc/barnacle/barnacle_gulp"..math.random(2)..".wav", 70, math.random(125, 130)) +end + +function SWEP:EmitBiteObjectSound() + self:GetOwner():EmitSound("NPC_FastHeadcrab.Bite") +end + +function SWEP:EmitIdleSound() + self:GetOwner():EmitSound("NPC_FastHeadcrab.Idle") +end + +function SWEP:EmitAttackSound() + self:GetOwner():EmitSound("npc/headcrab_fast/attack"..math.random(3)..".wav", 70, math.random(215,220)) +end + +function SWEP:Reload() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/cl_init.lua index 0887879..adea782 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/cl_init.lua @@ -1,38 +1,23 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Junk Pack" -SWEP.Description = "It's simply a pack of wooden junk kept together with some duct tape.\nVery useful for making barricades when no materials are around.\nNeeds something like a hammer and nails to keep the things in place." SWEP.ViewModelFOV = 45 SWEP.ViewModelFlip = false +SWEP.ShowWorldModel = false + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_R_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(3.332, -14.445, -21.112) } +} + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_debris/wood_board06a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 2.596, -6.753), angle = Angle(180, 66.623, -1.17), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_debris/wood_board06a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 2.596, -6.753), angle = Angle(180, 66.623, -1.17), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + SWEP.Slot = 4 -SWEP.SlotPos = 0 - -function SWEP:Deploy() - self.IdleAnimation = CurTime() + self:SequenceDuration() - - return true -end - -function SWEP:DrawWorldModel() - local owner = self.Owner - if owner:IsValid() and self:GetReplicatedAmmo() > 0 then - local id = owner:LookupAttachment("anim_attachment_RH") - if id and id > 0 then - local attch = owner:GetAttachment(id) - if attch then - cam.Start3D(EyePos() + (owner:GetPos() - attch.Pos + Vector(0, 0, 24)), EyeAngles()) - self:DrawModel() - cam.End3D() - end - end - end -end -SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel - -function SWEP:Initialize() - self:SetDeploySpeed(1.1) -end function SWEP:GetViewModelPosition(pos, ang) if self:GetPrimaryAmmoCount() <= 0 then @@ -41,7 +26,3 @@ function SWEP:GetViewModelPosition(pos, ang) return pos, ang end - -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/init.lua index f524b52..3e20b96 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/init.lua @@ -1,26 +1 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") - -function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) - - self.IdleAnimation = CurTime() + self:SequenceDuration() - - return true -end - -function SWEP:Initialize() - self.ActivityTranslate = {} - self.ActivityTranslate[ACT_HL2MP_IDLE] = ACT_HL2MP_IDLE_MELEE2 - self.ActivityTranslate[ACT_HL2MP_WALK] = ACT_HL2MP_WALK_MELEE2 - self.ActivityTranslate[ACT_HL2MP_RUN] = ACT_HL2MP_RUN_MELEE2 - self.ActivityTranslate[ACT_HL2MP_IDLE_CROUCH] = ACT_HL2MP_IDLE_CROUCH_MELEE2 - self.ActivityTranslate[ACT_HL2MP_WALK_CROUCH] = ACT_HL2MP_WALK_CROUCH_MELEE2 - self.ActivityTranslate[ACT_HL2MP_GESTURE_RANGE_ATTACK] = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2 - self.ActivityTranslate[ACT_HL2MP_GESTURE_RELOAD] = ACT_HL2MP_GESTURE_RELOAD_MELEE2 - self.ActivityTranslate[ACT_HL2MP_JUMP] = ACT_HL2MP_JUMP_MELEE2 - self.ActivityTranslate[ACT_RANGE_ATTACK1] = ACT_RANGE_ATTACK_MELEE2 - self:SetDeploySpeed(1.1) -end +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/shared.lua index 1eea9f5..000b135 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boardpack/shared.lua @@ -1,13 +1,20 @@ -SWEP.ViewModel = "models/weapons/v_aegiskit.mdl" +SWEP.Base = "weapon_zs_basemelee" + +SWEP.PrintName = "Junk Pack" +SWEP.Description = "It's simply a pack of wooden junk kept together with some duct tape.\nVery useful for making barricades when no materials are around.\nNeeds something like a hammer and nails to keep the things in place." + +SWEP.ViewModel = "models/weapons/c_aegiskit.mdl" SWEP.WorldModel = "models/props_debris/wood_board06a.mdl" +SWEP.UseHands = true SWEP.AmmoIfHas = true +SWEP.AllowEmpty = true SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "SniperRound" SWEP.Primary.Delay = 1 -SWEP.Primary.DefaultClip = 3 +SWEP.Primary.DefaultClip = 4 SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 @@ -33,6 +40,8 @@ SWEP.JunkModels = { Model("models/props_c17/furniturechair001a.mdl") } +SWEP.HoldType = "physgun" + function SWEP:SetReplicatedAmmo(count) self:SetDTInt(0, count) end @@ -50,35 +59,38 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local aimvec = self.Owner:GetAimVector() - local shootpos = self.Owner:GetShootPos() - local tr = util.TraceLine({start = shootpos, endpos = shootpos + aimvec * 32, filter = self.Owner}) + local aimvec = self:GetOwner():GetAimVector() + local shootpos = self:GetOwner():GetShootPos() + local tr = util.TraceLine({start = shootpos, endpos = shootpos + aimvec * 32, filter = self:GetOwner()}) self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(75, 80)) self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE) self.IdleAnimation = CurTime() + math.min(self.Primary.Delay, self:SequenceDuration()) if SERVER then + self:GetOwner():RestartGesture(ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE) + local ent = ents.Create("prop_physics") if ent:IsValid() then local ang = aimvec:Angle() ang:RotateAroundAxis(ang:Forward(), 90) ent:SetPos(tr.HitPos) ent:SetAngles(ang) - ent:SetModel(table.Random(self.JunkModels)) + ent:SetModel(self.JunkModels[math.random(#self.JunkModels)]) ent:Spawn() ent:SetHealth(350) ent.NoVolumeCarryCheck = true + ent.NoDisTime = CurTime() + 15 + ent.NoDisOwner = self:GetOwner() local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:SetMass(math.min(phys:GetMass(), 50)) - phys:SetVelocityInstantaneous(self.Owner:GetVelocity()) + phys:SetVelocityInstantaneous(self:GetOwner():GetVelocity()) end - ent:SetPhysicsAttacker(self.Owner) + ent:SetPhysicsAttacker(self:GetOwner()) self:TakePrimaryAmmo(1) end end @@ -91,9 +103,9 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end - if math.abs(self.Owner:GetVelocity().z) >= 256 then return false end + if math.abs(self:GetOwner():GetVelocity().z) >= 256 then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) @@ -113,17 +125,7 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end end - -function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) - - self.IdleAnimation = CurTime() + self:SequenceDuration() - - return true -end - -util.PrecacheModel("models/props_debris/wood_board04a.mdl") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/cl_init.lua index e6b3baa..77160d3 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() SWEP.PrintName = "Bone Mesh" SWEP.ViewModelFOV = 47 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/init.lua index d1e3e20..a4e0b53 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Reload() self.BaseClass.SecondaryAttack(self) @@ -9,7 +6,8 @@ end local function DoFleshThrow(pl, wep) if pl:IsValid() and pl:Alive() and wep:IsValid() then - pl:ResetSpeed() + --pl:ResetSpeed() + pl.LastRangedAttack = CurTime() local startpos = pl:GetPos() startpos.z = pl:GetShootPos().z @@ -24,14 +22,14 @@ local function DoFleshThrow(pl, wep) local phys = ent:GetPhysicsObject() if phys:IsValid() then - phys:SetVelocityInstantaneous(heading * 800) + phys:SetVelocityInstantaneous(heading * 600) phys:AddAngleVelocity(VectorRand() * 45) end end pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.random(70, 80)) - pl:RawCapLegDamage(CurTime() + 2) + --pl:RawCapLegDamage(CurTime() + 2) end end @@ -47,13 +45,13 @@ end function SWEP:SecondaryAttack() if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() then return end - local owner = self.Owner + local owner = self:GetOwner() self:SetSwingAnimTime(CurTime() + 1) - self.Owner:DoAnimationEvent(ACT_RANGE_ATTACK2) - self.Owner:EmitSound("NPC_PoisonZombie.Throw") - self.Owner:SetSpeed(1) - self:SetNextSecondaryFire(CurTime() + 4) + self:GetOwner():DoAnimationEvent(ACT_RANGE_ATTACK2) + self:GetOwner():EmitSound("NPC_PoisonZombie.Throw") + --self:GetOwner():SetSpeed(1) + self:SetNextSecondaryFire(CurTime() + 1.1) self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) timer.Simple(0.6, function() DoSwing(owner, self) end) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/shared.lua index 4076059..f16c65a 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bonemesh/shared.lua @@ -1,12 +1,11 @@ SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeReach = 48 +SWEP.MeleeReach = 52 SWEP.MeleeDelay = 0.55 -SWEP.MeleeSize = 1.5 -SWEP.MeleeDamage = 35 +SWEP.MeleeSize = 4.5 --1.5 +SWEP.MeleeDamage = 35 --28 SWEP.MeleeDamageType = DMG_SLASH SWEP.MeleeAnimationDelay = 0.05 -SWEP.FrozenWhileSwinging = true SWEP.Primary.Delay = 1.6 @@ -23,19 +22,19 @@ function SWEP:StartMoaningSound() end function SWEP:PlayHitSound() - self.Owner:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav", 75, 80) + self:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 75, 80) + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("NPC_PoisonZombie.ThrowWarn") + self:EmitSound("NPC_PoisonZombie.ThrowWarn") end function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 75, 140) + self:GetOwner():EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 75, 140) end SWEP.PlayIdleSound = SWEP.PlayAlertSound @@ -51,7 +50,3 @@ function SWEP:StartSwinging() self.BaseClass.StartSwinging(self) self:SetSwingAnimTime(CurTime() + 1) end - -function SWEP:PrimaryAttack() - if self.Owner:IsOnGround() then self.BaseClass.PrimaryAttack(self) end -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boomstick.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boomstick.lua index 8af370c..3ad3726 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boomstick.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_boomstick.lua @@ -1,137 +1,79 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Boom Stick" - SWEP.Description = "This shotgun allows you to load up to four shells in the chamber at once. Hold down reload for faster loading of each shell." - SWEP.Slot = 3 - SWEP.SlotPos = 0 +SWEP.Base = "weapon_zs_baseshotgun" +SWEP.PrintName = "Boom Stick" +SWEP.Description = "This shotgun allows you to load up to four shells in the chamber at once. Hold down reload for faster loading of each shell." + +if CLIENT then SWEP.HUD3DBone = "ValveBiped.Gun" SWEP.HUD3DPos = Vector(1.65, 0, -8) SWEP.HUD3DScale = 0.025 - + SWEP.ViewModelFlip = false end -SWEP.Base = "weapon_zs_base" - -SWEP.HoldType = "shotgun" - SWEP.ViewModel = "models/weapons/c_shotgun.mdl" SWEP.WorldModel = "models/weapons/w_shotgun.mdl" SWEP.UseHands = true SWEP.CSMuzzleFlashes = false -SWEP.ReloadDelay = 0.4 +SWEP.ReloadDelay = 0.5 SWEP.Primary.Sound = Sound("weapons/shotgun/shotgun_dbl_fire.wav") -SWEP.Primary.Recoil = 12.5 -SWEP.Primary.Damage = 36 +SWEP.Primary.Damage = 27 SWEP.Primary.NumShots = 6 -SWEP.Primary.Delay = 1.5 +SWEP.Primary.Delay = 1 + +SWEP.Recoil = 7.5 SWEP.Primary.ClipSize = 4 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "buckshot" SWEP.Primary.DefaultClip = 28 -SWEP.ConeMax = 0.23 -SWEP.ConeMin = 0.2 +SWEP.ConeMax = 11.5 +SWEP.ConeMin = 10 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 SWEP.WalkSpeed = SPEED_SLOWER +SWEP.FireAnimSpeed = 0.4 +SWEP.Knockback = 80 -function SWEP:SetIronsights() -end +SWEP.PumpActivity = ACT_SHOTGUN_PUMP +SWEP.PumpSound = Sound("Weapon_Shotgun.Special1") +SWEP.ReloadSound = Sound("Weapon_Shotgun.Reload") -SWEP.reloadtimer = 0 -SWEP.nextreloadfinish = 0 - -function SWEP:Reload() - if self.reloading then return end - - if self:GetNextReload() <= CurTime() and self:Clip1() < self.Primary.ClipSize and 0 < self.Owner:GetAmmoCount(self.Primary.Ammo) then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - self.reloading = true - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) - self.Owner:DoReloadEvent() - self:SetNextReload(CurTime() + self:SequenceDuration()) - end -end +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.07) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Lithe Stick", "Decreased damage but faster reload, more knockback and more move speed", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.75 + wept.ReloadSpeed = wept.ReloadSpeed * 1.25 + wept.Primary.Delay = wept.Primary.Delay * 0.5 + wept.Knockback = 100 + wept.WalkSpeed = SPEED_SLOW +end) function SWEP:PrimaryAttack() - if self:CanPrimaryAttack() then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - self:EmitSound(self.Primary.Sound) + if not self:CanPrimaryAttack() then return end - local clip = self:Clip1() + local owner = self:GetOwner() - self:ShootBullets(self.Primary.Damage, self.Primary.NumShots * clip, self:GetCone()) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + self:EmitSound(self.Primary.Sound) - self:TakePrimaryAmmo(clip) - self.Owner:ViewPunch(clip * 0.5 * self.Primary.Recoil * Angle(math.Rand(-0.1, -0.1), math.Rand(-0.1, 0.1), 0)) + local clip = self:Clip1() - self.Owner:SetGroundEntity(NULL) - self.Owner:SetVelocity(-80 * clip * self.Owner:GetAimVector()) + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots * clip, self:GetCone()) - self.IdleAnimation = CurTime() + self:SequenceDuration() - end -end - -function SWEP:Think() - if self.reloading and self.reloadtimer < CurTime() then - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_VM_RELOAD) - - self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) - self:SetClip1(self:Clip1() + 1) - self:EmitSound("Weapon_Shotgun.Reload") - - if self.Primary.ClipSize <= self:Clip1() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 or not self.Owner:KeyDown(IN_RELOAD) then - self.nextreloadfinish = CurTime() + self.ReloadDelay - self.reloading = false - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - end - end - - local nextreloadfinish = self.nextreloadfinish - if nextreloadfinish ~= 0 and nextreloadfinish < CurTime() then - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self:EmitSound("Weapon_Shotgun.Special1") - self.nextreloadfinish = 0 - end - - if self.IdleAnimation and self.IdleAnimation <= CurTime() then - self.IdleAnimation = nil - self:SendWeaponAnim(ACT_VM_IDLE) - end - - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then - self:SetIronsights(false) - end -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:Clip1() <= 0 then - self:EmitSound("Weapon_Shotgun.Empty") - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - if self.reloading then - if self:Clip1() < self.Primary.ClipSize then - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - else - self:SendWeaponAnim(ACT_SHOTGUN_PUMP) - self:EmitSound("Weapon_Shotgun.Special1") - end - self.reloading = false - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - return self:GetNextPrimaryFire() <= CurTime() + self:TakePrimaryAmmo(clip) + owner:ViewPunch(clip * 0.5 * self.Recoil * Angle(math.Rand(-0.1, -0.1), math.Rand(-0.1, 0.1), 0)) + + owner:SetGroundEntity(NULL) + owner:SetVelocity(-self.Knockback * clip * owner:GetAimVector()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_brassknuckles.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_brassknuckles.lua new file mode 100644 index 0000000..38e04a7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_brassknuckles.lua @@ -0,0 +1,45 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_fists" + +SWEP.PrintName = "Brass Knuckles" +SWEP.Description = "A pair of brass knuckles used to concentrate strikes from one's fists, increasing the damage done, while keeping their movement speed up." + +if CLIENT then + SWEP.ViewModelFOV = 52 + SWEP.ViewModelFlip = false + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_R_Finger2", rel = "", pos = Vector(1.129, -0.087, 0.4), angle = Angle(0, 15.421, 94.749), size = Vector(0.458, 0.349, 0.395), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_L_Finger2", rel = "", pos = Vector(1.238, 0.136, -0.399), angle = Angle(2.473, 1.322, 83.697), size = Vector(0.458, 0.349, 0.395), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.021, 1.006, 0), angle = Angle(0, -93.675, 100), size = Vector(0.458, 0.349, 0.395), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(4.085, 0.674, 0), angle = Angle(0, -99.708, 82.794), size = Vector(0.458, 0.349, 0.395), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.WalkSpeed = SPEED_FASTEST + +SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl" +SWEP.WorldModel = "models/weapons/w_grenade.mdl" + +SWEP.Weight = 4 + +SWEP.MeleeDamage = 22.5 + +SWEP.Unarmed = false + +SWEP.Undroppable = false +SWEP.NoPickupNotification = false +SWEP.NoDismantle = false + +SWEP.NoGlassWeapons = false + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.06) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/cl_init.lua new file mode 100644 index 0000000..0b5ef14 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/cl_init.lua @@ -0,0 +1,53 @@ +INC_CLIENT() + +SWEP.Slot = 5 +SWEP.SlotPos = 0 + +SWEP.ViewModelFOV = 61 +SWEP.ViewModelFlip = false + +SWEP.HUD3DBone = "base" +SWEP.HUD3DPos = Vector(5.3, 3.2, 12) +SWEP.HUD3DAng = Angle(180, 0, 0) +SWEP.HUD3DScale = 0.035 + +SWEP.VElements = { + ["gep_gun+++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "base", rel = "gep_gun", pos = Vector(18, 0.5, 4.2), angle = Angle(0, 90, 180), size = Vector(0.05, 0.037, 0.029), color = Color(89, 110, 156, 255), surpresslightning = false, material = "models/props_wasteland/prison_objects002", skin = 0, bodygroup = {} }, + ["gep_gun+++++++"] = { type = "Model", model = "models/props_wasteland/kitchen_stove002a.mdl", bone = "base", rel = "gep_gun", pos = Vector(2, 5, 2), angle = Angle(90, 0, 0), size = Vector(0.06, 0.059, 0.15), color = Color(55, 61, 75, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun++++++++"] = { type = "Model", model = "models/props_combine/combine_emitter01.mdl", bone = "base", rel = "gep_gun", pos = Vector(-5.47, 5, 1.5), angle = Angle(180, 0, 0), size = Vector(0.259, 0.08, 0.09), color = Color(46, 64, 79, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun++"] = { type = "Model", model = "models/props_wasteland/coolingtank02.mdl", bone = "base", rel = "gep_gun", pos = Vector(4.675, 1.399, -3.1), angle = Angle(50, 90, 90), size = Vector(0.04, 0.01, 0.06), color = Color(110, 125, 168, 255), surpresslightning = false, material = "models/props_wasteland/laundry_machines001", skin = 0, bodygroup = {} }, + ["gep_gun++++++"] = { type = "Model", model = "models/props_pipes/pipecluster32d_001a.mdl", bone = "base", rel = "gep_gun", pos = Vector(-5, 3, -1.5), angle = Angle(0, 90, 0), size = Vector(0.04, 0.019, 0.048), color = Color(51, 70, 127, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["gep_gun++++"] = { type = "Model", model = "models/props_c17/truss02g.mdl", bone = "base", rel = "gep_gun", pos = Vector(18, -0.1, 4.2), angle = Angle(0, 90, 180), size = Vector(0.17, 0.153, 0.2), color = Color(47, 64, 120, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gunf"] = { type = "Model", model = "models/props_trainstation/flatcar.mdl", bone = "base", rel = "gep_gun", pos = Vector(23, -1.56, 8), angle = Angle(0, 0, 90), size = Vector(0.029, 0.039, 0.06), color = Color(66, 105, 150, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "base", rel = "", pos = Vector(0, 0.3, 4.635), angle = Angle(90, 90, 0), size = Vector(0.04, 0.07, 0.023), color = Color(216, 219, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun+++++"] = { type = "Model", model = "models/props_wasteland/prison_heavydoor001a.mdl", bone = "base", rel = "gep_gun", pos = Vector(-0.7, 0.899, -2.1), angle = Angle(-30, 90, 90), size = Vector(0.2, 0.115, 0.129), color = Color(89, 105, 143, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["gep_gun+++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(18, -0.5, 4.9), angle = Angle(0, 90, 180), size = Vector(0.05, 0.037, 0.029), color = Color(89, 110, 156, 255), surpresslightning = false, material = "models/props_wasteland/prison_objects002", skin = 0, bodygroup = {} }, + ["gep_gun+++++++"] = { type = "Model", model = "models/props_wasteland/kitchen_stove002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(2, 5, 2), angle = Angle(90, 0, 0), size = Vector(0.06, 0.059, 0.15), color = Color(55, 61, 75, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun++++++++"] = { type = "Model", model = "models/props_combine/combine_emitter01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(-5.47, 5, 1.5), angle = Angle(180, 0, 0), size = Vector(0.259, 0.08, 0.09), color = Color(46, 64, 79, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun++"] = { type = "Model", model = "models/props_wasteland/coolingtank02.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(4.675, 1.399, -3.1), angle = Angle(50, 90, 90), size = Vector(0.04, 0.01, 0.06), color = Color(110, 125, 168, 255), surpresslightning = false, material = "models/props_wasteland/laundry_machines001", skin = 0, bodygroup = {} }, + ["gep_gun++++++"] = { type = "Model", model = "models/props_pipes/pipecluster32d_001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(-5, 3, -1.5), angle = Angle(0, 90, 0), size = Vector(0.04, 0.019, 0.048), color = Color(51, 70, 127, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004b", skin = 0, bodygroup = {} }, + ["gep_gun++++"] = { type = "Model", model = "models/props_c17/truss02g.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(18, -0.9, 4.9), angle = Angle(0, 90, 180), size = Vector(0.17, 0.153, 0.2), color = Color(47, 64, 120, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gunf"] = { type = "Model", model = "models/props_trainstation/flatcar.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(11.598, -1.56, 7), angle = Angle(0, 0, 90), size = Vector(0.029, 0.039, 0.06), color = Color(66, 105, 150, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(0.5, -1.5, -11), angle = Angle(0, 0, 0), size = Vector(0.05, 0.05, 0.025), color = Color(216, 219, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["gep_gun+++++"] = { type = "Model", model = "models/props_wasteland/prison_heavydoor001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "gep_gun", pos = Vector(-0.7, 0.899, -2.1), angle = Angle(-30, 90, 90), size = Vector(0.2, 0.115, 0.129), color = Color(89, 105, 143, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["base"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} + +function SWEP:PostDrawViewModel(vm) + local time = UnPredictedCurTime() + local reloaddelta = ((self:GetReloadFinish() - time) > (time - self:GetReloadStart()) and 55 or -7) * FrameTime() + + local reloadpos = self.VElements.gep_gunf.pos + reloadpos.x = math.Clamp(reloadpos.x + reloaddelta, 8.5, 23) + + self.BaseClass.PostDrawViewModel(self, vm) +end + +function SWEP:SecondaryAttack() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/init.lua new file mode 100644 index 0000000..24bcc47 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/init.lua @@ -0,0 +1,28 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_rocket" +SWEP.Primary.ProjVelocity = 900 +SWEP.Primary.ProjExplosionTaper = 0.95 + +function SWEP:EntModify(ent) + local owner = self:GetOwner() + owner.RemoteDetRocket = ent + owner:SetGroundEntity(NULL) + owner:SetVelocity(-220 * owner:GetAimVector()) + + ent.ProjTaper = self.Primary.ProjExplosionTaper + + self:SetNextSecondaryFire(CurTime() + 0.5) +end + +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() > CurTime() then return end + + for k,v in pairs(ents.FindByClass(self.Primary.Projectile)) do + if v:GetOwner() == self:GetOwner() then + v:Explode() + end + end + + self:SetNextSecondaryFire(CurTime() + 0.5) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/shared.lua new file mode 100644 index 0000000..09e81fc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_broadside/shared.lua @@ -0,0 +1,87 @@ +SWEP.PrintName = "'Broadside' Missile Launcher" +SWEP.Description = "Launches missiles that deal considerable AOE explosive damage. Right click remotely detonates them." + +SWEP.UseHands = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "rpg" + +SWEP.ViewModel = "models/weapons/c_rpg.mdl" +SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" + +SWEP.Primary.Delay = 1.2 +SWEP.Primary.ClipSize = 3 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.DefaultClip = 3 +SWEP.Primary.Damage = 107 + +SWEP.ReloadSound = Sound("vehicles/tank_readyfire1.wav") +SWEP.Primary.Sound = Sound("weapons/stinger_fire1.wav") + +SWEP.ReloadSpeed = 0.55 +SWEP.Recoil = 3 + +SWEP.ConeMin = 0.0001 +SWEP.ConeMax = 0.0001 + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_RPG +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_RPG + +SWEP.WalkSpeed = SPEED_SLOWEST * 0.85 + +SWEP.FireAnimSpeed = 0.75 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Salvo' Micro-missile Launcher", "Rapidly fires miniature missiles that use 33% ammo", function(wept) + wept.Primary.Delay = wept.Primary.Delay * 0.24 + wept.Primary.Automatic = true + wept.Recoil = 0 + wept.Primary.Damage = wept.Primary.Damage * 0.3 + wept.FireAnimSpeed = 1.1 + + wept.EmitFireSound = function(self) + self:EmitSound(self.Primary.Sound, 75, math.random(218, 223), 0.6) + self:EmitSound("weapons/grenade_launcher1.wav", 75, math.random(126, 132), 0.5, CHAN_WEAPON + 20) + end + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + ent.ProjTaper = self.Primary.ProjExplosionTaper + + local owner = self:GetOwner() + owner.RemoteDetRocket = ent + + self:SetNextSecondaryFire(CurTime() + 0.2) + end + + wept.PrimaryAttack = function(self) + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + self:EmitFireSound() + + local altuse = self:GetDTInt(10) + if altuse == 0 then + self:TakeAmmo() + end + self:SetDTInt(10, (altuse - 1) % 3) + + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + end + + wept.ConeMax = 3 + wept.ConeMin = 1.5 +end) + + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 80, math.random(118, 123), 0.8) + self:EmitSound("weapons/grenade_launcher1.wav", 80, math.random(76, 82), 0.7, CHAN_WEAPON + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulletstorm.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulletstorm.lua index 984eb56..e7f83d4 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulletstorm.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulletstorm.lua @@ -1,11 +1,12 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Bullet Storm' SMG" +SWEP.Description = "Hold right click to use the Storm firing mode: fire rate is reduced to 60% but two bullets are fired at once." +SWEP.Slot = 2 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Bullet Storm' SMG" - SWEP.Description = "Hold right click to use the Storm firing mode: fire rate is reduced to 60% but two bullets are fired at once." - SWEP.Slot = 2 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 @@ -23,7 +24,7 @@ SWEP.WorldModel = "models/weapons/w_smg_p90.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_p90.Single") -SWEP.Primary.Damage = 15.5 +SWEP.Primary.Damage = 17.5 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.07 @@ -32,53 +33,49 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.11 -SWEP.ConeMin = 0.06 +SWEP.ConeMax = 5.5 +SWEP.ConeMin = 3 SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 4 +SWEP.MaxStock = 3 + SWEP.IronSightsPos = Vector(-2, 6, 3) SWEP.IronSightsAng = Vector(0, 2, 0) -SWEP.Primary.DefaultNumShots = SWEP.Primary.NumShots -SWEP.Primary.DefaultDelay = SWEP.Primary.Delay -SWEP.Primary.IronsightsNumShots = SWEP.Primary.NumShots * 2 -SWEP.Primary.IronsightsDelay = SWEP.Primary.Delay * 1.6666 +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + local ironsights = self:GetIronsights() + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * (ironsights and 1.3333 or 1)) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage * (ironsights and 0.6666 or 1), self.Primary.NumShots * (ironsights and 2 or 1), self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end function SWEP:SetIronsights(b) if self:GetIronsights() ~= b then if b then - self.Primary.NumShots = self.Primary.IronsightsNumShots - self.Primary.Delay = self.Primary.IronsightsDelay - self:EmitSound("npc/scanner/scanner_scan4.wav", 40) else - self.Primary.NumShots = self.Primary.DefaultNumShots - self.Primary.Delay = self.Primary.DefaultDelay - self:EmitSound("npc/scanner/scanner_scan2.wav", 40) end end - self.BaseClass.SetIronsights(self, b) + BaseClass.SetIronsights(self, b) end -function SWEP:CanPrimaryAttack() - if self:GetIronsights() and self:Clip1() == 1 then - self:SetIronsights(false) - end - - return self.BaseClass.CanPrimaryAttack(self) -end - -function SWEP:TakeAmmo() - if self:GetIronsights() then - self:TakePrimaryAmmo(2) - else - self.BaseClass.TakeAmmo(self) +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then + self:SetIronsights(true) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/cl_init.lua new file mode 100644 index 0000000..50702d4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/cl_init.lua @@ -0,0 +1,122 @@ +INC_CLIENT() + +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 65 + +SWEP.HUD3DBone = "Base" +SWEP.HUD3DPos = Vector(3, -0.5, -13) +SWEP.HUD3DAng = Angle(180, 0, 0) +SWEP.HUD3DScale = 0.03 + +SWEP.VElements = { + ["barrel1+"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, 0, -2.274), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handleexternalattachment"] = { type = "Model", model = "models/xqm/coastertrack/track_guide.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "handle", pos = Vector(0.34, 0, -0.64), angle = Angle(0, 0, 0), size = Vector(0.123, 0.108, 0.193), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1+++++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, -2.057, 0.998), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/props_wasteland/panel_leverhandle001a.mdl", bone = "Base", rel = "", pos = Vector(2.502, 1.71, 0.43), angle = Angle(-90, 90.875, 0), size = Vector(0.5, 1.041, 0.903), color = Color(95, 95, 95, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["triangle++++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-22.296, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["triangle+++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-20.307, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, 2.056, 0.998), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["triangle+++++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-24.285, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["circle1+"] = { type = "Model", model = "models/props_citizen_tech/steamengine001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "handle", pos = Vector(9.253, -1.787, -0.245), angle = Angle(0, 180, 0), size = Vector(0.052, 0.1, 0.1), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, 0, 2.216), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["ammobox"] = { type = "Model", model = "models/Items/ammocrate_smg1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "handle", pos = Vector(9.486, -0.033, -6.211), angle = Angle(0, 90, 0), size = Vector(0.18, 0.174, 0.224), color = Color(122, 125, 166, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["triangle++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-11.82, 0, 0), angle = Angle(180, 180, 0), size = Vector(2.15, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["circle1"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "handle", pos = Vector(0.708, 0, 0), angle = Angle(0, 0, 0), size = Vector(2.135, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1+++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, 2.056, -1.323), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1++++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "circle1", pos = Vector(-14.094, -2.057, -1.323), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["secondhandle"] = { type = "Model", model = "models/props_c17/TrapPropeller_Lever.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "handle", pos = Vector(13.623, 0, 3.605), angle = Angle(0, 90, 90), size = Vector(0.842, 0.598, 1.07), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["barrel1+"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, 0, 2.216), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handleexternalattachment"] = { type = "Model", model = "models/xqm/coastertrack/track_guide.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "handle", pos = Vector(0.34, 0, -0.64), angle = Angle(0, 0, 0), size = Vector(0.123, 0.108, 0.193), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["triangle+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-11.82, 0, 0), angle = Angle(180, 180, 0), size = Vector(2.15, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/props_wasteland/panel_leverhandle001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(16.549, 0.56, 4.052), angle = Angle(177.938, 3.655, 0), size = Vector(0.5, 1.041, 0.903), color = Color(95, 95, 95, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel1++++++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, -2.057, 0.998), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["triangle+++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-22.296, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["secondhandle"] = { type = "Model", model = "models/props_c17/TrapPropeller_Lever.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "handle", pos = Vector(13.623, 0, 3.605), angle = Angle(0, 90, 90), size = Vector(0.842, 0.598, 1.07), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, 0, -2.274), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["circle1+"] = { type = "Model", model = "models/props_citizen_tech/steamengine001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "handle", pos = Vector(9.253, -1.787, -0.245), angle = Angle(0, 180, 0), size = Vector(0.052, 0.1, 0.1), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["circle1"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "handle", pos = Vector(0.708, 0, 0), angle = Angle(0, 0, 0), size = Vector(2.135, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["ammobox"] = { type = "Model", model = "models/Items/ammocrate_smg1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "handle", pos = Vector(9.486, -0.002, -6.052), angle = Angle(0, 90, 0), size = Vector(0.187, 0.174, 0.224), color = Color(122, 125, 166, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["triangle++++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-24.285, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["triangle++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-20.307, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.949, 0.143, 0.143), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1+++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, 2.056, 0.998), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1++++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, 2.056, -1.323), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["barrel1+++++"] = { type = "Model", model = "models/mechanics/wheels/wheel_rugged_24.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "circle1", pos = Vector(-14.094, -2.057, -1.323), angle = Angle(90, 0, 0), size = Vector(0.054, 0.054, 3.535), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_L_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(1, 0, 9), angle = Angle(0, 0, 0) }, + ["Base"] = { scale = Vector(1, 1, 1), pos = Vector(-12.412, -2.212, -0.42), angle = Angle(0, 0, 0) } +} + +SWEP.LastVel = 0 + +SWEP.IronSightsPos = Vector(1.24, 0, 2.359) +SWEP.IronSightsAng = Vector(0, 0, 0) + +function SWEP:Think() + self:CheckSpool() +end + +local colBG = Color(16, 16, 16, 90) +local colRed = Color(220, 0, 0, 230) +local colWhite = Color(220, 220, 220, 230) + +function SWEP:Draw2DHUD() + local screenscale = BetterScreenScale() + + local wid, hei = 180 * screenscale, 64 * screenscale + local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 + local spare = self:GetPrimaryAmmoCount() + + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + + local rotators = self.VElements["circle1"].angle + local vel = Lerp(0.01, self.LastVel, self:GetSpool() * FrameTime() * 2000) + rotators.r = rotators.r + vel + + self.LastVel = vel +end + +function SWEP:Draw3DHUD(vm, pos, ang) + local wid, hei = 180, 64 + local x, y = wid * -0.6, hei * -0.5 + local spare = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + draw.RoundedBoxEx(32, x, y, wid, hei, colBG, true, false, true, false) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + local Offset = self.IronSightsPos + if self.IronSightsAng then + ang = Angle(ang.p, ang.y, ang.r) + ang:RotateAroundAxis(ang:Right(), self.IronSightsAng.x) + ang:RotateAroundAxis(ang:Up(), self.IronSightsAng.y) + ang:RotateAroundAxis(ang:Forward(), self.IronSightsAng.z) + end + + pos = pos + Offset.x * ang:Right() + Offset.y * ang:Forward() + Offset.z * ang:Up() + + if not self:GetSpooling() then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.5) + end + + if ghostlerp > 0 then + pos = pos - 35.5 * ghostlerp * ang:Up() + ang:RotateAroundAxis(ang:Right(), 70 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/init.lua new file mode 100644 index 0000000..2346d97 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function SWEP:Think() + self:CheckSpool() + + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/shared.lua new file mode 100644 index 0000000..94f2f7f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulwark/shared.lua @@ -0,0 +1,176 @@ +SWEP.PrintName = "'Bulwark' Minigun" +SWEP.Description = "Incredibly heavy duty minigun. Takes time to spool. Hold right click to spool the gun without firing." + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_physcannon.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.Primary.Damage = 24 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.22 + +SWEP.Primary.ClipSize = 150 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Secondary.Automatic = true + +SWEP.ConeMax = 6.15 +SWEP.ConeMin = 5.25 + +SWEP.Recoil = 0.5 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.769) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.656) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Citadel' Minicannon", "Uses 3 ammo per shot, shoots slower, but more damage and accuracy", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 2.5 + wept.ConeMin = wept.ConeMin * 0.5 + wept.ConeMax = wept.ConeMax * 0.5 + wept.Primary.Delay = wept.Primary.Delay * 2.65 + wept.Recoil = 4 + + wept.TakeAmmo = function(self) + self:TakeCombinedPrimaryAmmo(3) + end + + wept.GetFireDelay = function(self) + return self.BaseClass.GetFireDelay(self) - (self:GetSpool() * 0.35) + end + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/m249/m249-1.wav", 75, math.random(47, 49), 0.7) + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 75, math.random(85, 87), 0.65, CHAN_WEAPON + 20) + end +end) + +SWEP.WalkSpeed = SPEED_SLOWEST * 0.75 +SWEP.FireAnimSpeed = 0.3 + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + self.ChargeSound = CreateSound(self, "ambient/machines/spin_loop.wav") +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + if not self:GetSpooling() then + self:SetSpooling(true) + self:EmitSound("ambient/machines/spinup.wav", 75, 65) + self:GetOwner():ResetSpeed() + + self:SetNextPrimaryFire(CurTime() + 0.75) + else + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + end +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + + if not self:GetSpooling() then + self:SetSpooling(true) + self:EmitSound("ambient/machines/spinup.wav", 75, 65) + self:GetOwner():ResetSpeed() + + self:SetNextPrimaryFire(CurTime() + 0.75) + else + self.IdleAnimation = CurTime() + self:SequenceDuration() + end +end + +function SWEP:TakeAmmo() + self:TakeCombinedPrimaryAmmo(1) +end + +function SWEP:CanPrimaryAttack() + if self:GetPrimaryAmmoCount() <= 0 then + return false + end + + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:GetWalkSpeed() + return self.BaseClass.GetWalkSpeed(self) * (self:GetSpooling() and 0.5 or 1) +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/m249/m249-1.wav", 75, math.random(86, 89), 0.65) + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 75, math.random(122, 125), 0.6, CHAN_WEAPON + 20) +end + +function SWEP:Reload() +end + +function SWEP:Holster() + self.ChargeSound:Stop() + + return self.BaseClass.Holster(self) +end + +function SWEP:OnRemove() + self.ChargeSound:Stop() +end + +function SWEP:SetSpool(spool) + self:SetDTFloat(9, spool) +end + +function SWEP:GetSpool() + return self:GetDTFloat(9) +end + +function SWEP:SetSpooling(isspool) + self:SetDTBool(1, isspool) +end + +function SWEP:GetSpooling() + return self:GetDTBool(1) +end + +function SWEP:GetFireDelay() + return self.BaseClass.GetFireDelay(self) - (self:GetSpool() * 0.15) +end + +function SWEP:CheckSpool() + if self:GetSpooling() then + if not self:GetOwner():KeyDown(IN_ATTACK) and not self:GetOwner():KeyDown(IN_ATTACK2) then + self:SetSpooling(false) + self:GetOwner():ResetSpeed() + self:SetNextPrimaryFire(CurTime() + 0.75) + self:EmitSound("ambient/machines/spindown.wav", 75, 150) + else + self:SetSpool(math.min(self:GetSpool() + FrameTime() * 0.12, 1)) + end + + self.ChargeSound:PlayEx(1, math.min(255, 65 + self:GetSpool() * 25)) + else + self:SetSpool(math.max(0, self:GetSpool() - FrameTime() * 0.36)) + self.ChargeSound:Stop() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_burster.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_burster.lua index fe18459..0356608 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_burster.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_burster.lua @@ -2,12 +2,17 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" -SWEP.ChargeTime = 2 +SWEP.ChargeTime = 2.1 function SWEP:PrimaryAttack() if self:GetChargeStart() == 0 then self:SetChargeStart(CurTime()) - self.Owner:EmitSound("weapons/cguard/charging.wav", 80, 60) + + self.m_ViewAngles = self:GetOwner():EyeAngles() + + if IsFirstTimePredicted() then + self:EmitSound(")ambient/levels/labs/teleport_mechanism_windup5.wav", 80, 185, 0.75) + end end end @@ -20,7 +25,7 @@ end function SWEP:Think() if self:GetCharge() >= 1 then - self.Owner:Kill() + self:GetOwner():Kill() end self:NextThink(CurTime()) @@ -34,8 +39,9 @@ end function SWEP:Move(mv) local charge = self:GetCharge() if charge > 0 then - mv:SetMaxSpeed(mv:GetMaxSpeed() * math.max(0, 1 - charge * 2)) - mv:SetMaxClientSpeed(mv:GetMaxSpeed()) + local mul = 1 + charge * 0.7 + mv:SetMaxSpeed(mv:GetMaxSpeed() * mul) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * mul) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bust.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bust.lua index 53769ec..f47cf56 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bust.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bust.lua @@ -1,7 +1,8 @@ AddCSLuaFile() +SWEP.PrintName = "Bust-on-a-stick" + if CLIENT then - SWEP.PrintName = "Bust-on-a-stick" SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false @@ -27,8 +28,8 @@ SWEP.ViewModel = "models/weapons/c_crowbar.mdl" SWEP.WorldModel = Model("models/props_combine/breenbust.mdl") SWEP.UseHands = true -SWEP.MeleeDamage = 100 -SWEP.MeleeRange = 60 +SWEP.MeleeDamage = 50 +SWEP.MeleeRange = 50 SWEP.MeleeSize = 1.4 SWEP.UseMelee1 = false @@ -40,6 +41,14 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingTime = 0.3 SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 2, 1) + +SWEP.Tier = 2 +SWEP.DismantleDiv = 2 + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.Rand(35, 45)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknife.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknife.lua index f157972..c91e8c4 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknife.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknife.lua @@ -1,8 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Butcher Knife" +SWEP.PrintName = "Butcher Knife" +SWEP.Description = "A very fast swinging butcher knife, capable of mincing zombies very quickly up close." +if CLIENT then SWEP.ViewModelFOV = 55 SWEP.ViewModelFlip = false @@ -27,10 +28,10 @@ SWEP.NoDroppedWorldModel = true --[[SWEP.BoxPhysicsMax = Vector(8, 1, 4) SWEP.BoxPhysicsMin = Vector(-8, -1, -4)]] -SWEP.MeleeDamage = 40 +SWEP.MeleeDamage = 45 SWEP.MeleeRange = 48 SWEP.MeleeSize = 0.875 -SWEP.Primary.Delay = 0.7 +SWEP.Primary.Delay = 0.5 SWEP.WalkSpeed = SPEED_FAST @@ -42,6 +43,13 @@ SWEP.MissGesture = SWEP.HitGesture SWEP.HitDecal = "Manhackcut" SWEP.HitAnim = ACT_VM_MISSCENTER +SWEP.Tier = 2 + +SWEP.AllowQualityWeapons = true +SWEP.Culinary = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.06) + function SWEP:PlaySwingSound() self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav", 72, math.Rand(85, 95)) end @@ -56,7 +64,7 @@ function SWEP:PlayHitFleshSound() end function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() and hitent:IsPlayer() and hitent:Health() <= 0 then + --[[if hitent:IsValid() and hitent:IsPlayer() and hitent:Health() <= 0 then -- Dismember closest limb to tr.HitPos - end + end]] end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknifez.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknifez.lua index c228f5e..683b60e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknifez.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_butcherknifez.lua @@ -3,15 +3,22 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_butcherknife" SWEP.ZombieOnly = true -SWEP.MeleeDamage = 30 -SWEP.Primary.Delay = 0.4 +SWEP.MeleeDamage = 28 +SWEP.OriginalMeleeDamage = SWEP.MeleeDamage +SWEP.Primary.Delay = 0.45 function SWEP:OnMeleeHit(hitent, hitflesh, tr) if not hitent:IsPlayer() then - self.MeleeDamage = 11 + self.MeleeDamage = 18 end end function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) - self.MeleeDamage = 24 + self.MeleeDamage = self.OriginalMeleeDamage end + +function SWEP:SetNextAttack() + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * armdelay) +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/cl_init.lua new file mode 100644 index 0000000..a91c969 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/cl_init.lua @@ -0,0 +1,28 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end + +function SWEP:Deploy() + self.IdleAnimation = CurTime() + self:SequenceDuration() + + return true +end + +function SWEP:DrawWorldModel() +end +SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel + +function SWEP:PrimaryAttack() +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/init.lua new file mode 100644 index 0000000..25952e4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/init.lua @@ -0,0 +1,78 @@ +INC_SERVER() + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + + self:SpawnGhost() + + return true +end + +function SWEP:OnRemove() + self:RemoveGhost() +end + +function SWEP:Holster() + self:RemoveGhost() + return true +end + +function SWEP:SpawnGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:GiveStatus(self.GhostStatus) + end +end + +function SWEP:RemoveGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:RemoveStatus(self.GhostStatus, false, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local status = owner:GetStatus(self.GhostStatus) + if not (status and status:IsValid()) then return end + status:RecalculateValidity() + if not status:GetValidPlacement() then return end + + local pos, ang = status:RecalculateValidity() + if not pos or not ang then return end + + self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + + local ent = ents.Create(self.DeployClass) + if ent:IsValid() then + ent:SetPos(pos) + ent:SetAngles(ang) + ent.PreOwn = owner + ent:Spawn() + + ent:SetObjectOwner(owner) + + ent:EmitSound("npc/dog/dog_servo12.wav") + + self:TakePrimaryAmmo(1) + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + end + + if not owner:HasWeapon("weapon_zs_cameracontrol") then + owner:Give("weapon_zs_cameracontrol") + end + owner:SelectWeapon("weapon_zs_cameracontrol") + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/shared.lua new file mode 100644 index 0000000..09ac9ad --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_camera/shared.lua @@ -0,0 +1,85 @@ +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = Model("models/props_c17/light_domelight02_off.mdl") + +SWEP.PrintName = "Camera" +SWEP.Description = "Allows remote observation of other areas. Zombies cannot see the camera unless they are very close.\nPress PRIMARY ATTACK to deploy.\nPress USE on a deployed camera with no owner (blue light) to reclaim it." + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "camera" +SWEP.Primary.Delay = 2 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +--SWEP.MaxStock = 20 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.GhostStatus = "ghost_camera" +SWEP.DeployClass = "prop_camera" + +SWEP.NoDeploySpeedChange = true + +function SWEP:Initialize() + self:SetWeaponHoldType("slam") + GAMEMODE:DoChangeDeploySpeed(self) + self:HideViewAndWorldModel() +end + +function SWEP:SetReplicatedAmmo(count) + self:SetDTInt(0, count) +end + +function SWEP:GetReplicatedAmmo() + return self:GetDTInt(0) +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:Think() + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end + + if SERVER then + local count = self:GetPrimaryAmmoCount() + if count ~= self:GetReplicatedAmmo() then + self:SetReplicatedAmmo(count) + self:GetOwner():ResetSpeed() + end + end +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + + return true +end + +function SWEP:Holster() + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/cl_init.lua new file mode 100644 index 0000000..6e700dc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/cl_init.lua @@ -0,0 +1,103 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 45 +SWEP.ViewModelFlip = false + +SWEP.BobScale = 0.15 +SWEP.SwayScale = 0.15 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/tv_monitor01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7.791, 3.635, -1.558), angle = Angle(0, -118.053, 180), size = Vector(0.1, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/tv_monitor01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 4.5, -1.558), angle = Angle(0, 180, 180), size = Vector(0.1, 0.4, 0.4), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/tv_monitor01_screen.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.1, 0.4, 0.4), color = Color(255, 255, 255, 255), surpresslightning = false, material = "effects/tvscreen_noise003a", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_R_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 4, 3), angle = Angle(0, 0, 0) } +} + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + if self:GetOwner() == MySelf then + hook.Add("RenderScene", self, self.RenderScene) + end +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end + +local w, h = 320, 256 +local x, y = -w / 2, -h / 2 +local CamPos = Vector(8, -4, -2) +local CamAng = Angle(180, -28, 90) +local CamScale = 0.025 +local CamData = {x = 0, y = 0, w = h * 2, h = h * 2, drawhud = false, drawmonitors = false, drawviewmodel = false, aspectratio = w / h} +local rt = GetRenderTarget("prop_camera", w * 2, h * 2) +local matRT = Material("prop_camera") +local matStatic = Material("zombiesurvival/filmgrain/filmgrain") +local matNoSignal = Material("effects/tvscreen_noise003a") +function SWEP:PostDrawViewModel(vm) + self.BaseClass.PostDrawViewModel(self, vm) + + if not vm or not vm:IsValid() then return end + + local boneid = vm:LookupBone("ValveBiped.Bip01_R_Hand") + if not boneid or boneid == 0 then return end + + local bpos, bang = vm:GetBonePositionMatrixed(boneid) + + bpos, bang = LocalToWorld(CamPos, CamAng, bpos, bang) + + cam.Start3D2D(bpos, bang, CamScale) + + surface.SetDrawColor(255, 255, 255, 255) + + local camera = self:GetCamera() + if camera:IsValid() then + matRT:SetTexture("$basetexture", rt) + surface.SetMaterial(matRT) + surface.DrawTexturedRect(x, y, w, h) + + surface.SetDrawColor(30, 30, 30, 200) + surface.SetMaterial(matStatic) + surface.DrawTexturedRectUV(x, y, w, h, 2, 2, 0, 0) + else + surface.SetMaterial(matNoSignal) + surface.DrawTexturedRect(x, y, w, h) + end + + cam.End3D2D() +end + +function SWEP:RenderScene(origin, angles, fov) + if FROM_CAMERA then return end + + local camera = self:GetCamera() + if not camera:IsValid() then return end + + FROM_CAMERA = camera + + CamData.origin = camera:GetPos() + camera:GetUp() * -16 + CamData.angles = angles + + local originalRT = render.GetRenderTarget() + render.SetRenderTarget(rt) + render.RenderView(CamData) + render.SetRenderTarget(originalRT) + + FROM_CAMERA = nil +end + +function SWEP:Draw3DHUD(vm, pos, ang) +end + +function SWEP:Draw2DHUD() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/init.lua new file mode 100644 index 0000000..f0d48d2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/init.lua @@ -0,0 +1,42 @@ +INC_SERVER() + +function SWEP:SetupPlayerVisibility(pl) + local owner = self:GetOwner() + if owner ~= pl then return end + + local camera = self:GetCamera() + if camera:IsValid() then + AddOriginToPVS(camera:WorldSpaceCenter()) + end +end + +function SWEP:CycleCamera(reverse) + local cameras = {} + + for _, camera in pairs(ents.FindByClass("prop_camera")) do + if camera:IsValid() then + table.insert(cameras, camera) + end + end + + if #cameras == 0 then return end + + local index + for i, camera in pairs(cameras) do + if self:GetCamera() == camera then + index = i + break + end + end + + if not index or #cameras == 1 then + self:SetCamera(cameras[1]) + return + end + + if reverse then + self:SetCamera(cameras[index - 1] or cameras[#cameras]) + else + self:SetCamera(cameras[index + 1] or cameras[1]) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/shared.lua new file mode 100644 index 0000000..2dc813a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cameracontrol/shared.lua @@ -0,0 +1,120 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_base" + +SWEP.PrintName = "Camera Viewer" +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.ViewModel = "models/weapons/c_slam.mdl" +SWEP.WorldModel = "models/weapons/w_slam.mdl" +SWEP.UseHands = true + +SWEP.Primary.Delay = 0 +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.Delay = 20 +SWEP.Secondary.Heal = 10 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.NoMagazine = true +SWEP.Undroppable = true +SWEP.NoDismantle = true +SWEP.AllowQualityWeapons = false +SWEP.NoPickupNotification = true + +SWEP.HoldType = "camera" + +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + +SWEP.IdleActivity = ACT_SLAM_THROW_DETONATE + +AccessorFuncDT(SWEP, "Camera", "Entity", 0) + +function SWEP:PrimaryAttack(reverse) + if IsFirstTimePredicted() then + self:SendWeaponAnim(ACT_SLAM_TRIPMINE_ATTACH) + self.IdleAnimation = CurTime() + 0.33 + + if SERVER then + self:CycleCamera(reverse) + end + + if CLIENT then + MySelf:EmitSound("buttons/button17.wav", 0) + end + end +end + +function SWEP:SecondaryAttack(reverse) + self:PrimaryAttack(true) +end + +function SWEP:Reload() + return false +end + +function SWEP:Think() + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(self.IdleActivity) + end + + if SERVER then + if not self:GetCamera():IsValid() then + self:CycleCamera() + end + + for _, ent in pairs(ents.FindByClass("prop_camera")) do + if ent:GetObjectOwner() == self:GetOwner() then + return + end + end + + self:GetOwner():StripWeapon(self:GetClass()) + end +end + +function SWEP:Deploy() + self.BaseClass.Deploy(self) + + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = math.huge + self:SendWeaponAnim(self.IdleActivity) + + if SERVER then + hook.Add("SetupPlayerVisibility", self, self.SetupPlayerVisibility) + end + + if CLIENT then + hook.Add("RenderScene", self, self.RenderScene) + end + + return true +end + +function SWEP:Holster() + self.BaseClass.Holster(self) + + if SERVER then + hook.Remove("SetupPlayerVisibility", self) + end + + if CLIENT then + hook.Remove("RenderScene", self) + end + + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/cl_init.lua new file mode 100644 index 0000000..5d29e46 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/cl_init.lua @@ -0,0 +1,67 @@ +INC_CLIENT() + +SWEP.VElements = { + ["underbarrel_sides"] = { type = "Model", model = "models/mechanics/solid_steel/type_b_2_2.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(-2.26, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.514, 0.293, 0.312), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["underbarrel_stripes"] = { type = "Model", model = "models/Mechanics/gears/gear24x6.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(4.05, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.063, 0.063, 2.016), color = Color(175, 175, 175, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["FRONT"] = { type = "Model", model = "models/props_combine/combine_smallmonitor001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "side", pos = Vector(0, -9.323, 1.125), angle = Angle(90, 90, 180), size = Vector(0.252, 0.358, 0.127), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["FINS+"] = { type = "Model", model = "models/props_c17/playground_swingset_seat01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(1.534, -3.013, 10.057), angle = Angle(-125.673, -180, 2.9), size = Vector(0.425, 0.256, 0.601), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["FINS"] = { type = "Model", model = "models/props_c17/playground_swingset_seat01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(1.848, -3.013, -10.058), angle = Angle(56.659, 0, 0), size = Vector(0.425, 0.256, 0.601), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["underbarrel"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(0, 2.382, 15.612), angle = Angle(90, 0, 0), size = Vector(9.519, 0.065, 0.065), color = Color(0, 0, 0, 255), surpresslightning = false, material = "models/debug/debugwhite", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/weapons/w_shot_m3super90.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "side", pos = Vector(0.086, 7.222, -1.844), angle = Angle(0, 90, 0), size = Vector(0.5, 0.845, 0.513), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["side"] = { type = "Model", model = "models/props_trainstation/trainstation_arch001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(-6.483, -0.226, 0), angle = Angle(90, -90, 0), size = Vector(3.45, 0.178, 0.043), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["overlay"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.bolt", rel = "", pos = Vector(-0.13, 0, 11.22), angle = Angle(90, 0, 180), size = Vector(0.303, 0.555, 0.555), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["stuff"] = { type = "Model", model = "models/props_c17/grinderclamp01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "underbarrel", pos = Vector(-17.656, -4.215, 0.122), angle = Angle(90, 90, 90), size = Vector(0.245, 0.221, 0.314), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} } +} +SWEP.WElements = { + ["underbarrel_sides"] = { type = "Model", model = "models/mechanics/solid_steel/type_b_2_2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(-2.26, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.514, 0.293, 0.312), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["underbarrel_stripes"] = { type = "Model", model = "models/Mechanics/gears/gear24x6.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(4.05, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.063, 0.063, 2.016), color = Color(175, 175, 175, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["FRONT"] = { type = "Model", model = "models/props_combine/combine_smallmonitor001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "side", pos = Vector(0, -9.323, 1.125), angle = Angle(90, 90, 180), size = Vector(0.252, 0.358, 0.112), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["FINS+"] = { type = "Model", model = "models/props_c17/playground_swingset_seat01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(1.534, -3.013, 10.057), angle = Angle(-125.673, -180, 2.9), size = Vector(0.425, 0.256, 0.601), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["FINS"] = { type = "Model", model = "models/props_c17/playground_swingset_seat01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(1.848, -3.013, -10.058), angle = Angle(56.659, 0, 0), size = Vector(0.425, 0.256, 0.601), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["underbarrel"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(19.784, -1.318, -0.436), angle = Angle(0, 10.428, -90), size = Vector(9.519, 0.065, 0.065), color = Color(0, 0, 0, 255), surpresslightning = false, material = "models/debug/debugwhite", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/weapons/w_shot_m3super90.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "side", pos = Vector(0.086, 7.221, -3.266), angle = Angle(0, 90, 0), size = Vector(0.5, 0.811, 0.708), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["overlay"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(0, -3.143, 0), angle = Angle(0, 0, 180), size = Vector(0.303, 0.555, 0.555), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["side"] = { type = "Model", model = "models/props_trainstation/trainstation_arch001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(-6.483, -0.226, 0), angle = Angle(90, -90, 0), size = Vector(3.45, 0.178, 0.043), color = Color(200, 200, 200, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} }, + ["stuff"] = { type = "Model", model = "models/props_c17/grinderclamp01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "underbarrel", pos = Vector(-17.656, -4.215, 0.122), angle = Angle(90, 90, 90), size = Vector(0.245, 0.221, 0.314), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/officewindow_1-1", skin = 0, bodygroup = {} } +} + + + +SWEP.HUD3DBone = "ValveBiped.Crossbow_base" +SWEP.HUD3DPos = Vector(1.5, 0.5, 11) +SWEP.HUD3DScale = 0.025 + +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +function SWEP:PostDrawViewModel(vm, pl, wep) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local adj = math.min(1, (CurTime() - self:GetShootTime()) * 3) + self.VElements["overlay"].size = Vector(0.303, 0.555, 0.555) * adj +end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.3) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -18 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/init.lua new file mode 100644 index 0000000..14da5c3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_cha" +SWEP.Primary.ProjVelocity = 1300 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/shared.lua new file mode 100644 index 0000000..5585a6a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_charon/shared.lua @@ -0,0 +1,95 @@ +SWEP.PrintName = "'Charon' Repeating Crossbow" +SWEP.Description = "A rapid firing crossbow with no other unique properties." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Crossbow.Single") +SWEP.Primary.Delay = 0.4 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 68 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.DefaultClip = 40 + +SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 3 + +SWEP.ReloadDelay = 2.8 +SWEP.Recoil = 2 + +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 3.25 + +SWEP.NextZoom = 0 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.03) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Styx' Repeating Crossbow", "Increases the rate of fire, clip size, but decreases accuracy, reload speed and damage", function(wept) + wept.Primary.ClipSize = math.floor(wept.Primary.ClipSize * 2) + wept.Primary.Delay = wept.Primary.Delay * 0.5 + wept.Primary.Damage = wept.Primary.Damage * 0.78 + wept.Primary.Projectile = "projectile_arrow_sli" + + wept.ConeMax = wept.ConeMax * 1.4 + wept.ConeMin = wept.ConeMin * 1.4 + wept.ReloadSpeed = wept.ReloadSpeed * 0.7 +end) + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + self:SetShootTime(CurTime()) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/crossbow/bolt_load"..math.random(2)..".wav", 50, 100, 1, CHAN_AUTO) + self:EmitSound("weapons/crossbow/reload1.wav") + end +end + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(ACT_VM_FIDGET) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed) + timer.Simple(self.Primary.Delay/3.5, function() + if IsValid(self) then + self:SendWeaponAnim(ACT_VM_IDLE) + self:GetOwner():GetViewModel():SetPlaybackRate(6) + end + end) +end + +function SWEP:SendReloadAnimation() +end + +function SWEP:ProcessReloadEndTime() + local reloadspeed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + self:SetReloadFinish(CurTime() + self.ReloadDelay / reloadspeed) +end + +function SWEP:SetShootTime(time) + self:SetDTFloat(8, time) +end + +function SWEP:GetShootTime() + return self:GetDTFloat(8) +end + +util.PrecacheSound("weapons/crossbow/bolt_load1.wav") +util.PrecacheSound("weapons/crossbow/bolt_load2.wav") +util.PrecacheSound("weapons/sniper/sniper_zoomin.wav") +util.PrecacheSound("weapons/sniper/sniper_zoomout.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/cl_init.lua index b8ca775..85ab1ca 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() SWEP.PrintName = "Chem Zombie" SWEP.DrawCrosshair = false @@ -7,6 +7,6 @@ function SWEP:Think() end function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/init.lua index 1598043..8d98401 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chemzombie/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() SWEP.NextAura = 0 function SWEP:Think() @@ -13,10 +10,10 @@ function SWEP:Think() if self.NextAura <= CurTime() then self.NextAura = CurTime() + 2 - local origin = self.Owner:LocalToWorld(self.Owner:OBBCenter()) + local origin = self:GetOwner():LocalToWorld(self:GetOwner():OBBCenter()) for _, ent in pairs(ents.FindInSphere(origin, 40)) do - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() ~= TEAM_UNDEAD and ent:Alive() and TrueVisible(origin, ent:NearestPoint(origin)) then - ent:PoisonDamage(1, self.Owner, self) + if ent and ent:IsValidLivingHuman() and TrueVisible(origin, ent:NearestPoint(origin)) then + ent:PoisonDamage(1, self:GetOwner(), self) end end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/cl_init.lua new file mode 100644 index 0000000..8345f19 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/cl_init.lua @@ -0,0 +1,12 @@ +INC_CLIENT() + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) + render.SetColorModulation(1, 1, 1) +end + +local matSheet = Material("Models/humans/corpse/corpse1.vtf") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) + render.SetColorModulation(0.2, 0.5, 0.95) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/shared.lua new file mode 100644 index 0000000..ee901ff --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_chilledghoul/shared.lua @@ -0,0 +1,107 @@ +AddCSLuaFile() + +SWEP.PrintName = "Frigid Ghoul" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 22 +SWEP.MeleeForceScale = 0.5 +SWEP.SlowDownScale = 0.1 + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if SERVER and ent:IsPlayer() then + local gt = ent:GiveStatus("frost", 8) + local owner = self:GetOwner() + + if gt and gt:IsValid() then + gt.Applier = owner + end + ent:AddLegDamageExt(12, owner, self, SLOWTYPE_COLD) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/fast_zombie/fz_frenzy1.wav", 75, math.Rand(70, 80)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:EmitSound("npc/metropolice/pain"..math.random(4)..".wav", 74, math.Rand(110, 130)) +end + +local Spread = { + {0, 0}, + {-0.5, 0}, + {0.5, 0} +} +local function DoFleshThrow(pl, wep) + if pl:IsValid() and pl:Alive() and wep:IsValid() then + pl:ResetSpeed() + pl.LastRangedAttack = CurTime() + + if SERVER then + local startpos = pl:GetShootPos() + local aimang = pl:EyeAngles() + local ang + + for _, spr in pairs(Spread) do + ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), spr[1] * 5) + ang:RotateAroundAxis(ang:Right(), spr[2] * 5) + + local ent = ents.Create("projectile_ghoulfleshchilled") + if ent:IsValid() then + ent:SetPos(startpos) + ent:SetOwner(pl) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(ang:Forward() * 750) + end + end + end + + pl:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + end + + --[[if CurTime() >= (pl.GhoulImmunity or 0) then + pl.GhoulImmunity = CurTime() + 2 + pl:RawCapLegDamage(CurTime() + 0.5) + end]] + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end + + self:SetNextSecondaryFire(CurTime() + 3) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:GetOwner():DoZombieEvent() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + --self:GetOwner():RawCapLegDamage(CurTime() + 3) + self:SendWeaponAnim(ACT_VM_HITCENTER) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + timer.Simple(0.7, function() DoFleshThrow(owner, self) end) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) +end + +local matSheet = Material("models/weapons/v_zombiearms/ghoulsheet") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/init.lua new file mode 100644 index 0000000..3f7e7ba --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/init.lua @@ -0,0 +1,45 @@ +INC_SERVER() + +function SWEP.BulletCallback(attacker, tr, dmginfo) + if attacker:IsValid() and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + local pos = tr.HitPos + for ent, dmg in pairs(util.BlastDamageExAlloc(attacker:GetActiveWeapon(), attacker, pos, 82, dmginfo:GetDamage() * 0.75, DMG_ALWAYSGIB)) do + if math.random(4) == 1 and ent:IsValidLivingPlayer() and (ent:Team() == TEAM_UNDEAD or ent == attacker) then + ent:Ignite(dmg / 14) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(attacker) + fire:SetPhysicsAttacker(attacker) + fire.AttackerForward = attacker + end + end + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + local owner = self:GetOwner() + if owner:IsValid() then + local pos = owner:GetPos() + + util.BlastDamagePlayer(self, owner, pos, 50, 55, DMG_ALWAYSGIB) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/shared.lua new file mode 100644 index 0000000..1ad6072 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_cinderrod/shared.lua @@ -0,0 +1,17 @@ +SWEP.PrintName = "'Cinderrod' Zip Gun" + +SWEP.Base = "weapon_zs_blareduct" + +SWEP.Primary.Damage = 54 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.5 + +SWEP.ConeMax = 7.5 +SWEP.ConeMin = 6.5 + +SWEP.ReloadSpeed = 0.35 +SWEP.ReloadDelay = 0.45 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.15, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RECOIL, -32.5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -1) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_classiczombie.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_classiczombie.lua index c18df0f..0fa1426 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_classiczombie.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_classiczombie.lua @@ -2,7 +2,7 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDamage = 20 +SWEP.MeleeDamage = 25 function SWEP:Reload() self.BaseClass.SecondaryAttack(self) @@ -20,15 +20,14 @@ end SWEP.NextClimbSound = 0 function SWEP:Think() - local curtime = CurTime() - local owner = self.Owner + local owner = self:GetOwner() if self:GetClimbing() then if self:GetClimbSurface() and owner:KeyDown(IN_ATTACK2) then if SERVER and CurTime() >= self.NextClimbSound then - local speed = owner:GetVelocity():Length() - if speed >= 16 then - if speed >= 50 then + local speed = owner:GetVelocity():LengthSqr() + if speed >= 256 then + if speed >= 2500 then self.NextClimbSound = CurTime() + 0.75 else self.NextClimbSound = CurTime() + 1 @@ -63,24 +62,27 @@ end local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-5, -5, -5), maxs = Vector(5, 5, 5)} function SWEP:GetClimbSurface() - local owner = self.Owner + local owner = self:GetOwner() local fwd = owner:SyncAngles():Forward() local up = owner:GetUp() local pos = owner:GetPos() + local height = owner:OBBMaxs().z local tr - for i=-15, owner:OBBMaxs().z, 5 do + local ha + for i=5, height, 5 do if not tr or not tr.Hit then climbtrace.start = pos + up * i - climbtrace.endpos = climbtrace.start + fwd * 28 + climbtrace.endpos = climbtrace.start + fwd * 36 tr = util.TraceHull(climbtrace) + ha = i if tr.Hit and not tr.HitSky then break end end end if tr.Hit and not tr.HitSky then - climbtrace.start = tr.HitPos + tr.HitNormal - climbtrace.endpos = climbtrace.start + owner:SyncAngles():Up() * 72 + climbtrace.start = pos + up * ha --tr.HitPos + tr.HitNormal + climbtrace.endpos = climbtrace.start + owner:SyncAngles():Up() * (height - ha) local tr2 = util.TraceHull(climbtrace) if tr2.Hit and not tr2.HitSky then return tr2 @@ -93,7 +95,7 @@ end function SWEP:SecondaryAttack() if self:IsClimbing() then return end - if not self.Owner:IsOnGround() and self.Owner:GetVelocity():Length() < 200 and self:GetClimbSurface() then + if not self:GetOwner():IsOnGround() and self:GetOwner():GetVelocity():LengthSqr() < 40000 and self:GetClimbSurface() then self:StartClimbing() else self.BaseClass.SecondaryAttack(self) @@ -121,13 +123,14 @@ function SWEP:Move(mv) mv:SetMaxSpeed(0) mv:SetMaxClientSpeed(0) - local owner = self.Owner + local owner = self:GetOwner() local tr = self:GetClimbSurface() - local angs = self.Owner:SyncAngles() + local angs = self:GetOwner():SyncAngles() local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) local vel = Vector(0, 0, 4) if owner:KeyDown(IN_FORWARD) then + owner:SetGroundEntity(nil) vel = vel + dir * 60 end if owner:KeyDown(IN_BACK) then diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_colossus.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_colossus.lua new file mode 100644 index 0000000..a920a89 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_colossus.lua @@ -0,0 +1,200 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Colossus' Mass Driver" +SWEP.Description = "Projects rifle ammo rounds at extremely high velocity, penetrating through multiple targets." + +if CLIENT then + SWEP.Slot = 3 + SWEP.SlotPos = 0 + + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 55 + + SWEP.HUD3DBone = "v_weapon.xm1014_Bolt" + SWEP.HUD3DPos = Vector(-3.75, -1, -10) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.022 + + SWEP.VElements = { + ["frontbit_inner"] = { type = "Model", model = "models/hunter/tubes/tube2x2x1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit__behind_underbit", pos = Vector(0, 0, 0), angle = Angle(0, 141.695, 0), size = Vector(0.07, 0.07, 0.215), color = Color(255, 15, 15, 255), surpresslightning = false, material = "models/props_combine/masterinterface_disp", skin = 0, bodygroup = {} }, + ["frontbit_behind"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "side", pos = Vector(6.011, 0.037, -3.062), angle = Angle(0, 0, 0), size = Vector(1.881, 0.136, 0.136), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.xm1014_Parent", rel = "", pos = Vector(-0.262, -3.875, -25.164), angle = Angle(0, 100.58, 0), size = Vector(0.085, 0.085, 0.143), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit_behind_2+"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind+", pos = Vector(-0.461, 2, 0), angle = Angle(90, 90, 0), size = Vector(0.032, 0.092, 0.089), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind_bottom"] = { type = "Model", model = "models/props_docks/dock03_pole01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind_2+", pos = Vector(0, 1.937, 3.118), angle = Angle(0, 0, 10), size = Vector(0.092, 0.092, 0.012), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind", pos = Vector(10.821, 0, 0), angle = Angle(0, 0, 0), size = Vector(1, 0.136, 0.136), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit_behind_mp5"] = { type = "Model", model = "models/weapons/w_smg_mp5.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind_2", pos = Vector(0, -2.057, -4.428), angle = Angle(0, 90, 0), size = Vector(0.977, 1.077, 0.354), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind_2"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind+", pos = Vector(0, -1.275, 0), angle = Angle(-90, 90, 0), size = Vector(0.032, 0.085, 0.048), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_pipe"] = { type = "Model", model = "models/props_debris/rebar_smallnorm01c.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "side", pos = Vector(0, 0.239, 0.003), angle = Angle(21.548, 0, 0), size = Vector(0.649, 0.666, 0.319), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/metal_plate", skin = 0, bodygroup = {} }, + ["side"] = { type = "Model", model = "models/props_wasteland/horizontalcoolingtank04.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top", pos = Vector(-0.736, -2.576, 0.358), angle = Angle(90, -78, 0), size = Vector(0.028, 0.041, 0.048), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit__behind_underbit"] = { type = "Model", model = "models/hunter/tubes/tube2x2x1b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "frontbit_behind", pos = Vector(5.613, 0.043, 0), angle = Angle(-45, 90, 90), size = Vector(0.074, 0.074, 0.231), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["frontbit_behind++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "side", pos = Vector(-4.196, -0.069, -3.062), angle = Angle(0, 0, 0), size = Vector(1.205, 0.119, 0.119), color = Color(0, 0, 0, 255), surpresslightning = false, material = "models/debug/debugwhite", skin = 0, bodygroup = {} }, + ["frontbit_inner"] = { type = "Model", model = "models/hunter/tubes/tube2x2x1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit__behind_underbit", pos = Vector(0, 0, 0), angle = Angle(0, 141.695, 0), size = Vector(0.07, 0.07, 0.215), color = Color(255, 15, 15, 255), surpresslightning = false, material = "models/props_combine/masterinterface_disp", skin = 0, bodygroup = {} }, + ["frontbit_behind"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "side", pos = Vector(6.011, 0.037, -3.062), angle = Angle(0, 0, 0), size = Vector(1.881, 0.136, 0.136), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(20.954, 2.823, -8.398), angle = Angle(-78.195, 180, 0), size = Vector(0.085, 0.085, 0.143), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit_pipe"] = { type = "Model", model = "models/props_debris/rebar_smallnorm01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "side", pos = Vector(0, 0.239, 0.003), angle = Angle(21.548, 0, 0), size = Vector(0.649, 0.666, 0.319), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/metal_plate", skin = 0, bodygroup = {} }, + ["side"] = { type = "Model", model = "models/props_wasteland/horizontalcoolingtank04.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top", pos = Vector(-0.736, -2.576, 0.358), angle = Angle(90, -78, 0), size = Vector(0.028, 0.041, 0.048), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit_behind+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind", pos = Vector(10.821, 0, 0), angle = Angle(0, 0, 0), size = Vector(1, 0.136, 0.136), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit__behind_underbit"] = { type = "Model", model = "models/hunter/tubes/tube2x2x1b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind", pos = Vector(5.613, 0.043, 0), angle = Angle(-45, 90, 90), size = Vector(0.074, 0.074, 0.231), color = Color(170, 155, 149, 255), surpresslightning = false, material = "models/props_wasteland/tugboat02", skin = 0, bodygroup = {} }, + ["frontbit_behind_2"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind+", pos = Vector(0, -1.275, 0), angle = Angle(-90, 90, 0), size = Vector(0.032, 0.085, 0.048), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind_2+"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind+", pos = Vector(-0.461, 2, 0), angle = Angle(90, 90, 0), size = Vector(0.032, 0.092, 0.089), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind_bottom"] = { type = "Model", model = "models/props_docks/dock03_pole01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind_2+", pos = Vector(0, 1.937, 3.118), angle = Angle(0, 0, 10), size = Vector(0.092, 0.092, 0.012), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["frontbit_behind_mp5"] = { type = "Model", model = "models/weapons/w_smg_mp5.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "frontbit_behind_2", pos = Vector(0, -2.057, -4.428), angle = Angle(0, 90, 0), size = Vector(0.977, 1.077, 0.354), color = Color(165, 165, 165, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} } + } + + SWEP.ViewModelBoneMods = { + ["v_weapon.xm1014_Parent"] = { scale = Vector(1, 1, 1), pos = Vector(-5, -2, -3), angle = Angle(0, 0, 0) } + } +end + +SWEP.ShowWorldModel = false +SWEP.ShowViewModel = false + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "physgun" + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_xm1014.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" +SWEP.UseHands = false + +SWEP.Primary.Damage = 135 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1 +SWEP.HeadshotMulti = 1.75 +SWEP.ReloadSound = Sound("ambient/machines/thumper_startup1.wav") + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "357" +SWEP.Primary.DefaultClip = 9 + +SWEP.ConeMax = 0.25 +SWEP.ConeMin = 0.25 + +SWEP.Recoil = 5 + +SWEP.IronSightsPos = Vector(5.015, -8, 2.52) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.FireAnimSpeed = 0.4 + +SWEP.TracerName = "tracer_colossus" + +SWEP.ReloadSpeed = 1 +SWEP.Tier = 5 + +SWEP.MaxStock = 2 +SWEP.Pierces = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.032) + +function SWEP:ShootBullets(dmg, numbul, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + local dir = owner:GetAimVector() + local dirang = dir:Angle() + local start = owner:GetShootPos() + + dirang:RotateAroundAxis(dirang:Forward(), util.SharedRandom("bulletrotate1", 0, 360)) + dirang:RotateAroundAxis(dirang:Up(), util.SharedRandom("bulletangle1", -cone, cone)) + + dir = dirang:Forward() + local tr = owner:CompensatedPenetratingMeleeTrace(4092, 0.01, start, dir) + local ent + + local dmgf = function(i) return dmg * (1 - 0.1 * i) end + + owner:LagCompensation(true) + for i, trace in ipairs(tr) do + if not trace.Hit then continue end + if i > self.Pierces - 1 then break end + + ent = trace.Entity + + if ent and ent:IsValid() then + owner:FireBulletsLua(trace.HitPos, dir, 0, numbul, dmgf(i-1), nil, self.Primary.KnockbackScale, "", self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + end + end + owner:FireBulletsLua(start, dir, cone, numbul, 0, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + owner:LagCompensation(false) +end + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + + local owner = self:GetOwner() + local vm = owner:GetViewModel() + local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + + if vm:IsValid() then + vm:SetPlaybackRate(0.25 * speed) + end + + self:SetReloadFinish(CurTime() + 2.1 / speed) + + if IsFirstTimePredicted() then + self:EmitSound("ambient/machines/thumper_startup1.wav", 70, 147, 1, CHAN_WEAPON + 21) + end +end + +function SWEP:MockReload() + local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + self:SetReloadFinish(CurTime() + 2.1 / speed) +end + +function SWEP:Reload() + local owner = self:GetOwner() + if owner:IsHolding() then return end + + if self:GetIronsights() then + self:SetIronsights(false) + end + + if self:CanReload() then + self:MockReload() + end +end + +function SWEP:Deploy() + self.BaseClass.Deploy(self) + + if self:Clip1() <= 0 then + self:MockReload() + end + + return true +end + +function SWEP:Think() + self.BaseClass.Think(self) + + if self:Clip1() <= 0 and self:GetPrimaryAmmoCount() <= 0 then + self:MockReload() + end +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetNormal(tr.HitNormal) + util.Effect("hit_hunter", effectdata) +end + +function SWEP:EmitReloadSound() + +end + +function SWEP:EmitReloadFinishSound() +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 76, 45, 0.35) + self:EmitSound("weapons/zs_rail/rail.wav", 76, 100, 0.95, CHAN_WEAPON + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/cl_init.lua new file mode 100644 index 0000000..ccb5075 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/cl_init.lua @@ -0,0 +1,7 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/init.lua new file mode 100644 index 0000000..1ca767f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/init.lua @@ -0,0 +1,7 @@ +INC_SERVER() + +function SWEP:Deploy() + self:GetOwner():CreateAmbience("ambience_coolwisp") + + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/shared.lua new file mode 100644 index 0000000..cf66fab --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_coolwisp/shared.lua @@ -0,0 +1,66 @@ +SWEP.PrintName = "Cool Wisp" + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = true +SWEP.Secondary.Ammo = "none" + +SWEP.ZombieOnly = true +SWEP.IsMelee = true + +SWEP.ViewModel = "models/weapons/v_knife_t.mdl" +SWEP.WorldModel = "models/weapons/w_knife_t.mdl" + +local math_random = math.random +local string_format = string.format + +function SWEP:Initialize() + self:HideViewAndWorldModel() +end + +function SWEP:Think() +end + +function SWEP:PrimaryAttack() + if CurTime() < self:GetNextPrimaryAttack() then return end + self:SetNextPrimaryAttack(CurTime() + 3) + + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + if SERVER then + for _, ent in pairs(util.BlastAlloc(self, owner, owner:GetPos(), 57)) do + if ent:IsValidLivingPlayer() and gamemode.Call("PlayerShouldTakeDamage", ent, owner) and ent ~= owner then + ent:GiveStatus("frost", 4) + ent:AddLegDamageExt(10, owner, self, SLOWTYPE_COLD) + end + end + + owner:GodEnable() + util.BlastDamageEx(self, owner, owner:GetShootPos(), 57, 5, DMG_DROWN) + owner:GodDisable() + end + + if IsFirstTimePredicted() then + local effectdata = EffectData() + effectdata:SetOrigin(owner:GetShootPos()) + effectdata:SetNormal(owner:GetAimVector()) + util.Effect("explosion_cold", effectdata) + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() + if CurTime() >= self:GetNextSecondaryAttack() then + self:SetNextSecondaryAttack(CurTime() + 5) + self:EmitSound(string_format("ambient/wind/wind_moan%d.wav", math_random(2))) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/cl_init.lua new file mode 100644 index 0000000..fe40857 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/cl_init.lua @@ -0,0 +1,11 @@ +INC_CLIENT() + +SWEP.VElements = { + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Grenade_body", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.1, 0.029, 0.029), color = Color(120, 95, 74, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Grenade_body", rel = "", pos = Vector(0, 0, -1), angle = Angle(0, 0, 90), size = Vector(0.449, 0.4, 0.449), color = Color(89, 67, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.1, 0.029, 0.029), color = Color(120, 95, 74, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.5, 2, -0.5), angle = Angle(0, 0, 90), size = Vector(0.449, 0.4, 0.449), color = Color(89, 67, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/init.lua new file mode 100644 index 0000000..5bf991a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_corgasgrenade" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/shared.lua new file mode 100644 index 0000000..3ae7600 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corgasgrenade/shared.lua @@ -0,0 +1,11 @@ +SWEP.PrintName = "Corrosive Gas Grenade" +SWEP.Description = "Spews corrosive gas in an area where it lands for a significant period of time. Zombies in the area take damage over time and lose damage resistance." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "corgasgrenade" + +SWEP.MaxStock = 6 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corruptedfragment.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corruptedfragment.lua new file mode 100644 index 0000000..e1968c2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_corruptedfragment.lua @@ -0,0 +1,60 @@ +AddCSLuaFile() + +SWEP.PrintName = "Corrupted Fragment" +SWEP.Description = "An eerie stone which returns you to corrupted Sanity Sigils." + +SWEP.Base = "weapon_zs_sigilfragment" + +if CLIENT then + SWEP.VElements = { + ["main"] = { type = "Model", model = "", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1, 5, 1), angle = Angle(-61.949, 87.662, 127.402), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(-1.558, -1.558, 0.2), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["base+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1+++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(0.518, 1, 1.557), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1+"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(1.557, 0, 0.2), angle = Angle(0, 99.35, 52.597), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_wasteland/medbridge_post01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(0, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(166, 255, 100, 255), surpresslightning = true, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["main"] = { type = "Model", model = "", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 5, -0.5), angle = Angle(-17.532, 45.583, 127.402), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(-1.558, -1.558, 0.2), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["base+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1+++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0.518, 1, 1.557), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_wasteland/medbridge_post01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(166, 255, 100, 255), surpresslightning = true, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(123, 255, 104, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1+"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(1.557, 0, 0.2), angle = Angle(0, 99.35, 52.597), size = Vector(0.05, 0.05, 0.05), color = Color(72, 200, 64, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } + } +end + +SWEP.Primary.Ammo = "corruptedfragment" + +SWEP.TeleportStatus = "corruptedteleport" +SWEP.TeleportEffect = "corrupted_teleport" + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or GAMEMODE:NumCorruptedSigils() <= 0 then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +if CLIENT then +function SWEP:DrawWorldModel() + local time = UnPredictedCurTime() * 45 + local vang = self.WElements.main.angle + vang.p = time % 360 + vang.y = vang.p + + self.BaseClass.BaseClass.DrawWorldModel(self) +end +SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackedbottle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackedbottle.lua new file mode 100644 index 0000000..4585cb3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackedbottle.lua @@ -0,0 +1,67 @@ +AddCSLuaFile() + +SWEP.PrintName = "Cracked Bottle" +SWEP.Description = "A cracked bottle." + +if CLIENT then + SWEP.ViewModelFOV = 55 + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a_chunk01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.635, 1.557, -4.676), angle = Angle(180, -111.04, 155.455), size = Vector(1.144, 1.144, 1.144), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a_chunk01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.714, 2.596, -2.597), angle = Angle(38.57, -68.961, 22.208), size = Vector(1.274, 1.274, 1.274), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "knife" + +SWEP.DamageType = DMG_SLASH + +SWEP.ViewModelFlip = false +SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl" +SWEP.WorldModel = "models/props_junk/glassbottle01a_chunk01a.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.AutoSwitchFrom = true + +SWEP.MeleeDamage = 20 +SWEP.MeleeRange = 45 +SWEP.MeleeSize = 0.875 + +SWEP.WalkSpeed = SPEED_FASTEST + +SWEP.Primary.Delay = 0.8 + +SWEP.HitDecal = "Manhackcut" + +SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_KNIFE +SWEP.MissGesture = SWEP.HitGesture + +SWEP.HitAnim = ACT_VM_MISSCENTER +SWEP.MissAnim = ACT_VM_PRIMARYATTACK + +SWEP.NoHitSoundFlesh = true + +SWEP.NoGlassWeapons = true + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav") +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/glass/glass_bottle_break2.wav") +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/glass/glass_bottle_break2.wav") +end + +function SWEP:OnMeleeHit(hitent, hitflesh) + if hitent:IsValid() and SERVER then + timer.Simple(0, function() self:GetOwner():StripWeapon(self:GetClass()) end) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackler.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackler.lua index 5e5ab5c..5da91d7 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackler.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crackler.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Crackler' Assault Rifle" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Crackler' Assault Rifle" +SWEP.Description = "An unsophisticated assault rifle which has good damage and accuracy." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -23,7 +25,7 @@ SWEP.UseHands = true SWEP.ReloadSound = Sound("Weapon_FAMAS.Clipout") SWEP.Primary.Sound = Sound("Weapon_FAMAS.Single") -SWEP.Primary.Damage = 16 +SWEP.Primary.Damage = 15 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.175 @@ -32,9 +34,22 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "ar2" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.045 -SWEP.ConeMin = 0.019 +SWEP.ConeMax = 3.0 --0.045 +SWEP.ConeMin = 1.6 --0.019 + +SWEP.ReloadSpeed = 1.1 SWEP.WalkSpeed = SPEED_SLOW SWEP.IronSightsPos = Vector(-3, 3, 2) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.375, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.2, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Crackler' Combat Rifle", "Loses automatic fire rate but gains a bit of damage and accuracy", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.2 + wept.Primary.Delay = wept.Primary.Delay * 2 + wept.Primary.ClipSize = 15 + wept.ConeMin = wept.ConeMin * 0.7 + wept.ConeMax = wept.ConeMax * 0.7 + wept.Primary.Automatic = false +end) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_craftingpack.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_craftingpack.lua new file mode 100644 index 0000000..4574d83 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_craftingpack.lua @@ -0,0 +1,29 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_boardpack" + +SWEP.PrintName = "Crafting Pack" +SWEP.Description = "A pack of assorted items which seem to have greater use when combined with other things." + +function SWEP:Initialize() + self.JunkModels = { + Model("models/props_combine/breenbust.mdl"), + Model("models/props_junk/gascan001a.mdl"), + Model("models/props_c17/oildrum001.mdl"), + Model("models/props_junk/sawblade001a.mdl"), + Model("models/items/car_battery01.mdl"), + Model("models/props_junk/propane_tank001a.mdl") + } + + self.BaseClass.Initialize(self) +end + +--[[if CLIENT then + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/items/car_battery01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 2.596, -6.753), angle = Angle(180, 66.623, -1.17), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/items/car_battery01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 2.596, -6.753), angle = Angle(180, 66.623, -1.17), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end]] diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow.lua deleted file mode 100644 index fb98d58..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow.lua +++ /dev/null @@ -1,187 +0,0 @@ -AddCSLuaFile() - -if CLIENT then - SWEP.PrintName = "'Impaler' Crossbow" - SWEP.Description = "This ancient weapon can easily skewer groups of zombies." - - SWEP.HUD3DBone = "ValveBiped.Crossbow_base" - SWEP.HUD3DPos = Vector(1.5, 0.5, 11) - SWEP.HUD3DScale = 0.025 - - SWEP.ViewModelFOV = 60 - SWEP.ViewModelFlip = false - - SWEP.Slot = 3 - SWEP.SlotPos = 0 -end - -SWEP.Base = "weapon_zs_base" - -SWEP.HoldType = "crossbow" - -SWEP.ViewModel = "models/weapons/c_crossbow.mdl" -SWEP.WorldModel = "models/weapons/w_crossbow.mdl" -SWEP.UseHands = true - -SWEP.CSMuzzleFlashes = false - -SWEP.Primary.ClipSize = 1 -SWEP.Primary.Automatic = true -SWEP.Primary.Ammo = "XBowBolt" -SWEP.Primary.Delay = 2.0 -SWEP.Primary.DefaultClip = 15 - -SWEP.SecondaryDelay = 0.25 - -SWEP.WalkSpeed = SPEED_SLOW - -SWEP.NextZoom = 0 - -if SERVER then - function SWEP:PrimaryAttack() - if self:CanPrimaryAttack() then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - - local owner = self.Owner - - self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - owner:RestartGesture(ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW) - - self:TakePrimaryAmmo(1) - - self.IdleAnimation = CurTime() + self:SequenceDuration() - - self:EmitSound("Weapon_Crossbow.Single") - - local ent = ents.Create("projectile_arrow") - if ent:IsValid() then - ent:SetOwner(owner) - ent:SetPos(owner:GetShootPos()) - ent:SetAngles(owner:GetAimVector():Angle()) - ent.Team = owner:Team() - ent:Spawn() - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:SetVelocityInstantaneous(owner:GetAimVector() * 1400) - end - end - end - end - - function SWEP:Reload() - if self:GetNextReload() <= CurTime() and self:Clip1() == 0 and 0 < self.Owner:GetAmmoCount("XBowBolt") then - self:EmitSound("weapons/crossbow/bolt_load"..math.random(2)..".wav", 50, 100) - self:EmitSound("weapons/crossbow/reload1.wav") - self:DefaultReload(ACT_VM_RELOAD) - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RELOAD_CROSSBOW) - self:SetNextReload(CurTime() + self:SequenceDuration()) - end - end - - function SWEP:SecondaryAttack() - if CurTime() < self.NextZoom then return end - - self.NextZoom = CurTime() + self.SecondaryDelay - - local zoomed = self:GetDTBool(1) - self:SetDTBool(1, not zoomed) - - if zoomed then - self.Owner:SetFOV(self.Owner:GetInfo("fov_desired"), 0.15) - self:EmitSound("weapons/sniper/sniper_zoomout.wav", 50, 100) - else - self.Owner:SetFOV(self.Owner:GetInfo("fov_desired") * 0.25, 0.15) - self:EmitSound("weapons/sniper/sniper_zoomin.wav", 50, 100) - end - end -end - -if CLIENT then - function SWEP:PrimaryAttack() - if self:CanPrimaryAttack() then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - self:TakePrimaryAmmo(1) - self:EmitSound("Weapon_Crossbow.Single") - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW) - self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - self.IdleAnimation = CurTime() + self:SequenceDuration() - end - end - - function SWEP:SecondaryAttack() - if CurTime() < self.NextZoom then return end - self.NextZoom = CurTime() + self.SecondaryDelay - - local zoomed = self:GetDTBool(1) - self:SetDTBool(1, not zoomed) - if zoomed then - surface.PlaySound("weapons/sniper/sniper_zoomout.wav") - else - surface.PlaySound("weapons/sniper/sniper_zoomin.wav") - end - end - - function SWEP:Reload() - if self:GetNextReload() <= CurTime() and self:Clip1() == 0 and 0 < self.Owner:GetAmmoCount("XBowBolt") then - surface.PlaySound("weapons/crossbow/bolt_load"..math.random(1,2)..".wav") - self:DefaultReload(ACT_VM_RELOAD) - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RELOAD_CROSSBOW) - self:SetNextReload(CurTime() + self:SequenceDuration()) - end - end - - local texScope = surface.GetTextureID("zombiesurvival/scope") - function SWEP:DrawHUDBackground() - if self:GetDTBool(1) then - local scrw, scrh = ScrW(), ScrH() - local size = math.min(scrw, scrh) - - local hw = scrw * 0.5 - local hh = scrh * 0.5 - - surface.SetDrawColor(255, 0, 0, 180) - surface.DrawLine(0, hh, scrw, hh) - surface.DrawLine(hw, 0, hw, scrh) - for i=1, 10 do - surface.DrawLine(hw, hh + i * 7, hw + (50 - i * 5), hh + i * 7) - end - - surface.SetTexture(texScope) - surface.SetDrawColor(255, 255, 255, 255) - surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size) - surface.SetDrawColor(0, 0, 0, 255) - if scrw > size then - local extra = (scrw - size) * 0.5 - surface.DrawRect(0, 0, extra, scrh) - surface.DrawRect(scrw - extra, 0, extra, scrh) - end - if scrh > size then - local extra = (scrh - size) * 0.5 - surface.DrawRect(0, 0, scrw, extra) - surface.DrawRect(0, scrh - extra, scrw, extra) - end - end - end -end - -function SWEP:Holster() - if self:GetDTBool(1) then - self.Owner:SetFOV(self.Owner:GetInfo("fov_desired"), 0.5) - self:EmitSound("weapons/sniper/sniper_zoomout.wav", 50, 100) - self:SetDTBool(1, false) - end - - return true -end - -function SWEP:OnRemove() - if self.Owner:IsValid() and self:GetDTBool(1) then - self.Owner:SetFOV(self.Owner:GetInfo("fov_desired"), 0.5) - end -end - -util.PrecacheSound("weapons/crossbow/bolt_load1.wav") -util.PrecacheSound("weapons/crossbow/bolt_load2.wav") -util.PrecacheSound("weapons/sniper/sniper_zoomin.wav") -util.PrecacheSound("weapons/sniper/sniper_zoomout.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/cl_init.lua new file mode 100644 index 0000000..d3d6af7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/cl_init.lua @@ -0,0 +1,57 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "ValveBiped.Crossbow_base" +SWEP.HUD3DPos = Vector(1.5, 0.5, 11) +SWEP.HUD3DScale = 0.025 + +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.IronsightsMultiplier = 0.25 + +function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return self.BaseClass.GetViewModelPosition(self, pos, ang) +end + +local texScope = surface.GetTextureID("zombiesurvival/scope") +function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if not self:IsScoped() then return end + + local scrw, scrh = ScrW(), ScrH() + local size = math.min(scrw, scrh) + + local hw = scrw * 0.5 + local hh = scrh * 0.5 + + surface.SetDrawColor(255, 0, 0, 180) + surface.DrawLine(0, hh, scrw, hh) + surface.DrawLine(hw, 0, hw, scrh) + for i=1, 10 do + surface.DrawLine(hw, hh + i * 7, hw + (50 - i * 5), hh + i * 7) + end + + surface.SetTexture(texScope) + surface.SetDrawColor(255, 255, 255, 255) + surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size) + surface.SetDrawColor(0, 0, 0, 255) + if scrw > size then + local extra = (scrw - size) * 0.5 + surface.DrawRect(0, 0, extra, scrh) + surface.DrawRect(scrw - extra, 0, extra, scrh) + end + if scrh > size then + local extra = (scrh - size) * 0.5 + surface.DrawRect(0, 0, scrw, extra) + surface.DrawRect(0, scrh - extra, scrw, extra) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/shared.lua new file mode 100644 index 0000000..f23ae24 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crossbow/shared.lua @@ -0,0 +1,51 @@ +SWEP.PrintName = "'Impaler' Crossbow" +SWEP.Description = "This ancient weapon can easily skewer groups of zombies." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Crossbow.Single") +SWEP.Primary.Delay = 2.0 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 90 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.DefaultClip = 15 + +SWEP.SecondaryDelay = 0.25 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.NextZoom = 0 + +SWEP.ReloadSpeed = 0.85 -- Since it works with it now. + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_PROJECTILE_VELOCITY, 100) + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/crossbow/bolt_load"..math.random(2)..".wav", 65, 100, 0.9, CHAN_WEAPON + 21) + self:EmitSound("weapons/crossbow/reload1.wav", 65, 100, 0.9, CHAN_WEAPON + 22) + end +end + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +util.PrecacheSound("weapons/crossbow/bolt_load1.wav") +util.PrecacheSound("weapons/crossbow/bolt_load2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/cl_init.lua index 022a2ae..6fcd26f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/cl_init.lua @@ -1,4 +1,4 @@ -include("shared.lua") +INC_CLIENT() SWEP.PrintName = "Crow" SWEP.DrawCrosshair = false @@ -14,3 +14,7 @@ end function SWEP:Think() end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/init.lua index 6d84545..096095d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/init.lua @@ -1,15 +1,12 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - self.Owner.SkipCrow = true + self:GetOwner().SkipCrow = true return true end function SWEP:Holster() - local owner = self.Owner + local owner = self:GetOwner() if owner:IsValid() then owner:StopSound("NPC_Crow.Flap") owner:SetAllowFullRotation(false) @@ -18,12 +15,7 @@ end SWEP.OnRemove = SWEP.Holster function SWEP:Think() - local owner = self.Owner - - if owner:KeyDown(IN_WALK) then - owner:TrySpawnAsGoreChild() - return - end + local owner = self:GetOwner() local fullrot = not owner:OnGround() if owner:GetAllowFullRotation() ~= fullrot then @@ -54,28 +46,28 @@ function SWEP:Think() owner:ResetSpeed() - if ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD and ent:Alive() and ent:GetZombieClassTable().Name == "Crow" then + if ent:IsValidLivingZombie() and ent:GetZombieClassTable().Name == "Crow" then -- Crows can team kill other crows as something to do. ent:TakeSpecialDamage(2, DMG_SLASH, owner, self) end end function SWEP:PrimaryAttack() - if CurTime() < self:GetNextPrimaryFire() or not self.Owner:IsOnGround() then return end + if CurTime() < self:GetNextPrimaryFire() or not self:GetOwner():IsOnGround() then return end self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - self.Owner:EmitSound("NPC_Crow.Squawk") - self.Owner.EatAnim = CurTime() + 2 + self:GetOwner():EmitSound("NPC_Crow.Squawk") + self:GetOwner().EatAnim = CurTime() + 2 self:SetPeckEndTime(CurTime() + 1) - self.Owner:SetSpeed(1) + self:GetOwner():SetSpeed(1) end function SWEP:SecondaryAttack() if CurTime() < self:GetNextSecondaryFire() then return end self:SetNextSecondaryFire(CurTime() + 1.6) - self.Owner:EmitSound("NPC_Crow.Alert") + self:GetOwner():EmitSound("NPC_Crow.Alert") end function SWEP:Reload() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/shared.lua index 156d52c..9aa7216 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crow/shared.lua @@ -21,7 +21,7 @@ function SWEP:Initialize() end function SWEP:OnRemove() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then if owner.Flapping then owner:StopSound("NPC_Crow.Flap") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crowbar.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crowbar.lua index 21f064e..31f3a78 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crowbar.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crowbar.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Crowbar" - SWEP.Description = "Instantly kills headcrabs." +SWEP.PrintName = "Crowbar" +SWEP.Description = "An effective and fast swinging melee weapon, the crowbar also has the ability to instantly kill headcrabs." +if CLIENT then SWEP.ViewModelFOV = 65 end @@ -15,10 +15,13 @@ SWEP.UseHands = true SWEP.HoldType = "melee" +SWEP.DamageType = DMG_CLUB + SWEP.MeleeDamage = 35 +SWEP.OriginalMeleeDamage = SWEP.MeleeDamage SWEP.MeleeRange = 55 SWEP.MeleeSize = 1.5 -SWEP.MeleeKnockBack = 10 +SWEP.MeleeKnockBack = 110 SWEP.Primary.Delay = 0.7 @@ -26,6 +29,10 @@ SWEP.SwingTime = 0.4 SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3) + function SWEP:PlaySwingSound() self:EmitSound("Weapon_Crowbar.Single") end @@ -38,8 +45,18 @@ function SWEP:PlayHitFleshSound() self:EmitSound("Weapon_Crowbar.Melee_Hit") end -function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() and hitent:IsPlayer() and hitent:Team() == TEAM_UNDEAD and hitent:IsHeadcrab() and gamemode.Call("PlayerShouldTakeDamage", hitent, self.Owner) then - hitent:SetHealth(1) +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and hitent:Team() == TEAM_UNDEAD and hitent:IsHeadcrab() and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then + hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, self:GetOwner(), self, tr.HitPos) end end + +--[[function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and hitent:Team() == TEAM_UNDEAD and hitent:IsHeadcrab() and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then + self.MeleeDamage = hitent:GetMaxHealth() * 10 + end +end + +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + self.MeleeDamage = self.OriginalMeleeDamage +end]] diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/cl_init.lua new file mode 100644 index 0000000..b28c231 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/cl_init.lua @@ -0,0 +1,11 @@ +INC_CLIENT() + +SWEP.VElements = { + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Grenade_body", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.1, 0.029, 0.029), color = Color(74, 95, 120, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Grenade_body", rel = "", pos = Vector(0, 0, -1), angle = Angle(0, 0, 90), size = Vector(0.449, 0.4, 0.449), color = Color(67, 119, 165, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["corrosive_nade+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "corrosive_nade", pos = Vector(0, -0.201, 0.4), angle = Angle(0, 90, 0), size = Vector(0.1, 0.029, 0.029), color = Color(74, 95, 120, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["corrosive_nade"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.5, 2, -0.5), angle = Angle(0, 0, 90), size = Vector(0.449, 0.4, 0.449), color = Color(67, 119, 165, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/init.lua new file mode 100644 index 0000000..ba25304 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_crygasgrenade" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/shared.lua new file mode 100644 index 0000000..231318f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_crygasgrenade/shared.lua @@ -0,0 +1,11 @@ +SWEP.PrintName = "Cryo Gas Grenade" +SWEP.Description = "Spews cryo gas in an area where it lands for a significant period of time. Zombies in the area take damage over time and move and attack slower." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "crygasgrenade" + +SWEP.MaxStock = 6 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deagle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deagle.lua index 4d7bc73..381e4df 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deagle.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deagle.lua @@ -1,11 +1,11 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Zombie Drill' Desert Eagle" - SWEP.Description = "This handgun uses high-powered rounds that have more knockback than others." --SWEP.Description = "This high-powered handgun has the ability to pierce through multiple zombies. The bullet's power decreases by half which each zombie it hits." - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Zombie Drill' Desert Eagle" +SWEP.Description = "This handgun uses high-powered rounds that have more knockback than others." --SWEP.Description = "This high-powered handgun has the ability to pierce through multiple zombies. The bullet's power decreases by half which each zombie it hits." +SWEP.Slot = 1 +SWEP.SlotPos = 0 +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 @@ -26,7 +26,7 @@ SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_Deagle.Single") -SWEP.Primary.Damage = 47 +SWEP.Primary.Damage = 57 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.32 SWEP.Primary.KnockbackScale = 2 @@ -36,5 +36,11 @@ SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.1 -SWEP.ConeMin = 0.04 +SWEP.ConeMax = 3.4 +SWEP.ConeMin = 1.25 + +SWEP.FireAnimSpeed = 1.3 + +SWEP.Tier = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 2) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deathdealers.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deathdealers.lua new file mode 100644 index 0000000..4af432e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_deathdealers.lua @@ -0,0 +1,135 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Deathdealers' Dual Shotguns" +SWEP.Description = "A unique pair of fast firing, high damage shotguns. Reloads quickly by quickly replacing the shotguns used with a new pair, throwing the old away." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 62 + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.HUD3DBone = "v_weapon.slide_right" + SWEP.HUD3DPos = Vector(0, -3, -3.5) + SWEP.HUD3DScale = 0.015 + + SWEP.VElements = { + ["handle+"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel++", pos = Vector(-0.308, 20.618, -2.906), angle = Angle(-60.416, 89, 0), size = Vector(0.685, 1.394, 1.488), color = Color(105, 105, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel", pos = Vector(-0.308, 20.618, -2.906), angle = Angle(-60.416, 89, 0), size = Vector(0.685, 1.394, 1.488), color = Color(105, 105, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel+"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.elite_right", rel = "barrel", pos = Vector(0, 11.961, 0), angle = Angle(0, 0, 0), size = Vector(0.035, 0.004, 0.029), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["barrel+++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.elite_right", rel = "barrel++", pos = Vector(0, 11.961, 0), angle = Angle(0, 0, 0), size = Vector(0.035, 0.004, 0.029), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["bottom2"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel", pos = Vector(0, -5.393, -3.069), angle = Angle(180, 90, 0), size = Vector(0.143, 0.07, 0.057), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.elite_right", rel = "", pos = Vector(0.028, -2.34, 17.02), angle = Angle(180, 0, -90), size = Vector(0.034, 0.045, 0.029), color = Color(165, 165, 155, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["BARREL2+"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel++", pos = Vector(-0.138, -14.155, -0.889), angle = Angle(180, -90, -90), size = Vector(0.352, 0.356, 0.18), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["bottom2+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel++", pos = Vector(0, -5.393, -3.069), angle = Angle(180, 90, 0), size = Vector(0.143, 0.07, 0.057), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["barrel++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.elite_left", rel = "", pos = Vector(-0.213, -2.34, 17.02), angle = Angle(180, 0, -90), size = Vector(0.034, 0.045, 0.029), color = Color(165, 165, 155, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["BARREL2"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel", pos = Vector(-0.138, -14.155, -0.889), angle = Angle(180, -90, -90), size = Vector(0.352, 0.356, 0.18), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["handle+"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel++", pos = Vector(-0.308, 20.618, -2.906), angle = Angle(-60.416, 89, 0), size = Vector(0.685, 1.394, 1.488), color = Color(105, 105, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(-0.308, 20.618, -2.906), angle = Angle(-60.416, 89, 0), size = Vector(0.685, 1.394, 1.488), color = Color(105, 105, 105, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel+"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(0, 11.961, 0), angle = Angle(0, 0, 0), size = Vector(0.035, 0.004, 0.029), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["BARREL2+"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel++", pos = Vector(-0.138, -14.155, -0.889), angle = Angle(180, -90, -90), size = Vector(0.352, 0.356, 0.18), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["bottom2+"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel++", pos = Vector(0, -5.393, -3.069), angle = Angle(180, 90, 0), size = Vector(0.143, 0.07, 0.057), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(20.041, 2.372, -3.764), angle = Angle(180, -95, 8), size = Vector(0.034, 0.045, 0.029), color = Color(165, 165, 155, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["BARREL2"] = { type = "Model", model = "models/props_combine/combinebutton.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(-0.138, -14.155, -0.889), angle = Angle(180, -90, -90), size = Vector(0.352, 0.356, 0.18), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["bottom2"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(0, -5.393, -3.069), angle = Angle(180, 90, 0), size = Vector(0.143, 0.07, 0.057), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} }, + ["barrel++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(19.978, 2.829, 4.127), angle = Angle(0, -95, 8), size = Vector(0.034, 0.045, 0.029), color = Color(165, 165, 155, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel+++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel++", pos = Vector(0, 11.961, 0), angle = Angle(0, 0, 0), size = Vector(0.035, 0.004, 0.029), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/destroyedpipes01a", skin = 0, bodygroup = {} } + } + + SWEP.ViewModelBoneMods = { + ["v_weapon.elite_right"] = { scale = Vector(1, 1, 1), pos = Vector(0, -0.19, -4.318), angle = Angle(0, 0, -3) }, + ["ValveBiped.Bip01_Spine4"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 4.721, 0) }, + ["ValveBiped.Bip01_L_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(7, 0, 0) }, + ["v_weapon.elite_left"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0.126, -3.794), angle = Angle(0, 0, -3) }, + ["ValveBiped.Bip01_R_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-7, 0, 0) } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "duel" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_elite.mdl" +SWEP.WorldModel = "models/weapons/w_pist_elite.mdl" +SWEP.FakeWorldModel = "models/weapons/w_shotgun.mdl" +SWEP.UseHands = true + +SWEP.Primary.Damage = 15.75 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Delay = 0.6 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 6 +SWEP.ConeMin = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.75) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.5) + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() + local owner = self:GetOwner() + if owner:IsHolding() or not self:CanReload() then return end + + if SERVER then + for i=1,2 do + local ent = ents.Create("prop_fakeweapon") + if ent:IsValid() then + ent:SetOwner(owner) + ent:SetWeaponType(self:GetClass()) + local pos = owner:EyePos() + owner:EyeAngles():Right() * (i == 1 and 8 or -8) + ent:SetPos(pos) + ent:SetAngles(VectorRand():Angle()) + ent:Spawn() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:AddAngleVelocity(Vector(math.Rand(-420, 420), math.Rand(-420, 420), math.Rand(-420, 420))) + phys:ApplyForceCenter(phys:GetMass() * owner:GetAimVector() * math.random(64, 128)) + end + end + end + end + + self.BaseClass.Reload(self) +end + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(self:Clip1() % 2 == 0 and ACT_VM_PRIMARYATTACK or ACT_VM_SECONDARYATTACK) +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/shotgun/shotgun_dbl_fire.wav", 75, math.random(125, 130)) +end + +if not CLIENT then return end + +function SWEP:GetTracerOrigin() + local owner = self:GetOwner() + if owner:IsValid() then + local vm = owner:GetViewModel() + if vm and vm:IsValid() then + local attachment = vm:GetAttachment(self:Clip1() % 2 + 3) + if attachment then + return attachment.Pos + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/cl_init.lua index cb0f1be..9c7145f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/cl_init.lua @@ -1,26 +1,24 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Remote Detonation Pack" -SWEP.Description = "A pack of explosives that can be placed on surfaces and detonated remotely.\nPress PRIMARY ATTACK to deploy.\nPress PRIMARY ATTACK again to detonate.\nPress SPRINT on a deployed detonation pack to disarm and retrieve it." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/init.lua index 532efbe..df45a8f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_detpack") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_detpack", false, true) end @@ -37,7 +34,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_detpack if not (status and status:IsValid()) then return end @@ -47,7 +44,7 @@ function SWEP:PrimaryAttack() local pos, ang, entity = status:RecalculateValidity() if not pos or not ang then return end - self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + self:SetNextPrimaryAttack(CurTime() + 1) local ent = ents.Create("prop_detpack") if ent:IsValid() then @@ -62,7 +59,7 @@ function SWEP:PrimaryAttack() self:TakePrimaryAmmo(1) - ent:SetOwner(self.Owner) + ent:SetOwner(self:GetOwner()) if self:GetPrimaryAmmoCount() <= 0 then owner:StripWeapon(self:GetClass()) @@ -82,6 +79,6 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/shared.lua index 05e18a6..6712831 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpack/shared.lua @@ -1,3 +1,6 @@ +SWEP.PrintName = "Remote Detonation Pack" +SWEP.Description = "A pack of explosives that can be placed on surfaces and detonated remotely, to deal large explosive damage.\nPress PRIMARY ATTACK to deploy.\nPress PRIMARY ATTACK again to detonate.\nPress SPRINT on a deployed detonation pack to disarm and retrieve it." + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/weapons/w_c4_planted.mdl") @@ -6,19 +9,23 @@ SWEP.AmmoIfHas = true SWEP.Primary.ClipSize = 1 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Ammo = "sniperpenetratedround" -SWEP.Primary.Delay = 1 +SWEP.Primary.Delay = 0.1 SWEP.Primary.Automatic = true SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Ammo = "dummy" +SWEP.MaxStock = 8 + SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOW +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() end @@ -40,7 +47,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) @@ -55,7 +62,7 @@ function SWEP:CanSecondaryAttack() end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpackremote.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpackremote.lua index 06e4b09..25a2218 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpackremote.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_detpackremote.lua @@ -1,14 +1,14 @@ AddCSLuaFile() +SWEP.PrintName = "Detonation Pack Remote" +SWEP.Description = "Allows the user to remotely detonate their detonation packs." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + if CLIENT then SWEP.ViewModelFOV = 50 SWEP.BobScale = 0.5 SWEP.SwayScale = 0.5 - SWEP.PrintName = "Detonation Pack Remote" - SWEP.Description = "Allows the user to remotely detonate their detonation packs." - - SWEP.Slot = 4 - SWEP.SlotPos = 0 end SWEP.ViewModel = "models/weapons/c_slam.mdl" @@ -33,6 +33,8 @@ SWEP.NoPickupNotification = true SWEP.HoldType = "slam" +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) end @@ -40,12 +42,12 @@ end if SERVER then function SWEP:Think() for _, ent in pairs(ents.FindByClass("prop_detpack")) do - if ent:GetOwner() == self.Owner then + if ent:GetOwner() == self:GetOwner() then return end end - self.Owner:StripWeapon(self:GetClass()) + self:GetOwner():StripWeapon(self:GetClass()) end end @@ -55,7 +57,7 @@ function SWEP:PrimaryAttack() if CLIENT then return end for _, ent in pairs(ents.FindByClass("prop_detpack")) do - if ent:GetOwner() == self.Owner and ent:GetExplodeTime() == 0 then + if ent:GetOwner() == self:GetOwner() and ent:GetExplodeTime() == 0 then ent:SetExplodeTime(CurTime() + ent.ExplosionDelay) end end @@ -67,9 +69,9 @@ end function SWEP:Reload() return false end - + function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SendWeaponAnim(ACT_SLAM_DETONATOR_IDLE) @@ -82,8 +84,8 @@ end if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/cl_init.lua new file mode 100644 index 0000000..31b188f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/cl_init.lua @@ -0,0 +1,6 @@ +INC_CLIENT() + +SWEP.PrintName = "Devourer" + +SWEP.ViewModelFOV = 47 +SWEP.DrawCrosshair = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/init.lua new file mode 100644 index 0000000..954a91d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/init.lua @@ -0,0 +1,27 @@ +INC_SERVER() + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:ThrowHook() + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + local ent = ents.Create("projectile_devourer") + if ent:IsValid() then + local ang = owner:EyeAngles() + ang:RotateAroundAxis(ang:Up(), 90) + + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(ang) + ent:SetOwner(owner) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(owner:GetAimVector() * 2150) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/shared.lua new file mode 100644 index 0000000..89d7b5d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_devourer/shared.lua @@ -0,0 +1,88 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeReach = 52 +SWEP.MeleeDelay = 0.36 +SWEP.MeleeSize = 4.5 +SWEP.MeleeDamage = 24 +SWEP.SlowDownScale = 3 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.MeleeAnimationDelay = 0.05 + +SWEP.Primary.Delay = 0.8 + +SWEP.ViewModel = Model("models/weapons/v_pza.mdl") +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +AccessorFuncDT(SWEP, "HookTime", "Float", 1) + +function SWEP:SecondaryAttack() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() then return end + + self:SetNextSecondaryFire(CurTime() + 3.25) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:SetSwingAnimTime(CurTime() + 0.7) + + self:GetOwner():DoReloadEvent() + + self:EmitSound("npc/headcrab_poison/ph_poisonbite3.wav", 75, 46) + + self:SetHookTime(CurTime() + 0.9) +end + +function SWEP:Think() + if self:GetHookTime() > 0 and CurTime() >= self:GetHookTime() then + self:SetHookTime(0) + + self:EmitSound("physics/flesh/flesh_squishy_impact_hard"..math.random(2, 4)..".wav", 72, math.random(70, 83)) + self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) + + if SERVER then + self:ThrowHook() + end + end + + return self.BaseClass.Think(self) +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:CheckMoaning() +end + +function SWEP:StopMoaningSound() +end + +function SWEP:StartMoaningSound() +end + +function SWEP:PlayHitSound() + self:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav", 75, 80, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 75, 80, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 75, 140) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:SetSwingAnimTime(time) + self:SetDTFloat(3, time) +end + +function SWEP:GetSwingAnimTime() + return self:GetDTFloat(3) +end + +function SWEP:StartSwinging() + self.BaseClass.StartSwinging(self) + self:SetSwingAnimTime(CurTime() + 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/cl_init.lua new file mode 100644 index 0000000..00b1376 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/cl_init.lua @@ -0,0 +1,13 @@ +INC_CLIENT() + +SWEP.PrintName = "Doom Crab" +SWEP.DrawCrosshair = false + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/init.lua new file mode 100644 index 0000000..b1efee1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/init.lua @@ -0,0 +1,47 @@ +INC_SERVER() + +function SWEP:ThrowGibs() + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + local ent = ents.Create("projectile_doomcrab") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(AngleRand()) + ent:SetOwner(owner) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(owner:GetAimVector() * 600) + phys:AddAngleVelocity(VectorRand() * 360) + end + end +end + +function SWEP:PoundAttackProcess() + if CurTime() < self.PoundAttackStart + 0.4 then return end + + local owner = self:GetOwner() + local pos = owner:GetPos() + Vector(0, 0, 2) + + owner:LagCompensation(true) + + owner:EmitSound("physics/concrete/concrete_break3.wav", 77, 70) + + util.ScreenShake(pos, 5, 5, 1, 300) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0, 0, 1)) + util.Effect("ThumperDust", effectdata, true, true) + + owner:GodEnable() + util.BlastDamageEx(self, owner, pos, 112, 25, DMG_CLUB) + util.BlastDamageEx(self, owner, pos, 22, 40, DMG_CLUB) + owner:GodDisable() + + owner:LagCompensation(false) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/shared.lua new file mode 100644 index 0000000..301060b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_doomcrab/shared.lua @@ -0,0 +1,172 @@ +SWEP.ZombieOnly = true +SWEP.IsMelee = true + +SWEP.ViewModel = "models/weapons/v_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "none" +SWEP.Primary.Delay = 0.4 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.Delay = 0.22 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = true +SWEP.Secondary.Ammo = "none" + +SWEP.NoHitRecovery = 0.75 +SWEP.HitRecovery = 1 + +SWEP.AttackTime = 1.875 +SWEP.AttackProcessTime = 1.35 +--[[SWEP.AttackDamage = 40 +SWEP.AttackDamageType = DMG_BLUNT + +SWEP.MeleeReach = 64 +SWEP.MeleeSize = 64]] + +AccessorFuncDT(SWEP, "AttackStartTime", "Float", 0) +AccessorFuncDT(SWEP, "AttackProcessTime", "Float", 1) + +SWEP.PoundAttackStart = 0 + +function SWEP:Initialize() + self:HideViewAndWorldModel() +end + +function SWEP:Think() + local time = CurTime() + local owner = self:GetOwner() + + if self:GetAttackProcessTime() > 0 and time >= self:GetAttackProcessTime() then + self:SetAttackProcessTime(0) + + if SERVER then + self:ThrowGibs() + end + end + + if self:IsAttacking() and time > self:GetAttackEndTime() then + self:SetAttackStartTime(0) + self:SetAttackProcessTime(0) + end + + if self:IsPouncing() then + local delay = owner:GetMeleeSpeedMul() + if owner:WaterLevel() >= 2 then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.5 * delay) + elseif owner:OnGround() and owner:IsOnGround() then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.6 * delay) + + if SERVER then + self:PoundAttackProcess() + end + end + end + + self:NextThink(time) + return true +end + +function SWEP:PrimaryAttack() + local owner = self:GetOwner() + if self:IsPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() or self:IsAttacking() then return end + + self.PoundAttackStart = CurTime() + + local vel = owner:GetAimVector() + vel.z = math.max(0.45, vel.z) + vel:Normalize() + + owner:SetGroundEntity(NULL) + owner:SetVelocity(vel * 250) + owner:DoAnimationEvent(ACT_RANGE_ATTACK1) + + if SERVER then + self:EmitAttackSound() + end + + self.m_ViewAngles = owner:EyeAngles() + + self:SetPouncing(true) +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if self:IsAttacking() or self:IsPouncing() or not owner:IsOnGround() then return end + + self:SetAttackStartTime(CurTime()) + self:SetAttackProcessTime(CurTime() + self.AttackProcessTime) + + if SERVER then + self:EmitAttackSound() + end +end + +function SWEP:Reload() + if CurTime() < self:GetNextSecondaryFire() then return end + self:SetNextSecondaryFire(CurTime() + 2) + + if SERVER then + self:EmitIdleSound() + end +end + +function SWEP:Move(mv) + if self:IsPouncing() then + if CurTime() < self.PoundAttackStart + 0.1 then + local vel = mv:GetVelocity() + vel.z = 350 + self:GetOwner():SetGroundEntity(NULL) + mv:SetVelocity(vel) + end + + mv:SetMaxSpeed(mv:GetMaxSpeed() * 5) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 5) + return true + end + + if self:IsAttacking() then + mv:SetMaxSpeed(16) + mv:SetMaxClientSpeed(16) + return true + end +end + +function SWEP:EmitIdleSound() + local ent = self:GetOwner():CompensatedMeleeTrace(4096, 24).Entity + if ent:IsValidPlayer() then + self:GetOwner():EmitSound("npc/headcrab/idle"..math.random(3)..".wav", 75, 60) + else + self:GetOwner():EmitSound("npc/headcrab/alert1.wav", 75, 60) + end +end + +function SWEP:EmitAttackSound() + self:GetOwner():EmitSound("npc/ichthyosaur/attack_growl"..math.random(3)..".wav") +end + +function SWEP:IsAttacking() + return self:GetAttackStartTime() > 0 +end + +function SWEP:GetAttackEndTime() + return self:GetAttackStartTime() + self.AttackTime +end + +function SWEP:SetPouncing(pouncing) + if not pouncing then + self.m_ViewAngles = nil + end + + self:SetDTBool(1, pouncing) +end + +function SWEP:IsPouncing() + return self:GetDTBool(1) +end +SWEP.GetPouncing = SWEP.IsPouncing diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone.lua index 9c0bcd7..2dfac41 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Drone" - SWEP.Description = "A deployable, remotely controlled device.\nIdeal for scouting, retrieval, and targeted attacks." +SWEP.PrintName = "Drone" +SWEP.Description = "A deployable, remotely controlled device.\nIdeal for scouting, retrieval, and targeted attacks." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 SWEP.ShowViewModel = true @@ -46,11 +46,18 @@ SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Ammo = "dummy" +SWEP.ResupplyAmmoType = "smg1" + SWEP.WalkSpeed = SPEED_FAST +SWEP.MaxStock = 6 + +SWEP.DeployClass = "prop_drone" +SWEP.DeployAmmoType = "smg1" + function SWEP:Initialize() self:SetWeaponHoldType("grenade") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) if CLIENT then self:Anim_Initialize() @@ -58,10 +65,10 @@ function SWEP:Initialize() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end - for _, ent in pairs(ents.FindByClass("prop_drone")) do - if ent:GetOwner() == self.Owner then return false end + for _, ent in pairs(ents.FindByClass(self.DeployClass)) do + if ent:GetObjectOwner() == self:GetOwner() then return false end end if self:GetPrimaryAmmoCount() <= 0 then @@ -76,19 +83,21 @@ function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - local owner = self.Owner + local owner = self:GetOwner() self:SendWeaponAnim(ACT_VM_THROW) owner:DoAttackEvent() self:TakePrimaryAmmo(1) self.NextDeploy = CurTime() + 0.75 + owner.DroneControlAmmo = self.DeployAmmoType if SERVER then - local ent = ents.Create("prop_drone") + local ent = ents.Create(self.DeployClass) if ent:IsValid() then ent:SetPos(owner:GetShootPos()) - ent:SetOwner(owner) ent:Spawn() + ent:SetObjectOwner(owner) + ent:SetupPlayerSkills() local stored = owner:PopPackedItem(ent:GetClass()) if stored then @@ -99,7 +108,14 @@ function SWEP:PrimaryAttack() local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:Wake() - phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 200) + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 200) + end + + local ammotype = self.DeployAmmoType + if ammotype then + local ammo = math.min(owner:GetAmmoCount(ammotype), ent.MaxAmmo) + ent:SetAmmo(ammo) + owner:RemoveAmmo(ammo, ammotype) end if not owner:HasWeapon("weapon_zs_dronecontrol") then @@ -126,7 +142,7 @@ function SWEP:Reload() end function SWEP:Deploy() - GAMEMODE:WeaponDeployed(self.Owner, self) + GAMEMODE:WeaponDeployed(self:GetOwner(), self) if self:GetPrimaryAmmoCount() <= 0 then self:SendWeaponAnim(ACT_VM_THROW) @@ -166,7 +182,7 @@ local colWhite = Color(220, 220, 220, 230) SWEP.HUD3DPos = Vector(5, 2, 0) function SWEP:PostDrawViewModel(vm) - if not self.HUD3DPos or GAMEMODE.WeaponHUDMode == 1 then return end + if not self.HUD3DPos or not GAMEMODE:ShouldDraw3DWeaponHUD() then return end local bone = vm:LookupBone("ValveBiped.Bip01_R_Hand") if not bone then return end @@ -196,4 +212,4 @@ function SWEP:PostDrawViewModel(vm) draw.RoundedBox(32, x, y, wid, hei, colBG) draw.SimpleText(clip, "ZS3D2DFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) cam.End3D2D() -end \ No newline at end of file +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_hauler.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_hauler.lua new file mode 100644 index 0000000..81be251 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_hauler.lua @@ -0,0 +1,13 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_drone") + +SWEP.Base = "weapon_zs_drone" + +SWEP.PrintName = "Hauler Drone" +SWEP.Description = "A hauling drone.\nIdeal for scouting and retrieval.\nCarries props and items around at immense speeds, but cannot attack." + +SWEP.Primary.Ammo = "drone_hauler" + +SWEP.DeployClass = "prop_drone_hauler" +SWEP.DeployAmmoType = false +SWEP.ResupplyAmmoType = nil diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_pulse.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_pulse.lua new file mode 100644 index 0000000..a30b8ac --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_drone_pulse.lua @@ -0,0 +1,13 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_drone") + +SWEP.Base = "weapon_zs_drone" + +SWEP.PrintName = "Pulse Drone" +SWEP.Description = "A deployable, remotely controlled device.\nIdeal for scouting, retrieval, and targeted attacks.\nUses projectiles instead of bullets." + +SWEP.Primary.Ammo = "pulse_cutter" + +SWEP.DeployClass = "prop_drone_pulse" +SWEP.DeployAmmoType = "pulse" +SWEP.ResupplyAmmoType = "pulse" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_dronecontrol.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_dronecontrol.lua index 70d9899..8c3f830 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_dronecontrol.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_dronecontrol.lua @@ -1,16 +1,13 @@ AddCSLuaFile() +SWEP.PrintName = "Drone Control" +SWEP.Description = "Controller for your Drone." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + if CLIENT then - SWEP.PrintName = "Drone Control" - SWEP.Description = "Controller for your Drone." - - SWEP.ViewModelFOV = 50 - SWEP.BobScale = 0.5 SWEP.SwayScale = 0.5 - - SWEP.Slot = 4 - SWEP.SlotPos = 0 end SWEP.ViewModel = "models/weapons/c_slam.mdl" @@ -23,7 +20,7 @@ SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" -SWEP.Secondary.Delay = 20 +SWEP.Secondary.Delay = 0 SWEP.Secondary.Heal = 10 SWEP.Secondary.ClipSize = -1 @@ -39,6 +36,10 @@ SWEP.NoPickupNotification = true SWEP.HoldType = "slam" +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self:SetDeploySpeed(10) @@ -51,35 +52,42 @@ function SWEP:Think() end if SERVER then - for _, ent in pairs(ents.FindByClass("prop_drone")) do - if ent:GetOwner() == self.Owner then + for _, ent in pairs(ents.FindByClass("prop_drone*")) do + if ent:IsValid() and ent:GetObjectOwner() == self:GetOwner() then return end end - self.Owner:StripWeapon(self:GetClass()) + self:GetOwner():StripWeapon(self:GetClass()) end end +function SWEP:GetResupplyAmmoType() + local owner = self:GetOwner() + if owner:IsValid() and owner.DroneControlAmmo then + return owner.DroneControlAmmo + end + return "smg1" +end + function SWEP:PrimaryAttack() +end + +function SWEP:SecondaryAttack() if IsFirstTimePredicted() then self:SetDTBool(0, not self:GetDTBool(0)) if CLIENT then - LocalPlayer():EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) + MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) end end end -function SWEP:SecondaryAttack() +function SWEP:Reload() end -function SWEP:Reload() - return false -end - function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -92,11 +100,8 @@ function SWEP:Holster() return true end -function SWEP:Reload() -end - if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_elderghoul.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_elderghoul.lua new file mode 100644 index 0000000..6a8e7a0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_elderghoul.lua @@ -0,0 +1,101 @@ +AddCSLuaFile() + +SWEP.PrintName = "Elder Ghoul" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 26 +SWEP.MeleeDamageVsProps = 22 +SWEP.MeleeForceScale = 0.5 +SWEP.SlowDownScale = 0.25 + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + ent:PoisonDamage(damage, self:GetOwner(), self, trace.HitPos) +end + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = self.MeleeDamageVsProps + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/fast_zombie/fz_alert_close1.wav", 75, math.Rand(70, 80)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) +end + +local PoisonPatterns = { + Angle(0, 0, 0), + Angle(8, 0, 0), + Angle(-8, 8, 0), + Angle(-8, -8, 0) +} +local function DoFleshThrow(pl, wep) + if pl:IsValid() and pl:Alive() and wep:IsValid() then + pl.LastRangedAttack = CurTime() + + if SERVER then + local startpos = pl:GetShootPos() + local aimang = pl:EyeAngles() + + for i, pattern in pairs(PoisonPatterns) do + local ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), pattern.yaw) + ang:RotateAroundAxis(ang:Right(), pattern.pitch) + + local ent = ents.Create("projectile_poisonflesh") + if ent:IsValid() then + ent:SetPos(startpos) + ent:SetOwner(pl) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(ang:Forward() * 350) + end + end + end + + pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.Rand(85, 95)) + end + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end + + self:SetNextSecondaryFire(CurTime() + 3) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:GetOwner():DoZombieEvent() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + self:SendWeaponAnim(ACT_VM_HITCENTER) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + timer.Simple(0.7, function() DoFleshThrow(owner, self) end) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) + render.SetColorModulation(1, 1, 1) +end + +local matSheet = Material("models/weapons/v_zombiearms/ghoulsheet") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) + render.SetColorModulation(0.66, 0.86, 0) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_electrohammer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_electrohammer.lua index 858247d..ed8343a 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_electrohammer.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_electrohammer.lua @@ -1,11 +1,12 @@ AddCSLuaFile() +SWEP.PrintName = "Electrohammer" + if CLIENT then - SWEP.PrintName = "Electrohammer" SWEP.VElements = { ["base2"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(0, 0, 0), angle = Angle(0, 180, 0), size = Vector(0.08, 0.08, 0.08), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base"] = { type = "Model", model = "models/props_lab/powerbox02d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.4, 3.975, -9.412), angle = Angle(5.961, 270, 16.764), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_lab/powerbox02d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-0.9, 4.975, -8.412), angle = Angle(5.961, 270, 16.764), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["ss"] = { type = "Sprite", sprite = "sprites/grav_flare", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-1.338, 2.894, 0.125), size = { x = 5, y = 5 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, ["base2+"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-0.975, -0.263, 0.232), angle = Angle(0, 270, 90), size = Vector(0.15, 0.15, 0.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } @@ -20,8 +21,13 @@ end SWEP.Base = "weapon_zs_hammer" -SWEP.MeleeDamage = 40 +SWEP.MeleeDamage = 19 --40 SWEP.HealStrength = 1.4 -SWEP.ViewModel = "models/weapons/v_hammer/v_hammer.mdl" +SWEP.ViewModel = "models/weapons/v_hammer/c_hammer.mdl" SWEP.WorldModel = "models/weapons/w_hammer.mdl" + +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.04) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3, 1) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/cl_init.lua new file mode 100644 index 0000000..57e4143 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/cl_init.lua @@ -0,0 +1,76 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.ump45_Release" +SWEP.HUD3DPos = Vector(-1.6, -4.4, 2) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.02 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModelFOV = 65 +SWEP.ViewModelFlip = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["whity++"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.26, 0.26, 0.26), color = Color(255, 255, 255, 26), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["whity+++++"] = { type = "Model", model = "models/props_wasteland/coolingtank01.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, -2.597, 4.699), angle = Angle(8, 90, 180), size = Vector(0.014, 0.019, 0.041), color = Color(105, 128, 135, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity+++++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(2.2, 0, 8), angle = Angle(0, 0, 90), size = Vector(0.3, 0.3, 0.3), color = Color(180, 193, 195, 255), surpresslightning = false, material = "models/props_combine/breenwindows_sheet", skin = 0, bodygroup = {} }, + ["whity++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, 3, 8), angle = Angle(0, 0, 180), size = Vector(0.039, 0.039, 0.237), color = Color(249, 223, 204, 255), surpresslightning = false, material = "models/props_combine/combine_monitorbay_sheet", skin = 0, bodygroup = {} }, + ["whity2"] = { type = "Sprite", sprite = "sprites/glow04", bone = "ValveBiped.Bip01_Spine4", rel = "whity", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(255, 255, 255, 49), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["whity"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-0.5, -2.3, -3.636), angle = Angle(0, 0, 0), size = Vector(0.23, 0.23, 0.23), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["whity++++"] = { type = "Model", model = "models/props_wasteland/coolingtank01.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, 2.5, 4.675), angle = Angle(-8.183, 90, 180), size = Vector(0.014, 0.019, 0.041), color = Color(105, 128, 135, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity++++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(-2.201, 0, 8), angle = Angle(0, 180, 90), size = Vector(0.3, 0.3, 0.3), color = Color(180, 193, 195, 255), surpresslightning = false, material = "models/props_combine/breenwindows_sheet", skin = 0, bodygroup = {} }, + ["whity+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, 1.899, 0), angle = Angle(0, 90, 0), size = Vector(1.7, 0.019, 0.019), color = Color(70, 74, 79, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity+++++++++"] = { type = "Model", model = "models/props_c17/handrail04_short.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, 0, 1.557), angle = Angle(-90, 90, 0), size = Vector(0.3, 0.15, 0.15), color = Color(181, 193, 204, 255), surpresslightning = false, material = "models/props_combine/combine_gate_vehicle01a", skin = 0, bodygroup = {} }, + ["whity+++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Crossbow_base", rel = "whity", pos = Vector(0, -3.3, 0), angle = Angle(0, 90, 0), size = Vector(2.5, 0.019, 0.019), color = Color(74, 79, 79, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["whity++"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.26, 0.26, 0.26), color = Color(255, 255, 255, 36), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["whity+++++"] = { type = "Model", model = "models/props_wasteland/coolingtank01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, -2.597, 4.699), angle = Angle(8, 90, 180), size = Vector(0.014, 0.019, 0.041), color = Color(105, 128, 135, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity+++++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(2.2, 0, 8), angle = Angle(0, 0, 90), size = Vector(0.3, 0.3, 0.3), color = Color(180, 193, 195, 255), surpresslightning = false, material = "models/props_combine/breenwindows_sheet", skin = 0, bodygroup = {} }, + ["whity++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 3, 8), angle = Angle(0, 0, 180), size = Vector(0.039, 0.039, 0.237), color = Color(249, 223, 204, 255), surpresslightning = false, material = "models/props_combine/combine_monitorbay_sheet", skin = 0, bodygroup = {} }, + ["whity2"] = { type = "Sprite", sprite = "sprites/glow04", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(255, 255, 255, 49), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["whity"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.675, 0, -1.558), angle = Angle(0, -90, -104.027), size = Vector(0.23, 0.23, 0.23), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["whity++++"] = { type = "Model", model = "models/props_wasteland/coolingtank01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 2.5, 4.675), angle = Angle(-8.183, 90, 180), size = Vector(0.014, 0.019, 0.041), color = Color(105, 128, 135, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity++++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(-2.201, 0, 8), angle = Angle(0, 180, 90), size = Vector(0.3, 0.3, 0.3), color = Color(180, 193, 195, 255), surpresslightning = false, material = "models/props_combine/breenwindows_sheet", skin = 0, bodygroup = {} }, + ["whity+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 1.899, 0), angle = Angle(0, 90, 0), size = Vector(1.7, 0.019, 0.019), color = Color(70, 74, 79, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity+++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, -3.3, 0), angle = Angle(0, 90, 0), size = Vector(2.5, 0.019, 0.019), color = Color(74, 79, 79, 255), surpresslightning = false, material = "phoenix_storms/torpedo", skin = 0, bodygroup = {} }, + ["whity+++++++++"] = { type = "Model", model = "models/props_c17/handrail04_short.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "whity", pos = Vector(0, 0, 1.557), angle = Angle(-90, 90, 0), size = Vector(0.3, 0.15, 0.15), color = Color(181, 193, 204, 255), surpresslightning = false, material = "models/props_combine/combine_gate_vehicle01a", skin = 0, bodygroup = {} } +} + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -35 * ghostlerp) + end + + return pos, ang +end + +function SWEP:PostDrawViewModel(vm, pl, wep) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local veles = self.VElements + local col1, col2, col3 = Color(0, 0, 0, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 50) + veles["whity"].color = col1 + veles["whity2"].color = col1 + + if self:Clip1() < 1 or self:GetNextPrimaryFire() > CurTime() then return end + + veles["whity"].color = col2 + veles["whity2"].color = col3 +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/init.lua new file mode 100644 index 0000000..a78541d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/init.lua @@ -0,0 +1,7 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_emi" +SWEP.Primary.ProjVelocity = 100 + +function SWEP:PhysModify(physobj) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/shared.lua new file mode 100644 index 0000000..cb441ef --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eminence/shared.lua @@ -0,0 +1,49 @@ +SWEP.PrintName = "'Eminence' Particle Cannon" +SWEP.Description = "Fires projectiles fire particle tracers whilst moving." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "smg" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.Delay = 0.7 +SWEP.Primary.DefaultClip = 4 +SWEP.Primary.Damage = 26 +SWEP.Primary.NumShots = 1 + +SWEP.ConeMax = 3 +SWEP.ConeMin = 2 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 5 + +SWEP.ReloadSpeed = 0.75 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.075) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/grenade_launcher1.wav", 75, math.random(67, 74), 0.4) + self:EmitSound("npc/attack_helicopter/aheli_mine_drop1.wav", 75, 65, 0.8, CHAN_AUTO + 20) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/ar2/ar2_reload_rotate.wav", 70, 55) + self:EmitSound("items/battery_pickup.wav", 70, 77, 0.85, CHAN_AUTO) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/ar2/ar2_reload_push.wav", pos, 70, math.Rand(130, 140)) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ender.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ender.lua index 76904b9..ebfdd2b 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ender.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ender.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Ender' Automatic Shotgun" - SWEP.Slot = 3 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Ender' Automatic Shotgun" +SWEP.Description = "Relatively accurate, clip loaded, automatic shotgun." +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -22,8 +24,8 @@ SWEP.WorldModel = "models/weapons/w_rif_galil.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_Galil.Single") -SWEP.Primary.Damage = 23 -SWEP.Primary.NumShots = 4 +SWEP.Primary.Damage = 9.5 +SWEP.Primary.NumShots = 8 SWEP.Primary.Delay = 0.4 SWEP.Primary.ClipSize = 8 @@ -31,10 +33,21 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "buckshot" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.16 -SWEP.ConeMin = 0.14 +SWEP.ConeMax = 5.625 +SWEP.ConeMin = 4.875 SWEP.WalkSpeed = SPEED_SLOWER +SWEP.Tier = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.603, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.51, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Ender' Automatic Slug Rifle", "Single accurate slug round, less total damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 5.5 + wept.Primary.NumShots = 1 + wept.ConeMin = wept.ConeMin * 0.15 + wept.ConeMax = wept.ConeMax * 0.3 +end) + function SWEP:SecondaryAttack() end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/cl_init.lua new file mode 100644 index 0000000..e66775d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/cl_init.lua @@ -0,0 +1,64 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.HUD3DPos = Vector(4, 0, 15) +SWEP.HUD3DAng = Angle(0, 180, 180) +SWEP.HUD3DScale = 0.04 +SWEP.HUD3DBone = "base" + +SWEP.VElements = { + ["base++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "base", rel = "base", pos = Vector(16, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "base", rel = "base", pos = Vector(22, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_junk/propane_tank001a.mdl", bone = "base", rel = "base", pos = Vector(33.765, 9, -4.676), angle = Angle(0, -90, 90), size = Vector(0.5, 0.5, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/weapons/c_shotgun.mdl", bone = "base", rel = "", pos = Vector(8, -4.5, -21), angle = Angle(90, -90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "base", rel = "base", pos = Vector(30.649, 8.5, -9.87), angle = Angle(0, 0, 0), size = Vector(0.4, 0.4, 0.4), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "base", rel = "base", pos = Vector(36, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "base", rel = "base", pos = Vector(42, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/weapons/w_shotgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(34.805, 9, -9), angle = Angle(-7, 180, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(22, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_junk/propane_tank001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(33.765, 9, -4.676), angle = Angle(0, -90, 90), size = Vector(0.5, 0.5, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(42, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-16.5, 8.5, -11), angle = Angle(0, 0, 180), size = Vector(1, 1, 1), color = Color(255, 255, 255, 0), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(30.649, 8.5, -9.87), angle = Angle(0, 0, 0), size = Vector(0.4, 0.4, 0.4), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(36, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(16, 9, -9), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +function SWEP:DrawHUD() + local wid, hei = 384, 16 + local x, y = ScrW() - wid - 128, ScrH() - hei - 128 + local texty = y - 4 - draw.GetFontHeight("ZSHUDFont") + + local c = 0 + if not self.NextMineCheckTime or self.NextMineCheckTime < CurTime() then + for _, ent in pairs(ents.FindByClass("projectile_impactmine_kin")) do + if (CLIENT or ent.CreateTime + 300 > CurTime()) and ent:GetOwner() == self:GetOwner() then + c = c + 1 + end + end + self.CachedMines = c + self.NextMineCheckTime = CurTime() + 1 + else + c = self.CachedMines + end + + local charges = self:GetPrimaryAmmoCount() + local chargetxt = "Mines: " .. c .. " / " .. self.MaxMines + if charges > 0 then + draw.SimpleText(chargetxt, "ZSHUDFont", x + wid, texty, COLOR_CYAN, TEXT_ALIGN_RIGHT) + end + + if GAMEMODE:ShouldDraw2DWeaponHUD() then + self:Draw2DHUD() + end + + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/init.lua new file mode 100644 index 0000000..58d8941 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/init.lua @@ -0,0 +1,8 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_impactmine_kin" +SWEP.Primary.ProjVelocity = 600 + +function SWEP:PhysModify(physobj) + physobj:AddAngleVelocity(VectorRand():GetNormalized() * 90) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/shared.lua new file mode 100644 index 0000000..34e570f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_enkindler/shared.lua @@ -0,0 +1,103 @@ +SWEP.PrintName = "'Enkindler' Fire Mine Layer" +SWEP.Description = "A mine layer that lays mines that ignite zombies." + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_rpg.mdl" +SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" + +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound("weapons/grenade_launcher1.wav") +SWEP.Primary.Delay = 1 + +SWEP.Primary.Damage = 36.5 +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.DefaultClip = 7 + +SWEP.ReloadSound = Sound("weapons/ar2/ar2_reload.wav") + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.WalkSpeed = SPEED_SLOWEST * 0.9 + +SWEP.UseHands = true + +SWEP.MaxMines = 6 + +SWEP.Tier = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAXIMUM_MINES, 1) + +function SWEP:CanPrimaryAttack() + if self.BaseClass.CanPrimaryAttack(self) then + local c = 0 + for _, ent in pairs(ents.FindByClass("projectile_impactmine_kin")) do + if (CLIENT or ent.CreateTime + 300 > CurTime()) and ent:GetOwner() == self:GetOwner() then + c = c + 1 + end + end + + if c >= self.MaxMines then return false end + + return true + end + + return false +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextSecondaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + + self:SetNextSecondaryFire(CurTime() + 0.1) + + local owner = self:GetOwner() + local hitpos = owner:CompensatedMeleeTrace(2048, 1, nil, nil, false).HitPos + + if SERVER then + for _, ent in pairs(ents.FindInSphere(hitpos, 24)) do + if ent:GetClass() == "projectile_impactmine_kin" and ent:GetOwner() == owner then + local mine = ents.Create("prop_ammo") + if mine:IsValid() then + mine:SetAmmo(1) + mine:SetAmmoType("impactmine") + mine:SetPos(ent:GetStartPos()) + mine:SetAngles(ent:GetAngles()) + mine:Spawn() + end + + if owner:IsValidLivingHuman() then + mine.NoPickupsTime = CurTime() + 15 + mine.NoPickupsOwner = owner + end + + ent:Remove() + end + end + end +end + + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 65, math.random(107, 113), 0.6) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound(self.ReloadSound, 60, 110, 0.5, CHAN_WEAPON + 21) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eradicator.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eradicator.lua new file mode 100644 index 0000000..ec8f845 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eradicator.lua @@ -0,0 +1,34 @@ +AddCSLuaFile() + +SWEP.PrintName = "Eradicator" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 36 +SWEP.SlowDownScale = 0 + +SWEP.AlertDelay = 3.5 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/combine_gunship/gunship_moan.wav", 75, math.random(70,75)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 75, math.random(75,80)) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) +end + +local matSheet = Material("Models/charple/charple4_sheet.vtf") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eraser.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eraser.lua index 58a3834..30e162d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eraser.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_eraser.lua @@ -1,15 +1,15 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Eraser' Tactical Pistol" +SWEP.Description = "Damage increases as remaining bullets decrease." +SWEP.Slot = 1 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Eraser' Tactical Pistol" - SWEP.Description = "Damage increases as remaining bullets decrease. The last shot is worth triple damage." - SWEP.ViewModelFOV = 60 SWEP.ViewModelFlip = false - SWEP.Slot = 1 - SWEP.SlotPos = 0 - SWEP.HUD3DBone = "v_weapon.FIVESEVEN_PARENT" SWEP.HUD3DPos = Vector(-1, -2.5, -1) SWEP.HUD3DAng = Angle(0, 0, 0) @@ -24,30 +24,45 @@ SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("weapons/ar2/npc_ar2_altfire.wav") -SWEP.Primary.Damage = 21 +SWEP.Primary.Damage = 23.5 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 0.1 +SWEP.Primary.Delay = 0.15 SWEP.Primary.ClipSize = 12 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.06 -SWEP.ConeMin = 0.03 +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 1.25 + +SWEP.ReloadSpeed = 1 +SWEP.HeadshotMulti = 2 + +SWEP.Tier = 2 SWEP.IronSightsPos = Vector(-5.95, 0, 2.5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEADSHOT_MULTI, 0.07) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Cleanser' Tactical Pistol", "Less reload speed, accuracy and headshot multiplier but gains increased damage per wave", function(wept) + wept.ConeMax = wept.ConeMax * 1.7 + wept.ConeMin = wept.ConeMin * 2.1 + wept.ReloadSpeed = wept.ReloadSpeed * 0.7 + wept.HeadshotMulti = wept.HeadshotMulti * 0.9 + + wept.BulletCallback = function(attacker, tr, dmginfo) + dmginfo:SetDamage(dmginfo:GetDamage() + dmginfo:GetDamage() * GAMEMODE:GetWave()/15) + end +end) + function SWEP:EmitFireSound() - self:EmitSound(self.Primary.Sound, 80, 70 + (1 - (self:Clip1() / self.Primary.ClipSize)) * 90) + self:EmitSound("weapons/fiveseven/fiveseven-1.wav", 75, 80 + (1 - (self:Clip1() / self.Primary.ClipSize)) * 30, 0.8, 21) + self:EmitSound(self.Primary.Sound, 75, 130 + (1 - (self:Clip1() / self.Primary.ClipSize)) * 70, 0.75, 22) end function SWEP:ShootBullets(dmg, numbul, cone) - if self:Clip1() == 1 then - dmg = dmg * 3 - else - dmg = dmg + dmg * (1 - self:Clip1() / self.Primary.ClipSize) - end + dmg = dmg + dmg * (1 - self:Clip1() / self.Primary.ClipSize) - self.BaseClass.ShootBullets(self, dmg, numbul, cone) + BaseClass.ShootBullets(self, dmg, numbul, cone) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_executioner.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_executioner.lua new file mode 100644 index 0000000..c153d05 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_executioner.lua @@ -0,0 +1,74 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Executioner' Axe" +SWEP.Description = "Instantly kills zombies brought bellow 10% of their max health." + +if CLIENT then + SWEP.ViewModelFOV = 55 + SWEP.ViewModelFlip = false + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/hunter/triangles/1x1mirrored.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(3.743, 0, 19.208), angle = Angle(180, 0, 90), size = Vector(0.12, 0.029, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_docks/channelmarker_gib01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.207, 1.348, -11.422), angle = Angle(-180, 0, 0), size = Vector(0.15, 0.15, 0.813), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 15.366), angle = Angle(0, 0, 0), size = Vector(0.09, 0.09, 0.143), color = Color(211, 255, 255, 255), surpresslightning = false, material = "models/props_debris/rebar_medthin01", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/hunter/tubes/circle2x2d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.888, 0, 19.982), angle = Angle(-33.882, 0, 90), size = Vector(0.231, 0.268, 0.159), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_docks/channelmarker_gib01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.664, 2.203, -11.2), angle = Angle(174.453, 19.062, 3.076), size = Vector(0.15, 0.15, 0.813), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/hunter/triangles/1x1mirrored.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(3.743, 0, 19.208), angle = Angle(180, 0, 90), size = Vector(0.12, 0.029, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 15.366), angle = Angle(0, 0, 0), size = Vector(0.09, 0.09, 0.143), color = Color(211, 255, 255, 255), surpresslightning = false, material = "models/props_debris/rebar_medthin01", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/hunter/tubes/circle2x2d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.888, 0, 19.982), angle = Angle(-33.882, 0, 90), size = Vector(0.231, 0.268, 0.159), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "melee2" + +SWEP.MeleeDamage = 125 +SWEP.MeleeRange = 75 +SWEP.MeleeSize = 2.75 +SWEP.MeleeKnockBack = 225 + +SWEP.Primary.Delay = 1.35 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.SwingTime = 0.7 +SWEP.SwingRotation = Angle(0, -20, -40) +SWEP.SwingOffset = Vector(10, 0, 0) +SWEP.SwingHoldType = "melee" + +SWEP.Tier = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.13) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 70)) +end + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/golf club/golf_hit-0"..math.random(4)..".ogg") +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav") +end + +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and hitent:Alive() and hitent:Health() <= hitent:GetMaxHealthEx() * 0.1 and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then + if SERVER then + hitent:SetWasHitInHead() + end + hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, self:GetOwner(), self, tr.HitPos) + hitent:EmitSound("npc/roller/blade_out.wav", 80, 75) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/cl_init.lua new file mode 100644 index 0000000..75eea30 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/cl_init.lua @@ -0,0 +1,13 @@ +INC_CLIENT() + +SWEP.PrintName = "Extinction Crab" +SWEP.DrawCrosshair = false + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/init.lua new file mode 100644 index 0000000..784c78f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/init.lua @@ -0,0 +1,47 @@ +INC_SERVER() + +function SWEP:ThrowGibs() + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + local ent = ents.Create("projectile_extinctioncrab") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(AngleRand()) + ent:SetOwner(owner) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(owner:GetAimVector() * 600) + phys:AddAngleVelocity(VectorRand() * 360) + end + end +end + +function SWEP:PoundAttackProcess() + if CurTime() < self.PoundAttackStart + 0.4 then return end + + local owner = self:GetOwner() + local pos = owner:GetPos() + Vector(0, 0, 2) + + owner:LagCompensation(true) + + owner:EmitSound("physics/concrete/concrete_break3.wav", 77, 70) + + util.ScreenShake(pos, 5, 5, 1, 300) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0, 0, 1)) + util.Effect("ThumperDust", effectdata, true, true) + + owner:GodEnable() + util.BlastDamageEx(self, owner, pos, 112, 25, DMG_CLUB) + util.BlastDamageEx(self, owner, pos, 22, 40, DMG_CLUB) + owner:GodDisable() + + owner:LagCompensation(false) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/shared.lua new file mode 100644 index 0000000..6c88350 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_extinctioncrab/shared.lua @@ -0,0 +1,167 @@ +SWEP.ZombieOnly = true +SWEP.IsMelee = true + +SWEP.ViewModel = "models/weapons/v_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "none" +SWEP.Primary.Delay = 0.4 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.Delay = 0.22 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = true +SWEP.Secondary.Ammo = "none" + +SWEP.NoHitRecovery = 0.75 +SWEP.HitRecovery = 1 + +SWEP.AttackTime = 1.875 +SWEP.AttackProcessTime = 1.35 + +AccessorFuncDT(SWEP, "AttackStartTime", "Float", 0) +AccessorFuncDT(SWEP, "AttackProcessTime", "Float", 1) + +SWEP.PoundAttackStart = 0 + +function SWEP:Initialize() + self:HideViewAndWorldModel() +end + +function SWEP:Think() + local time = CurTime() + local owner = self:GetOwner() + + if self:GetAttackProcessTime() > 0 and time >= self:GetAttackProcessTime() then + self:SetAttackProcessTime(0) + + if SERVER then + self:ThrowGibs() + end + end + + if self:IsAttacking() and time > self:GetAttackEndTime() then + self:SetAttackStartTime(0) + self:SetAttackProcessTime(0) + end + + if self:IsPouncing() then + local delay = owner:GetMeleeSpeedMul() + if owner:WaterLevel() >= 2 then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.5 * delay) + elseif owner:OnGround() and owner:IsOnGround() then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.4 * delay) + + if SERVER then + self:PoundAttackProcess() + end + end + end + + self:NextThink(time) + return true +end + +function SWEP:PrimaryAttack() + local owner = self:GetOwner() + if self:IsPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() or self:IsAttacking() then return end + + self.PoundAttackStart = CurTime() + + local vel = owner:GetAimVector() + vel.z = math.max(0.45, vel.z) + vel:Normalize() + + owner:SetGroundEntity(NULL) + owner:SetVelocity(vel * 250) + owner:DoAnimationEvent(ACT_RANGE_ATTACK1) + + if SERVER then + self:EmitAttackSound() + end + + self.m_ViewAngles = owner:EyeAngles() + + self:SetPouncing(true) +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if self:IsAttacking() or self:IsPouncing() or not owner:IsOnGround() then return end + + self:SetAttackStartTime(CurTime()) + self:SetAttackProcessTime(CurTime() + self.AttackProcessTime) + + if SERVER then + self:EmitAttackSound() + end +end + +function SWEP:Reload() + if CurTime() < self:GetNextSecondaryFire() then return end + self:SetNextSecondaryFire(CurTime() + 2) + + if SERVER then + self:EmitIdleSound() + end +end + +function SWEP:Move(mv) + if self:IsPouncing() then + if CurTime() < self.PoundAttackStart + 0.1 then + local vel = mv:GetVelocity() + vel.z = 350 + self:GetOwner():SetGroundEntity(NULL) + mv:SetVelocity(vel) + end + + mv:SetMaxSpeed(mv:GetMaxSpeed() * 5) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 5) + return true + end + + if self:IsAttacking() then + mv:SetMaxSpeed(16) + mv:SetMaxClientSpeed(16) + return true + end +end + +function SWEP:EmitIdleSound() + local ent = self:GetOwner():CompensatedMeleeTrace(4096, 24).Entity + if ent:IsValidPlayer() then + self:GetOwner():EmitSound("npc/headcrab/idle"..math.random(3)..".wav", 75, 60) + else + self:GetOwner():EmitSound("npc/headcrab/alert1.wav", 75, 60) + end +end + +function SWEP:EmitAttackSound() + self:GetOwner():EmitSound("npc/ichthyosaur/attack_growl"..math.random(3)..".wav", 70, math.random(130, 160)) +end + +function SWEP:IsAttacking() + return self:GetAttackStartTime() > 0 +end + +function SWEP:GetAttackEndTime() + return self:GetAttackStartTime() + self.AttackTime +end + +function SWEP:SetPouncing(pouncing) + if not pouncing then + self.m_ViewAngles = nil + end + + self:SetDTBool(1, pouncing) +end + +function SWEP:IsPouncing() + return self:GetDTBool(1) +end +SWEP.GetPouncing = SWEP.IsPouncing diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_banana.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_banana.lua new file mode 100644 index 0000000..42b1976 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_banana.lua @@ -0,0 +1,27 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Banana" + +if CLIENT then + SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_R_Finger02"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 59, 0) }, + } + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props/cs_italy/bananna.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 2.5, -1), angle = Angle(0, 0, 120), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props/cs_italy/bananna.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 2.5, -1), angle = Angle(0, 0, 120), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props/cs_italy/bananna.mdl" + +SWEP.Primary.Ammo = "foodbanana" + +SWEP.FoodHealth = 10 +SWEP.FoodEatTime = 2.75 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_milk.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_milk.lua new file mode 100644 index 0000000..1b74e69 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_milk.lua @@ -0,0 +1,24 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Milk" + +if CLIENT then + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/garbage_milkcarton002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.75, 2.5, -2), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/garbage_milkcarton002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.75, 2.5, -2), angle = Angle(180, 0, -25), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props_junk/garbage_milkcarton002a.mdl" + +SWEP.Primary.Ammo = "foodmilk" + +SWEP.FoodHealth = 13 +SWEP.FoodEatTime = 3 +SWEP.FoodIsLiquid = true diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_orange.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_orange.lua new file mode 100644 index 0000000..617d8dc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_orange.lua @@ -0,0 +1,23 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Orange" + +if CLIENT then + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props/cs_italy/orange.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 2.5, -1), angle = Angle(0, 0, 0), size = Vector(0.6, 0.6, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props/cs_italy/orange.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2.5, -1), angle = Angle(0, 0, 0), size = Vector(0.6, 0.6, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props/cs_italy/orange.mdl" + +SWEP.Primary.Ammo = "foodorange" + +SWEP.FoodHealth = 10 +SWEP.FoodEatTime = 2.75 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_soda.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_soda.lua new file mode 100644 index 0000000..197c6bf --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_soda.lua @@ -0,0 +1,28 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Soda" + +if CLIENT then + SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_R_Finger02"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 59, 0) }, + } + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props_junk/popcan01a.mdl" + +SWEP.Primary.Ammo = "foodsoda" + +SWEP.FoodHealth = 5 +SWEP.FoodEatTime = 2 +SWEP.FoodIsLiquid = true diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_takeout.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_takeout.lua new file mode 100644 index 0000000..a39ae90 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_takeout.lua @@ -0,0 +1,23 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Chinese Takeout" + +if CLIENT then + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/garbage_takeoutcarton001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.75, 2.5, -2), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/garbage_takeoutcarton001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.75, 2.5, -2), angle = Angle(180, 0, -25), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props_junk/garbage_takeoutcarton001a.mdl" + +SWEP.Primary.Ammo = "foodtakeout" + +SWEP.FoodHealth = 17 +SWEP.FoodEatTime = 5 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_water.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_water.lua new file mode 100644 index 0000000..cd34160 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_water.lua @@ -0,0 +1,28 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Water" + +if CLIENT then + SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_R_Finger02"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 59, 0) }, + } + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props/cs_office/water_bottle.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props/cs_office/water_bottle.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/props/cs_office/water_bottle.mdl" + +SWEP.Primary.Ammo = "foodwater" + +SWEP.FoodHealth = 5 +SWEP.FoodEatTime = 2 +SWEP.FoodIsLiquid = true diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_watermelon.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_watermelon.lua new file mode 100644 index 0000000..2ac18be --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_f_watermelon.lua @@ -0,0 +1,25 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basefood" + +SWEP.PrintName = "Watermelon" + +if CLIENT then + SWEP.ViewModelFOV = 80 + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/watermelon01_chunk02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1, 4, -3), angle = Angle(-45, -70, -80), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/watermelon01_chunk02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 1, -3), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/props_junk/watermelon01_chunk02a.mdl" + +SWEP.Primary.Ammo = "foodwatermelon" + +SWEP.FoodHealth = 15 +SWEP.FoodEatTime = 4 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastheadcrab.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastheadcrab.lua index 1573813..0ca638e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastheadcrab.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastheadcrab.lua @@ -2,9 +2,7 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_headcrab" -if CLIENT then - SWEP.PrintName = "Fast Headcrab" -end +SWEP.PrintName = "Fast Headcrab" SWEP.PounceDamage = 6 @@ -12,15 +10,15 @@ SWEP.NoHitRecovery = 0.6 SWEP.HitRecovery = 0.75 function SWEP:EmitBiteSound() - self.Owner:EmitSound("NPC_FastHeadcrab.Bite") + self:GetOwner():EmitSound("NPC_FastHeadcrab.Bite") end function SWEP:EmitIdleSound() - self.Owner:EmitSound("NPC_FastHeadcrab.Idle") + self:GetOwner():EmitSound("NPC_FastHeadcrab.Idle") end function SWEP:EmitAttackSound() - self.Owner:EmitSound("NPC_FastHeadcrab.Attack") + self:GetOwner():EmitSound("NPC_FastHeadcrab.Attack") end function SWEP:Reload() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua index 5a0bfc8..d867492 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua @@ -1,9 +1,11 @@ AddCSLuaFile() -SWEP.Base = "weapon_zs_zombie" +DEFINE_BASECLASS("weapon_zs_zombie") + +SWEP.PrintName = "Fast Zombie" SWEP.ViewModel = Model("models/weapons/v_fza.mdl") -SWEP.WorldModel = Model("models/weapons/w_crowbar.mdl") +SWEP.WorldModel = "" if CLIENT then SWEP.ViewModelFOV = 70 @@ -11,13 +13,17 @@ end SWEP.MeleeDelay = 0 SWEP.MeleeReach = 42 -SWEP.MeleeDamage = 8 +SWEP.MeleeDamage = 7 --8 SWEP.MeleeForceScale = 0.1 -SWEP.MeleeSize = 1.5 +SWEP.MeleeSize = 4.5 --1.5 SWEP.MeleeDamageType = DMG_SLASH SWEP.Primary.Delay = 0.32 -SWEP.PounceDamage = 1 --SWEP.PounceDamage = 10 +SWEP.SlowMeleeDelay = 0.8 +SWEP.SlowMeleeDamage = 18 + +SWEP.PounceDamage = 20 +SWEP.PounceDamageVsPlayerMul = 0.2 SWEP.PounceDamageType = DMG_IMPACT SWEP.PounceReach = 26 SWEP.PounceSize = 12 @@ -32,10 +38,10 @@ SWEP.Secondary.Automatic = false SWEP.NextClimbSound = 0 SWEP.NextAllowPounce = 0 function SWEP:Think() - self.BaseClass.Think(self) + BaseClass.Think(self) local curtime = CurTime() - local owner = self.Owner + local owner = self:GetOwner() if self.NextAllowJump and self.NextAllowJump <= curtime then self.NextAllowJump = nil @@ -45,15 +51,16 @@ function SWEP:Think() if self:GetClimbing() then if self:GetClimbSurface() and owner:KeyDown(IN_ATTACK2) then - if SERVER and curtime >= self.NextClimbSound then - local speed = owner:GetVelocity():Length() - if speed >= 50 then - if speed >= 100 then + if curtime >= self.NextClimbSound and IsFirstTimePredicted() then + local speed = owner:GetVelocity():LengthSqr() + if speed >= 2500 then + if speed >= 10000 then self.NextClimbSound = curtime + 0.25 else self.NextClimbSound = curtime + 0.8 end - owner:EmitSound("player/footsteps/metalgrate"..math.random(4)..".wav") + + self:PlayClimbSound() end end else @@ -61,7 +68,62 @@ function SWEP:Think() end end - if self:GetSwinging() then + if self:IsSlowSwinging() then + if curtime >= self:GetSlowSwingEnd() then + self:SetSlowSwingEnd(0) + + if IsFirstTimePredicted() then + self.MeleeAnimationMul = 1 / owner:GetMeleeSpeedMul() + self:SendAttackAnim() + + local hit = false + local traces = owner:CompensatedZombieMeleeTrace(self.MeleeReach, self.MeleeSize) + local prehit = self.PreHit + if prehit then + local ins = true + for _, tr in pairs(traces) do + if tr.Entity == prehit.Entity then + ins = false + break + end + end + if ins then + local eyepos = owner:EyePos() + if prehit.Entity:IsValid() and prehit.Entity:NearestPoint(eyepos):DistToSqr(eyepos) <= self.MeleeReach * self.MeleeReach then + table.insert(traces, prehit) + end + end + self.PreHit = nil + end + + local damage = self:GetSlowSwingDamage(self:GetTracesNumPlayers(traces)) + + for _, trace in ipairs(traces) do + if not trace.Hit then continue end + + hit = true + + if trace.HitWorld then + self:MeleeHitWorld(trace) + else + local ent = trace.Entity + if ent and ent:IsValid() then + self:MeleeHit(ent, trace, damage) + if ent:IsPlayer() then + self:MeleeHitPlayer(ent, trace, damage) + end + end + end + end + + if hit then + self:PlayHitSound() + else + self:PlayMissSound() + end + end + end + elseif self:GetSwinging() then if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then self:SetSwinging(false) self.SwingStop = nil @@ -74,10 +136,11 @@ function SWEP:Think() if self.RoarCheck <= curtime then self.RoarCheck = nil - if owner:GetVelocity():Length2D() <= 0.5 and owner:IsOnGround() then + if owner:GetVelocity():Length2DSqr() <= 1 and owner:IsOnGround() then self:SetRoarEndTime(curtime + self.RoarTime) - if SERVER then - owner:EmitSound("NPC_FastZombie.Frenzy") + + if IsFirstTimePredicted() then + self:PlaySwingEndSound() end end end @@ -89,9 +152,7 @@ function SWEP:Think() dir.z = math.Clamp(dir.z, -0.5, 0.9) dir:Normalize() - owner:LagCompensation(true) - - local traces = owner:PenetratingMeleeTrace(self.PounceReach, self.PounceSize, nil, owner:LocalToWorld(owner:OBBCenter()), dir) + local traces = owner:CompensatedZombieMeleeTrace(self.PounceReach, self.PounceSize, owner:WorldSpaceCenter(), dir) local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.PounceDamage) local hit = false @@ -107,19 +168,16 @@ function SWEP:Think() local ent = trace.Entity if ent and ent:IsValid() then hit = true - self:MeleeHit(ent, trace, damage, ent:IsPlayer() and 1 or 10) + self:MeleeHit(ent, trace, damage * (ent:IsPlayer() and self.PounceDamageVsPlayerMul or ent.PounceWeakness or 1), ent:IsPlayer() and 1 or 10) end end end - if SERVER and hit then - owner:EmitSound("physics/flesh/flesh_strider_impact_bullet1.wav") - owner:EmitSound("npc/fast_zombie/wake1.wav") - end - - owner:LagCompensation(false) - if hit then + if IsFirstTimePredicted() then + self:PlayPounceHitSound() + end + self:StopPounce() end end @@ -131,8 +189,80 @@ function SWEP:Think() return true end +function SWEP:PlayClimbSound() + self:EmitSound("player/footsteps/metalgrate"..math.random(4)..".wav") +end + +function SWEP:PlayPounceHitSound() + self:EmitSound("physics/flesh/flesh_strider_impact_bullet1.wav") + self:EmitSound("npc/fast_zombie/wake1.wav", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlaySwingEndSound() + self:EmitSound("NPC_FastZombie.Frenzy") +end + +function SWEP:MeleeHitPlayer(ent, trace, damage) + ent:MeleeViewPunch(damage) + local nearest = ent:NearestPoint(trace.StartPos) + util.Blood(nearest, math.Rand(damage * 0.5, damage * 0.75), (nearest - trace.StartPos):GetNormalized(), math.Rand(damage * 5, damage * 10), true) +end + +function SWEP:GetSlowSwingDamage(numplayers, basedamage) + basedamage = basedamage or self.SlowMeleeDamage + + if numplayers then + return basedamage * math.Clamp(1.2 - numplayers * 0.2, 0.5, 1) + end + + return basedamage +end + +function SWEP:Move(mv) + if self:IsPouncing() or self:GetPounceTime() > 0 then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + elseif self:GetClimbing() then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + + local owner = self:GetOwner() + local tr = self:GetClimbSurface() + local angs = owner:SyncAngles() + local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) + local vel = Vector(0, 0, 4) + + if owner:KeyDown(IN_FORWARD) then + owner:SetGroundEntity(nil) + vel = vel + dir * 250 --160 + end + if owner:KeyDown(IN_BACK) then + vel = vel + dir * -250 ---160 + end + + if vel.z == 4 then + if owner:KeyDown(IN_MOVERIGHT) then + vel = vel + angs:Right() * 100 --60 + end + if owner:KeyDown(IN_MOVELEFT) then + vel = vel + angs:Right() * -100 ---60 + end + end + + mv:SetVelocity(vel) + + return true + elseif self:GetSwinging() then + mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.6666) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.6666) + elseif self:IsSlowSwinging() then + mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.85) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.85) + end +end + function SWEP:MeleeHitEntity(ent, trace, damage, forcescale) - self.BaseClass.MeleeHitEntity(self, ent, trace, damage, forcescale ~= nil and forcescale * 0.25) + BaseClass.MeleeHitEntity(self, ent, trace, damage, forcescale ~= nil and forcescale * 0.25) end local climblerp = 0 @@ -155,22 +285,74 @@ function SWEP:Swung() self:StartSwingingSound() end - self.BaseClass.Swung(self) + BaseClass.Swung(self) end function SWEP:PrimaryAttack() - if self:IsPouncing() or self:GetPounceTime() > 0 or not self.Owner:OnGround() and not self:IsClimbing() and self.Owner:WaterLevel() < 2 then return end + if self:IsSlowSwinging() or self:IsPouncing() or self:GetPounceTime() > 0 then return end - self.BaseClass.PrimaryAttack(self) + local owner = self:GetOwner() + + if self:IsClimbing() or owner:WaterLevel() >= 2 or owner:GetVelocity():LengthSqr() < 64 then + BaseClass.PrimaryAttack(self) + elseif CurTime() >= self:GetNextPrimaryFire() then + local armdelay = owner:GetMeleeSpeedMul() + + self:SetNextPrimaryFire(CurTime() + (self.SlowMeleeDelay + 0.25) * armdelay) + self:SetNextSecondaryFire(self:GetNextPrimaryFire() + 0.5) + + self:SetSlowSwingEnd(CurTime() + self.SlowMeleeDelay * armdelay) + owner:DoAttackEvent() + + if IsFirstTimePredicted() then + self:PlaySlowSwingSound() + end + + self:StopSwingingSound() + self:SetSwinging(false) + + local trace = self:GetOwner():CompensatedMeleeTrace(self.MeleeReach, self.MeleeSize) + if trace.HitNonWorld then + trace.IsPreHit = true + self.PreHit = trace + end + + self.IdleAnimation = CurTime() + self:SequenceDuration() * armdelay + end end -local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-4, -4, -4), maxs = Vector(4, 4, 4)} +function SWEP:PlaySlowSwingSound() + self:EmitSound("npc/fast_zombie/leap1.wav") +end + +local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-5, -5, -5), maxs = Vector(5, 5, 5)} function SWEP:GetClimbSurface() - local owner = self.Owner - climbtrace.start = owner:GetPos() + owner:GetUp() * 8 - climbtrace.endpos = climbtrace.start + owner:SyncAngles():Forward() * 24 - local tr = util.TraceHull(climbtrace) + local owner = self:GetOwner() + + local fwd = owner:SyncAngles():Forward() + local up = owner:GetUp() + local pos = owner:GetPos() + local height = owner:OBBMaxs().z + local tr + local ha + for i=5, height, 5 do + if not tr or not tr.Hit then + climbtrace.start = pos + up * i + climbtrace.endpos = climbtrace.start + fwd * 36 + tr = util.TraceHull(climbtrace) + ha = i + if tr.Hit and not tr.HitSky then break end + end + end + if tr.Hit and not tr.HitSky then + climbtrace.start = pos + up * ha --tr.HitPos + tr.HitNormal + climbtrace.endpos = climbtrace.start + owner:SyncAngles():Up() * (height - ha) + local tr2 = util.TraceHull(climbtrace) + if tr2.Hit and not tr2.HitSky then + return tr2 + end + return tr end end @@ -178,15 +360,16 @@ end function SWEP:SecondaryAttack() if self:IsPouncing() or self:IsClimbing() or self:GetPounceTime() > 0 then return end - if self.Owner:IsOnGround() then + if self:GetOwner():IsOnGround() then if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or CurTime() < self.NextAllowPounce then return end self:SetNextPrimaryFire(math.huge) self:SetPounceTime(CurTime() + self.PounceStartDelay) - self.Owner:ResetJumpPower() - if SERVER then - self.Owner:EmitSound("npc/fast_zombie/leap1.wav") + self:GetOwner():ResetJumpPower() + + if IsFirstTimePredicted() then + self:PlayPounceStartSound() end elseif self:GetClimbSurface() then self:StartClimbing() @@ -214,14 +397,14 @@ function SWEP:StartPounce() self:SetPounceTime(0) - local owner = self.Owner + local owner = self:GetOwner() if owner:IsOnGround() then self:SetPouncing(true) self.m_ViewAngles = owner:EyeAngles() - if SERVER then - owner:EmitSound("NPC_FastZombie.Scream") + if IsFirstTimePredicted() then + self:PlayPounceSound() end local ang = owner:EyeAngles() @@ -236,10 +419,18 @@ function SWEP:StartPounce() self.NextAllowJump = CurTime() self.NextAllowPounce = CurTime() + self.PounceDelay self:SetNextPrimaryFire(CurTime() + 0.1) - self.Owner:ResetJumpPower() + self:GetOwner():ResetJumpPower() end end +function SWEP:PlayPounceStartSound() + self:EmitSound("npc/fast_zombie/leap1.wav", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayPounceSound() + self:EmitSound("NPC_FastZombie.Scream", nil, nil, nil, CHAN_AUTO) +end + function SWEP:StopPounce() if not self:IsPouncing() then return end @@ -249,33 +440,33 @@ function SWEP:StopPounce() self.NextAllowJump = CurTime() + 0.25 self.NextAllowPounce = CurTime() + self.PounceDelay self:SetNextPrimaryFire(CurTime() + 0.1) - self.Owner:ResetJumpPower() + self:GetOwner():ResetJumpPower() end function SWEP:Reload() - self.BaseClass.SecondaryAttack(self) + BaseClass.SecondaryAttack(self) end function SWEP:OnRemove() self.Removing = true - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then self:StopSwingingSound() owner:ResetJumpPower() end - self.BaseClass.OnRemove(self) + BaseClass.OnRemove(self) end function SWEP:Holster() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then self:StopSwingingSound() owner:ResetJumpPower() end - self.BaseClass.Holster(self) + BaseClass.Holster(self) end function SWEP:ResetJumpPower(power) @@ -286,89 +477,50 @@ function SWEP:ResetJumpPower(power) end end -function SWEP:StartMoaning() +--[[function SWEP:CheckIdleAnimation() end +SWEP.CheckAttackAnimation = SWEP.CheckIdleAnimation]] -function SWEP:StopMoaning() -end - -function SWEP:StartMoaningSound() +function SWEP:CheckMoaning() end +SWEP.StartMoaning = SWEP.CheckMoaning +SWEP.StopMoaning = SWEP.CheckMoaning +SWEP.StartMoaningSound = SWEP.CheckMoaning +SWEP.DoSwingEvent = SWEP.CheckMoaning function SWEP:PlayHitSound() - self.Owner:EmitSound("NPC_FastZombie.AttackHit") + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("NPC_FastZombie.AttackMiss") + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() end function SWEP:PlayIdleSound() - self.Owner:EmitSound("NPC_FastZombie.AlertFar") + self:GetOwner():EmitSound("NPC_FastZombie.AlertFar") self:SetRoarEndTime(CurTime() + self.RoarTime) end function SWEP:PlayAlertSound() - self.Owner:EmitSound("NPC_FastZombie.Frenzy") + self:GetOwner():EmitSound("NPC_FastZombie.Frenzy") self:SetRoarEndTime(CurTime() + self.RoarTime) end function SWEP:StartSwingingSound() - self.Owner:EmitSound("NPC_FastZombie.Gurgle") + self:EmitSound("NPC_FastZombie.Gurgle") end function SWEP:StopSwingingSound() - self.Owner:StopSound("NPC_FastZombie.Gurgle") + self:StopSound("NPC_FastZombie.Gurgle") end function SWEP:IsMoaning() return false end -function SWEP:Move(mv) - if self:IsPouncing() or self:GetPounceTime() > 0 then - mv:SetMaxSpeed(0) - mv:SetMaxClientSpeed(0) - elseif self:GetClimbing() then - mv:SetMaxSpeed(0) - mv:SetMaxClientSpeed(0) - - local owner = self.Owner - local tr = self:GetClimbSurface() - local angs = self.Owner:SyncAngles() - local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) - local vel = Vector(0, 0, 4) - - if owner:KeyDown(IN_FORWARD) then - vel = vel + dir * 250 --160 - end - if owner:KeyDown(IN_BACK) then - vel = vel + dir * -250 ---160 - end - - if vel.z == 4 then - if owner:KeyDown(IN_MOVERIGHT) then - vel = vel + angs:Right() * 100 --60 - end - if owner:KeyDown(IN_MOVELEFT) then - vel = vel + angs:Right() * -100 ---60 - end - end - - mv:SetVelocity(vel) - - return true - elseif self:GetSwinging() then - --[[mv:SetMaxSpeed(math.min(mv:GetMaxSpeed(), 60)) - mv:SetMaxClientSpeed(math.min(mv:GetMaxClientSpeed(), 60))]] - mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.9) - mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.9) - end -end - function SWEP:SetRoarEndTime(time) self:SetDTFloat(1, time) end @@ -418,6 +570,18 @@ function SWEP:SetPouncing(leaping) self:SetDTBool(3, leaping) end +function SWEP:SetSlowSwingEnd(time) + self:SetDTFloat(3, time) +end + +function SWEP:GetSlowSwingEnd() + return self:GetDTFloat(3) +end + +function SWEP:IsSlowSwinging() + return self:GetSlowSwingEnd() > 0 +end + function SWEP:GetPouncing() return self:GetDTBool(3) end @@ -426,7 +590,7 @@ SWEP.IsPouncing = SWEP.GetPouncing if CLIENT then return end function SWEP:Deploy() - self.Owner:CreateAmbience("fastzombieambience") + self:GetOwner():CreateAmbience("fastzombieambience") - return self.BaseClass.Deploy(self) + return BaseClass.Deploy(self) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie_slingshot.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie_slingshot.lua new file mode 100644 index 0000000..8accaee --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie_slingshot.lua @@ -0,0 +1,577 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Slingshot Zombie" + +SWEP.ViewModel = Model("models/weapons/v_fza.mdl") +SWEP.WorldModel = Model("models/weapons/w_crowbar.mdl") + +if CLIENT then + SWEP.ViewModelFOV = 70 +end + +SWEP.MeleeDelay = 0 +SWEP.MeleeReach = 42 +SWEP.MeleeDamage = 8 +SWEP.MeleeForceScale = 0.1 +SWEP.MeleeSize = 4.5 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.Primary.Delay = 0.32 + +SWEP.SlowMeleeDelay = 0.8 +SWEP.SlowMeleeDamage = 20 + +SWEP.PounceStartDelay = 0.33 +SWEP.PounceDelay = 1.25 +SWEP.PounceVelocity = 910 + +SWEP.RoarTime = 1.6 + +SWEP.Secondary.Automatic = false + +SWEP.NextClimbSound = 0 +SWEP.NextAllowPounce = 0 +function SWEP:Think() + self.BaseClass.Think(self) + + local curtime = CurTime() + local owner = self:GetOwner() + + if self.NextAllowJump and self.NextAllowJump <= curtime then + self.NextAllowJump = nil + + owner:ResetJumpPower() + end + + if self:GetClimbing() then + if self:GetClimbSurface() and owner:KeyDown(IN_ATTACK2) then + if SERVER and curtime >= self.NextClimbSound then + local speed = owner:GetVelocity():LengthSqr() + if speed >= 2500 then + if speed >= 10000 then + self.NextClimbSound = curtime + 0.25 + else + self.NextClimbSound = curtime + 0.8 + end + owner:EmitSound("player/footsteps/metalgrate"..math.random(4)..".wav") + end + end + else + self:StopClimbing() + end + end + + if self:IsSlowSwinging() then + if curtime >= self:GetSlowSwingEnd() then + self:SetSlowSwingEnd(0) + + if IsFirstTimePredicted() then + self.MeleeAnimationMul = 1 / owner:GetMeleeSpeedMul() + self:SendAttackAnim() + + local hit = false + local traces = owner:CompensatedZombieMeleeTrace(self.MeleeReach, self.MeleeSize) + local prehit = self.PreHit + if prehit then + local ins = true + for _, tr in pairs(traces) do + if tr.Entity == prehit.Entity then + ins = false + break + end + end + if ins then + local eyepos = owner:EyePos() + if prehit.Entity:IsValid() and prehit.Entity:NearestPoint(eyepos):DistToSqr(eyepos) <= self.MeleeReach * self.MeleeReach then + table.insert(traces, prehit) + end + end + self.PreHit = nil + end + + local damage = self:GetSlowSwingDamage(self:GetTracesNumPlayers(traces)) + + for _, trace in ipairs(traces) do + if not trace.Hit then continue end + + hit = true + + if trace.HitWorld then + self:MeleeHitWorld(trace) + else + local ent = trace.Entity + if ent and ent:IsValid() then + self:MeleeHit(ent, trace, damage) + end + end + end + + if hit then + self:PlayHitSound() + else + self:PlayMissSound() + end + end + end + elseif self:GetSwinging() then + if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then + self:SetSwinging(false) + self.SwingStop = nil + + self.RoarCheck = curtime + 0.1 + + self:StopSwingingSound() + end + elseif self.RoarCheck then + if self.RoarCheck <= curtime then + self.RoarCheck = nil + + if owner:GetVelocity():Length2DSqr() <= 1 and owner:IsOnGround() then + self:SetRoarEndTime(curtime + self.RoarTime) + if SERVER then + owner:EmitSound("NPC_FastZombie.Frenzy") + end + end + end + elseif self:GetPounceTime() > 0 and curtime >= self:GetPounceTime() then + self:Slingshot() + end + + self:NextThink(curtime) + return true +end + +function SWEP:GetSlowSwingDamage(numplayers, basedamage) + basedamage = basedamage or self.SlowMeleeDamage + + if numplayers then + return basedamage * math.Clamp(1.2 - numplayers * 0.2, 0.5, 1) + end + + return basedamage +end + +function SWEP:Move(mv) + if self:IsPouncing() or self:GetPounceTime() > 0 then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + elseif self:GetClimbing() then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + + local owner = self:GetOwner() + local tr = self:GetClimbSurface() + local angs = owner:SyncAngles() + local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) + local vel = Vector(0, 0, 4) + + if owner:KeyDown(IN_FORWARD) then + owner:SetGroundEntity(nil) + vel = vel + dir * 250 --160 + end + if owner:KeyDown(IN_BACK) then + vel = vel + dir * -250 ---160 + end + + if vel.z == 4 then + if owner:KeyDown(IN_MOVERIGHT) then + vel = vel + angs:Right() * 100 --60 + end + if owner:KeyDown(IN_MOVELEFT) then + vel = vel + angs:Right() * -100 ---60 + end + end + + mv:SetVelocity(vel) + + return true + elseif self:GetSwinging() then + mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.6666) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.6666) + elseif self:IsSlowSwinging() then + mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.85) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.85) + end +end + +function SWEP:MeleeHitEntity(ent, trace, damage, forcescale) + self.BaseClass.MeleeHitEntity(self, ent, trace, damage, forcescale ~= nil and forcescale * 0.25) +end + +local climblerp = 0 +function SWEP:GetViewModelPosition(pos, ang) + climblerp = math.Approach(climblerp, self:IsClimbing() and not self:IsSwinging() and 1 or 0, FrameTime() * ((climblerp + 1) ^ 3)) + ang:RotateAroundAxis(ang:Right(), 64 * climblerp) + if climblerp > 0 then + pos = pos + -8 * climblerp * ang:Up() + -12 * climblerp * ang:Forward() + end + + return pos, ang +end + +function SWEP:Swung() + self.SwingStop = CurTime() + 0.5 + + if not self:GetSwinging() then + self:SetSwinging(true) + + self:StartSwingingSound() + end + + self.BaseClass.Swung(self) +end + +function SWEP:PrimaryAttack() + if self:IsSlowSwinging() or self:IsPouncing() or self:GetPounceTime() > 0 then return end + + local owner = self:GetOwner() + + if self:IsClimbing() or owner:WaterLevel() >= 2 or owner:GetVelocity():LengthSqr() < 64 then + self.BaseClass.PrimaryAttack(self) + elseif CurTime() >= self:GetNextPrimaryFire() then + local armdelay = owner:GetMeleeSpeedMul() + + self:SetNextPrimaryFire(CurTime() + (self.SlowMeleeDelay + 0.25) * armdelay) + self:SetNextSecondaryFire(self:GetNextPrimaryFire() + 0.5) + + self:SetSlowSwingEnd(CurTime() + self.SlowMeleeDelay * armdelay) + owner:DoAttackEvent() + + if IsFirstTimePredicted() then + self:EmitSound("npc/fast_zombie/leap1.wav") + end + self:StopSwingingSound() + self:SetSwinging(false) + + local trace = self:GetOwner():CompensatedMeleeTrace(self.MeleeReach, self.MeleeSize) + if trace.HitNonWorld then + trace.IsPreHit = true + self.PreHit = trace + end + + self.IdleAnimation = CurTime() + self:SequenceDuration() * armdelay + end +end + +local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-5, -5, -5), maxs = Vector(5, 5, 5)} +function SWEP:GetClimbSurface() + local owner = self:GetOwner() + + local fwd = owner:SyncAngles():Forward() + local up = owner:GetUp() + local pos = owner:GetPos() + local height = owner:OBBMaxs().z + local tr + local ha + for i=5, height, 5 do + if not tr or not tr.Hit then + climbtrace.start = pos + up * i + climbtrace.endpos = climbtrace.start + fwd * 36 + tr = util.TraceHull(climbtrace) + ha = i + if tr.Hit and not tr.HitSky then break end + end + end + + if tr.Hit and not tr.HitSky then + climbtrace.start = pos + up * ha --tr.HitPos + tr.HitNormal + climbtrace.endpos = climbtrace.start + owner:SyncAngles():Up() * (height - ha) + local tr2 = util.TraceHull(climbtrace) + if tr2.Hit and not tr2.HitSky then + return tr2 + end + + return tr + end +end + +function SWEP:SecondaryAttack() + if self:IsPouncing() or self:IsClimbing() or self:GetPounceTime() > 0 then return end + + if self:GetOwner():IsOnGround() then + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or CurTime() < self.NextAllowPounce then return end + + self:SetNextPrimaryFire(math.huge) + self:SetPounceTime(CurTime() + self.PounceStartDelay) + + self:GetOwner():ResetJumpPower() + if SERVER then + self:GetOwner():EmitSound("npc/fast_zombie/leap1.wav") + end + elseif self:GetClimbSurface() then + self:StartClimbing() + end +end + +function SWEP:StartClimbing() + if self:GetClimbing() then return end + + self:SetClimbing(true) + + self:SetNextSecondaryFire(CurTime() + 0.5) +end + +function SWEP:StopClimbing() + if not self:GetClimbing() then return end + + self:SetClimbing(false) + + self:SetNextSecondaryFire(CurTime()) +end + +function SWEP:Slingshot() + if self:IsPouncing() then return end + + self:SetPounceTime(0) + + local owner = self:GetOwner() + if owner:IsOnGround() then + self:SetPouncing(true) + + local pos = owner:GetPos() + local ang = owner:EyeAngles() + local deathclass = owner.DeathClass or owner:GetZombieClass() + local vel = self.PounceVelocity + + if SERVER then + + owner:EmitSound("NPC_FastZombie.Scream") + + local lastattacker = owner:GetLastAttacker() + local classtable = GAMEMODE.ZombieClasses["Slingshot Zombie Torso"] + local hpmul = math.min((owner:Health() * 1.25) / owner:GetMaxHealth(), 1) + local spawnpos = pos + spawnpos.z = spawnpos.z + owner:OBBMaxs().z + if classtable then + owner:RemoveStatus("overridemodel", false, true) + owner:SetZombieClass(classtable.Index) + owner:DoHulls(classtable.Index, TEAM_UNDEAD) + owner.DeathClass = deathclass + spawnpos.z = spawnpos.z - owner:OBBMaxs().z + + local effectdata = EffectData() + effectdata:SetEntity(owner) + effectdata:SetOrigin(pos) + util.Effect("gib_player", effectdata, true, true) + + timer.Simple(0, function() + if owner:IsValidLivingZombie() then + owner.DeathClass = nil + owner.Revived = true + owner:UnSpectateAndSpawn() + owner.Revived = nil + owner.DeathClass = deathclass + owner:SetLastAttacker(lastattacker) + owner:SetPos(spawnpos) + owner:SetHealth(math.max(1, math.min(classtable.Health * hpmul, classtable.Health))) + owner:SetEyeAngles(ang) + end + end) + + end + end + + timer.Simple(0, function() + if owner:IsValidLivingZombie() then + ang.pitch = math.min(-10, ang.pitch) + owner:SetGroundEntity(NULL) + owner:SetVelocity((1 - 0.5 * (owner:GetLegDamage() / GAMEMODE.MaxLegDamage)) * vel * ang:Forward()) + owner:SetAnimation(PLAYER_JUMP) + local wep = owner:GetActiveWeapon() + if wep:IsValid() and wep.GetPouncing then + wep.m_ViewAngles = owner:EyeAngles() + wep:SetPouncing(true) + wep:SetNextSecondaryFire(CurTime() + wep.AlertDelay) + end + end + end) + else + self:SetNextSecondaryFire(CurTime()) + self.m_ViewAngles = nil + self.NextAllowJump = CurTime() + self.NextAllowPounce = CurTime() + self.PounceDelay + self:SetNextPrimaryFire(CurTime() + 0.1) + self:GetOwner():ResetJumpPower() + end +end + +function SWEP:StopPounce() + if not self:IsPouncing() then return end + + self:SetPouncing(false) + self:SetNextSecondaryFire(CurTime()) + self.m_ViewAngles = nil + self.NextAllowJump = CurTime() + 0.25 + self.NextAllowPounce = CurTime() + self.PounceDelay + self:SetNextPrimaryFire(CurTime() + 0.1) + self:GetOwner():ResetJumpPower() +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:OnRemove() + self.Removing = true + + local owner = self:GetOwner() + if owner and owner:IsValid() then + self:StopSwingingSound() + owner:ResetJumpPower() + end + + self.BaseClass.OnRemove(self) +end + +function SWEP:Holster() + local owner = self:GetOwner() + if owner and owner:IsValid() then + self:StopSwingingSound() + owner:ResetJumpPower() + end + + self.BaseClass.Holster(self) +end + +function SWEP:ResetJumpPower(power) + if self.Removing then return end + + if self.NextAllowJump and CurTime() < self.NextAllowJump or self:IsPouncing() or self:GetPounceTime() > 0 then + return 1 + end +end + +--[[function SWEP:CheckIdleAnimation() +end +SWEP.CheckAttackAnimation = SWEP.CheckIdleAnimation]] + +function SWEP:CheckMoaning() +end +SWEP.StartMoaning = SWEP.CheckMoaning +SWEP.StopMoaning = SWEP.CheckMoaning +SWEP.StartMoaningSound = SWEP.CheckMoaning +SWEP.DoSwingEvent = SWEP.CheckMoaning + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("NPC_FastZombie.AlertFar") + self:SetRoarEndTime(CurTime() + self.RoarTime) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("NPC_FastZombie.Frenzy") + self:SetRoarEndTime(CurTime() + self.RoarTime) +end + +function SWEP:StartSwingingSound() + self:GetOwner():EmitSound("NPC_FastZombie.Gurgle") +end + +function SWEP:StopSwingingSound() + self:GetOwner():StopSound("NPC_FastZombie.Gurgle") +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:SetRoarEndTime(time) + self:SetDTFloat(1, time) +end + +function SWEP:GetRoarEndTime() + return self:GetDTFloat(1) +end + +function SWEP:IsRoaring() + return CurTime() < self:GetRoarEndTime() +end + +function SWEP:SetPounceTime(time) + self:SetDTFloat(2, time) +end + +function SWEP:GetPounceTime() + return self:GetDTFloat(2) +end + +function SWEP:SetPounceTime(time) + self:SetDTFloat(2, time) +end + +function SWEP:GetPounceTime() + return self:GetDTFloat(2) +end + +function SWEP:SetClimbing(climbing) + self:SetDTBool(1, climbing) +end + +function SWEP:GetClimbing() + return self:GetDTBool(1) +end +SWEP.IsClimbing = SWEP.GetClimbing + +function SWEP:SetSwinging(swinging) + self:SetDTBool(2, swinging) +end + +function SWEP:GetSwinging() + return self:GetDTBool(2) +end + +function SWEP:SetPouncing(leaping) + self:SetDTBool(3, leaping) +end + +function SWEP:SetSlowSwingEnd(time) + self:SetDTFloat(3, time) +end + +function SWEP:GetSlowSwingEnd() + return self:GetDTFloat(3) +end + +function SWEP:IsSlowSwinging() + return self:GetSlowSwingEnd() > 0 +end + +function SWEP:GetPouncing() + return self:GetDTBool(3) +end +SWEP.IsPouncing = SWEP.GetPouncing + +if SERVER then + +function SWEP:Deploy() + self:GetOwner():CreateAmbience("fastzombieambience") + + return self.BaseClass.Deploy(self) +end + +end + +if not CLIENT then return end + +local matSkin = Material("models/barnacle/barnacle_sheet") + +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSkin) + render.SetColorModulation(0.64, 0.37, 0.39) +end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombielegs.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombielegs.lua index 2863399..eb58fa5 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombielegs.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombielegs.lua @@ -1,30 +1,28 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Fast Zombie Kung Fu" -end - SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Fast Zombie Kung Fu" + SWEP.Primary.Delay = 1 SWEP.MeleeDelay = 0.25 SWEP.MeleeReach = 38 -SWEP.MeleeDamage = 13 +SWEP.MeleeDamage = 14 SWEP.DelayWhenDeployed = true -function SWEP:Move(mv) +--[[function SWEP:Move(mv) if self:IsSwinging() then mv:SetMaxSpeed(0) mv:SetMaxClientSpeed(0) end -end +end]] function SWEP:PrimaryAttack(fromsecondary) local n = self:GetNextPrimaryAttack() - if self.Owner:IsOnGround() or self.Owner:WaterLevel() >= 2 or self.Owner:GetMoveType() ~= MOVETYPE_WALK then + if self:GetOwner():IsOnGround() or self:GetOwner():WaterLevel() >= 2 or self:GetOwner():GetMoveType() ~= MOVETYPE_WALK then self.BaseClass.PrimaryAttack(self) end @@ -42,11 +40,11 @@ function SWEP:SecondaryAttack() end function SWEP:PlayHitSound() - self.Owner:EmitSound("npc/zombie/zombie_pound_door.wav") + self:EmitSound("npc/zombie/zombie_pound_door.wav", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/zombie/foot_slide"..math.random(3)..".wav") + self:EmitSound("npc/zombie/foot_slide"..math.random(3)..".wav") end function SWEP:Reload() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso.lua new file mode 100644 index 0000000..a64e82c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso.lua @@ -0,0 +1,31 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombietorso" + +SWEP.PrintName = "Fast Zombie Torso" + +SWEP.ViewModel = Model("models/weapons/v_fza.mdl") + +SWEP.MeleeDelay = 0.25 +SWEP.MeleeDamage = 18 +SWEP.SwingAnimSpeed = 2.4 + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/leap1.wav", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("NPC_FastZombie.AlertFar") +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("NPC_FastZombie.Frenzy") +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso_slingshot.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso_slingshot.lua new file mode 100644 index 0000000..6d59611 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombietorso_slingshot.lua @@ -0,0 +1,175 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Slingshot Zombie Torso" + +SWEP.ViewModel = Model("models/weapons/v_fza.mdl") + +SWEP.MeleeDelay = 0.25 +SWEP.MeleeDamage = 20 +SWEP.MeleeReach = 40 +SWEP.SwingAnimSpeed = 2.4 + +SWEP.PounceDamage = 20 +SWEP.PounceDamageVsPlayerMul = 0.75 +SWEP.PounceReach = 26 +SWEP.PounceSize = 12 + +function SWEP:Think() + self.BaseClass.Think(self) + + local curtime = CurTime() + local owner = self:GetOwner() + + if self.NextAllowJump and self.NextAllowJump <= curtime then + self.NextAllowJump = nil + + owner:ResetJumpPower() + end + + if self:GetPouncing() then + if owner:IsOnGround() or owner:WaterLevel() >= 2 then + self:StopPounce() + else + local dir = owner:GetAimVector() + dir.z = math.Clamp(dir.z, -0.5, 0.9) + dir:Normalize() + + local traces = owner:CompensatedZombieMeleeTrace(self.PounceReach, self.PounceSize, owner:WorldSpaceCenter(), dir) + local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.PounceDamage) + + local hit = false + for _, trace in ipairs(traces) do + if not trace.Hit then continue end + + if trace.HitWorld then + if trace.HitNormal.z < 0.8 then + hit = true + self:MeleeHitWorld(trace) + end + else + local ent = trace.Entity + if ent and ent:IsValid() then + hit = true + self:MeleeHit(ent, trace, damage * (ent:IsPlayer() and self.PounceDamageVsPlayerMul or ent.PounceWeakness or 1), ent:IsPlayer() and 1 or 10) + if ent:IsPlayer() then + ent:GiveStatus("slow", 5) + ent:AddLegDamage(24) + end + end + end + end + + if SERVER and hit then + owner:EmitSound("physics/flesh/flesh_strider_impact_bullet1.wav") + owner:EmitSound("npc/fast_zombie/wake1.wav") + end + + if hit then + self:StopPounce() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + end + end + end + + self:NextThink(curtime) + return true +end + +function SWEP:PrimaryAttack() + if CurTime() < self:GetNextPrimaryFire() or self:IsPouncing() then return end + + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * armdelay) + self:SetNextSecondaryFire(self:GetNextPrimaryFire() + 0.5) + + self:StartSwinging() +end + +function SWEP:Move(mv) + if self:IsPouncing() then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + end +end + +function SWEP:StopPounce() + if not self:IsPouncing() then return end + + self:SetPouncing(false) + self.m_ViewAngles = nil + self.NextAllowJump = CurTime() + 0.25 + self:SetNextPrimaryFire(CurTime() + 0.1) + self:GetOwner():ResetJumpPower() +end + + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/leap1.wav", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("NPC_FastZombie.AlertFar") +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("NPC_FastZombie.Frenzy") +end + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:SetPouncing(leaping) + self:SetDTBool(3, leaping) +end + +function SWEP:GetPouncing() + return self:GetDTBool(3) +end +SWEP.IsPouncing = SWEP.GetPouncing + +if SERVER then + +function SWEP:Deploy() + self:GetOwner():CreateAmbience("fastzombieambience") + + return self.BaseClass.Deploy(self) +end + +end + +if not CLIENT then return end + +local matSkin = Material("models/barnacle/barnacle_sheet") + +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSkin) + render.SetColorModulation(0.64, 0.37, 0.39) +end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride() + render.SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/cl_init.lua index 1dc3073..77def91 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/cl_init.lua @@ -1,35 +1,33 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Force Field Emitter" -SWEP.Description = "Blocks bullets and other projectiles but will not stop humans, zombies, or other creatures from passing.\nPress PRIMARY ATTACK to deploy.\nPress SECONDARY ATTACK and RELOAD to rotate." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end @@ -40,5 +38,5 @@ function SWEP:RotateGhost(amount) surface.PlaySound("npc/headcrab_poison/ph_step4.wav") nextclick = RealTime() + 0.3 end - RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/init.lua index 994587d..acdada7 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_ffemitter") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_ffemitter", false, true) end @@ -37,7 +34,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_ffemitter if not (status and status:IsValid()) then return end @@ -56,18 +53,21 @@ function SWEP:PrimaryAttack() ent:Spawn() ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() ent:EmitSound("npc/dog/dog_servo12.wav") - ent:GhostAllPlayersInMe(5) - self:TakePrimaryAmmo(1) local stored = owner:PopPackedItem(ent:GetClass()) if stored then - ent.m_Health = stored[1] + ent:SetObjectHealth(stored[1]) end + local ammo = math.min(owner:GetAmmoCount("pulse"), 150) + ent:SetAmmo(ammo) + owner:RemoveAmmo(ammo, "pulse") + if self:GetPrimaryAmmoCount() <= 0 then owner:StripWeapon(self:GetClass()) end @@ -78,6 +78,6 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/shared.lua index 79d736a..e5c0cac 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ffemitter/shared.lua @@ -1,3 +1,6 @@ +SWEP.PrintName = "Force Field Emitter" +SWEP.Description = "Blocks zombie projectiles but will not stop humans or zombies from passing.\nPress PRIMARY ATTACK to deploy.\nPress SECONDARY ATTACK and RELOAD to rotate." + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/props_lab/lab_flourescentlight002b.mdl") @@ -16,9 +19,11 @@ SWEP.Secondary.Ammo = "dummy" SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOWEST +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() end @@ -43,7 +48,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fists.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fists.lua index 98f41bf..eedc942 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fists.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fists.lua @@ -2,41 +2,42 @@ AddCSLuaFile() SWEP.PrintName = "Fists" -if GAMEMODE.ZombieEscape then - SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL -else - SWEP.WalkSpeed = SPEED_NORMAL -end - -SWEP.IsMelee = true - -SWEP.UseHands = true +SWEP.Base = "weapon_zs_basemelee" SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl" SWEP.WorldModel = "" +SWEP.UseHands = true -SWEP.Damage = 5 +SWEP.HoldType = "fist" + +SWEP.WalkSpeed = SPEED_NORMAL +SWEP.OldWalkSpeed = 0 + +SWEP.MeleeDamage = 15 +SWEP.DamageType = DMG_CLUB SWEP.UppercutDamageMultiplier = 3 SWEP.HitDistance = 40 +SWEP.MeleeKnockBack = 0 SWEP.ViewModelFOV = 52 SWEP.AutoSwitchFrom = true -SWEP.NoMagazine = true +SWEP.Unarmed = true + SWEP.Undroppable = true SWEP.NoPickupNotification = true +SWEP.NoDismantle = true +SWEP.NoGlassWeapons = true -SWEP.Primary.Ammo = "none" -SWEP.Secondary.Ammo = "none" +SWEP.Primary.Delay = 0.6 -local SwingSound = Sound( "weapons/slam/throw.wav" ) -local HitSound = Sound( "Flesh.ImpactHard" ) +SWEP.Weight = 2 -- This is the second crappiest weapon you could hope for, besides food +SWEP.SlotPos = 100 -function SWEP:Initialize() - --self:SetWeaponHoldType("normal") - self:SetWeaponHoldType("fist") -end +SWEP.IsFistWeapon = true +SWEP.SwingSound = Sound( "weapons/slam/throw.wav" ) +SWEP.HitSound = Sound( "Flesh.ImpactHard" ) function SWEP:PreDrawViewModel(vm, wep, pl) vm:SetMaterial("engine/occlusionproxy") @@ -47,19 +48,29 @@ function SWEP:SetupDataTables() self:NetworkVar("Float", 1, "NextIdle") self:NetworkVar("Float", 2, "NextIdleHoldType") self:NetworkVar("Int", 2, "Combo") + --self:NetworkVar("Bool", 0, "HitPrevious") + self:NetworkVar("Int", 0, "PowerCombo") end function SWEP:UpdateNextIdle() - local vm = self.Owner:GetViewModel() + local vm = self:GetOwner():GetViewModel() self:SetNextIdle( CurTime() + vm:SequenceDuration() ) end +SWEP.LastSwingHit = 0 +SWEP.LastSwingStart = 0 + function SWEP:PrimaryAttack(right) - --self:SetWeaponHoldType("fist") - self:SetNextIdleHoldType(CurTime() + 2) - self.Owner:SetAnimation(PLAYER_ATTACK1) - self.WalkSpeed = 165 - self.Owner:ResetSpeed() + local owner = self:GetOwner() + local time = CurTime() + + self:SetNextIdleHoldType(time + 1.5) + owner:SetAnimation(PLAYER_ATTACK1) + self.OldWalkSpeed = math.max(self.OldWalkSpeed, self.WalkSpeed) + if not owner:IsSkillActive(SKILL_KNUCKLEMASTER) and self.Unarmed then + self.WalkSpeed = 165 + owner:ResetSpeed() + end local anim = "fists_left" if ( right ) then anim = "fists_right" end @@ -67,90 +78,162 @@ function SWEP:PrimaryAttack(right) anim = "fists_uppercut" end - local vm = self.Owner:GetViewModel() + local vm = self:GetOwner():GetViewModel() vm:SendViewModelMatchingSequence( vm:LookupSequence( anim ) ) - self:EmitSound( SwingSound ) + self:EmitSound( self.SwingSound ) self:UpdateNextIdle() - self:SetNextMeleeAttack( CurTime() + 0.2 ) - - self:SetNextPrimaryFire( CurTime() + 0.9 ) - self:SetNextSecondaryFire( CurTime() + 0.9 ) + + local armdelay = owner:GetMeleeSpeedMul() + local hitdelay = self.Primary.Delay / 3 * (owner.MeleeSwingDelayMul or 1) * armdelay + owner:GetViewModel():SetPlaybackRate(1 / armdelay) + if time < self.LastSwingStart + 1 and owner:IsSkillActive(SKILL_COMBOKNUCKLE) then + if time < self.LastSwingHit + 0.75 then --if self:GetHitPrevious() then + hitdelay = hitdelay / 2 + owner:GetViewModel():SetPlaybackRate(2 / armdelay) + else + hitdelay = hitdelay * 2 + owner:GetViewModel():SetPlaybackRate(0.5 / armdelay) + end + end + + self:SetNextMeleeAttack( time + hitdelay ) + + self:SetNextPrimaryFire( time + self.Primary.Delay * armdelay ) + self:SetNextSecondaryFire( time + self.Primary.Delay * armdelay ) + + self.LastSwingStart = time end function SWEP:SecondaryAttack() self:PrimaryAttack( true ) end +function SWEP:GenerateDamageInfo(damage, hitpos) + local dmginfo = DamageInfo() + dmginfo:SetAttacker(self:GetOwner()) + dmginfo:SetInflictor(self) + dmginfo:SetDamageType(self.DamageType) + dmginfo:SetDamagePosition(hitpos) + dmginfo:SetDamage(damage) + return dmginfo +end + function SWEP:DealDamage() - local owner = self.Owner - local shootpos = owner:GetShootPos() + local owner = self:GetOwner() local aimvector = owner:GetAimVector() local anim = self:GetSequenceName(owner:GetViewModel():GetSequence()) - local filter = owner:GetMeleeFilter() + local time = CurTime() - owner:LagCompensation( true ) - - local tr = util.TraceLine( { - start = shootpos, - endpos = shootpos + aimvector * self.HitDistance, - filter = filter - } ) - - if not IsValid( tr.Entity ) then - tr = util.TraceHull( { - start = shootpos, - endpos = shootpos + aimvector * self.HitDistance, - filter = filter, - mins = Vector( -3, -3, -3 ), - maxs = Vector( 3, 3, 3 ) - } ) - end + local tr = owner:CompensatedMeleeTrace(self.HitDistance * (owner.MeleeRangeMul or 1), 3) local hitent = tr.Entity -- We need the second part for single player because SWEP:Think is ran shared in SP. if tr.Hit and not ( game.SinglePlayer() and CLIENT ) then - self:EmitSound( HitSound ) + self:EmitSound( self.HitSound, 75, 100, 1, CHAN_WEAPON + 1) end - local hit = false - local hitplayer = false + if self.OnMeleeHit and self:OnMeleeHit(hitent, hitflesh, tr) then + return + end - if SERVER and IsValid( hitent ) then - hitplayer = hitent:IsNPC() or hitent:IsPlayer() - - local dmginfo = DamageInfo() - dmginfo:SetAttacker(IsValid(owner) and owner or self) - dmginfo:SetInflictor(self) - dmginfo:SetDamageType(DMG_CLUB) - dmginfo:SetDamagePosition(tr.HitPos) - if anim == "fists_uppercut" then - dmginfo:SetDamage(self.Damage * self.UppercutDamageMultiplier) - else - dmginfo:SetDamage(self.Damage) + local armdelay = owner:GetMeleeSpeedMul() + local delay = self.Primary.Delay * (owner.UnarmedDelayMul or 1) * armdelay + if tr.Hit then + self.LastSwingHit = time + if owner:IsSkillActive(SKILL_COMBOKNUCKLE) then + delay = delay / 2 + end + else + if owner:IsSkillActive(SKILL_COMBOKNUCKLE) then + delay = delay * 2 end - if hitent:IsPlayer() and hitent:WouldDieFrom(dmginfo:GetDamage(), dmginfo:GetDamagePosition()) then - if anim == "fists_left" then - dmginfo:SetDamageForce(owner:GetRight() * 4912 + owner:GetForward() * 9998) - elseif anim == "fists_right" then - dmginfo:SetDamageForce(owner:GetRight() * -4912 + owner:GetForward() * 9989) - elseif anim == "fists_uppercut" then - dmginfo:SetDamageForce(owner:GetUp() * 5158 + owner:GetForward() * 10012) + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + self:SetNextPrimaryFire( time + delay ) + self:SetNextSecondaryFire( time + delay ) + + if hitent:IsValid() then + local damagemultiplier = owner:GetTotalAdditiveModifier("UnarmedDamageMul", "MeleeDamageMultiplier") + if owner:IsSkillActive(SKILL_LASTSTAND) then + if owner:Health() <= owner:GetMaxHealth() * 0.25 then + damagemultiplier = damagemultiplier * 2 + else + damagemultiplier = damagemultiplier * 0.85 end end - hitent:TakeDamageInfo( dmginfo ) - hit = true - end + if SERVER and hitent:IsPlayer() and not self.NoGlassWeapons and owner:IsSkillActive(SKILL_GLASSWEAPONS) then + damagemultiplier = damagemultiplier * 3.5 + owner.GlassWeaponShouldBreak = not owner.GlassWeaponShouldBreak + end - if SERVER and IsValid( hitent ) and hitent:GetMoveType() == MOVETYPE_VPHYSICS then - local phys = hitent:GetPhysicsObject() - if IsValid( phys ) then - phys:ApplyForceOffset( aimvector * 2000, tr.HitPos ) - hitent:SetPhysicsAttacker(owner) + if anim == "fists_uppercut" then + damagemultiplier = damagemultiplier * self.UppercutDamageMultiplier + end + + local damage = self.MeleeDamage * damagemultiplier + local dmginfo = self:GenerateDamageInfo(damage, tr.HitPos) + + local vel + if hitent:IsPlayer() then + self:PlayerHitUtil(owner, damage, hitent, dmginfo) + + if SERVER then + hitent:SetLastHitGroup(tr.HitGroup) + if tr.HitGroup == HITGROUP_HEAD then + hitent:SetWasHitInHead() + end + + if hitent:WouldDieFrom(dmginfo:GetDamage(), dmginfo:GetDamagePosition()) then + if anim == "fists_left" then + dmginfo:SetDamageForce(owner:GetRight() * 4912 + owner:GetForward() * 9998) + elseif anim == "fists_right" then + dmginfo:SetDamageForce(owner:GetRight() * -4912 + owner:GetForward() * 9989) + elseif anim == "fists_uppercut" then + dmginfo:SetDamageForce(owner:GetUp() * 5158 + owner:GetForward() * 10012) + end + else + if owner:IsSkillActive(SKILL_CRITICALKNUCKLE) then + hitent:ThrowFromPositionSetZ(tr.StartPos, 240 * (owner.MeleeKnockbackMultiplier or 1), nil, true) + end + + if owner.BoxingTraining then + self:SetDTInt(5, self:GetDTInt(5) + 1) + + if self:GetDTInt(5) >= 5 then + self:SetDTInt(5, 0) + + hitent:AddLegDamage(18) + hitent:AddArmDamage(18) + hitent:EmitSound("weapons/crowbar/crowbar_impact1.wav", 75, math.random(60, 65)) + end + end + end + end + + vel = hitent:GetVelocity() + else + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + + if IsFirstTimePredicted() then + self:PostHitUtil(owner, hitent, dmginfo, tr, vel) + end + + if SERVER and hitent:GetMoveType() == MOVETYPE_VPHYSICS then + local phys = hitent:GetPhysicsObject() + if phys and phys:IsValid() then + phys:ApplyForceOffset( aimvector * 2000, tr.HitPos ) + hitent:SetPhysicsAttacker(owner) + end end end @@ -162,12 +245,14 @@ function SWEP:DealDamage() end end - owner:LagCompensation(false) + if SERVER then + self:ServerMeleePostHitEntity(tr, hitent, damagemultiplier) + end end function SWEP:OnRemove() - if CLIENT and self.Owner:IsValid() and self.Owner:IsPlayer() then - local vm = self.Owner:GetViewModel() + if CLIENT and self:GetOwner():IsValid() and self:GetOwner():IsPlayer() then + local vm = self:GetOwner():GetViewModel() if IsValid(vm) then vm:SetMaterial("") end end end @@ -175,6 +260,9 @@ end function SWEP:Holster(wep) if CurTime() >= self:GetNextPrimaryFire() then self:OnRemove() + if CLIENT then + self:Anim_Holster() + end return true end @@ -183,57 +271,60 @@ function SWEP:Holster(wep) end function SWEP:Deploy() - local vm = self.Owner:GetViewModel() + local vm = self:GetOwner():GetViewModel() vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) - + self:UpdateNextIdle() - + if SERVER then self:SetCombo(0) end - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() return true end function SWEP:Think() - local vm = self.Owner:GetViewModel() - local curtime = CurTime() local idletime = self:GetNextIdle() local idle_holdtype_time = self:GetNextIdleHoldType() - if idle_holdtype_time > 0 and curtime >= idle_holdtype_time then + if idle_holdtype_time > 0 and CurTime() >= idle_holdtype_time then --self:SetWeaponHoldType("normal") self:SetNextIdleHoldType(0) - if GAMEMODE.ZombieEscape then - self.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL - else - self.WalkSpeed = SPEED_NORMAL - end - self.Owner:ResetSpeed() + self.WalkSpeed = self.OldWalkSpeed + self:GetOwner():ResetSpeed() end - - if idletime > 0 and curtime >= idletime then + + if idletime > 0 and CurTime() >= idletime then + local vm = self:GetOwner():GetViewModel() vm:SendViewModelMatchingSequence( vm:LookupSequence("fists_idle_0"..math.random(2))) self:UpdateNextIdle() end - + local meleetime = self:GetNextMeleeAttack() - - if meleetime > 0 and curtime >= meleetime then + + if meleetime > 0 and CurTime() >= meleetime then self:DealDamage() self:SetNextMeleeAttack( 0 ) end - - if SERVER and curtime >= self:GetNextPrimaryFire() + 0.1 then + + if SERVER and CurTime() >= self:GetNextPrimaryFire() + 0.1 then self:SetCombo( 0 ) end end +function SWEP:TranslateActivity( act ) + return self.ActivityTranslate and self.ActivityTranslate[act] or -1 +end + if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end + +function SWEP:DrawHUD() + self:DrawCrosshairDot() end function SWEP:GetViewModelPosition(pos, ang) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/init.lua new file mode 100644 index 0000000..c9f0611 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_flashbomb" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/shared.lua new file mode 100644 index 0000000..04be229 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_flashbomb/shared.lua @@ -0,0 +1,16 @@ +SWEP.PrintName = "Flash Bomb" +SWEP.Description = "Deals no damage but stuns all zombies around the flash, especially if they're looking at it." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ViewModel = "models/weapons/cstrike/c_eq_flashbang.mdl" +SWEP.WorldModel = "models/weapons/w_eq_flashbang.mdl" + +SWEP.Primary.Ammo = "flashbomb" +SWEP.Primary.Sound = Sound("weapons/pinpull.wav") + +SWEP.MaxStock = 12 + +function SWEP:Precache() + util.PrecacheSound("weapons/pinpull.wav") +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper.lua deleted file mode 100644 index fe85fd6..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper.lua +++ /dev/null @@ -1,249 +0,0 @@ -AddCSLuaFile() - -SWEP.Base = "weapon_zs_zombie" - -SWEP.PrintName = "Flesh Creeper" - -SWEP.MeleeDelay = 0.5 -SWEP.MeleeReach = 52 -SWEP.MeleeDamage = 15 -SWEP.MeleeForceScale = 1.25 -SWEP.MeleeSize = 3 -SWEP.MeleeDamageType = DMG_SLASH -SWEP.Primary.Delay = 0.75 - -SWEP.Secondary.Automatic = false - -AccessorFuncDT(SWEP, "RightClickStart", "Float", 2) -AccessorFuncDT(SWEP, "AttackAnimTime", "Float", 3) - -SWEP.NextDigSound = 0 -SWEP.NextMessage = 0 - -function SWEP:Think() - self.BaseClass.Think(self) - - if self:GetHoldingRightClick() and not self.Owner:KeyDown(IN_ATTACK2) then - self:SetRightClickStart(0) - - if self.BuildSoundPlaying then - self.BuildSoundPlaying = false - self.BuildSound:ChangeVolume(0, 0.5) - end - elseif self:IsBuilding() then - if not self.BuildSoundPlaying then - self.BuildSoundPlaying = true - self.BuildSound:ChangeVolume(0.45, 0.5) - end - - if SERVER then - self:BuildingThink() - end - end - - self:NextThink(CurTime()) - return true -end - -function SWEP:SendMessage(msg, friendly) - if CurTime() >= self.NextMessage then - self.NextMessage = CurTime() + 2 - self.Owner:CenterNotify(friendly and COLOR_GREEN or COLOR_RED, translate.ClientGet(self.Owner, msg)) - end -end - -function SWEP:Initialize() - self.BaseClass.Initialize(self) - - self.BuildSound = CreateSound(self, "npc/antlion/charge_loop1.wav") - self.BuildSound:PlayEx(0, 100) -end - -function SWEP:OnRemove() - self.BaseClass.OnRemove(self) - - self.BuildSound:Stop() -end - -function SWEP:BuildingThink() - local owner = self.Owner - local pos = owner:WorldSpaceCenter() - local ang = owner:EyeAngles() - ang.pitch = 0 - ang.roll = 0 - local forward = ang:Forward() - local right = ang:Right() - local endpos = pos + forward * 32 - - local tr = util.TraceLine({start = pos, endpos = endpos, filter = player.GetAll(), mask = MASK_PLAYERSOLID}) - local trent = tr.Entity - - if trent and trent:IsValid() and trent:GetClass() == "prop_creepernest" then - --[[if not trent:GetNestBuilt() and trent.LastBuilder and trent.LastBuild and trent.LastBuilder:IsValid() and trent.LastBuilder ~= owner and CurTime() < trent.LastBuild + 0.1 then - owner:ConCommand("-attack2") - self:SendMessage("nest_already_being_built") - return - end]] - - self:BuildNest(trent) - - return - end - - if owner.NextNestSpawn and CurTime() < owner.NextNestSpawn then - if CurTime() >= self.NextMessage then - self.NextMessage = CurTime() + 2 - owner:CenterNotify(COLOR_RED, translate.ClientFormat(owner, "wait_x_seconds_before_making_a_new_nest", math.ceil(owner.NextNestSpawn - CurTime()))) - end - - return - end - - tr = util.TraceLine({start = endpos, endpos = endpos + Vector(0, 0, -48), mask = MASK_PLAYERSOLID}) - local hitnormal = tr.HitNormal - local z = hitnormal.z - if not tr.HitWorld or tr.HitSky or z < 0.75 then - self:SendMessage("not_enough_room_for_a_nest") - return - end - - local hitpos = tr.HitPos - - for x = -20, 20, 20 do - for y = -20, 20, 20 do - local start = endpos + x * right + y * forward - tr = util.TraceLine({start = start, endpos = start + Vector(0, 0, -48), mask = MASK_PLAYERSOLID}) - if not tr.HitWorld or tr.HitSky or math.abs(tr.HitNormal.z - z) >= 0.2 then - self:SendMessage("not_enough_room_for_a_nest") - return - end - end - end - - for _, ent in pairs(team.GetValidSpawnPoint(TEAM_UNDEAD)) do - if ent.Disabled then continue end - - if util.SkewedDistance(ent:GetPos(), hitpos, 2.5) < GAMEMODE.DynamicSpawnDistBuild then - self:SendMessage("too_close_to_a_spawn") - return - end - end - - -- See if there's a nest nearby. - for _, ent in pairs(ents.FindByClass("prop_creepernest")) do - if util.SkewedDistance(ent:GetPos(), hitpos, 2.5) <= GAMEMODE.DynamicSpawnDistBuild then - self:SendMessage("too_close_to_another_nest") - return - end - end - - for _, human in pairs(team.GetPlayers(TEAM_HUMAN)) do - if util.SkewedDistance(human:GetPos(), hitpos, 2.75) <= GAMEMODE.DynamicSpawnDistBuild then - self:SendMessage("too_close_to_a_human") - return - end - end - - -- I didn't make this check where trigger_hurt entities are. Rather I made it check the time since the last time you were hit with a trigger_hurt. - -- I'm not sure if it's possible to check if a trigger_hurt is enabled or disabled through the Lua bindings. - if owner.LastHitWithTriggerHurt and CurTime() < owner.LastHitWithTriggerHurt + 2 then - return - end - - local ent = ents.Create("prop_creepernest") - if ent:IsValid() then - nestang = hitnormal:Angle() - nestang:RotateAroundAxis(nestang:Right(), 270) - - ent:SetPos(hitpos) - ent:SetAngles(nestang) - ent:Spawn() - - ent:SetNestHealth(1) - ent:SetNestBuilt(false) - - self:SendMessage("nest_created") - - ent.Owner = owner - - owner.NextNestSpawn = CurTime() + 10 - end -end - -function SWEP:BuildNest(ent) - ent:BuildUp() - - ent.LastBuild = CurTime() - ent.LastBuilder = self.Owner - - if not ent:GetNestBuilt() and ent:GetNestHealth() == ent:GetNestMaxHealth() then - ent:SetNestBuilt(true) - ent:EmitSound("physics/flesh/flesh_bloody_break.wav") - - local name = self.Owner:Name() - for _, pl in pairs(team.GetPlayers(TEAM_UNDEAD)) do - pl:CenterNotify(COLOR_GREEN, translate.ClientFormat(pl, "nest_built_by_x", name)) - end - end -end - -function SWEP:PrimaryAttack() - if self:GetHoldingRightClick() or not self.Owner:OnGround() then return end - - self.BaseClass.PrimaryAttack(self) - - if self:IsSwinging() then - self:SetAttackAnimTime(CurTime() + self.Primary.Delay) - end -end - -function SWEP:SecondaryAttack() - if self:IsSwinging() or self:IsInAttackAnim() or not self.Owner:OnGround() then return end - - self:SetRightClickStart(CurTime()) -end - -function SWEP:GetHoldingRightClick() - return self:GetRightClickStart() > 0 -end - -function SWEP:IsBuilding() - return self:GetHoldingRightClick() and (CurTime() - self:GetRightClickStart()) >= 1 -end - -function SWEP:Reload() - self.BaseClass.SecondaryAttack(self) -end - -function SWEP:IsMoaning() - return false -end - -function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/barnacle/barnacle_pull"..math.random(4)..".wav", 70) -end - -function SWEP:PlayIdleSound() - self.Owner:EmitSound("npc/barnacle/barnacle_pull"..math.random(4)..".wav", 70, 85) -end - -function SWEP:PlayAttackSound() -end - -function SWEP:PlayHitSound() - self.Owner:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 70, math.random(110, 120)) -end - -function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 70, math.random(90, 100)) -end - -function SWEP:IsInAttackAnim() - return self:GetAttackAnimTime() > 0 and CurTime() < self:GetAttackAnimTime() -end - -if not CLIENT then return end - -function SWEP:PreDrawViewModel(vm) - return true -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/cl_init.lua new file mode 100644 index 0000000..5a9e8b3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/cl_init.lua @@ -0,0 +1,5 @@ +INC_CLIENT() + +function SWEP:PreDrawViewModel(vm) + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/init.lua new file mode 100644 index 0000000..461bd5c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/init.lua @@ -0,0 +1,182 @@ +INC_SERVER() + +SWEP.NextMessage = 0 + +function SWEP:SendMessage(msg, friendly) + if CurTime() >= self.NextMessage then + self.NextMessage = CurTime() + 2 + self:GetOwner():CenterNotify(friendly and COLOR_GREEN or COLOR_RED, translate.ClientGet(self:GetOwner(), msg)) + end +end + +function SWEP:BuildingThink() + local owner = self:GetOwner() + local allzombies = team.GetPlayers(TEAM_UNDEAD) + local pos = owner:WorldSpaceCenter() + local ang = owner:EyeAngles() + ang.pitch = 0 + ang.roll = 0 + local forward = ang:Forward() + local right = ang:Right() + local endpos = pos + forward * 32 + + local tr = util.TraceLine({start = pos, endpos = endpos, filter = allzombies, mask = MASK_PLAYERSOLID}) + local trent = tr.Entity + + if trent and trent:IsValid() and trent.ZombieConstruction then + self:BuildNest(trent) + + return + end + + if owner.NextNestSpawn and CurTime() < owner.NextNestSpawn then + if CurTime() >= self.NextMessage then + self.NextMessage = CurTime() + 2 + owner:CenterNotify(COLOR_RED, translate.ClientFormat(owner, "wait_x_seconds_before_making_a_new_nest", math.ceil(owner.NextNestSpawn - CurTime()))) + end + + return + end + + local uid = owner:UniqueID() + local count = 0 + local personal_count = 0 + for _, ent in pairs(ents.FindByClass("prop_creepernest")) do + if ent.OwnerUID == uid then + personal_count = personal_count + 1 + end + count = count + 1 + end + + if count >= 12 then + if CurTime() >= self.NextMessage then + self.NextMessage = CurTime() + 2 + owner:CenterNotify(COLOR_RED, translate.ClientGet(owner, "there_are_too_many_nests")) + end + + return + end + + if personal_count >= 3 then + if CurTime() >= self.NextMessage then + self.NextMessage = CurTime() + 2 + owner:CenterNotify(COLOR_RED, translate.ClientGet(owner, "you_have_made_too_many_nests")) + end + + return + end + + tr = util.TraceLine({start = endpos, endpos = endpos + Vector(0, 0, -48), filter = allzombies, mask = MASK_PLAYERSOLID}) + local hitnormal = tr.HitNormal + local z = hitnormal.z + if not tr.HitWorld or tr.HitSky or z < 0.75 then + self:SendMessage("not_enough_room_for_a_nest") + return + end + + local hitpos = tr.HitPos + + for x = -20, 20, 20 do + for y = -20, 20, 20 do + local start = endpos + x * right + y * forward + tr = util.TraceLine({start = start, endpos = start + Vector(0, 0, -48), filter = allzombies, mask = MASK_PLAYERSOLID}) + if not tr.HitWorld or tr.HitSky or math.abs(tr.HitNormal.z - z) >= 0.2 then + self:SendMessage("not_enough_room_for_a_nest") + return + end + end + end + + local spawnpositions = { + Vector(17, 17, 0), + Vector(-17, -17, 0), + Vector(17, 17, 64), + Vector(-17, -17, 64) + } + for _, spos in pairs(spawnpositions) do + if bit.band(util.PointContents(hitpos + spos), CONTENTS_SOLID) == CONTENTS_SOLID then + self:SendMessage("not_enough_room_for_a_nest") + return + end + end + + for _, ent in pairs(team.GetValidSpawnPoint(TEAM_UNDEAD)) do + if ent.Disabled then continue end + + if util.SkewedDistance(ent:GetPos(), hitpos, 1.5) < GAMEMODE.CreeperNestDistBuildZSpawn then + self:SendMessage("too_close_to_a_spawn") + return + end + end + + -- See if there's a nest nearby. + for _, ent in pairs(ents.FindByClass("prop_creepernest")) do + if util.SkewedDistance(ent:GetPos(), hitpos, 1.5) <= GAMEMODE.CreeperNestDistBuildNest then + self:SendMessage("too_close_to_another_nest") + return + end + end + + for _, sigil in pairs(ents.FindByClass("prop_obj_sigil")) do + if sigil:GetSigilCorrupted() then continue end + + if util.SkewedDistance(sigil:GetPos(), hitpos, 1.5) <= GAMEMODE.CreeperNestDistBuildNest then + self:SendMessage("too_close_to_uncorrupt") + return + end + end + + for _, human in pairs(team.GetPlayers(TEAM_HUMAN)) do + if util.SkewedDistance(human:GetPos(), hitpos, 1.5) <= GAMEMODE.CreeperNestDistBuild then + self:SendMessage("too_close_to_a_human") + return + end + end + + -- I didn't make this check where trigger_hurt entities are. Rather I made it check the time since the last time you were hit with a trigger_hurt. + -- I'm not sure if it's possible to check if a trigger_hurt is enabled or disabled through the Lua bindings. + if owner.LastHitWithTriggerHurt and CurTime() < owner.LastHitWithTriggerHurt + 2 then + return + end + + local ent = ents.Create("prop_creepernest") + if ent:IsValid() then + nestang = hitnormal:Angle() + nestang:RotateAroundAxis(nestang:Right(), 270) + + ent:SetPos(hitpos) + ent:SetAngles(nestang) + ent:Spawn() + + ent.OwnerUID = uid + + ent:SetNestHealth(1) + ent:SetNestBuilt(false) + + self:SendMessage("nest_created") + + ent:SetNestOwner(owner) + + owner.NextNestSpawn = CurTime() + 10 + end +end + +function SWEP:BuildNest(ent) + ent:BuildUp() + + ent.LastBuild = CurTime() + ent.LastBuilder = self:GetOwner() + + if not ent:GetNestBuilt() and ent:GetNestHealth() == ent:GetNestMaxHealth() then + ent:SetNestBuilt(true) + ent:EmitSound("physics/flesh/flesh_bloody_break.wav") + + local name = self:GetOwner():Name() + for _, pl in pairs(team.GetPlayers(TEAM_UNDEAD)) do + pl:CenterNotify(COLOR_GREEN, translate.ClientFormat(pl, "nest_built_by_x", name)) + end + + net.Start("zs_nestbuilt") + net.Broadcast() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/shared.lua new file mode 100644 index 0000000..90605f8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fleshcreeper/shared.lua @@ -0,0 +1,185 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Flesh Creeper" + +SWEP.MeleeDelay = 0.5 +SWEP.MeleeReach = 52 +SWEP.MeleeDamage = 15 +SWEP.MeleeForceScale = 1.25 +SWEP.MeleeSize = 4.5 --3 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.Primary.Delay = 0.75 + +SWEP.Secondary.Automatic = false + +AccessorFuncDT(SWEP, "RightClickStart", "Float", 2) +AccessorFuncDT(SWEP, "AttackAnimTime", "Float", 3) +AccessorFuncDT(SWEP, "Pouncing", "Boolean", 1) + +function SWEP:Think() + self.BaseClass.Think(self) + + if self:GetHoldingRightClick() and not self:GetOwner():KeyDown(IN_ATTACK2) then + self:SetRightClickStart(0) + + if self.BuildSoundPlaying then + self.BuildSoundPlaying = false + self.BuildSound:ChangeVolume(0, 0.5) + end + elseif self:IsBuilding() then + if not self.BuildSoundPlaying then + self.BuildSoundPlaying = true + self.BuildSound:ChangeVolume(0.45, 0.5) + end + + if SERVER then + self:BuildingThink() + end + end + + if self:IsPouncing() then + self.FlySound:PlayEx(0.5, 60) + + local owner = self:GetOwner() + local delay = owner:GetMeleeSpeedMul() + local time = CurTime() + + if owner:WaterLevel() >= 2 then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.8 * delay) + elseif owner:OnGround() and owner:IsOnGround() then + self:SetPouncing(false) + self:SetNextPrimaryFire(time + 0.9 * delay) + + if IsFirstTimePredicted() then + owner:EmitSound("npc/antlion/land1.wav", 65, 140, 0.65) + end + end + else + self.FlySound:Stop() + end + + self:NextThink(CurTime()) + return true +end + +function SWEP:Move(mv) + if self:IsPouncing() then + if CurTime() < self.PoundAttackStart + 0.1 then + local vel = mv:GetVelocity() + vel.z = 350 + self:GetOwner():SetGroundEntity(NULL) + mv:SetVelocity(vel) + end + + mv:SetMaxSpeed(mv:GetMaxSpeed() * 5) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 5) + return true + end +end + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent.ZombieConstruction then + damage = damage * 3 + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + self.BuildSound = CreateSound(self, "npc/antlion/charge_loop1.wav") + self.BuildSound:PlayEx(0, 100) + + self.FlySound = CreateSound(self, "npc/antlion/fly1.wav") +end + +function SWEP:OnRemove() + self.BaseClass.OnRemove(self) + + self.BuildSound:Stop() + self.FlySound:Stop() +end + +function SWEP:PrimaryAttack() + if self:GetHoldingRightClick() or not self:GetOwner():OnGround() then return end + + self.BaseClass.PrimaryAttack(self) + + if self:IsSwinging() then + self:SetAttackAnimTime(CurTime() + self.Primary.Delay) + end +end + +function SWEP:SecondaryAttack() + if self:IsSwinging() or self:IsInAttackAnim() or not self:GetOwner():OnGround() then return end + + self:SetRightClickStart(CurTime()) +end + +function SWEP:GetHoldingRightClick() + return self:GetRightClickStart() > 0 +end + +function SWEP:IsBuilding() + return self:GetHoldingRightClick() and (CurTime() - self:GetRightClickStart()) >= 1 +end + +function SWEP:Reload() + local owner = self:GetOwner() + if self:IsPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() or self:IsSwinging() or self:GetHoldingRightClick() then return end + + self.PoundAttackStart = CurTime() + + local vel = owner:GetAimVector() + vel.z = math.max(0.55, vel.z) + vel:Normalize() + + owner:SetGroundEntity(NULL) + owner:SetVelocity(vel * 350) + + self.m_ViewAngles = owner:EyeAngles() + + self:SetPouncing(true) +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/barnacle/barnacle_pull"..math.random(4)..".wav", 70) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/barnacle/barnacle_pull"..math.random(4)..".wav", 70, 85) +end + +function SWEP:PlayAttackSound() +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 70, math.random(110, 120), nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 70, math.random(90, 100), nil, CHAN_AUTO) +end + +function SWEP:IsInAttackAnim() + return self:GetAttackAnimTime() > 0 and CurTime() < self:GetAttackAnimTime() +end + +function SWEP:SetPouncing(pouncing) + if not pouncing then + self.m_ViewAngles = nil + end + + self:SetDTBool(1, pouncing) +end + +function SWEP:IsPouncing() + return self:GetDTBool(1) +end +SWEP.GetPouncing = SWEP.IsPouncing diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fracture.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fracture.lua new file mode 100644 index 0000000..009da12 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fracture.lua @@ -0,0 +1,103 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_baseshotgun" +DEFINE_BASECLASS("weapon_zs_baseshotgun") + +SWEP.PrintName = "'Fracture' Shotgun" +SWEP.Description = "A pump shotgun that shoots in a line spread." + +if CLIENT then + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.M3_PARENT" + SWEP.HUD3DPos = Vector(-1, -4, -3) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 + + SWEP.VElements = { + ["fracture++++++"] = { type = "Model", model = "models/props_c17/trappropeller_lever.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(10.5, 0, -2), angle = Angle(0, -90, -33.896), size = Vector(1, 0.6, 1.5), color = Color(87, 99, 118, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(4.675, 0, -0.201), angle = Angle(0, -90, 0), size = Vector(0.625, 0.625, 0.625), color = Color(60, 67, 90, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(8, 0, -2.597), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(60, 67, 90, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5.715, 0, -1.4), angle = Angle(180, -90, 0), size = Vector(0.025, 0.025, 0.025), color = Color(49, 54, 79, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5.715, 0, 0), angle = Angle(0, -90, 0), size = Vector(0.025, 0.025, 0.025), color = Color(49, 54, 79, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "v_weapon.M3_PARENT", rel = "", pos = Vector(0, -4.5, -10.91), angle = Angle(90, -90, 0), size = Vector(0.15, 0.035, 0.035), color = Color(59, 70, 103, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-1.5, 0, -1), angle = Angle(0, -90, -90), size = Vector(0.035, 0.029, 0.25), color = Color(49, 57, 74, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["fracture+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-1.5, 0, -1), angle = Angle(0, -90, -90), size = Vector(0.035, 0.029, 0.25), color = Color(49, 57, 74, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture++++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(4.675, 0, -0.201), angle = Angle(0, -90, 0), size = Vector(0.625, 0.625, 0.625), color = Color(60, 67, 90, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(16, 1, -5.715), angle = Angle(176.494, 0, 0), size = Vector(0.15, 0.035, 0.035), color = Color(59, 70, 103, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(8, 0, -2.597), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(60, 67, 90, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture+"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-5.715, 0, 0), angle = Angle(0, -90, 0), size = Vector(0.025, 0.025, 0.025), color = Color(49, 54, 79, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++++++"] = { type = "Model", model = "models/props_c17/trappropeller_lever.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(10.5, 0, -2), angle = Angle(0, -90, -33.896), size = Vector(1, 0.6, 1.5), color = Color(87, 99, 118, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-5.715, 0, -1.4), angle = Angle(180, -90, 0), size = Vector(0.025, 0.025, 0.025), color = Color(49, 54, 79, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" +SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" +SWEP.UseHands = true + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.ReloadDelay = 0.45 + +SWEP.Primary.Sound = Sound("Weapon_M3.Single") +SWEP.Primary.Damage = 13 +SWEP.Primary.NumShots = 7 +SWEP.Primary.Delay = 0.9 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 7.55 +SWEP.ConeMin = 5.25 + +SWEP.FireAnimSpeed = 1 +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.Tier = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_SHOT_COUNT, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1, 1) + +function SWEP:PrimaryAttack() + self.AttackContext = true + BaseClass.PrimaryAttack(self) +end + +function SWEP:SecondaryAttack() + self.AttackContext = nil + BaseClass.PrimaryAttack(self) +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/m3/m3-1.wav", 75, math.random(134, 136), 0.7) + self:EmitSound("weapons/xm1014/xm1014-1.wav", 75, math.random(172, 180), 0.5, CHAN_WEAPON + 20) +end + +function SWEP:ShootBullets(dmg, numbul, cone) + local owner = self:GetOwner() + local sprd = (self.AttackContext and 2 or 2.75)*cone/6 + local recp = self.AttackContext and 2 or 1.25 + + self:SendWeaponAnimation() + owner:DoAttackEvent() + + owner:LagCompensation(true) + for i = 1, numbul do + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(self.AttackContext and angle:Up() or angle:Right(), (i - math.ceil(self.Primary.NumShots/2)) * sprd) + + owner:FireBulletsLua(owner:GetShootPos(), angle:Forward(), cone/recp, 1, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + end + owner:LagCompensation(false) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_freshdead.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_freshdead.lua index e6f42a1..aeed2f1 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_freshdead.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_freshdead.lua @@ -2,6 +2,8 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Fresh Dead" + SWEP.MeleeDamage = 20 function SWEP:Reload() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/cl_init.lua new file mode 100644 index 0000000..352f116 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function SWEP:PreDrawViewModel(vm) + render_SetBlend(0.65) + render_SetColorModulation(0.1, 0.5, 0.9) +end + +function SWEP:PostDrawViewModel(vm) + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/init.lua new file mode 100644 index 0000000..9275c7d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/init.lua @@ -0,0 +1,16 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsPlayer() then + ent:GiveStatus("dimvision", 6) + local gt = ent:GiveStatus("frost", 8) + local owner = self:GetOwner() + + if gt and gt:IsValid() then + gt.Applier = owner + end + ent:AddLegDamageExt(12, owner, self, SLOWTYPE_COLD) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/shared.lua new file mode 100644 index 0000000..32163b2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frigidrevenant/shared.lua @@ -0,0 +1,94 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Frigid Revenant" + +SWEP.MeleeDamage = 32 + +local Spread = { + {0, 0}, + {-0.5, 0}, + {0.5, 0} +} +local function DoFleshThrow(pl, wep) + if pl:IsValid() and pl:Alive() and wep:IsValid() then + pl:ResetSpeed() + pl.LastRangedAttack = CurTime() + + if SERVER then + local startpos = pl:GetShootPos() + local aimang = pl:EyeAngles() + local ang + + for _, spr in pairs(Spread) do + ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), spr[1] * 5) + ang:RotateAroundAxis(ang:Right(), spr[2] * 5) + + local ent = ents.Create("projectile_ghoulfleshfr") + if ent:IsValid() then + ent:SetPos(startpos) + ent:SetOwner(pl) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(ang:Forward() * 750) + end + end + end + + pl:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + end + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end + + self:SetNextSecondaryFire(CurTime() + 3) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:GetOwner():DoZombieEvent() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + self:SendWeaponAnim(ACT_VM_HITCENTER) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + timer.Simple(0.7, function() DoFleshThrow(owner, self) end) +end + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie_poison/pz_warn"..math.random(2)..".wav", 70, math.random(140, 145), 0.65, CHAN_AUTO) + self:EmitSound("npc/metropolice/pain"..math.random(4)..".wav", 74, math.Rand(125, 135), 0.65, CHAN_WEAPON + 20) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/antlion/idle"..math.random(5)..".wav", 70, math.random(60, 66)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(80, 90)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frostshade.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frostshade.lua new file mode 100644 index 0000000..c5d7092 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frostshade.lua @@ -0,0 +1,8 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_shade" + +SWEP.PrintName = "Frost Shade" + +SWEP.ShadeControl = "env_frostshadecontrol" +SWEP.ShadeProjectile = "projectile_shadeice" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/cl_init.lua new file mode 100644 index 0000000..a5ecddb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/cl_init.lua @@ -0,0 +1,124 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 65 +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.VElements = { + ["base++++"] = { type = "Model", model = "models/gibs/glass_shard02.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-30.751, -0.101, -5.35), angle = Angle(-169.978, 0, 90), size = Vector(1.149, 0.651, 0.5), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/gibs/glass_shard05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-22.646, -0.11, -5.762), angle = Angle(14.866, 0, 90), size = Vector(0.952, 0.847, 0.4), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/gibs/glass_shard06.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-26.855, -0.12, -0.797), angle = Angle(132.593, 0, 90), size = Vector(0.813, 1.879, 0.449), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_wasteland/rockcliff01g.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(35.922, 0.632, 1.478), angle = Angle(1.037, 86.152, 93.763), size = Vector(0.03, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_foliage/driftwood_01a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_foliage/driftwood_01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.473, 1.353, -12.9), angle = Angle(93.541, 15.888, -27.748), size = Vector(0.14, 0.059, 0.059), color = Color(236, 234, 233, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-26.306, -0.119, 0.578), angle = Angle(62.902, 0, 0), size = Vector(0.014, 0.041, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_foliage/driftwood_01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(22.452, 0.104, -0.147), angle = Angle(0.186, -1.838, 2.183), size = Vector(0.07, 0.075, 0.071), color = Color(89, 69, 57, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_wasteland/rockgranite04b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-27.06, -0.257, 0.49), angle = Angle(55.191, 1.259, 180), size = Vector(0.016, 0.014, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_foliage/driftwood_01a", skin = 0, bodygroup = {} } +} +SWEP.DVElements = SWEP.VElements + +SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/gibs/glass_shard05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-20.38, -0.099, -5.185), angle = Angle(14.866, 0, 90), size = Vector(0.856, 0.762, 0.36), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_wasteland/rockgranite04b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-24.354, -0.232, 0.441), angle = Angle(55.191, 1.259, 180), size = Vector(0.014, 0.013, 0.018), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_foliage/driftwood_01a", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/gibs/glass_shard06.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-24.17, -0.109, -0.717), angle = Angle(132.593, 0, 90), size = Vector(0.731, 1.692, 0.405), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_foliage/driftwood_01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.296, 1.764, -12.671), angle = Angle(85.412, 40.909, -21.896), size = Vector(0.126, 0.054, 0.054), color = Color(236, 234, 233, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_wasteland/rockcliff01g.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(32.328, 0.568, 1.33), angle = Angle(1.037, 86.152, 93.763), size = Vector(0.027, 0.032, 0.018), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_foliage/driftwood_01a", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-23.674, -0.106, 0.521), angle = Angle(62.902, 0, 0), size = Vector(0.012, 0.037, 0.054), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_foliage/driftwood_01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(20.207, 0.093, -0.132), angle = Angle(0.186, -1.838, 2.183), size = Vector(0.063, 0.067, 0.064), color = Color(89, 69, 57, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/gibs/glass_shard02.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-27.675, -0.091, -4.816), angle = Angle(-169.978, 0, 90), size = Vector(1.034, 0.584, 0.449), color = Color(45, 145, 255, 255), surpresslightning = false, material = "models/shadertest/shader2", skin = 0, bodygroup = {} } +} +SWEP.DWElements = SWEP.WElements + +local ghostlerp = 0 +function SWEP:GetViewModelPosition(pos, ang) + local owner = self:GetOwner() + if self:IsSwinging() then + local rot = self.SwingRotation + local offset = self.SwingOffset + local armdelay = owner:GetMeleeSpeedMul() + local swingtime = (self:IsCharging() and self.SwingTimeSecondary or self.SwingTime) * (owner.MeleeSwingDelayMul or 1) * armdelay + + ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy + + local swingend = self:GetSwingEnd() + local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime) + local power = CosineInterpolation(0, 1, delta / swingtime) + + if power >= 0.9 then + power = (1 - power) ^ 0.4 * 2 + end + + pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up() + + ang:RotateAroundAxis(ang:Right(), rot.pitch * power) + ang:RotateAroundAxis(ang:Up(), rot.yaw * power) + ang:RotateAroundAxis(ang:Forward(), rot.roll * power) + end + + if owner:GetBarricadeGhosting() then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 5) + end + + if ghostlerp > 0 then + pos = pos + 3.5 * ghostlerp * ang:Up() + ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp) + end + + return pos, ang +end + + +function SWEP:PreDrawViewModel(vm) + self.BaseClass.PreDrawViewModel(self, vm) + + for mdl, tab in pairs(self.VElements) do + tab.material = self:IsCharging() and "models/shiny" or self.DVElements[mdl].material + tab.color = self:IsCharging() and Color(255, 255, 255, 255) or self.DVElements[mdl].color + end +end + +function SWEP:DrawWorldModel() + self.BaseClass.DrawWorldModel(self) + + for mdl, tab in pairs(self.WElements) do + tab.material = self:IsCharging() and "models/shiny" or self.DWElements[mdl].material + tab.color = self:IsCharging() and Color(255, 255, 255, 255) or self.DWElements[mdl].color + end + + local owner = self:GetOwner() + if owner:IsValid() and not owner.ShadowMan then + + local boneindex = owner:LookupBone("valvebiped.bip01_r_hand") + if boneindex then + local pos, ang = owner:GetBonePosition(boneindex) + if pos then + if self:IsCharging() then + local rdelta = math.min(0.5, CurTime() - self:GetCharge()) + + local force = rdelta * 140 + local resist = force * 0.5 + + pos = pos + ang:Up() * -32 + + local curvel = owner:GetVelocity() * 0.5 + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 48) + + for i=1, math.min(16, math.ceil(FrameTime() * 200)) do + local particle = emitter:Add("particle/snow", pos) + particle:SetVelocity(curvel + VectorRand():GetNormalized() * force) + particle:SetDieTime(0.5) + particle:SetStartAlpha(rdelta * 125 + 15) + particle:SetEndAlpha(0) + particle:SetStartSize(1) + particle:SetEndSize(rdelta * 10 + 4) + particle:SetAirResistance(resist) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/init.lua new file mode 100644 index 0000000..989dc62 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/init.lua @@ -0,0 +1,35 @@ +INC_SERVER() + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + local secondary = self:IsCharging() + + if secondary then + self.OriginalMeleeDamage = self.MeleeDamage + self.OriginalMeleeKnockBack = self.MeleeKnockBack + self.MeleeDamage = self.MeleeDamage * self.MeleeDamageSecondaryMul + self.MeleeKnockBack = self.MeleeKnockBack * self.MeleeKnockBackSecondaryMul + end + + local owner = self:GetOwner() + if hitent:IsValid() and hitent:IsPlayer() then + hitent:AddLegDamageExt(secondary and 18 or 15, owner, self, SLOWTYPE_COLD) + end + + if tr.HitWorld and tr.HitNormal.z > 0.8 and hitent == Entity(0) and secondary then + local ice = ents.Create("env_protrusionspike") + if ice:IsValid() then + ice:SetPos(tr.HitPos) + ice:SetOwner(owner) + ice.Damage = self.MeleeDamage * 0.85 + ice.Team = owner:Team() + ice:Spawn() + end + end +end + +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + if self:IsCharging() then + self.MeleeDamage = self.OriginalMeleeDamage + self.MeleeKnockBack = self.OriginalMeleeKnockBack + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/shared.lua new file mode 100644 index 0000000..d5ac185 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_frotchet/shared.lua @@ -0,0 +1,117 @@ +SWEP.PrintName = "Frotchet" +SWEP.Description = "An axe made from frost. Secondary attack unleashes a powerful swing, creating an icy explosion when aimed at the ground. Slows zombie movement and attack speed." + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "melee2" + +SWEP.MeleeDamage = 142 +SWEP.MeleeRange = 75 +SWEP.MeleeSize = 3 +SWEP.MeleeKnockBack = 240 + +SWEP.MeleeDamageSecondaryMul = 1.2273 +SWEP.MeleeKnockBackSecondaryMul = 1.25 + +SWEP.Primary.Delay = 1.4 +SWEP.Secondary.Delay = SWEP.Primary.Delay * 1.75 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.HitAnim = ACT_VM_MISSCENTER + +SWEP.SwingRotation = Angle(60, 0, -80) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingTime = 0.62 +SWEP.SwingHoldType = "melee" + +SWEP.SwingTimeSecondary = 0.85 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.14) + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + self.ChargeSound = CreateSound(self, "nox/scatterfrost.ogg") +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + return self:GetNextSecondaryFire() <= CurTime() and not self:IsSwinging() +end + +function SWEP:Think() + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end + + if self:IsSwinging() and self:GetSwingEnd() <= CurTime() then + self:StopSwinging() + self:MeleeSwing() + if self:IsCharging() then + self:SetCharge(0) + end + end + + if self:IsCharging() then + self.ChargeSound:PlayEx(1, math.min(255, 35 + (CurTime() - self:GetCharge()) * 220)) + else + self.ChargeSound:Stop() + end +end + +function SWEP:PlaySwingSound() + self:EmitSound("nox/sword_miss.ogg", 75, math.random(40, 45)) +end + +function SWEP:PlayHitSound() + self:EmitSound("nox/frotchet_test1.ogg", 75, math.random(95, 105)) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/flesh/flesh_bloody_break.wav", 80, math.random(95, 105)) +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() or not self:CanSecondaryAttack() then return end + self:SetNextAttack(true) + self:StartSwinging(true) +end + +function SWEP:SetNextAttack(secondary) + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + (secondary and self.Primary.Delay + 0.23 or self.Primary.Delay) * armdelay) + self:SetNextSecondaryFire(CurTime() + (secondary and self.Secondary.Delay or self.Primary.Delay) * armdelay) +end + +function SWEP:StartSwinging(secondary) + local owner = self:GetOwner() + + local armdelay = owner:GetMeleeSpeedMul() + self:SetSwingEnd(CurTime() + (secondary and self.SwingTimeSecondary or self.SwingTime) * (owner.MeleeSwingDelayMul or 1) * armdelay) + if secondary then self:SetCharge(CurTime()) end +end + +function SWEP:IsCharging() + return self:GetCharge() > 0 +end + +function SWEP:SetCharge(charge) + self:SetDTFloat(1, charge) +end + +function SWEP:GetCharge() + return self:GetDTFloat(1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fryingpan.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fryingpan.lua index 2132af7..c7b010d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fryingpan.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fryingpan.lua @@ -1,8 +1,8 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Frying Pan" +SWEP.PrintName = "Frying Pan" +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 @@ -38,6 +38,11 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingTime = 0.3 SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true +SWEP.Culinary = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1) + function SWEP:PlayHitSound() self:EmitSound("weapons/melee/frying_pan/pan_hit-0"..math.random(4)..".ogg") end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_galestorm.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_galestorm.lua new file mode 100644 index 0000000..cb48817 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_galestorm.lua @@ -0,0 +1,138 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Gale Storm' SMG" +SWEP.Description = "Hold right click to use the Storm firing mode: fire rate is reduced to 60% but two bullets are fired at once." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 50 + + SWEP.HUD3DBone = "v_weapon.mac10_bolt" + SWEP.HUD3DPos = Vector(-1.75, 1, 0) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 + + SWEP.VElements = { + ["top2"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top", pos = Vector(0, -1.201, -0.602), angle = Angle(180, 0, 0), size = Vector(0.057, 0.611, 0.068), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "v_weapon.mac10_parent", rel = "", pos = Vector(-0.064, -3.751, -0.304), angle = Angle(180, -90, 0), size = Vector(0.177, 0.079, 0.342), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "v_weapon.mac10_parent", rel = "", pos = Vector(-0.178, -5.091, -1.982), angle = Angle(180, 0, 90), size = Vector(0.021, 0.009, 0.009), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top2", pos = Vector(0, 0, 0.843), angle = Angle(90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top2", pos = Vector(0, 0, 0.577), angle = Angle(-90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["top2"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(1.906, 0.238, 3.084), angle = Angle(0, 90, 90), size = Vector(0.057, 0.611, 0.068), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.876, 1.121, -3.771), angle = Angle(-91.623, -4.99, 0), size = Vector(0.177, 0.101, 0.418), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(1.287, 0.241, 2.313), angle = Angle(0, -90, 90), size = Vector(0.021, 0.009, 0.009), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top2", pos = Vector(0, 0, 0.843), angle = Angle(90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top2", pos = Vector(0, 0, 0.577), angle = Angle(-90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} } + } +end + +sound.Add( +{ + name = "Weapon_Gale.Single", + channel = CHAN_WEAPON, + volume = 1.0, + soundlevel = 100, + pitch = {120, 125}, + sound = "weapons/p90/p90-1.wav" +}) + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_mac10.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = true +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("Weapon_Gale.Single") +SWEP.Primary.Damage = 8.5 +SWEP.Primary.NumShots = 2 +SWEP.Primary.Delay = 0.12 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 6.3 +SWEP.ConeMin = 3.5 + +SWEP.ReloadSpeed = 0.95 + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.Tier = 2 + +SWEP.IronSightsPos = Vector(-7, 15, 0) +SWEP.IronSightsAng = Vector(3, -3, -10) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.7, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.4, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.01, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Whirlwind' Shower Rifle", "Uses rifle ammo, shoots slower, but more damage and more accuracy", function(wept) + wept.Primary.Delay = wept.Primary.Delay * 4 + wept.Primary.Damage = wept.Primary.Damage * 4 + wept.Primary.Ammo = "357" + wept.Primary.ClipSize = 12 + wept.Recoil = 1 + + wept.ConeMin = wept.ConeMin * 0.6 + wept.ConeMax = wept.ConeMax * 0.5 + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/p90/p90-1.wav", 70, 105, 0.65, CHAN_AUTO) + self:EmitSound("weapons/sg552/sg552-1.wav", 70, 235, 0.65, CHAN_AUTO) + end +end) + + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + local ironsights = self:GetIronsights() + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * (ironsights and 1.2 or 1)) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage * (ironsights and 0.7255 or 1), self.Primary.NumShots * (ironsights and 1.5 or 1), self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:SetIronsights(b) + if self:GetIronsights() ~= b then + if b then + self:EmitSound("npc/scanner/scanner_scan4.wav", 40) + else + self:EmitSound("npc/scanner/scanner_scan2.wav", 40) + end + end + + self.BaseClass.SetIronsights(self, b) +end + +function SWEP:CanPrimaryAttack() + if self:GetIronsights() and self:Clip1() == 1 then + self:SetIronsights(false) + end + + return self.BaseClass.CanPrimaryAttack(self) +end + +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then + self:SetIronsights(true) + end +end + +util.PrecacheSound("npc/scanner/scanner_scan4.wav") +util.PrecacheSound("npc/scanner/scanner_scan2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ghoul.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ghoul.lua index 926754c..2d22d24 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ghoul.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ghoul.lua @@ -1,22 +1,24 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Ghoul" -end +SWEP.PrintName = "Ghoul" SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDamage = 15 +SWEP.MeleeDamage = 23 SWEP.MeleeForceScale = 0.5 SWEP.SlowDownScale = 0.25 +SWEP.EnfeebleDurationMul = 10 / SWEP.MeleeDamage --[[SWEP.MeleeForceScale = 0.1 SWEP.SlowDownScale = 2.25 SWEP.SlowDownImmunityTime = 2]] function SWEP:ApplyMeleeDamage(ent, trace, damage) - ent:PoisonDamage(damage, self.Owner, self, trace.HitPos) + ent:PoisonDamage(damage, self:GetOwner(), self, trace.HitPos) if SERVER and ent:IsPlayer() then - ent:GiveStatus("ghoultouch", 10) + local gt = ent:GiveStatus("enfeeble", damage * self.EnfeebleDurationMul) + if gt and gt:IsValid() then + gt.Applier = self:GetOwner() + end end end @@ -25,28 +27,37 @@ function SWEP:Reload() end function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/fast_zombie/fz_alert_close1.wav", 75, math.Rand(70, 80)) + self:GetOwner():EmitSound("npc/fast_zombie/fz_alert_close1.wav", 75, math.Rand(70, 80)) end SWEP.PlayIdleSound = SWEP.PlayAlertSound function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) end +local Spread = { + {0, 0}, + {-1, 0}, + {1, 0}, + {-0.5, 0}, + {0.5, 0} +} local function DoFleshThrow(pl, wep) if pl:IsValid() and pl:Alive() and wep:IsValid() then pl:ResetSpeed() + pl.LastRangedAttack = CurTime() if SERVER then local startpos = pl:GetShootPos() local aimang = pl:EyeAngles() + local ang - for i=1, 4 do - local ang = Angle(aimang.p, aimang.y, aimang.r) - ang:RotateAroundAxis(ang:Up(), math.Rand(-8, 8)) - ang:RotateAroundAxis(ang:Right(), math.Rand(-8, 8)) + for _, spr in pairs(Spread) do + ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), spr[1] * 5) + ang:RotateAroundAxis(ang:Right(), spr[2] * 5) - local ent = ents.Create("projectile_poisonflesh") + local ent = ents.Create("projectile_ghoulflesh") if ent:IsValid() then ent:SetPos(startpos) ent:SetOwner(pl) @@ -54,32 +65,27 @@ local function DoFleshThrow(pl, wep) local phys = ent:GetPhysicsObject() if phys:IsValid() then - phys:SetVelocityInstantaneous(ang:Forward() * math.Rand(320, 380)) + phys:SetVelocityInstantaneous(ang:Forward() * 660) end end end - pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.Rand(85, 95)) - end - - if CurTime() >= (pl.GhoulImmunity or 0) then - pl.GhoulImmunity = CurTime() + 2 - pl:RawCapLegDamage(CurTime() + 2) + pl:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) end end end function SWEP:SecondaryAttack() - local owner = self.Owner + local owner = self:GetOwner() if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end self:SetNextSecondaryFire(CurTime() + 3) self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - self.Owner:DoAttackEvent() + self:GetOwner():DoZombieEvent() self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) - self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.Rand(85, 95)) - self.Owner:RawCapLegDamage(CurTime() + 3) + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + --self:GetOwner():RawCapLegDamage(CurTime() + 3) self:SendWeaponAnim(ACT_VM_HITCENTER) self.IdleAnimation = CurTime() + self:SequenceDuration() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigagorechild.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigagorechild.lua index dc3db17..6d1971c 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigagorechild.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigagorechild.lua @@ -2,32 +2,50 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeReach = 100 -SWEP.MeleeDamage = 30 -SWEP.MeleeForceScale = 2 -SWEP.MeleeSize = 3 -SWEP.MeleeDamageType = DMG_SLASH -SWEP.Primary.Delay = 3 -SWEP.Secondary.Delay = 5 +SWEP.PrintName = "Giga Gore Child" +SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl" +SWEP.WorldModel = "" + +if CLIENT then + SWEP.UseHands = true + SWEP.ViewModelFOV = 40 + SWEP.BobScale = 2 +end + +SWEP.MeleeReach = 90 +SWEP.MeleeDamage = 32 +SWEP.MeleeForceScale = 2 +SWEP.MeleeSize = 5 --3 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.Primary.Delay = 1.35 +SWEP.Secondary.Delay = 2.5 + +SWEP.CryDelay = 8 +SWEP.CryImpactDelay = 1 SWEP.ThrowDelay = 1 AccessorFuncDT(SWEP, "ThrowTime", "Float", 3) +AccessorFuncDT(SWEP, "CryTime", "Float", 4) function SWEP:Think() self:CheckMeleeAttack() self:CheckThrow() + self:CheckCry() end function SWEP:ApplyMeleeDamage(ent, trace, damage) - if ent:IsValid() and ent:IsPlayer() then - local vel = ent:GetPos() - self.Owner:GetPos() + if ent:IsValidPlayer() then + local vel = ent:GetPos() - self:GetOwner():GetPos() vel.z = 0 vel:Normalize() vel = vel * 400 vel.z = 200 - ent:KnockDown() + if CurTime() >= (ent.NextKnockdown or 0) then + ent:KnockDown() + ent.NextKnockdown = CurTime() + 4 + end ent:SetGroundEntity(NULL) ent:SetVelocity(vel) end @@ -41,11 +59,27 @@ function SWEP:PrimaryAttack() self.BaseClass.PrimaryAttack(self) end +function SWEP:Deploy() + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) + + return self.BaseClass.Deploy(self) +end + +local anims = {"fists_uppercut", "fists_right", "fists_left"} +function SWEP:StartSwinging() + self.BaseClass.StartSwinging(self) + + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence(anims[math.random(#anims)])) + vm:SetPlaybackRate(0.32) +end + function SWEP:SecondaryAttack() - if self:IsSwinging() or CurTime() <= self:GetNextSecondaryAttack() or IsValid(self.Owner.FeignDeath) then return end + if self:IsSwinging() or CurTime() <= self:GetNextSecondaryAttack() or IsValid(self:GetOwner().FeignDeath) then return end self:SetThrowTime(CurTime() + self.ThrowDelay) - self.Owner:DoReloadEvent() -- Handled in the class file. Fires the throwing anim. + self:GetOwner():DoReloadEvent() -- Handled in the class file. Fires the throwing anim. self:SetNextSecondaryAttack(CurTime() + self.Secondary.Delay) end @@ -54,8 +88,9 @@ function SWEP:CheckThrow() if self:GetThrowing() and CurTime() >= self:GetThrowTime() then self:SetThrowTime(0) - local owner = self.Owner + local owner = self:GetOwner() + owner.LastRangedAttack = CurTime() owner:EmitSound("weapons/slam/throw.wav", 70, math.random(78, 82)) if SERVER then @@ -69,7 +104,7 @@ function SWEP:CheckThrow() local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:Wake() - phys:SetVelocityInstantaneous(owner:GetAimVector() * 500) + phys:SetVelocityInstantaneous(owner:GetAimVector() * 650) phys:AddAngleVelocity(VectorRand() * math.Rand(200, 300)) ent:SetPhysicsAttacker(owner) @@ -85,25 +120,58 @@ end SWEP.GetThrowing = SWEP.IsThrowing function SWEP:Reload() - self.BaseClass.SecondaryAttack(self) + if self:IsSwinging() or CurTime() <= self:GetNextSecondaryAttack() or IsValid(self:GetOwner().FeignDeath) then return end + + self:PlayAlertSound() + self:GetOwner():AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_TAUNT_ZOMBIE, true) + + self:SetCryTime(CurTime() + self.CryImpactDelay) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + self:SetNextSecondaryAttack(CurTime() + self.CryDelay) +end + +function SWEP:CheckCry() + if self:IsCrying() and CurTime() >= self:GetCryTime() then + self:SetCryTime(0) + + local owner = self:GetOwner() + local worldspace = owner:WorldSpaceCenter() + + util.ScreenShake(worldspace, 5, 5, 2, 400) + owner:EmitSound("physics/concrete/concrete_break2.wav", 77, 50) + + for k, ent in pairs(ents.FindInSphere(worldspace, 150)) do + if ent:IsValid() and ent:IsValidLivingHuman() and WorldVisible(ent:GetPos(), worldspace) then + if CurTime() >= (ent.NextKnockdown or 0) then + ent:KnockDown() + ent.NextKnockdown = CurTime() + 4 + end + end + end + end +end + +function SWEP:IsCrying() + return self:GetCryTime() > 0 end function SWEP:PlayAlertSound() - self.Owner:EmitSound("ambient/creatures/teddy.wav", 77, 45) + self:GetOwner():EmitSound("ambient/creatures/town_child_scream1.wav", 82, 60) + self:GetOwner():EmitSound("npc/stalker/go_alert2a.wav", 82, 45, 0.25) end function SWEP:PlayIdleSound() - self.Owner:EmitSound("ambient/creatures/teddy.wav", 77, 60) + self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 77, 60) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("ambient/creatures/teddy.wav", 77, 60) + self:EmitSound("ambient/creatures/teddy.wav", 77, 60) end function SWEP:PlayHitSound() - self.Owner:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 77, math.random(60, 70)) + self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 77, math.random(60, 70), nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 77, math.random(60, 70)) + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 77, math.random(60, 70), nil, CHAN_AUTO) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/cl_init.lua new file mode 100644 index 0000000..b44dc87 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function SWEP:PreDrawViewModel(vm) + render_SetBlend(0.55) + render_SetColorModulation(0.1, 0.1, 0.1) +end + +function SWEP:PostDrawViewModel(vm) + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/shared.lua new file mode 100644 index 0000000..e60b071 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gigashadowchild/shared.lua @@ -0,0 +1,105 @@ +SWEP.Base = "weapon_zs_gigagorechild" + +SWEP.PrintName = "Giga Shadow Child" + +SWEP.MeleeDamage = 24 +SWEP.MeleeForceScale = 1 + +function SWEP:PrimaryAttack() + if self:IsThrowing() then return end + + self.BaseClass.BaseClass.PrimaryAttack(self) +end + +function SWEP:Deploy() + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) + + return self.BaseClass.BaseClass.Deploy(self) +end + +local anims = {"fists_uppercut", "fists_right", "fists_left"} +function SWEP:StartSwinging() + self.BaseClass.BaseClass.StartSwinging(self) + + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence(anims[math.random(#anims)])) + vm:SetPlaybackRate(0.32) +end + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsValidPlayer() then + local vel = ent:GetPos() - self:GetOwner():GetPos() + vel.z = 0 + vel:Normalize() + vel = vel * 300 + vel.z = 150 + + if CurTime() >= (ent.NextKnockdown or 0) then + ent:KnockDown() + ent.NextKnockdown = CurTime() + 4 + end + ent:SetGroundEntity(NULL) + ent:SetVelocity(vel) + + if SERVER then + ent:GiveStatus("dimvision", 10) + end + end + + self.BaseClass.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end + +function SWEP:CheckThrow() + if self:GetThrowing() and CurTime() >= self:GetThrowTime() then + self:SetThrowTime(0) + + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + owner:EmitSound("weapons/slam/throw.wav", 70, math.random(78, 82)) + + if SERVER then + local ent = ents.Create("prop_thrownshadowbaby") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(AngleRand()) + ent:SetOwner(owner) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(owner:GetAimVector() * 650) + phys:AddAngleVelocity(VectorRand() * math.Rand(200, 300)) + + ent:SetPhysicsAttacker(owner) + end + end + end + end +end + +function SWEP:CheckCry() + if self:IsCrying() and CurTime() >= self:GetCryTime() then + self:SetCryTime(0) + + local owner = self:GetOwner() + local worldspace = owner:WorldSpaceCenter() + + util.ScreenShake(worldspace, 5, 5, 2, 400) + owner:EmitSound("physics/concrete/concrete_break2.wav", 77, 50) + + for k, ent in pairs(ents.FindInSphere(worldspace, 150)) do + if ent:IsValid() and ent:IsValidLivingHuman() and WorldVisible(ent:GetPos(), worldspace) then + if CurTime() >= (ent.NextKnockdown or 0) then + ent:KnockDown() + ent.NextKnockdown = CurTime() + 4 + if SERVER then + ent:GiveStatus("dimvision", 10) + end + end + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gladiator.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gladiator.lua new file mode 100644 index 0000000..1824dfb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gladiator.lua @@ -0,0 +1,77 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.PrintName = "'Gladiator' Super Shotgun" +SWEP.Description = "A pump super shotgun." + +if CLIENT then + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.M3_PARENT" + SWEP.HUD3DPos = Vector(-1.5, -5, -2) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 + + SWEP.VElements = { + ["fracture+++++++"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(0, 0, 0.25), angle = Angle(97.013, 0, 0), size = Vector(0.6, 0.4, 1.598), color = Color(77, 100, 135, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-1.5, 0, -1), angle = Angle(0, -90, -90), size = Vector(0.035, 0.029, 0.25), color = Color(69, 77, 94, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture++++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(4.675, 0, -0.201), angle = Angle(0, -90, 0), size = Vector(0.625, 0.625, 0.625), color = Color(70, 87, 104, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "v_weapon.M3_PARENT", rel = "", pos = Vector(0, -4.5, -10.91), angle = Angle(90, -90, 0), size = Vector(0.25, 0.039, 0.029), color = Color(69, 90, 123, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5.715, 0, -1.4), angle = Angle(180, -90, 0), size = Vector(0.025, 0.025, 0.045), color = Color(75, 100, 125, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+"] = { type = "Model", model = "models/props_c17/traffic_light001a.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5.715, 0, 0), angle = Angle(0, 0, 90), size = Vector(1.399, 0.1, 0.119), color = Color(75, 100, 125, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++++++"] = { type = "Model", model = "models/props_c17/trappropeller_lever.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(10.5, 0, -2), angle = Angle(0, -90, -33.896), size = Vector(1, 0.6, 1.2), color = Color(87, 109, 117, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(8, 0, -2.597), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(70, 87, 104, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["fracture+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-1.5, 0, -1), angle = Angle(0, -90, -90), size = Vector(0.035, 0.029, 0.25), color = Color(69, 77, 94, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture+"] = { type = "Model", model = "models/props_c17/traffic_light001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-5.715, 0, 0), angle = Angle(0, 0, 90), size = Vector(1.399, 0.1, 0.119), color = Color(75, 100, 125, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(16, 1, -4.301), angle = Angle(180, 0, 0), size = Vector(0.25, 0.039, 0.029), color = Color(69, 77, 94, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++++"] = { type = "Model", model = "models/props_c17/utilityconnecter003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(4.675, 0, -0.201), angle = Angle(0, -90, 0), size = Vector(0.625, 0.625, 0.625), color = Color(70, 87, 104, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(8, 0, -2.597), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(70, 87, 104, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["fracture+++++++"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(0, 0, 0.25), angle = Angle(97.013, 0, 0), size = Vector(0.6, 0.4, 1.598), color = Color(77, 100, 125, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++++++"] = { type = "Model", model = "models/props_c17/trappropeller_lever.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(10.5, 0, -2), angle = Angle(0, -90, -33.896), size = Vector(1, 0.6, 1.2), color = Color(87, 99, 107, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "fracture", pos = Vector(-5.715, 0, -1.4), angle = Angle(180, -90, 0), size = Vector(0.025, 0.025, 0.045), color = Color(75, 100, 125, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" +SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" +SWEP.UseHands = true + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.ReloadDelay = 0.3 + +SWEP.Primary.Sound = Sound(")weapons/zs_glad/gladshot4.wav") +SWEP.Primary.Damage = 14 +SWEP.Primary.NumShots = 16 +SWEP.Primary.Delay = 1.2 + +SWEP.RequiredClip = 2 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 8.5 +SWEP.ConeMin = 7.25 + +SWEP.FireAnimSpeed = 0.8 +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.Tier = 5 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -1.0625) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.90625) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 77, 100, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glassbottle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glassbottle.lua new file mode 100644 index 0000000..57224ff --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glassbottle.lua @@ -0,0 +1,67 @@ +AddCSLuaFile() + +SWEP.PrintName = "Glass Bottle" +SWEP.Description = "A glass bottle." + +if CLIENT then + SWEP.ViewModelFOV = 70 + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.799, 0.899, -7), angle = Angle(8.182, -12.858, 8.182), size = Vector(1.144, 1.144, 1.144), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.4, 1.557, -5.715), angle = Angle(0, 0, 0), size = Vector(1.274, 1.274, 1.274), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModelFlip = false +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/props_junk/glassbottle01a.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.MeleeDamage = 40 +SWEP.MeleeRange = 48 +SWEP.MeleeSize = 0.875 + +SWEP.WalkSpeed = SPEED_FASTEST + +SWEP.Primary.Delay = 0.85 +SWEP.SwingTime = 0 +SWEP.SwingHoldType = "grenade" + +SWEP.NoHitSoundFlesh = true + +SWEP.NoGlassWeapons = true + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav") +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/glass/glass_bottle_break2.wav") +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/glass/glass_bottle_break2.wav") +end + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() then + if SERVER then + local owner = self:GetOwner() + timer.Simple(0, function() + owner:StripWeapon(self:GetClass()) + end) + + owner:Give("weapon_zs_crackedbottle") + owner:SelectWeapon("weapon_zs_crackedbottle") + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glock3.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glock3.lua index 3f0808e..7883064 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glock3.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_glock3.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Crossfire' Glock 3" - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Crossfire' Glock 3" +SWEP.Description = "Fires 3 shots at once. Not very accurate, but very damaging up close." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFOV = 50 SWEP.ViewModelFlip = false @@ -22,7 +24,7 @@ SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_Glock.Single") -SWEP.Primary.Damage = 17 +SWEP.Primary.Damage = 15.5 SWEP.Primary.NumShots = 3 SWEP.Primary.Delay = 0.3 @@ -31,7 +33,66 @@ SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.14 -SWEP.ConeMin = 0.07 +SWEP.ConeMax = 4.5 +SWEP.ConeMin = 3 + +SWEP.Tier = 2 SWEP.IronSightsPos = Vector(-5.75, 10, 2.7) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.9, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.5, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Collider' Glock 3", "Fires 1 less but more accurate shots, higher base damage, and a chance to gain reaper stacks", function(wept) + wept.Primary.NumShots = 2 + wept.Primary.Damage = wept.Primary.Damage * 1.2 + wept.ConeMin = wept.ConeMin * 0.65 + wept.ConeMax = wept.ConeMax * 0.65 + + wept.BulletCallback = function(attacker, tr, dmginfo) + if SERVER and tr.Entity:IsValidLivingZombie() and math.random(20) == 1 then + local status = attacker:GiveStatus("reaper", 14) + if status and status:IsValid() then + status:SetDTInt(1, math.min(status:GetDTInt(1) + 1, 3)) + attacker:EmitSound("hl1/ambience/particle_suck1.wav", 55, 150 + status:GetDTInt(1) * 30, 0.45) + end + end + end +end) +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Shroud' SOCOM Mark 23", "Fires 1 shot, hides your aura, deals less total damage but is more accurate", function(wept) + wept.Primary.NumShots = 1 + wept.Primary.Damage = wept.Primary.Damage * 2.3 + wept.Primary.Delay = 0.2 + wept.ConeMin = wept.ConeMin * 0.3 + wept.ConeMax = wept.ConeMax * 0.4 + wept.Primary.Sound = Sound("weapons/usp/usp1.wav") + + wept.VElements = { + ["detail"] = { type = "Model", model = "models/Mechanics/wheels/wheel_extruded_48.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom2", pos = Vector(0, -1.64, 0), angle = Angle(0, 0, -90), size = Vector(0.014, 0.014, 0.014), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom2+"] = { type = "Model", model = "models/props_junk/gascan001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom2", pos = Vector(0, 0.889, 0.976), angle = Angle(0, 0, 0), size = Vector(0.15, 0.268, 0.029), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom2", pos = Vector(0.039, -2.02, -1.951), angle = Angle(-90, -90, 0), size = Vector(0.041, 0.041, 0.013), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["spikes"] = { type = "Model", model = "models/props_phx/gears/rack9.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(1.583, -0.04, -0.08), angle = Angle(102.149, -90, 0), size = Vector(0.072, 0.082, 0.063), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["silencer2"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom2", pos = Vector(0.039, -2.26, -1.951), angle = Angle(90, -90, 0), size = Vector(0.043, 0.043, 0.101), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["spikes+"] = { type = "Model", model = "models/props_phx/gears/rack9.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(5.008, -0.035, -0.08), angle = Angle(102.149, -90, 0), size = Vector(0.072, 0.082, 0.063), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["topmetal"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(3.078, 0.217, -0.029), angle = Angle(76.47, 90, 0), size = Vector(0.035, 0.219, 0.034), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom2"] = { type = "Model", model = "models/props_junk/gascan001a.mdl", bone = "v_weapon.Glock_Parent", rel = "", pos = Vector(-3.201, -2.156, 0.246), angle = Angle(102.806, 84.778, -11.667), size = Vector(0.133, 0.172, 0.068), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } + } + wept.WElements = { + ["detail"] = { type = "Model", model = "models/Mechanics/wheels/wheel_extruded_48.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0, -1.64, 0), angle = Angle(0, 0, -90), size = Vector(0.014, 0.014, 0.014), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom"] = { type = "Model", model = "models/mechanics/solid_steel/crossbeam_4.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.513, 1.929, -2.32), angle = Angle(40.83, -4.801, 90), size = Vector(0.009, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_citadel001", skin = 0, bodygroup = {} }, + ["spikes"] = { type = "Model", model = "models/props_phx/gears/rack9.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0.009, 0.732, -2.25), angle = Angle(180, 0, -1.56), size = Vector(0.072, 0.082, 0.063), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom2"] = { type = "Model", model = "models/props_junk/gascan001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom", pos = Vector(0.241, -0.242, 0), angle = Angle(90, -135, 0), size = Vector(0.133, 0.172, 0.083), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0, -2.29, -1.851), angle = Angle(-92, -90, 0), size = Vector(0.041, 0.041, 0.013), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["topmetal"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(-0.01, 2.589, -1.861), angle = Angle(0, -0.181, 1.6), size = Vector(0.037, 0.223, 0.034), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["silencer2"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0, -2.471, -1.841), angle = Angle(88, -90, 0), size = Vector(0.043, 0.043, 0.101), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom2+"] = { type = "Model", model = "models/props_junk/gascan001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0, 0.889, 1.049), angle = Angle(0, 0, 0), size = Vector(0.15, 0.268, 0.029), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["spikes+"] = { type = "Model", model = "models/props_phx/gears/rack9.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom2", pos = Vector(0.009, 4.179, -2.35), angle = Angle(180, 0, -1.56), size = Vector(0.072, 0.082, 0.063), color = Color(190, 190, 190, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } + } + + wept.GetAuraRange = function() + return 512 + end +end) +branch.Colors = {Color(170, 170, 170), Color(120, 120, 120), Color(70, 70, 70)} +branch.NewNames = {"Cloaked", "Covert", "Silent"} +branch.Killicon = "weapon_zs_shroud" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/cl_init.lua new file mode 100644 index 0000000..57ab5f4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/cl_init.lua @@ -0,0 +1,113 @@ +INC_CLIENT() + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 58 + +SWEP.HUD3DBone = "Base" +SWEP.HUD3DPos = Vector(3, -0.5, -13) +SWEP.HUD3DAng = Angle(180, 0, 0) +SWEP.HUD3DScale = 0.03 + +SWEP.VElements = { + ["egon_base++++++"] = { type = "Model", model = "models/props_phx/misc/iron_beam2.mdl", bone = "", rel = "egon_base", pos = Vector(1.5, -4, -2), angle = Angle(-17.532, 90, 0), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["egon_base+"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "", rel = "egon_base", pos = Vector(18.181, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.095, 0.095, 0.11), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "", rel = "egon_base", pos = Vector(-3.5, 5, 1), angle = Angle(90, -90, 0), size = Vector(0.05, 0.05, 0.14), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++++++++"] = { type = "Model", model = "models/props_combine/combine_interface001a.mdl", bone = "", rel = "egon_base", pos = Vector(-3, 4, 0.6), angle = Angle(70, 0, 0), size = Vector(0.15, 0.15, 0.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "", rel = "egon_base", pos = Vector(-10.91, 3.635, 1.557), angle = Angle(120, 0, 0), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "", rel = "egon_base", pos = Vector(4, 0, -1.601), angle = Angle(180, 90, 0), size = Vector(0.064, 0.064, 0.064), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "", rel = "egon_base", pos = Vector(-10.91, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.079, 0.079, 0.237), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "Base", rel = "", pos = Vector(0.699, 1, -7.792), angle = Angle(90, -90, 0), size = Vector(0.301, 0.1, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "", rel = "egon_base", pos = Vector(3.635, 0, 1.5), angle = Angle(0, 90, 0), size = Vector(0.064, 0.064, 0.064), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["egon_base++++++"] = { type = "Model", model = "models/props_phx/misc/iron_beam2.mdl", bone = "", rel = "egon_base", pos = Vector(1.5, -4, -2), angle = Angle(-17.532, 90, 0), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "", rel = "egon_base", pos = Vector(15.064, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.071, 0.071, 0.08), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "", rel = "egon_base", pos = Vector(-4.676, 0.5, -6), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.159), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "", rel = "egon_base", pos = Vector(4, 0, -1.601), angle = Angle(180, 90, 0), size = Vector(0.05, 0.05, 0.05), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.8, 1, -7), angle = Angle(0, 0, -170), size = Vector(0.17, 0.1, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++++++++"] = { type = "Model", model = "models/props_combine/combine_interface001a.mdl", bone = "", rel = "egon_base", pos = Vector(4.675, 5, 0.6), angle = Angle(70, 0, 0), size = Vector(0.15, 0.15, 0.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "", rel = "egon_base", pos = Vector(0.518, 5, 1), angle = Angle(90, -90, 0), size = Vector(0.039, 0.039, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "", rel = "egon_base", pos = Vector(-2.597, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.079, 0.079, 0.129), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base+++++++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "", rel = "egon_base", pos = Vector(-2, 5, 1.557), angle = Angle(120, 0, 0), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "", rel = "egon_base", pos = Vector(3.635, 0, 1.5), angle = Angle(0, 90, 0), size = Vector(0.05, 0.05, 0.05), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_L_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, -3), angle = Angle(0, 0, 0) }, + ["Base"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 3), angle = Angle(0, 0, 0) } +} + +local colBG = Color(16, 16, 16, 90) +local colRed = Color(220, 0, 0, 230) +local colWhite = Color(220, 220, 220, 230) + +local function DrawHeatBar(self, x, y, wid, hei, is3d) + local heatcolor = (1 - (self:GetShortHeat() + self:GetLongHeat())) * 220 + colWhite.g = heatcolor + colWhite.b = heatcolor + colWhite.a = 230 + + local barrelcol = self.VElements["egon_base+"].color + barrelcol.g = heatcolor + barrelcol.b = heatcolor + + local shortdiv = self:GetShortHeat() + local longdiv = self:GetLongHeat() + local barheight = 20 + local bary = y + hei * 0.6 + local barshortwid = math.max(wid * shortdiv - 8, 0) + local barlongwid = math.max(wid * longdiv - 8, 0) + + surface.SetDrawColor(0, 0, 0, 220) + surface.DrawRect(x, bary, wid - 8, barheight) + surface.SetDrawColor(255, 30, 10, 220) + surface.DrawRect(x + 4, bary + 4, barlongwid, barheight - 8) + surface.SetDrawColor(255, 190, 0, 220) + surface.DrawRect(x + 4 + barlongwid, bary + 4, barshortwid, barheight - 8) + surface.SetDrawColor(100, 0, 0, 255) + surface.DrawRect(x - 12 + wid, bary - 4, 4, barheight + 8) + + if self:GetGunState() == 2 then + colWhite.b = 0 + colWhite.g = 0 + if ((CurTime() * 4) % 2) > 1 then + colWhite.a = 0 + else + draw.SimpleTextBlurry("VENTING", is3d and "ZS3D2DFontSmaller" or "ZSHUDFontSmaller", x + wid/2, bary + hei * 0.15, colRed, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + end +end + +function SWEP:Draw2DHUD() + local screenscale = BetterScreenScale() + + local wid, hei = 180 * screenscale, 64 * screenscale + local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 + local spare = self:GetPrimaryAmmoCount() + + local yy = ScrH() - hei * 2 - screenscale * 84 + + DrawHeatBar(self, x + wid * 0.25 - wid/4, yy + hei * 0.2, wid, hei) + + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + draw.SimpleTextBlurry("Heat", "ZSHUDFont", x + wid * 0.5, yy + hei * 0.45, colRed, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) +end + +function SWEP:Draw3DHUD(vm, pos, ang) + local wid, hei = 180, 64 + local x, y = wid * -0.6, hei * -0.5 + local spare = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + DrawHeatBar(self, x + wid * 0.25 - wid/4, y - hei * 1, wid, hei, true) + + draw.RoundedBoxEx(32, x, y, wid, hei, colBG, true, false, true, false) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + draw.SimpleTextBlurry("Heat", "ZS3D2DFontSmall", x + wid * 0.5, y - hei * 1, colRed, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/shared.lua new file mode 100644 index 0000000..b5383eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gluon/shared.lua @@ -0,0 +1,282 @@ +SWEP.PrintName = "'Helios' Gluon Gun" +SWEP.Description = "Projects a stream of gluons at the target, causing immense damage. Hard to wield and aim, and builds up heat over time." + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "physgun" + +SWEP.ViewModel = "models/weapons/c_physcannon.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.Primary.Damage = 13.25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.09 +SWEP.Primary.KnockbackScale = 0.1 +SWEP.Primary.MaxDistance = 764 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "pulse" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.HeatBuildShort = 0.10 +SWEP.HeatBuildLong = 0.045 +SWEP.HeatVentShort = 0.16 +SWEP.HeatVentLong = 0.13 +SWEP.HeatDecayShort = 0.1 +SWEP.HeatDecayLong = 0.01 +SWEP.HeatInitialLong = 0.05 + +SWEP.WalkSpeed = SPEED_SLOWEST * 0.9 +SWEP.FireAnimSpeed = 0.24 +SWEP.FireSoundPitch = 125 + +SWEP.TracerName = "tracer_gluon" + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_SHORT_TEAM_HEAT, -0.01, 1) + +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Hades' Higgs Gun", "Has a pulse slowing effect but deals less damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 10.5/12.5 + wept.TracerName = "tracer_higgs" + wept.EmitStartFiringSound = function(self) + self:EmitSound("ambient/machines/teleport1.wav", 75, 210) + self:EmitSound("npc/combine_gunship/ping_patrol.wav", 75, 120, 1, CHAN_AUTO+20) + end + wept.FireSoundPitch = 96 + wept.LegDamage = true +end) +branch.Colors = {Color(160, 160, 160), Color(105, 105, 105), Color(50, 50, 50)} +branch.NewNames = {"Deep", "Null", "Void"} + +GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Tartarus' Muon Gun", "Deals more damage with heat, but can overheat and damage you, reduced range", function(wept) + wept.GluonDamage = function(self) + return wept.Primary.Damage + (self:GetShortHeat() * 0.25 * wept.Primary.Damage) + end + wept.TracerName = "tracer_muon" + wept.FireSoundPitch = 65 + wept.Overheat = true + wept.Primary.MaxDistance = 512 +end).Colors = {Color(150, 110, 180), Color(130, 90, 160), Color(110, 60, 150)} + +function SWEP:Initialize() + self.FiringSound = CreateSound(self, "^thrusters/rocket02.wav") + self.FiringSound:SetSoundLevel(85) + if CLIENT then self.VentingSound = CreateSound(self, "ambient/levels/labs/teleport_alarm_loop1.wav") end + + self.BaseClass.Initialize(self) +end + +function SWEP:Deploy() + local owner = self:GetOwner() + if not self.PostOwner then + self.PostOwner = owner + end + local timediff = owner.GluonInactiveTime and CurTime() - owner.GluonInactiveTime or 0 + self:SetShortHeat(math.Clamp((owner.ShortGluonHeat or 0) - timediff * self.HeatDecayShort, 0, 1)) + self:SetLongHeat(math.Clamp((owner.LongGluonHeat or 0) - timediff * self.HeatDecayLong, 0, 1)) + + if self:GetLongHeat() > 0.5 then + self:SetGunState(2) + self:EmitSound("npc/scanner/scanner_siren1.wav") + end + + return self.BaseClass.Deploy(self) +end + +function SWEP:Holster() + self:EndGluonState() + + return self.BaseClass.Holster(self) +end + +function SWEP:OnRemove() + self.BaseClass.OnRemove(self) + self:EndGluonState() +end + +function SWEP:EmitStartFiringSound() + self:EmitSound("ambient/machines/teleport1.wav", 75, 210) +end + +function SWEP:GluonDamage() + return self.Primary.Damage +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + + -- Move this to DT vars because predicted at high pings + local altuse = self:GetAltUsage() + if altuse then + self:TakeCombinedPrimaryAmmo(1) + end + self:SetAltUsage(not altuse) + + self:ShootBullets(self:GluonDamage(), self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + if self:GetGunState() ~= 1 then + if IsFirstTimePredicted() then + self:EmitStartFiringSound() + self:GetOwner():ViewPunch(Angle(math.Rand(-2, 2), math.Rand(-2, 2), math.Rand(-5, 5))) + end + + -- We prevent a bit of tapping fire by doing this. + self:SetLongHeat(math.min(self:GetLongHeat() + self.HeatInitialLong, 1)) + self:SetGunState(1) + end +end + +function SWEP:CanPrimaryAttack() + if self:GetPrimaryAmmoCount() <= 0 then + return false + end + + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + dmginfo:SetDamageType(DMG_DISSOLVE) + + if tr.HitWorld then + util.Decal("FadingScorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) + end + + if attacker:GetActiveWeapon().LegDamage then + local ent = tr.Entity + if ent:IsValidZombie() then + ent:AddLegDamageExt(4.5, attacker, attacker:GetActiveWeapon(), SLOWTYPE_PULSE) + end + end + + return {impact = false} +end + +function SWEP:Reload() + if self:GetGunState() == 0 and self:GetLongHeat() ~= 0 then + self:SetGunState(2) + self:EmitSound("npc/scanner/scanner_siren1.wav") + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:StopGluonSounds() + self.FiringSound:Stop() + if CLIENT then self.VentingSound:Stop() end +end + +function SWEP:EndGluonState() + local owner = self.PostOwner or self:GetOwner() + if owner:IsValid() then + owner.ShortGluonHeat = self:GetShortHeat() + owner.LongGluonHeat = self:GetLongHeat() + owner.GluonInactiveTime = CurTime() + owner.GunSway = false + end + + self:StopGluonSounds() +end + +function SWEP:SetGunState(state) + self:SetDTInt(1, state) +end + +function SWEP:GetGunState(state) + return self:GetDTInt(1) +end + +function SWEP:SetAltUsage(usage) + self:SetDTBool(1, usage) +end + +function SWEP:GetAltUsage() + return self:GetDTBool(1) +end + +function SWEP:SetShortHeat(heat) + self:SetDTFloat(8, heat) +end + +function SWEP:GetShortHeat() + return self:GetDTFloat(8) +end + +function SWEP:SetLongHeat(heat) + self:SetDTFloat(9, heat) +end + +function SWEP:GetLongHeat() + return self:GetDTFloat(9) +end + +function SWEP:ManageHeat() + local owner = self:GetOwner() + if owner and owner:IsValid() then + local frametime = FrameTime() + if self:GetGunState() == 1 then + self.FiringSound:PlayEx(1, self.FireSoundPitch + CurTime() % 1) + self:SetShortHeat(math.min(self:GetShortHeat() + frametime * self.HeatBuildShort, 1)) + self:SetLongHeat(math.min(self:GetLongHeat() + frametime * self.HeatBuildLong, 1)) + + if CLIENT then owner.GunSway = true end + elseif self:GetGunState() == 2 then + self.FiringSound:Stop() + if CLIENT then + owner.GunSway = false + self.VentingSound:PlayEx(1, 55 + CurTime() % 1) + end + + local frametimeadj = frametime * self:GetReloadSpeedMultiplier() + + self:SetShortHeat(math.max(self:GetShortHeat() - frametimeadj * self.HeatVentShort, 0)) + self:SetLongHeat(math.max(self:GetLongHeat() - frametimeadj * self.HeatVentLong, 0)) + self:SetNextPrimaryFire(CurTime() + 0.25) + + if self:GetLongHeat() == 0 and self:GetShortHeat() < self.HeatBuildShort then + self:SetGunState(0) + self:EmitSound("npc/scanner/combat_scan3.wav", 65, 90) + end + else + owner.GunSway = false + self:StopGluonSounds() + self:SetShortHeat(math.max(self:GetShortHeat() - frametime * self.HeatDecayShort, 0)) + self:SetLongHeat(math.max(self:GetLongHeat() - frametime * self.HeatDecayLong, 0)) + end + else + self:StopGluonSounds() + end +end + +function SWEP:Think() + self.BaseClass.Think(self) + + local overheat = self:GetShortHeat() + self:GetLongHeat() >= 1 + if self:GetGunState() == 1 and CurTime() >= self:GetNextPrimaryFire() + 0.1 or overheat then + self:SetGunState(overheat and 2 or 0) + self:SetNextPrimaryFire(CurTime() + 0.15) + + if overheat then + if self.Overheat then + self:GetOwner():TakeSpecialDamage(15, DMG_BURN, self:GetOwner(), self) + end + self:EmitSound("npc/scanner/scanner_siren1.wav", 75) + end + self:EmitSound("weapons/zs_gluon/egon_off1.wav", 75, 115, 0.9, CHAN_WEAPON + 20) + end + + self:ManageHeat() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gorechild.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gorechild.lua index 896085f..451d4b6 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gorechild.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gorechild.lua @@ -2,24 +2,45 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Gore Child" + +SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl" +SWEP.WorldModel = "" +SWEP.UseHands = true +SWEP.ViewModelFOV = 40 + SWEP.MeleeDelay = 0 SWEP.MeleeReach = 16 SWEP.MeleeDamage = 3 SWEP.MeleeForceScale = 0.025 -SWEP.MeleeSize = 0.5 +SWEP.MeleeSize = 1 --0.5 SWEP.MeleeDamageType = DMG_SLASH SWEP.Primary.Delay = 0.32 +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if ent:IsPlayer() then + local owner = self:GetOwner() + + if owner.Master and owner.Master:IsValidLivingZombie() then + owner.Master:AddLifeHumanDamage(damage) + end + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + function SWEP:Think() self.BaseClass.Think(self) - local curtime = CurTime() - local owner = self.Owner + if IsFirstTimePredicted() then + local curtime = CurTime() + local owner = self:GetOwner() - if self:GetSwinging() then - if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then - self:SetSwinging(false) - self.SwingStop = nil + if self:GetSwinging() then + if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then + self:SetSwinging(false) + self.SwingStop = nil + end end end @@ -28,15 +49,29 @@ function SWEP:Think() end function SWEP:Swung() + if not IsFirstTimePredicted() then return end + self.SwingStop = CurTime() + 0.5 if not self:GetSwinging() then self:SetSwinging(true) end + self.AltSwing = not self.AltSwing + + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence(self.AltSwing and "fists_left" or "fists_right")) + self.BaseClass.Swung(self) end +function SWEP:Deploy() + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) + + return self.BaseClass.Deploy(self) +end + function SWEP:Reload() self:SecondaryAttack() end @@ -46,22 +81,22 @@ function SWEP:IsMoaning() end function SWEP:PlayAlertSound() - self.Owner:EmitSound("ambient/creatures/teddy.wav", 65, 85) + self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65, 85) end function SWEP:PlayIdleSound() - self.Owner:EmitSound("ambient/creatures/teddy.wav", 65) + self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65) end function SWEP:PlayAttackSound() end function SWEP:PlayHitSound() - self.Owner:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 65, math.random(130, 140)) + self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 65, math.random(130, 140), nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 65, math.random(140, 150)) + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 65, math.random(140, 150), nil, CHAN_AUTO) end function SWEP:SetSwinging(swinging) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/cl_init.lua new file mode 100644 index 0000000..a02afa4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/cl_init.lua @@ -0,0 +1,81 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 80 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.VElements = { + ["eye+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-3.097, 1.175, 32.965), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["skull"] = { type = "Model", model = "models/Gibs/HGIBS.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-0.245, 1.638, 32.466), angle = Angle(0, -159.118, 0), size = Vector(0.85, 0.85, 0.85), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["eye"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-3.097, 1.175, 32.965), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["spade2"] = { type = "Model", model = "models/Gibs/HGIBS_scapula.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-1.019, -0.357, -22.178), angle = Angle(24.246, -107.839, 6.21), size = Vector(2.15, 2.15, 2.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["eye+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-2.108, 3.815, 32.942), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["spade"] = { type = "Model", model = "models/Gibs/HGIBS_scapula.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-1.538, 0.66, -21.781), angle = Angle(0, 59.147, 30.173), size = Vector(2.15, 2.15, 2.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["eye++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_Spine4", rel = "spine", pos = Vector(-2.108, 3.815, 32.942), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["spine"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.125, 1.445, -21.761), angle = Angle(6.393, -2.498, -3.169), size = Vector(0.899, 0.665, 3.928), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["eye+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-3.097, 1.175, 33.444), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["eye"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-3.097, 1.175, 33.444), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["skull"] = { type = "Model", model = "models/Gibs/HGIBS.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-0.245, 1.603, 32.875), angle = Angle(0, -159.118, 0), size = Vector(0.85, 0.85, 0.85), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["spade+"] = { type = "Model", model = "models/Gibs/HGIBS_scapula.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-1.019, -0.357, -25.78), angle = Angle(24.246, -107.839, 6.21), size = Vector(2.15, 2.15, 2.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["eye+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-2.108, 3.815, 33.444), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["spade"] = { type = "Model", model = "models/Gibs/HGIBS_scapula.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-1.538, 0.66, -26.781), angle = Angle(0, 59.147, 30.173), size = Vector(2.15, 2.15, 2.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["spine"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.831, 2.115, -21.778), angle = Angle(-2.964, 174.585, -0.41), size = Vector(0.899, 0.665, 4.128), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["eye++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "spine", pos = Vector(-2.108, 3.815, 33.444), size = { x = 2.072, y = 2.072 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false} +} + +-- Yes it is from the frotchet +function SWEP:PreDrawViewModel(vm) + self.BaseClass.PreDrawViewModel(self, vm) + + local charge = math.min(self:GetShovelCharge()/66, 1) + for mdl, tab in pairs(self.VElements) do + if tab.type == "Model" then + tab.color = Color(255, 255 - (168 * charge), 255 - (192 * charge), 255) + end + end +end + +function SWEP:DrawWorldModel() + self.BaseClass.DrawWorldModel(self) + + local charge = math.min(self:GetShovelCharge()/66, 1) + for mdl, tab in pairs(self.WElements) do + if tab.type == "Model" then + tab.color = Color(255, 255 - (168 * charge), 255 - (192 * charge), 255) + end + end + + local owner = self:GetOwner() + if math.random(66) <= charge*66 and math.random(6) == 1 and owner:IsValid() and not owner.ShadowMan then + local boneindex = owner:LookupBone("valvebiped.bip01_r_hand") + if boneindex then + local pos, ang = owner:GetBonePosition(boneindex) + if pos then + pos = pos + ang:Up() * -36 + + local curvel = owner:GetVelocity() * 0.5 + local emitter = ParticleEmitter(pos) + emitter:SetNearClip(24, 48) + local dir = curvel + VectorRand():GetNormalized() * (70 + charge*66) + + for i=1, math.min(16, math.ceil(FrameTime() * 200)) do + local particle = emitter:Add("sprites/light_glow02_add", pos) + particle:SetVelocity(dir) + particle:SetGravity(dir * -3) + particle:SetDieTime(0.5) + particle:SetStartAlpha(125) + particle:SetEndAlpha(0) + particle:SetStartSize(3) + particle:SetEndSize(0) + particle:SetColor(255, 30, 30) + particle:SetAirResistance(90) + end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/init.lua new file mode 100644 index 0000000..f85fe3d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/init.lua @@ -0,0 +1,31 @@ +INC_SERVER() + +SWEP.OriginalMeleeDamage = SWEP.MeleeDamage + +function SWEP:Deploy() + self:SetShovelCharge(self:GetOwner().GraveShovelDamage or 0) + + return self.BaseClass.Deploy(self) +end + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if self:GetOwner().GraveShovelDamage then + self.MeleeDamage = self.MeleeDamage + self:GetOwner().GraveShovelDamage + end +end + +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and hitent.Revive and hitent.Revive:IsValid() and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then + local killer = self:GetOwner() + + if killer:IsValid() then + killer.GraveShovelDamage = killer.GraveShovelDamage and killer.GraveShovelDamage + 5 or 5 + killer:EmitSound("hl1/ambience/particle_suck1.wav", 65, 250, 0.65) + end + + self:SetShovelCharge(killer.GraveShovelDamage or 0) + hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, self:GetOwner(), self, tr.HitPos) + end + + self.MeleeDamage = self.OriginalMeleeDamage +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/shared.lua new file mode 100644 index 0000000..ba580c8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/shared.lua @@ -0,0 +1,53 @@ +SWEP.PrintName = "Grave Shovel" +SWEP.Description = "The Grave Digger's shovel. Instantly kills knocked down zombies and permanently gains damage when doing so." + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee2" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 130 +SWEP.MeleeRange = 78 +SWEP.MeleeSize = 1.5 +SWEP.MeleeKnockBack = 220 + +SWEP.Primary.Delay = 1.2 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.SwingRotation = Angle(0, -90, -60) +SWEP.SwingOffset = Vector(0, 30, -40) +SWEP.SwingTime = 0.65 +SWEP.SwingHoldType = "melee" + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.12) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 70)) +end + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/shovel/shovel_hit-0"..math.random(4)..".ogg", 75, 80) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav") +end + +function SWEP:SetShovelCharge(charge) + self:SetDTInt(9, charge) +end + +function SWEP:GetShovelCharge() + return self:GetDTInt(9) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/cl_init.lua new file mode 100644 index 0000000..aa3a128 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/cl_init.lua @@ -0,0 +1,9 @@ +INC_CLIENT() + +function SWEP:PreDrawViewModel(vm) + self.BaseClass.BaseClass.PreDrawViewModel(self, vm) +end + +function SWEP:DrawWorldModel() + self.BaseClass.BaseClass.DrawWorldModel(self) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/init.lua new file mode 100644 index 0000000..e85ff91 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/init.lua @@ -0,0 +1,17 @@ +INC_SERVER() + +SWEP.OriginalMeleeDamage = SWEP.MeleeDamage + +function SWEP:Deploy() + self.BaseClass.BaseClass.Deploy(self) +end + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if not hitent:IsPlayer() then + self.MeleeDamage = 30 + end +end + +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + self.MeleeDamage = self.OriginalMeleeDamage +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/shared.lua new file mode 100644 index 0000000..0ccf067 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovelz/shared.lua @@ -0,0 +1,5 @@ +SWEP.Base = "weapon_zs_graveshovel" +SWEP.ZombieOnly = true + +SWEP.MeleeDamage = 40 +SWEP.MeleeKnockBack = 0 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/cl_init.lua index 546517c..57d06eb 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/cl_init.lua @@ -1,21 +1 @@ -include("shared.lua") - -SWEP.PrintName = "Grenade" -SWEP.Description = "A simple fragmentation grenade.\nWhen used in the right conditions, it can obliterate groups of zombies." - -SWEP.ViewModelFOV = 60 - -SWEP.Slot = 4 -SWEP.SlotPos = 0 - ---[[function SWEP:GetViewModelPosition(pos, ang) - if self:GetPrimaryAmmoCount() <= 0 then - return pos + ang:Forward() * -256, ang - end - - return pos, ang -end]] - -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) -end +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/init.lua index 25b35c2..3e20b96 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/init.lua @@ -1,4 +1 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/shared.lua index f2a12f6..fd6b9f9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_grenade/shared.lua @@ -1,111 +1,6 @@ -SWEP.ViewModel = "models/weapons/c_grenade.mdl" -SWEP.WorldModel = "models/weapons/w_grenade.mdl" -SWEP.UseHands = true +SWEP.PrintName = "Grenade" +SWEP.Description = "A simple fragmentation grenade.\nWhen used in the right conditions, it can obliterate groups of zombies.\nDeals explosive damage." -SWEP.AmmoIfHas = true +SWEP.Base = "weapon_zs_basethrown" -SWEP.Primary.ClipSize = 1 -SWEP.Primary.Automatic = false -SWEP.Primary.Ammo = "grenade" -SWEP.Primary.Delay = 1.25 -SWEP.Primary.DefaultClip = 1 - -SWEP.Secondary.ClipSize = 1 -SWEP.Secondary.DefaultClip = 1 -SWEP.Secondary.Ammo = "dummy" - -SWEP.WalkSpeed = SPEED_FAST - -function SWEP:Initialize() - self:SetWeaponHoldType("grenade") - self:SetDeploySpeed(1.1) -end - -function SWEP:Precache() - util.PrecacheSound("WeaponFrag.Throw") -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:GetPrimaryAmmoCount() <= 0 then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - return false - end - - return true -end - -function SWEP:PrimaryAttack() - if not self:CanPrimaryAttack() then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - - local owner = self.Owner - self:SendWeaponAnim(ACT_VM_THROW) - owner:DoAttackEvent() - - self:TakePrimaryAmmo(1) - self.NextDeploy = CurTime() + 1 - - if SERVER then - local ent = ents.Create("projectile_zsgrenade") - if ent:IsValid() then - ent:SetPos(owner:GetShootPos()) - ent:SetOwner(owner) - ent:Spawn() - ent.GrenadeDamage = self.GrenadeDamage - ent.GrenadeRadius = self.GrenadeRadius - ent:EmitSound("WeaponFrag.Throw") - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:AddAngleVelocity(VectorRand() * 5) - phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 800) - end - end - end -end - -function SWEP:SecondaryAttack() -end - -function SWEP:CanSecondaryAttack() - return false -end - -function SWEP:Reload() - return false -end - -function SWEP:Deploy() - GAMEMODE:WeaponDeployed(self.Owner, self) - - if self:GetPrimaryAmmoCount() <= 0 then - self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) - end - - return true -end - -function SWEP:Holster() - self.NextDeploy = nil - return true -end - -function SWEP:Think() - if self.NextDeploy and self.NextDeploy <= CurTime() then - self.NextDeploy = nil - - if 0 < self:GetPrimaryAmmoCount() then - self:SendWeaponAnim(ACT_VM_DRAW) - else - self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) - - if SERVER then - self:Remove() - end - end - elseif SERVER and self:GetPrimaryAmmoCount() <= 0 then - self:Remove() - end -end +SWEP.MaxStock = 8 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/cl_init.lua index a697473..8281358 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/cl_init.lua @@ -1,14 +1,12 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Gun Turret" -SWEP.Description = "This automated turret requires constant upkeep to be useful.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your SMG ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end @@ -25,15 +23,15 @@ SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end @@ -44,5 +42,5 @@ function SWEP:RotateGhost(amount) surface.PlaySound("npc/headcrab_poison/ph_step4.wav") nextclick = RealTime() + 0.3 end - RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua index fcbc872..d6af3b4 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -23,25 +20,25 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then - owner:GiveStatus("ghost_gunturret") + owner:GiveStatus(self.GhostStatus) end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then - owner:RemoveStatus("ghost_gunturret", false, true) + owner:RemoveStatus(self.GhostStatus, false, true) end end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() - local status = owner.status_ghost_gunturret + local status = owner:GetStatus(self.GhostStatus) if not (status and status:IsValid()) then return end status:RecalculateValidity() if not status:GetValidPlacement() then return end @@ -51,17 +48,18 @@ function SWEP:PrimaryAttack() self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) - local channel = GAMEMODE:GetFreeChannel("prop_gunturret") + local channel = GAMEMODE:GetFreeChannel(self.Channel) if channel == -1 then owner:SendLua("surface.PlaySound(\"buttons/button8.wav\")") owner:CenterNotify(COLOR_RED, translate.ClientGet(owner, "no_free_channel")) return end - local ent = ents.Create("prop_gunturret") + local ent = ents.Create(self.DeployClass) if ent:IsValid() then ent:SetPos(pos) ent:SetAngles(ang) + ent.PreOwn = owner ent:Spawn() ent:SetObjectOwner(owner) @@ -69,7 +67,7 @@ function SWEP:PrimaryAttack() ent:EmitSound("npc/dog/dog_servo12.wav") - ent:GhostAllPlayersInMe(5) + --ent:GhostAllPlayersInMe(5) self:TakePrimaryAmmo(1) @@ -78,13 +76,19 @@ function SWEP:PrimaryAttack() ent:SetObjectHealth(stored[1]) end - local ammo = math.min(owner:GetAmmoCount("smg1"), 250) + local ammo = math.min(owner:GetAmmoCount(self.TurretAmmoType), self.TurretAmmoStartAmount) ent:SetAmmo(ammo) - owner:RemoveAmmo(ammo, "smg1") + owner:RemoveAmmo(ammo, self.TurretAmmoType) + + ent.TurretDeployableAmmo = self.Primary.Ammo + ent.Damage = self.Primary.Damage + ent.Spread = self.TurretSpread + ent.SWEP = self:GetClass() if not owner:HasWeapon("weapon_zs_gunturretcontrol") then owner:Give("weapon_zs_gunturretcontrol") end + owner:SelectWeapon("weapon_zs_gunturretcontrol") if self:GetPrimaryAmmoCount() <= 0 then owner:StripWeapon(self:GetClass()) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/shared.lua index ecf038e..9f116df 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/shared.lua @@ -1,6 +1,9 @@ SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = "models/Combine_turrets/Floor_turret.mdl" +SWEP.PrintName = "Gun Turret" +SWEP.Description = "This automated turret requires constant upkeep to be useful.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it." + SWEP.AmmoIfHas = true SWEP.Primary.ClipSize = 1 @@ -8,19 +11,37 @@ SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "thumper" SWEP.Primary.Delay = 2 +SWEP.Primary.Damage = 8.8 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" +SWEP.MaxStock = 5 + SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOWEST +SWEP.GhostStatus = "ghost_gunturret" +SWEP.DeployClass = "prop_gunturret" +SWEP.Channel = "turret" + +SWEP.TurretAmmoType = "smg1" +SWEP.TurretAmmoStartAmount = 250 +SWEP.TurretSpread = 2 + +SWEP.NoDeploySpeedChange = true +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_TURRET_SPREAD, -0.4) + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() + + self.ResupplyAmmoType = self.TurretAmmoType end function SWEP:SetReplicatedAmmo(count) @@ -44,7 +65,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) @@ -64,13 +85,13 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_assault.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_assault.lua new file mode 100644 index 0000000..0fb3519 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_assault.lua @@ -0,0 +1,21 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_gunturret" + +SWEP.PrintName = "Assault Turret" +SWEP.Description = "A heavier turret that uses assault rifle ammo.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your buckshot ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it." + +SWEP.Primary.Damage = 22.5 + +SWEP.GhostStatus = "ghost_gunturret_assault" +SWEP.DeployClass = "prop_gunturret_assault" + +SWEP.TurretAmmoType = "ar2" +SWEP.TurretAmmoStartAmount = 100 +SWEP.TurretSpread = 2 + +SWEP.Tier = 4 + +SWEP.Primary.Ammo = "turret_assault" + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_TURRET_SPREAD, -0.5) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_buckshot.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_buckshot.lua new file mode 100644 index 0000000..404c7cf --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_buckshot.lua @@ -0,0 +1,18 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_gunturret" + +SWEP.PrintName = "Blast Turret" +SWEP.Description = "An automated turret that fires spread shots.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your buckshot ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it." + +SWEP.Primary.Damage = 6.75 + +SWEP.GhostStatus = "ghost_gunturret_buckshot" +SWEP.DeployClass = "prop_gunturret_buckshot" +SWEP.TurretAmmoType = "buckshot" +SWEP.TurretAmmoStartAmount = 25 +SWEP.TurretSpread = 5 + +SWEP.Primary.Ammo = "turret_buckshot" + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_TURRET_SPREAD, -0.9) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_rocket.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_rocket.lua new file mode 100644 index 0000000..6e1d67b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret_rocket.lua @@ -0,0 +1,20 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_gunturret" + +SWEP.PrintName = "Rocket Turret" +SWEP.Description = "An automated turret that fires explosive missiles.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your explosive ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it." + +SWEP.Primary.Damage = 104 + +SWEP.GhostStatus = "ghost_gunturret_rocket" +SWEP.DeployClass = "prop_gunturret_rocket" +SWEP.TurretAmmoType = "impactmine" +SWEP.TurretAmmoStartAmount = 12 +SWEP.TurretSpread = 1 + +SWEP.Primary.Ammo = "turret_rocket" + +SWEP.Tier = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_TURRET_SPREAD, -0.45) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturretcontrol.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturretcontrol.lua index 5afbe74..2278ce8 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturretcontrol.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturretcontrol.lua @@ -1,16 +1,15 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Gun Turret Controller" - SWEP.Description = "Allows the user to manually take control of any turrets they own." +SWEP.PrintName = "Gun Turret Controller" +SWEP.Description = "Allows the user to manually take control of any turrets they own." +SWEP.Slot = 4 +SWEP.SlotPos = 0 +if CLIENT then SWEP.ViewModelFOV = 50 SWEP.BobScale = 0.5 SWEP.SwayScale = 0.5 - - SWEP.Slot = 4 - SWEP.SlotPos = 0 end SWEP.ViewModel = "models/weapons/c_slam.mdl" @@ -39,6 +38,10 @@ SWEP.NoPickupNotification = true SWEP.HoldType = "slam" +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self:SetDeploySpeed(10) @@ -53,22 +56,22 @@ function SWEP:Think() if SERVER then self:ControlClosestTurret() - for _, ent in pairs(ents.FindByClass("prop_gunturret")) do - if ent:GetObjectOwner() == self.Owner then + for _, ent in pairs(ents.FindByClass("prop_gunturret*")) do + if ent:GetObjectOwner() == self:GetOwner() then return end end - self.Owner:StripWeapon(self:GetClass()) + self:GetOwner():StripWeapon(self:GetClass()) end end function SWEP:ControlClosestTurret() local closest, closestdist - local ownerpos = self.Owner:GetPos() - for _, ent in pairs(ents.FindByClass("prop_gunturret")) do - if ent:GetObjectOwner() == self.Owner then - local dist = ent:NearestPoint(ownerpos):Distance(ownerpos) + local ownerpos = self:GetOwner():GetPos() + for _, ent in pairs(ents.FindByClass("prop_gunturret*")) do + if ent:GetObjectOwner() == self:GetOwner() then + local dist = ent:NearestPoint(ownerpos):DistToSqr(ownerpos) if not closestdist or dist < closestdist then closest = ent closestdist = dist @@ -88,7 +91,7 @@ function SWEP:SecondaryAttack() self:SetDTBool(0, not self:GetDTBool(0)) if CLIENT then - LocalPlayer():EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) + MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) end end end @@ -104,9 +107,9 @@ end function SWEP:Reload() return false end - + function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -120,8 +123,17 @@ end function SWEP:Reload() end +function SWEP:GetResupplyAmmoType() + local turret = self:GetTurret() + if turret:IsValid() then + return turret.AmmoType + end + + return "smg1" +end + if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/cl_init.lua index 395cb15..a7a9173 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/cl_init.lua @@ -1,22 +1,19 @@ -include("shared.lua") - -SWEP.PrintName = "Carpenter's Hammer" -SWEP.Description = "A simple but extremely useful tool. Allows you to hammer in nails to make barricades.\nPress SECONDARY FIRE to hammer in nail. It will be attached to whatever is behind it.\nPress RELOAD to take a nail out.\nUse PRIMARY FIRE to bash zombie brains or to repair damaged nails.\nYou get a point bonus for repairing damaged nails but a point penalty for removing another player's nails." +INC_CLIENT() SWEP.ViewModelFOV = 75 function SWEP:DrawHUD() if GetGlobalBool("classicmode") then return end - surface.SetFont("ZSHUDFontSmall") - local text = translate.Get("right_click_to_hammer_nail") + local screenscale = BetterScreenScale() + + surface.SetFont("ZSHUDFont") local nails = self:GetPrimaryAmmoCount() + local text = translate.Format("nails_x", nails) local nTEXW, nTEXH = surface.GetTextSize(text) - draw.SimpleTextBlurry(translate.Format("nails_x", nails), "ZSHUDFontSmall", ScrW() - nTEXW * 0.5 - 24, ScrH() - nTEXH * 3, nails > 0 and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) + draw.SimpleTextBlurry(text, "ZSHUDFont", ScrW() - nTEXW * 0.75 - 32 * screenscale, ScrH() - nTEXH * 1.5, nails > 0 and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) - draw.SimpleTextBlurry(text, "ZSHUDFontSmall", ScrW() - nTEXW * 0.5 - 24, ScrH() - nTEXH * 2, COLOR_LIMEGREEN, TEXT_ALIGN_CENTER) - - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/init.lua index 08906f8..448601d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/init.lua @@ -1,15 +1,12 @@ -AddCSLuaFile("shared.lua") -AddCSLuaFile("cl_init.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Reload() if CurTime() < self:GetNextPrimaryFire() then return end - local owner = self.Owner + local owner = self:GetOwner() if owner:GetBarricadeGhosting() then return end - local tr = owner:MeleeTrace(self.MeleeRange, self.MeleeSize, owner:GetMeleeFilter()) + local tr = owner:CompensatedMeleeTrace(self.MeleeRange, self.MeleeSize) local trent = tr.Entity if not trent:IsValid() or not trent:IsNailed() then return end @@ -18,7 +15,7 @@ function SWEP:Reload() for _, e in pairs(ents.FindByClass("prop_nail")) do if not e.m_PryingOut and e:GetParent() == trent then - local edist = e:GetActualPos():Distance(tr.HitPos) + local edist = e:GetActualPos():DistToSqr(tr.HitPos) if not dist or edist < dist then ent = e dist = edist @@ -29,9 +26,9 @@ function SWEP:Reload() if not ent or not gamemode.Call("CanRemoveNail", owner, ent) then return end local nailowner = ent:GetOwner() - if nailowner:IsValid() and nailowner:IsPlayer() and nailowner ~= owner and nailowner:Team() == TEAM_HUMAN and not gamemode.Call("PlayerIsAdmin", owner) and not gamemode.Call("CanRemoveOthersNail", owner, nailowner, ent) then return end + if nailowner:IsValid() and nailowner:IsPlayer() and nailowner ~= owner and nailowner:Team() == TEAM_HUMAN and not gamemode.Call("CanRemoveOthersNail", owner, nailowner, ent) then return end - self:SetNextPrimaryFire(CurTime() + 1) + self:SetNextPrimaryFire(CurTime() + (#trent.Nails > 2 and 0.5 or 1)) ent.m_PryingOut = true -- Prevents infinite loops @@ -42,15 +39,16 @@ function SWEP:Reload() owner:EmitSound("weapons/melee/crowbar/crowbar_hit-"..math.random(4)..".ogg") - ent:GetParent():RemoveNail(ent, nil, self.Owner) + ent:GetParent():RemoveNail(ent, nil, self:GetOwner()) + ent:GetParent():SetPhysicsAttacker(self:GetOwner()) if nailowner and nailowner:IsValid() and nailowner:IsPlayer() and nailowner ~= owner and nailowner:Team() == TEAM_HUMAN then - if not gamemode.Call("PlayerIsAdmin", owner) and (nailowner:Frags() >= 75 or owner:Frags() < 75) then + if gamemode.Call("PlayerShouldTakeNailRemovalPenalty", owner, ent, nailowner, trent) then owner:GivePenalty(30) owner:ReflectDamage(20) end - if nailowner:NearestPoint(tr.HitPos):Distance(tr.HitPos) <= 768 and (nailowner:HasWeapon("weapon_zs_hammer") or nailowner:HasWeapon("weapon_zs_electrohammer")) then + if nailowner:NearestPoint(tr.HitPos):DistToSqr(tr.HitPos) <= 589824 and (nailowner:HasWeapon("weapon_zs_hammer") or nailowner:HasWeapon("weapon_zs_electrohammer")) then --768^2 nailowner:GiveAmmo(1, self.Primary.Ammo) else owner:GiveAmmo(1, self.Primary.Ammo) @@ -61,44 +59,51 @@ function SWEP:Reload() end function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() then - if hitent.HitByHammer and hitent:HitByHammer(self, self.Owner, tr) then - return + if not hitent:IsValid() then return end + + local owner = self:GetOwner() + + if hitent.HitByHammer and hitent:HitByHammer(self, owner, tr) then + return + end + + if hitent:IsNailed() then + if owner:IsSkillActive(SKILL_BARRICADEEXPERT) then + hitent.ReinforceEnd = CurTime() + 2 + hitent.ReinforceApplier = owner end - if hitent:IsNailed() then - local healstrength = GAMEMODE.NailHealthPerRepair * (self.Owner.HumanRepairMultiplier or 1) * self.HealStrength - local oldhealth = hitent:GetBarricadeHealth() - if oldhealth <= 0 or oldhealth >= hitent:GetMaxBarricadeHealth() or hitent:GetBarricadeRepairs() <= 0 then return end + local healstrength = self.HealStrength * GAMEMODE.NailHealthPerRepair * (owner.RepairRateMul or 1) + local oldhealth = hitent:GetBarricadeHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxBarricadeHealth() or hitent:GetBarricadeRepairs() <= 0.01 then return end - hitent:SetBarricadeHealth(math.min(hitent:GetMaxBarricadeHealth(), hitent:GetBarricadeHealth() + math.min(hitent:GetBarricadeRepairs(), healstrength))) - local healed = hitent:GetBarricadeHealth() - oldhealth - hitent:SetBarricadeRepairs(math.max(hitent:GetBarricadeRepairs() - healed, 0)) - self:PlayRepairSound(hitent) - gamemode.Call("PlayerRepairedObject", self.Owner, hitent, healed, self) + hitent:SetBarricadeHealth(math.min(hitent:GetMaxBarricadeHealth(), hitent:GetBarricadeHealth() + math.min(hitent:GetBarricadeRepairs(), healstrength))) + local healed = hitent:GetBarricadeHealth() - oldhealth + hitent:SetBarricadeRepairs(math.max(hitent:GetBarricadeRepairs() - healed, 0)) + self:PlayRepairSound(hitent) + gamemode.Call("PlayerRepairedObject", owner, hitent, healed, self) - local effectdata = EffectData() - effectdata:SetOrigin(tr.HitPos) - effectdata:SetNormal(tr.HitNormal) - effectdata:SetMagnitude(1) - util.Effect("nailrepaired", effectdata, true, true) + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetNormal(tr.HitNormal) + effectdata:SetMagnitude(1) + util.Effect("nailrepaired", effectdata, true, true) - return true - end + return true end end function SWEP:SecondaryAttack() - if self:GetPrimaryAmmoCount() <= 0 or CurTime() < self:GetNextPrimaryFire() or self.Owner:GetBarricadeGhosting() then return end + if self:GetPrimaryAmmoCount() <= 0 or CurTime() < self:GetNextPrimaryFire() or self:GetOwner():GetBarricadeGhosting() then return end - local owner = self.Owner + local owner = self:GetOwner() if GAMEMODE:IsClassicMode() then owner:PrintTranslatedMessage(HUD_PRINTCENTER, "cant_do_that_in_classic_mode") return end - local tr = owner:TraceLine(64, MASK_SOLID, owner:GetMeleeFilter()) + local tr = owner:CompensatedMeleeTrace(64, self.MeleeSize, nil, nil, nil, true) local trent = tr.Entity if not trent:IsValid() @@ -106,8 +111,10 @@ function SWEP:SecondaryAttack() or tr.Fraction == 0 or trent:GetMoveType() ~= MOVETYPE_VPHYSICS and not trent:GetNailFrozen() or trent.NoNails + or trent:IsProjectile() or trent:IsNailed() and (#trent.Nails >= 8 or trent:GetPropsInContraption() >= GAMEMODE.MaxPropsInBarricade) or trent:GetMaxHealth() == 1 and trent:Health() == 0 and not trent.TotalHealth + or trent.PreHoldCollisionGroup and (trent.PreHoldCollisionGroup == COLLISION_GROUP_DEBRIS or trent.PreHoldCollisionGroup == COLLISION_GROUP_DEBRIS_TRIGGER or trent.PreHoldCollisionGroup == COLLISION_GROUP_INTERACTIVE_DEBRIS) or not trent:IsNailed() and not trent:GetPhysicsObject():IsMoveable() then return end if not gamemode.Call("CanPlaceNail", owner, tr) then return end @@ -116,7 +123,7 @@ function SWEP:SecondaryAttack() for _, nail in pairs(trent:GetNails()) do if nail:GetDeployer() == owner then count = count + 1 - if count >= 3 then + if count >= GAMEMODE.MaxNails then return end end @@ -131,23 +138,27 @@ function SWEP:SecondaryAttack() return end - if trent:IsValid() then - for _, nail in pairs(ents.FindByClass("prop_nail")) do - if nail:GetParent() == trent and nail:GetActualPos():Distance(tr.HitPos) <= 16 then - owner:PrintTranslatedMessage(HUD_PRINTCENTER, "too_close_to_another_nail") - return - end - end - - if trent:GetBarricadeHealth() <= 0 and trent:GetMaxBarricadeHealth() > 0 then - owner:PrintTranslatedMessage(HUD_PRINTCENTER, "object_too_damaged_to_be_used") + for _, nail in pairs(ents.FindByClass("prop_nail")) do + if nail:GetParent() == trent and nail:GetActualPos():DistToSqr(tr.HitPos) <= 81 then + owner:PrintTranslatedMessage(HUD_PRINTCENTER, "too_close_to_another_nail") return end end - local aimvec = owner:GetAimVector() + if trent:GetBarricadeHealth() <= 0 and trent:GetMaxBarricadeHealth() > 0 then + owner:PrintTranslatedMessage(HUD_PRINTCENTER, "object_too_damaged_to_be_used") + return + end - local trtwo = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos + aimvec * 24, filter = {owner, trent}, mask = MASK_SOLID}) + -- Specical case for nailing things a drone is towing + local ropeconstraint = constraint.FindConstraint(trent, "Rope") + if ropeconstraint then + if ropeconstraint.Ent1 and ropeconstraint.Ent1:IsValid() and ropeconstraint.Ent1:GetClass() == "prop_drone" then return end + if ropeconstraint.Ent2 and ropeconstraint.Ent2:IsValid() and ropeconstraint.Ent2:GetClass() == "prop_drone" then return end + end + + local aimvec = owner:GetAimVector() + local trtwo = util.TraceLine({start = tr.HitPos, endpos = tr.HitPos + aimvec * 24, filter = table.Add({owner, trent}, GAMEMODE.CachedInvisibleEntities), mask = MASK_SOLID}) if trtwo.HitSky then return end @@ -163,7 +174,7 @@ function SWEP:SecondaryAttack() return end - if ent and ent:IsValid() and (ent.NoNails or ent:IsNailed() and (#ent.Nails >= 8 or ent:GetPropsInContraption() >= GAMEMODE.MaxPropsInBarricade)) then return end + if ent and ent:IsValid() and (ent:IsProjectile() or ent.NoNails or ent:IsNailed() and (#ent.Nails >= 8 or ent:GetPropsInContraption() >= GAMEMODE.MaxPropsInBarricade)) then return end if ent:GetBarricadeHealth() <= 0 and ent:GetMaxBarricadeHealth() > 0 then owner:PrintTranslatedMessage(HUD_PRINTCENTER, "object_too_damaged_to_be_used") @@ -192,8 +203,6 @@ function SWEP:SecondaryAttack() self:SetNextPrimaryFire(CurTime() + 1) self:TakePrimaryAmmo(1) - trent:EmitSound("weapons/melee/crowbar/crowbar_hit-"..math.random(4)..".ogg") - local nail = ents.Create("prop_nail") if nail:IsValid() then nail:SetActualOffset(tr.HitPos, trent) @@ -206,6 +215,8 @@ function SWEP:SecondaryAttack() cons:DeleteOnRemove(nail) gamemode.Call("OnNailCreated", trent, ent, nail) + + nail:EmitSound(string.format("weapons/melee/crowbar/crowbar_hit-%d.ogg", math.random(4))) end end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/shared.lua index c8b4dfb..ff8db93 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hammer/shared.lua @@ -1,11 +1,13 @@ -AddCSLuaFile("shared.lua") - SWEP.Base = "weapon_zs_basemelee" +SWEP.PrintName = "Carpenter's Hammer" +SWEP.Description = "A simple but extremely useful tool. Allows you to hammer in nails to make barricades.\nPress SECONDARY FIRE to hammer in nail. It will be attached to whatever is behind it.\nPress RELOAD to take a nail out.\nUse PRIMARY FIRE to bash zombie brains or to repair damaged nails.\nYou get a point bonus for repairing damaged nails but a point penalty for removing another player's nails." + SWEP.DamageType = DMG_CLUB -SWEP.ViewModel = "models/weapons/v_hammer/v_hammer.mdl" +SWEP.ViewModel = "models/weapons/v_hammer/c_hammer.mdl" SWEP.WorldModel = "models/weapons/w_hammer.mdl" +SWEP.UseHands = true SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = true @@ -17,10 +19,13 @@ SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Ammo = "dummy" -SWEP.MeleeDamage = 35 +--SWEP.MeleeDamage = 35 -- Reduced due to instant swing speed +SWEP.MeleeDamage = 15 SWEP.MeleeRange = 50 SWEP.MeleeSize = 0.875 +SWEP.MaxStock = 5 + SWEP.UseMelee1 = true SWEP.NoPropThrowing = true @@ -28,15 +33,23 @@ SWEP.NoPropThrowing = true SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE SWEP.MissGesture = SWEP.HitGesture -SWEP.SwingTime = 0.25 -SWEP.SwingRotation = Angle(30, -30, -30) -SWEP.SwingOffset = Vector(0, -30, 0) -SWEP.SwingHoldType = "grenade" - SWEP.HealStrength = 1 SWEP.NoHolsterOnCarry = true +SWEP.NoGlassWeapons = true + +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.04) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3, 1) + +function SWEP:SetNextAttack() + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * (owner.HammerSwingDelayMul or 1) * armdelay) +end + function SWEP:PlayHitSound() self:EmitSound("weapons/melee/crowbar/crowbar_hit-"..math.random(4)..".ogg", 75, math.random(110, 115)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon.lua new file mode 100644 index 0000000..0de57a7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon.lua @@ -0,0 +1,95 @@ +AddCSLuaFile() + +SWEP.PrintName = "Harpoon" +SWEP.Description = "The harpoon has a very long range for a melee weapon. The harpoon can be thrown to impale into zombies, dealing damage over time." + +if CLIENT then + SWEP.ViewModelFOV = 60 + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(0, 0, -40), angle = Angle(-90, 0, 0), size = Vector(0.899, 0.899, 0.899), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.2, 1.363, -18), angle = Angle(-90, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "knife" + +SWEP.DamageType = DMG_SLASH + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 45 +SWEP.MeleeRange = 94 +SWEP.MeleeSize = 0.8 + +SWEP.Primary.Delay = 1.65 + +SWEP.Tier = 2 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.SwingRotation = Angle(0, -90, -60) +SWEP.SwingOffset = Vector(0, 30, -40) +SWEP.SwingTime = 0.6 +SWEP.SwingHoldType = "slam" + +SWEP.HitAnim = ACT_VM_MISSCENTER + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.15, 1) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 70)) +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/metal/metal_sheet_impact_bullet"..math.random(2)..".wav", 70, math.random(90, 95)) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("weapons/knife/knife_hit"..math.random(4)..".wav", 80, math.random(80, 85)) +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() then return end + local owner = self:GetOwner() + local tr = owner:TraceLine(60) + if tr.HitWorld or (tr.Entity:IsValid() and not tr.Entity:IsPlayer()) then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:SendWeaponAnim(ACT_VM_MISSCENTER) + owner:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE) + + self.NextDeploy = CurTime() + 0.75 + + if SERVER then + local ent = ents.Create("projectile_harpoon") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(owner:EyeAngles()) + ent:SetOwner(owner) + ent.ProjDamage = self.MeleeDamage * (owner.ProjectileDamageMul or 1) + ent.BaseWeapon = self:GetClass() + ent:Spawn() + ent.Team = owner:Team() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 900 * (owner.ObjectThrowStrengthMul or 1)) + end + end + + owner:StripWeapon(self:GetClass()) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon_te.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon_te.lua new file mode 100644 index 0000000..060ec83 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon_te.lua @@ -0,0 +1,39 @@ +AddCSLuaFile() + +SWEP.PrintName = "Tethered Harpoon" + +SWEP.Base = "weapon_zs_harpoon" + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() then return end + local owner = self:GetOwner() + local tr = owner:TraceLine(60) + if tr.HitWorld or (tr.Entity:IsValid() and not tr.Entity:IsPlayer()) then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:SendWeaponAnim(ACT_VM_MISSCENTER) + owner:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE) + + self.NextDeploy = CurTime() + 0.75 + + if SERVER then + local ent = ents.Create("projectile_harpoon_te") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:SetAngles(owner:EyeAngles()) + ent:SetOwner(owner) + ent:SetPuller(owner) + ent.ProjDamage = self.MeleeDamage * 0.75 + ent.BaseWeapon = self:GetClass() + ent:Spawn() + ent.Team = owner:Team() + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 700 * (owner.ObjectThrowStrengthMul or 1)) + end + end + + owner:StripWeapon(self:GetClass()) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/cl_init.lua index 776041f..580035d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/cl_init.lua @@ -1,13 +1,13 @@ -include("shared.lua") +INC_CLIENT() SWEP.PrintName = "Headcrab" SWEP.DrawCrosshair = false function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/init.lua index 25b35c2..3e20b96 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/init.lua @@ -1,4 +1 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/shared.lua index 6befc68..c937aab 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_headcrab/shared.lua @@ -16,7 +16,7 @@ SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" -SWEP.PounceDamage = 7 +SWEP.PounceDamage = 8 SWEP.PounceDamageType = DMG_SLASH SWEP.NoHitRecovery = 0.75 @@ -31,7 +31,7 @@ end if SERVER then SWEP.NextHeal = 0 end function SWEP:Think() local curtime = CurTime() - local owner = self.Owner + local owner = self:GetOwner() if self:GetBurrowTime() > 0 and curtime >= self:GetBurrowTime() then if not self:CanBurrow() then @@ -41,6 +41,12 @@ function SWEP:Think() if SERVER and curtime >= self.NextHeal then self.NextHeal = curtime + 0.333 + if owner:GetVelocity():LengthSqr() > 8 then + local effectdata = EffectData() + effectdata:SetOrigin(owner:GetPos() % 2) + util.Effect("headcrab_dust", effectdata, true, true) + end + if owner:Health() < owner:GetMaxHealth() then owner:SetHealth(owner:Health() + 1) end @@ -49,19 +55,20 @@ function SWEP:Think() elseif self:GetBurrowTime() < 0 and curtime >= -self:GetBurrowTime() then self:SetBurrowTime(0) elseif self:GetPouncing() then + local delay = owner:GetMeleeSpeedMul() if owner:IsOnGround() or 1 < owner:WaterLevel() then self:SetPouncing(false) - self:SetNextPrimaryFire(curtime + self.NoHitRecovery) + self:SetNextPrimaryFire(curtime + self.NoHitRecovery * delay) else - owner:LagCompensation(true) + --owner:LagCompensation(true) local shootpos = owner:GetShootPos() - local trace = util.TraceHull({start = shootpos, endpos = shootpos + owner:GetForward() * 8, mins = owner:OBBMins() * 0.8, maxs = owner:OBBMaxs() * 0.8, filter = owner:GetMeleeFilter()}) + local trace = owner:CompensatedMeleeTrace(8, 12, shootpos, owner:GetForward()) local ent = trace.Entity if trace.Hit then self:SetPouncing(false) - self:SetNextPrimaryFire(curtime + self.HitRecovery) + self:SetNextPrimaryFire(curtime + self.HitRecovery * delay) end if ent:IsValid() then @@ -73,7 +80,6 @@ function SWEP:Think() local damage = self.PounceDamage - local phys = ent:GetPhysicsObject() if ent:IsPlayer() then ent:MeleeViewPunch(damage) if SERVER then @@ -82,9 +88,12 @@ function SWEP:Think() end owner:AirBrake() - elseif phys:IsValid() and phys:IsMoveable() then - phys:ApplyForceOffset(damage * 600 * owner:EyeAngles():Forward(), (ent:NearestPoint(shootpos) + ent:GetPos() * 2) / 3) - ent:SetPhysicsAttacker(owner) + else + local phys = ent:GetPhysicsObject() + if phys:IsValid() and phys:IsMoveable() then + phys:ApplyForceOffset(damage * 600 * owner:EyeAngles():Forward(), (ent:NearestPoint(shootpos) + ent:GetPos() * 2) / 3) + ent:SetPhysicsAttacker(owner) + end end ent:TakeSpecialDamage(damage, self.PounceDamageType, owner, self, trace.HitPos) @@ -96,7 +105,7 @@ function SWEP:Think() end end - owner:LagCompensation(false) + --owner:LagCompensation(false) end end @@ -105,7 +114,7 @@ function SWEP:Think() end function SWEP:PrimaryAttack() - local owner = self.Owner + local owner = self:GetOwner() if self:GetPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() or self:IsBurrowing() then return end local vel = owner:GetAimVector() @@ -135,25 +144,39 @@ function SWEP:SecondaryAttack() end function SWEP:Reload() - local owner = self.Owner + local owner = self:GetOwner() if self:GetPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() then return end if self:GetBurrowTime() == 0 then if self:CanBurrow() then - self:SetBurrowTime(CurTime() + self.BurrowTime) - if SERVER then owner:EmitSound("npc/antlion/digdown1.wav", 60, 100) end + self:BurrowDown() end elseif self:GetBurrowTime() > 0 and CurTime() >= self:GetBurrowTime() then - self:SetBurrowTime(-(CurTime() + self.BurrowTime)) - if SERVER then owner:EmitSound("npc/antlion/digup1.wav", 60, 100) end - owner:DrawShadow(true) + self:BurrowUp() end end +function SWEP:BurrowDown() + self:SetBurrowTime(CurTime() + self.BurrowTime) + if SERVER then self:GetOwner():EmitSound("npc/antlion/digdown1.wav", 60, 100, 0.5) end +end + +function SWEP:BurrowUp() + self:SetBurrowTime(-(CurTime() + self.BurrowTime)) + if SERVER then self:GetOwner():EmitSound("npc/antlion/digup1.wav", 60, 100, 0.5) end + self:GetOwner():DrawShadow(true) +end + +local traceGround = {mask = MASK_SOLID_BRUSHONLY} function SWEP:CanBurrow() - local owner = self.Owner - local tr = util.TraceLine({start = owner:GetPos(), endpos = owner:GetPos() - owner:GetUp() * 8, mask = MASK_SOLID_BRUSHONLY}) - return tr.HitWorld and (tr.MatType == MAT_DIRT or tr.MatType == MAT_SAND or tr.MatType == MAT_SLOSH or tr.MatType == MAT_FOILAGE or tr.MatType == 88) + local owner = self:GetOwner() + if not owner:IsOnGround() or owner:WaterLevel() >= 2 then return false end + + traceGround.start = owner:GetPos() % 4 + traceGround.endpos = traceGround.start + Vector(0, 0, -128) + local tr = util.TraceLine(traceGround) + + return tr.HitWorld and (tr.MatType == MAT_DIRT or tr.MatType == MAT_SAND or tr.MatType == MAT_SLOSH or tr.MatType == MAT_FOILAGE or tr.MatType == 88 or tr.HitTexture == "**displacement**") end function SWEP:Move(mv) @@ -172,24 +195,24 @@ function SWEP:Move(mv) end function SWEP:EmitHitSound() - self.Owner:EmitSound("npc/headcrab_poison/ph_wallhit"..math.random(1, 2)..".wav") + self:GetOwner():EmitSound(string.format("npc/headcrab_poison/ph_wallhit%d.wav", math.random(2))) end function SWEP:EmitBiteSound() - self.Owner:EmitSound("NPC_HeadCrab.Bite") + self:GetOwner():EmitSound("NPC_HeadCrab.Bite") end function SWEP:EmitIdleSound() - local ent = self.Owner:MeleeTrace(4096, 24, self.Owner:GetMeleeFilter()).Entity - if ent:IsValid() and ent:IsPlayer() then - self.Owner:EmitSound("NPC_HeadCrab.Alert") + local ent = self:GetOwner():CompensatedMeleeTrace(4096, 24).Entity + if ent:IsValidPlayer() then + self:GetOwner():EmitSound("NPC_HeadCrab.Alert") else - self.Owner:EmitSound("NPC_HeadCrab.Idle") + self:GetOwner():EmitSound("NPC_HeadCrab.Idle") end end function SWEP:EmitAttackSound() - self.Owner:EmitSound("NPC_HeadCrab.Attack") + self:GetOwner():EmitSound("NPC_HeadCrab.Attack") end function SWEP:SetPouncing(pouncing) @@ -206,13 +229,20 @@ end SWEP.IsPouncing = SWEP.GetPouncing function SWEP:SetBurrowTime(time) + local owner = self:GetOwner() + self:SetDTFloat(1, time) - if SERVER then + if owner:IsValid() then if time == 0 then - self.Owner:TemporaryNoCollide(true) + owner.NoCollideAll = nil + owner:CollisionRulesChanged() + if SERVER then + owner:TemporaryNoCollide(true) + end else - self.Owner:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) + owner.NoCollideAll = true + owner:CollisionRulesChanged() end end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/cl_init.lua new file mode 100644 index 0000000..386f986 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/cl_init.lua @@ -0,0 +1,67 @@ +INC_CLIENT() + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 57 + +SWEP.HUD3DBone = "Base" +SWEP.HUD3DPos = Vector(4, -1, -10) +SWEP.HUD3DAng = Angle(180, 0, 0) +SWEP.HUD3DScale = 0.03 + +SWEP.VElements = { + ["egon_base+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "Base", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.017, 0.017, 0.129), color = Color(196, 234, 244, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["egon_base++++++"] = { type = "Model", model = "models/props_phx/misc/iron_beam2.mdl", bone = "Base", rel = "egon_base", pos = Vector(1.5, -4, -2), angle = Angle(-17.532, 90, 0), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["egon_base+"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "Base", rel = "egon_base", pos = Vector(10, 0.2, 0), angle = Angle(90, 0, 0), size = Vector(0.07, 0.07, 0.17), color = Color(89, 100, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "Base", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.018, 0.018, 0.1), color = Color(9, 115, 0, 255), surpresslightning = false, material = "phoenix_storms/camera", skin = 1, bodygroup = {} }, + ["egon_base+++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "Base", rel = "egon_base", pos = Vector(7, 0, -3.1), angle = Angle(180, 90, 0), size = Vector(0.039, 0.079, 0.054), color = Color(142, 142, 142, 255), surpresslightning = false, material = "phoenix_storms/future_vents", skin = 0, bodygroup = {} }, + ["egon_base+++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "Base", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.025, 0.025, 0.059), color = Color(188, 196, 213, 255), surpresslightning = false, material = "phoenix_storms/metal_plate", skin = 0, bodygroup = {} }, + ["egon_base+++++"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "Base", rel = "egon_base", pos = Vector(-6.909, 0.2, 0), angle = Angle(90, 0, 0), size = Vector(0.07, 0.07, 0.2), color = Color(145, 152, 173, 255), surpresslightning = false, material = "phoenix_storms/cube", skin = 0, bodygroup = {} }, + ["egon_base"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "Base", rel = "", pos = Vector(0.699, 1, -7.792), angle = Angle(90, -90, 0), size = Vector(0.2, 0.1, 0.1), color = Color(87, 95, 110, 255), surpresslightning = false, material = "phoenix_storms/indenttiles_1-2", skin = 0, bodygroup = {} }, + ["egon_base++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "Base", rel = "egon_base", pos = Vector(7, 0, 2), angle = Angle(0, 90, 0), size = Vector(0.039, 0.079, 0.05), color = Color(142, 142, 142, 255), surpresslightning = false, material = "phoenix_storms/future_vents", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["egon_base+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.017, 0.017, 0.129), color = Color(196, 234, 244, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, + ["egon_base++++++"] = { type = "Model", model = "models/props_phx/misc/iron_beam2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(1.5, -4, -2), angle = Angle(-17.532, 90, 0), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["egon_base+"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(10, 0.2, 0), angle = Angle(90, 0, 0), size = Vector(0.07, 0.07, 0.17), color = Color(89, 100, 99, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["egon_base++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.018, 0.018, 0.1), color = Color(9, 115, 0, 255), surpresslightning = false, material = "phoenix_storms/camera", skin = 1, bodygroup = {} }, + ["egon_base+++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(7, 0, -3.1), angle = Angle(180, 90, 0), size = Vector(0.039, 0.079, 0.054), color = Color(142, 142, 142, 255), surpresslightning = false, material = "phoenix_storms/future_vents", skin = 0, bodygroup = {} }, + ["egon_base"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(9, 2, -5.6), angle = Angle(0, 0, -160), size = Vector(0.2, 0.1, 0.1), color = Color(87, 95, 110, 255), surpresslightning = false, material = "phoenix_storms/indenttiles_1-2", skin = 0, bodygroup = {} }, + ["egon_base+++++"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(-6.909, 0.2, 0), angle = Angle(90, 0, 0), size = Vector(0.07, 0.07, 0.2), color = Color(145, 152, 173, 255), surpresslightning = false, material = "phoenix_storms/cube", skin = 0, bodygroup = {} }, + ["egon_base+++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(1, 3, 4), angle = Angle(140, -90, 0), size = Vector(0.025, 0.025, 0.059), color = Color(188, 196, 213, 255), surpresslightning = false, material = "phoenix_storms/metal_plate", skin = 0, bodygroup = {} }, + ["egon_base++"] = { type = "Model", model = "models/props_c17/factorymachine01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "egon_base", pos = Vector(7, 0, 2), angle = Angle(0, 90, 0), size = Vector(0.039, 0.079, 0.05), color = Color(142, 142, 142, 255), surpresslightning = false, material = "phoenix_storms/future_vents", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_L_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, -3), angle = Angle(0, 0, 0) }, + ["Base"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 3), angle = Angle(0, 0, 0) } +} + +local colBG = Color(16, 16, 16, 90) +local colRed = Color(220, 0, 0, 230) +local colWhite = Color(220, 220, 220, 230) + +function SWEP:Draw2DHUD() + local screenscale = BetterScreenScale() + + local wid, hei = 180 * screenscale, 64 * screenscale + local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 + local spare = self:GetPrimaryAmmoCount() + + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) +end + +function SWEP:Draw3DHUD(vm, pos, ang) + local wid, hei = 180, 64 + local x, y = wid * -0.6, hei * -0.5 + local spare = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + draw.RoundedBoxEx(32, x, y, wid, hei, colBG, true, false, true, false) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/shared.lua new file mode 100644 index 0000000..625b7a5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_healingray/shared.lua @@ -0,0 +1,130 @@ +SWEP.PrintName = "'Rejuvenator' Healing Ray" +SWEP.Description = "Locks on to humans and heals them to full, discharging medical ammo along a ray." + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "physgun" + +SWEP.ViewModel = "models/weapons/c_physcannon.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.Primary.Delay = 0.1 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "Battery" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.HealRange = 300 +SWEP.Heal = 3 + +SWEP.WalkSpeed = SPEED_SLOWER +SWEP.FireAnimSpeed = 0.24 + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_HEALRANGE, 100, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEALING, 0.3) + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + self.ChargeSound = CreateSound(self, "items/medcharge4.wav") +end + +function SWEP:Holster() + self.ChargeSound:Stop() + + return self.BaseClass.Holster(self) +end + +function SWEP:OnRemove() + self.ChargeSound:Stop() +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local trtbl = owner:CompensatedPenetratingMeleeTrace(self.HealRange, 2, nil, nil, true) + local ent + for _, tr in pairs(trtbl) do + local test = tr.Entity + if test and test:IsValidLivingHuman() and gamemode.Call("PlayerCanBeHealed", test) then + ent = test + + break + end + end + + if not ent or self:GetDTEntity(10):IsValid() then return end + + self:SetDTEntity(10, ent) + self:SetNextPrimaryFire(CurTime() + 1) + self:EmitSound("items/medshot4.wav", 75, 80) +end + +function SWEP:CanPrimaryAttack() + if self:GetPrimaryAmmoCount() <= 0 then + return false + end + + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetDTEntity(10):IsValid() then return false end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:Reload() +end + +function SWEP:Think() + self.BaseClass.Think(self) + + self:CheckHealRay() +end + +function SWEP:StopHealing() + self:SetDTEntity(10, NULL) + self:SetNextPrimaryFire(CurTime() + 0.75) + self:EmitSound("items/medshotno1.wav", 75, 60) + self.ChargeSound:Stop() +end + +function SWEP:TakeAmmo() + self:TakeCombinedPrimaryAmmo(2) +end + +function SWEP:CheckHealRay() + local ent = self:GetDTEntity(10) + local owner = self:GetOwner() + + if ent:IsValidLivingHuman() and gamemode.Call("PlayerCanBeHealed", ent) and owner:KeyDown(IN_ATTACK) and + ent:WorldSpaceCenter():DistToSqr(owner:WorldSpaceCenter()) <= self.HealRange * self.HealRange and self:GetCombinedPrimaryAmmo() > 0 then + + if CurTime() > self:GetDTFloat(10) then + owner:HealPlayer(ent, math.min(self:GetCombinedPrimaryAmmo(), self.Heal)) + self:TakeAmmo() + self:SetDTFloat(10, CurTime() + 0.36) + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + + local effectdata = EffectData() + effectdata:SetOrigin(ent:WorldSpaceCenter()) + effectdata:SetFlags(3) + effectdata:SetEntity(self) + effectdata:SetAttachment(1) + util.Effect("tracer_healray", effectdata) + end + + self.ChargeSound:PlayEx(1, 70) + elseif ent:IsValid() then + self:StopHealing() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/cl_init.lua new file mode 100644 index 0000000..def5da5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/cl_init.lua @@ -0,0 +1,114 @@ +INC_CLIENT() + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 68 + +SWEP.HUD3DBone = "ValveBiped.Gun" +SWEP.HUD3DPos = Vector(-1, -2, -6.15) +SWEP.HUD3DScale = 0.03 + +SWEP.LastVel = 0 + +SWEP.VElements = { + ["spinners"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "backwheel", pos = Vector(-0.791, -1.3, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["backwheel"] = { type = "Model", model = "models/mechanics/wheels/wheel_speed_72.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back2", pos = Vector(-0.371, 0, 2.788), angle = Angle(90, -90, 90), size = Vector(0.05, 0.05, 0.05), color = Color(100, 100, 100, 0), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["back3"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-17.06, 0, 0.769), angle = Angle(180, 0, 0), size = Vector(0.035, 0.059, 0.07), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["frontrail"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(1.121, 0.381, -2.737), angle = Angle(-60, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/props_c17/lamp_standard_off01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-6.378, 0, -0.244), angle = Angle(90, 0, 0), size = Vector(0.243, 0.243, 0.155), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spinners+"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "backwheel", pos = Vector(1.44, 0, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["Front2"] = { type = "Model", model = "models/XQM/deg180single.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-1.657, 0, 2.569), angle = Angle(0, 0, 0), size = Vector(0.229, 0.09, 0.109), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["frontrail+"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(1.121, -0.415, -2.737), angle = Angle(60, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["Front5"] = { type = "Model", model = "models/props_phx/trains/double_wheels_base.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-4.953, 0, -2.777), angle = Angle(180, 0, 0), size = Vector(0.026, 0.027, 0.016), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["backwheel_appearence"] = { type = "Model", model = "models/props_c17/playgroundTick-tack-toe_block01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "backwheel", pos = Vector(0.4, 0, 0), angle = Angle(0, 90, -90), size = Vector(0.2, 0.043, 0.2), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["FRONT3_metal"] = { type = "Model", model = "models/mechanics/solid_steel/type_b_2_2.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front3", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.159, 0.239, 0.239), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spinners++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "backwheel", pos = Vector(-0.791, 1.299, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["Front3"] = { type = "Model", model = "models/XQM/cylinderx1big.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-4.345, 0, -0.051), angle = Angle(0, 0, 0), size = Vector(0.123, 0.079, 0.079), color = Color(100, 50, 0, 255), surpresslightning = false, material = "phoenix_storms/wood_dome", skin = 0, bodygroup = {} }, + ["frontrail+++"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(3.124, 0.381, 1.192), angle = Angle(-122, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["Front4"] = { type = "Model", model = "models/hunter/triangles/05x05x05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-3.924, 0, -2.901), angle = Angle(180, -90, 0), size = Vector(0.115, 0.231, 0.039), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["BACK_detail"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back2", pos = Vector(-2.36, 0, -0.25), angle = Angle(0, 0, 0), size = Vector(0.246, 0.28, 0.119), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["Front"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Gun", rel = "", pos = Vector(-0.849, 1.128, 1.047), angle = Angle(90, 0, 90), size = Vector(0.035, 0.134, 0.119), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["back2"] = { type = "Model", model = "models/mechanics/articulating/arm_base_b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(-15.551, 0, -2.181), angle = Angle(180, 0, 180), size = Vector(0.219, 0.104, 0.125), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["frontrail++"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "Front", pos = Vector(3.124, -0.415, 1.192), angle = Angle(122, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["front2_metaledges"] = { type = "Model", model = "models/mechanics/solid_steel/type_b_2_2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT2+", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.159, 0.239, 0.239), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["FRONT3"] = { type = "Model", model = "models/hunter/triangles/05x05x05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-3.924, 0, -2.901), angle = Angle(180, -90, 0), size = Vector(0.115, 0.231, 0.039), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["chamber1"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "backwheelturner", pos = Vector(-0.791, -1.3, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["FRONT2+"] = { type = "Model", model = "models/XQM/cylinderx1big.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-4.345, 0, -0.051), angle = Angle(0, 0, 0), size = Vector(0.123, 0.079, 0.079), color = Color(100, 50, 0, 255), surpresslightning = false, material = "phoenix_storms/wood_dome", skin = 0, bodygroup = {} }, + ["FRONT2"] = { type = "Model", model = "models/XQM/deg180single.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-1.657, 0, 2.569), angle = Angle(0, 0, 0), size = Vector(0.229, 0.09, 0.109), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["railing1+"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(1.121, 0.381, -2.737), angle = Angle(-60, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["railing1+++"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(3.124, -0.415, 1.192), angle = Angle(122, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["chamber1++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "backwheelturner", pos = Vector(-0.791, 1.299, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["chamber1+"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "backwheelturner", pos = Vector(1.44, 0, 2.95), angle = Angle(180, 0, -90), size = Vector(0.349, 1.25, 0.349), color = Color(115, 60, 0, 255), surpresslightning = false, material = "phoenix_storms/simplymetallic2", skin = 0, bodygroup = {} }, + ["backtopdetail"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back2", pos = Vector(-2.36, 0, -0.25), angle = Angle(0, 0, 0), size = Vector(0.246, 0.28, 0.119), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["backwheelturner"] = { type = "Model", model = "models/mechanics/wheels/wheel_speed_72.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back2", pos = Vector(-0.371, 0, 2.788), angle = Angle(90, -90, 90), size = Vector(0.05, 0.05, 0.05), color = Color(100, 100, 100, 0), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/props_c17/lamp_standard_off01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-6.378, 0, -0.232), angle = Angle(90, 0, 0), size = Vector(0.243, 0.243, 0.155), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["BACKturner_appearence"] = { type = "Model", model = "models/props_c17/playgroundTick-tack-toe_block01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "backwheelturner", pos = Vector(0.4, 0, 0.079), angle = Angle(0, 90, -90), size = Vector(0.2, 0.043, 0.2), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["railing1++++"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(3.124, 0.381, 1.192), angle = Angle(-122, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["railing1++"] = { type = "Model", model = "models/props_lab/pipesystem02e.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(1.121, -0.415, -2.737), angle = Angle(60, 90, -90), size = Vector(0.272, 0.189, 0.419), color = Color(200, 115, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["topfront"] = { type = "Model", model = "models/props_phx/trains/double_wheels_base.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-4.953, 0, -2.777), angle = Angle(180, 0, 0), size = Vector(0.026, 0.027, 0.016), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["BACK3"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-17.06, 0, 0.769), angle = Angle(180, 0, 0), size = Vector(0.035, 0.059, 0.07), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["back2"] = { type = "Model", model = "models/mechanics/articulating/arm_base_b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "FRONT", pos = Vector(-15.551, 0, -2.181), angle = Angle(180, 0, 180), size = Vector(0.219, 0.104, 0.125), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["FRONT"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(20.058, 2.303, -6.487), angle = Angle(-13.343, -3.133, 0), size = Vector(0.035, 0.134, 0.119), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } +} + +function SWEP:Think() + self:CheckCharge() +end +--[[ +function SWEP:GetTracerOrigin() + local owner = self:GetOwner() + local vm = owner:GetViewModel() + + if not (vm and vm:IsValid()) or owner:ShouldDrawLocalPlayer() then + local shootpos = owner:GetShootPos() + shootpos.z = shootpos.z - 20 + shootpos = shootpos + owner:GetAimVector() * 30 + + return shootpos + end + + local attach + attach = vm:GetAttachment(vm:LookupAttachment("muzzle")) + + local muzzlepos, muzzleang = attach.Pos, attach.Ang + muzzlepos = muzzlepos + muzzleang:Forward() * -2 + muzzleang:Right() * 8 + muzzleang:Up() * 9 + + return muzzlepos +end]] + +local colBG = Color(16, 16, 16, 90) +local colRed = Color(220, 0, 0, 230) +local colWhite = Color(220, 220, 220, 230) + +function SWEP:Draw2DHUD() + local screenscale = BetterScreenScale() + + local wid, hei = 180 * screenscale, 64 * screenscale + local x, y = ScrW() - wid - screenscale * 128, ScrH() - hei - screenscale * 72 + local spare = self:GetPrimaryAmmoCount() + + draw.RoundedBox(16, x, y, wid, hei, colBG) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZSHUDFont" or "ZSHUDFontBig", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + + local rotators = self.VElements["backwheel"].angle + local vel = Lerp(0.03, self.LastVel, self:GetGunCharge() * FrameTime() * 130) + rotators.p = rotators.p + vel + + self.LastVel = vel +end + +function SWEP:Draw3DHUD(vm, pos, ang) + local wid, hei = 180, 64 + local x, y = wid * -0.6, hei * -0.5 + local spare = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + draw.RoundedBoxEx(32, x, y, wid, hei, colBG, true, false, true, false) + draw.SimpleTextBlurry(spare, spare >= 1000 and "ZS3D2DFontSmall" or "ZS3D2DFont", x + wid * 0.5, y + hei * 0.5, spare == 0 and colRed or colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/init.lua new file mode 100644 index 0000000..dec975e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/init.lua @@ -0,0 +1,10 @@ +INC_SERVER() + +function SWEP:Think() + self:CheckCharge() + + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/shared.lua new file mode 100644 index 0000000..2bc20bc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hephaestus/shared.lua @@ -0,0 +1,167 @@ +SWEP.PrintName = "'Hephaestus' Tau Cannon" +SWEP.Description = "Also known as the Gauss Gun. Launches tau projectiles at incredibly high speeds." + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/gauss/fire1.wav") +SWEP.Primary.Damage = 26.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.2 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 30 + +SWEP.ConeMax = 3 +SWEP.ConeMin = 1.5 + +SWEP.HeadshotMulti = 1.5 + +SWEP.ChargeDelay = 0.12 + +SWEP.Tier = 5 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.01) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Prometheus' Tau Cannon", "Bounces at low angles, three weaker shots, charges faster, increased fire delay", function(wept) + wept.Primary.Delay = wept.Primary.Delay * 1.4 + wept.Primary.Damage = wept.Primary.Damage * 1.2/3 + wept.Primary.NumShots = 3 + + wept.ChargeDelay = 0.08 + + local function DoRicochet(attacker, hitpos, hitnormal, normal, damage) + attacker.RicochetBullet = true + if attacker:IsValid() then + attacker:FireBulletsLua(hitpos, 2 * hitnormal * hitnormal:Dot(normal * -1) + normal, 0, 1, damage, nil, nil, "tracer_heph_alt", nil, nil, nil, nil, nil, attacker:GetActiveWeapon()) + end + attacker.RicochetBullet = nil + end + wept.BulletCallback = function(attacker, tr, dmginfo) + if SERVER and tr.HitWorld and not tr.HitSky and tr.HitNormal:Dot(tr.Normal) > -0.2 then + local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() * 1.2 + timer.Simple(0, function() DoRicochet(attacker, hitpos, hitnormal, normal, dmg) end) + end + + return {impact = false} + end +end) + +SWEP.WalkSpeed = SPEED_SLOW +SWEP.FireAnimSpeed = 1 + +SWEP.TracerName = "tracer_heph" + +function SWEP:TakeAmmo() + self:TakeCombinedPrimaryAmmo(1) + + if CLIENT then + self.LastVel = 7 + end +end + +function SWEP:Reload() +end + +function SWEP:Initialize() + self.BaseClass.Initialize(self) + + self.ChargeSound = CreateSound(self, "weapons/gauss/chargeloop.wav") +end + +function SWEP:CanPrimaryAttack() + if self:GetPrimaryAmmoCount() <= 0 then + return false + end + + if self:GetCharging() or self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() or self:GetCharging() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:SetLastChargeTime(CurTime()) + self:TakeAmmo() + self:SetCharging(true) +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + return {impact = false} +end + +function SWEP:CheckCharge() + if self:GetCharging() then + local owner = self:GetOwner() + if not owner:KeyDown(IN_ATTACK2) then + self:EmitFireSound() + + self.FireAnimSpeed = 0.3 + self:ShootBullets(self.Primary.Damage * self:GetGunCharge(), self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + self.FireAnimSpeed = 1 + + owner:SetGroundEntity(NULL) + owner:SetVelocity(-34 * self:GetGunCharge() * owner:GetAimVector()) + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * 4) + self:SetCharging(false) + self:SetLastChargeTime(CurTime()) + self:SetGunCharge(0) + elseif self:GetGunCharge() < 13 and self:GetPrimaryAmmoCount() ~= 0 and self:GetLastChargeTime() + self.ChargeDelay < CurTime() then + self:SetGunCharge(self:GetGunCharge() + 1) + self:SetLastChargeTime(CurTime()) + self:TakeAmmo() + end + + self.ChargeSound:PlayEx(1, math.min(255, 47 + self:GetGunCharge() * 16)) + else + self.ChargeSound:Stop() + end +end + +function SWEP:SetLastChargeTime(lct) + self:SetDTFloat(8, lct) +end + +function SWEP:GetLastChargeTime() + return self:GetDTFloat(8) +end + +function SWEP:SetGunCharge(charge) + self:SetDTInt(1, charge) +end + +function SWEP:GetGunCharge(charge) + return self:GetDTInt(1) +end + +function SWEP:SetCharging(charge) + self:SetDTBool(1, charge) +end + +function SWEP:GetCharging() + return self:GetDTBool(1) +end + +function SWEP:EmitFireSound() + local deduct = self:GetCharging() and 100 - self:GetGunCharge() or 100 + local owner = self:GetOwner() + + self:EmitSound("weapons/gauss/fire1.wav", 75, deduct, 0.9) + timer.Simple(0.2, function() + if self:IsValid() and owner:IsValid() and not owner:KeyDown(IN_ATTACK) then + self:EmitSound("weapons/zs_heph/electro"..math.random(4,6)..".wav", 75, deduct, 0.75, CHAN_WEAPON + 20) + end + end) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hook.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hook.lua index cef6921..3a04891 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hook.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hook.lua @@ -1,8 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Meat Hook" +SWEP.PrintName = "Meat Hook" +SWEP.Description = "Impales itself into zombies, dealing damage over time for a seconds. The hook can be recollected by the owner." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -36,6 +37,17 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingTime = 0.75 SWEP.SwingHoldType = "grenade" +SWEP.NoGlassWeapons = true + +SWEP.AllowQualityWeapons = true +SWEP.Weaken = false + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_IMPACT_DELAY, -0.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Meat Grapple", "Deals less damage but zombies affected by it take more damage from any source", function(wept) + wept.Weaken = true + wept.MeleeDamage = wept.MeleeDamage * 0.65 +end) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(95, 105)) end @@ -49,36 +61,23 @@ function SWEP:PlayHitSound() end function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() and hitent:IsPlayer() and hitent:Health() > self.MeleeDamage then - hitent:AddLegDamage(30) + if SERVER and hitent:IsValid() and hitent:IsPlayer() and hitent:Health() > self.MeleeDamage and not hitent.SpawnProtection then + local ang = self:GetOwner():EyeAngles() + ang:RotateAroundAxis(ang:Forward(), 180) - if SERVER then - local ang = self.Owner:EyeAngles() - ang:RotateAroundAxis(ang:Forward(), 180) - - local ent = ents.Create("prop_meathook") - if ent:IsValid() then - ent:SetPos(tr.HitPos) - ent:Spawn() - ent:SetOwner(self.Owner) - - local followed = false - if hitent:GetBoneCount() > 1 then - local boneindex = hitent:NearestBone(tr.HitPos) - if boneindex and boneindex > 0 then - ent:FollowBone(hitent, boneindex) - ent:SetPos((hitent:GetBonePositionMatrixed(boneindex) * 2 + tr.HitPos) / 3) - followed = true - end - end - if not followed then - ent:SetParent(hitent) - end - - ent:SetAngles(ang) - end - - self:Remove() + local ent = ents.Create("prop_meathook") + if ent:IsValid() then + ent:SetPos(tr.HitPos) + ent.BaseWeapon = self:GetClass() + ent.Weaken = true + ent:Spawn() + ent.BleedPerTick = 2 + ent.TicksRemaining = 20 + ent:SetOwner(self:GetOwner()) + ent:SetParent(hitent) + ent:SetAngles(ang) end + + timer.Simple(0, function() self:GetOwner():StripWeapon(self:GetClass()) end) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_howler.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_howler.lua new file mode 100644 index 0000000..0160fa6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_howler.lua @@ -0,0 +1,120 @@ +AddCSLuaFile() + +SWEP.PrintName = "Howler" + +SWEP.Base = "weapon_zs_zombie" + +if CLIENT then + SWEP.ViewModelFOV = 48 +end + +SWEP.ViewModel = Model("models/weapons/v_pza.mdl") + +SWEP.MeleeReach = 78 +SWEP.MeleeForceScale = 1.45 +SWEP.MeleeSize = 4.5 +SWEP.Primary.Delay = 1.35 +SWEP.MeleeDamage = 38 +SWEP.AlertDelay = 3.2 + +SWEP.SwingAnimSpeed = 0.58 + +SWEP.HowlDelay = 10 + +SWEP.BattlecryInterval = 0 + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +local function Battlecry(pos) + if SERVER then + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetNormal(Vector(0,0,1)) + util.Effect("zombie_battlecry", effectdata, true) + end +end + +function SWEP:Think() + self.BaseClass.Think(self) + + if self:GetBattlecry() > CurTime() then + if self.BattlecryInterval < CurTime() then + self.BattlecryInterval = CurTime() + 0.25 + local owner = self:GetOwner() + local center = owner:GetPos() + Vector(0, 0, 32) + if SERVER then + for _, ent in pairs(ents.FindInSphere(center, 80)) do + if ent:IsValidLivingZombie() and WorldVisible(ent:WorldSpaceCenter(), center)then + ent:GiveStatus("zombie_battlecry", 1) + end + end + end + end + end +end + +function SWEP:SecondaryAttack() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or CurTime() < self:GetNextHowl() then return end + + local owner = self:GetOwner() + local pos = owner:GetPos() + + owner:DoAnimationEvent(ACT_GMOD_GESTURE_TAUNT_ZOMBIE) + + self:SetBattlecry(CurTime() + 5) + + if SERVER then + owner:EmitSound("npc/stalker/go_alert2a.wav", 100, math.random(50, 54)) + util.ScreenShake(pos, 5, 5, 3, 560) + + local center = owner:WorldSpaceCenter() + timer.Simple(0, function() Battlecry(center) end) + + for _, ent in pairs(ents.FindInSphere(center, 150)) do + if ent:IsValidLivingHuman() and WorldVisible(ent:WorldSpaceCenter(), center) then + ent:GiveStatus("frightened", 10) + end + end + end + self:SetNextHowl(CurTime() + self.HowlDelay) + self:SetNextSecondaryFire(CurTime() + 0.5) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/combine_gunship/gunship_moan.wav", 70, math.random(85, 95)) +end + +SWEP.PlayAlertSound = SWEP.PlayIdleSound + +function SWEP:PlayAttackSound() + self:GetOwner():EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 75, math.random(80, 85)) +end + +function SWEP:SetBattlecry(time) + self:SetDTFloat(1, time) +end + +function SWEP:GetBattlecry() + return self:GetDTFloat(1) +end + +function SWEP:SetNextHowl(time) + self:SetDTFloat(2, time) +end + +function SWEP:GetNextHowl() + return self:GetDTFloat(2) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.SetColorModulation(1, 1, 1) +end + +function SWEP:PreDrawViewModel(vm) + render.SetColorModulation(1, 0.9, 0.6) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hunter.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hunter.lua index 29ed811..193abb5 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hunter.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hunter.lua @@ -1,11 +1,11 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Hunter' Rifle" - SWEP.Description = "Fires special large caliber rounds. The reloading time is slow but it packs a powerful punch." - SWEP.Slot = 3 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Hunter' Rifle" +SWEP.Description = "Fires special large caliber rounds. The reloading time is slow but it packs a powerful punch." +SWEP.Slot = 3 +SWEP.SlotPos = 0 +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -36,7 +36,7 @@ SWEP.UseHands = true SWEP.ReloadSound = Sound("Weapon_AWP.ClipOut") SWEP.Primary.Sound = Sound("Weapon_Hunter.Single") -SWEP.Primary.Damage = 115 +SWEP.Primary.Damage = 111 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 1.5 SWEP.ReloadDelay = SWEP.Primary.Delay @@ -49,7 +49,7 @@ SWEP.Primary.DefaultClip = 15 SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN -SWEP.ConeMax = 0.115 +SWEP.ConeMax = 5.75 SWEP.ConeMin = 0 SWEP.IronSightsPos = Vector(5.015, -8, 2.52) @@ -57,18 +57,85 @@ SWEP.IronSightsAng = Vector(0, 0, 0) SWEP.WalkSpeed = SPEED_SLOWER +SWEP.Tier = 3 + SWEP.TracerName = "AR2Tracer" +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Hunter' Explosive Rifle", "Uses twice as much ammo, reloads slowly, but overkill damage is dealt as an explosion", function(wept) + wept.Primary.ClipSize = 2 + wept.RequiredClip = 2 + wept.ReloadSpeed = 0.9 + + wept.OnZombieKilled = function(self, zombie, total, dmginfo) + local killer = self:GetOwner() + local minushp = -zombie:Health() + if killer:IsValid() and minushp > 10 then + local pos = zombie:GetPos() + + timer.Simple(0.15, function() + util.BlastDamagePlayer(killer:GetActiveWeapon(), killer, pos, 72, minushp, DMG_ALWAYSGIB, 0.94) + end) + + local effectdata = EffectData() + effectdata:SetOrigin(pos) + util.Effect("Explosion", effectdata, true, true) + end + end +end) + function SWEP:IsScoped() return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() end ---[[function SWEP:EmitFireSound() - self:EmitSound(self.Primary.Sound, 85, 80) -end]] - function SWEP:SendWeaponAnimation() self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + + local owner = self:GetOwner() + local vm = owner:GetViewModel() + local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + + if vm:IsValid() then + vm:SetPlaybackRate(0.5 * speed) + end + + self:SetReloadFinish(CurTime() + 2.5 / speed) +end + +function SWEP:MockReload() + local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier() + self:SetReloadFinish(CurTime() + 2.5 / speed) +end + +function SWEP:Reload() + local owner = self:GetOwner() + if owner:IsHolding() then return end + + if self:GetIronsights() then + self:SetIronsights(false) + end + + if self:CanReload() then + self:MockReload() + end +end + +function SWEP:Deploy() + self.BaseClass.Deploy(self) + + if self:Clip1() <= 0 then + self:MockReload() + end + + return true +end + +function SWEP:Think() + self.BaseClass.Think(self) + + if self:Clip1() <= 0 and self:GetPrimaryAmmoCount() <= 0 then + self:MockReload() + end end function SWEP.BulletCallback(attacker, tr, dmginfo) @@ -76,14 +143,14 @@ function SWEP.BulletCallback(attacker, tr, dmginfo) effectdata:SetOrigin(tr.HitPos) effectdata:SetNormal(tr.HitNormal) util.Effect("hit_hunter", effectdata) - - GenericBulletCallback(attacker, tr, dmginfo) end if CLIENT then SWEP.IronsightsMultiplier = 0.25 function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then return pos + ang:Up() * 256, ang end @@ -91,25 +158,11 @@ if CLIENT then return self.BaseClass.GetViewModelPosition(self, pos, ang) end - local matScope = Material("zombiesurvival/scope") function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then - local scrw, scrh = ScrW(), ScrH() - local size = math.min(scrw, scrh) - surface.SetMaterial(matScope) - surface.SetDrawColor(255, 255, 255, 255) - surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size) - surface.SetDrawColor(0, 0, 0, 255) - if scrw > size then - local extra = (scrw - size) * 0.5 - surface.DrawRect(0, 0, extra, scrh) - surface.DrawRect(scrw - extra, 0, extra, scrh) - end - if scrh > size then - local extra = (scrh - size) * 0.5 - surface.DrawRect(0, 0, scrw, extra) - surface.DrawRect(0, scrh - extra, scrw, extra) - end + self:DrawRegularScope() end end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hurricane.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hurricane.lua new file mode 100644 index 0000000..5ca0613 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hurricane.lua @@ -0,0 +1,119 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Hurricane' Pulse SMG" +SWEP.Description = "Fires rapid pulse shots that slow targets." + +if CLIENT then + SWEP.Slot = 2 + SWEP.SlotPos = 0 + + SWEP.HUD3DBone = "ValveBiped.base" + SWEP.HUD3DPos = Vector(2.2, -0.85, 1) + SWEP.HUD3DScale = 0.02 + + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.base", rel = "", pos = Vector(0, -0.301, 4.731), angle = Angle(0, 180, 90), size = Vector(0.025, 0.025, 0.014), color = Color(255, 228, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_c17/light_domelight01_off.mdl", bone = "ValveBiped.base", rel = "", pos = Vector(0.559, -1.04, -3.651), angle = Angle(-90, -164.752, 0), size = Vector(0.043, 0.037, 0.052), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/error/new light1", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/eli_pod_inner.mdl", bone = "ValveBiped.base", rel = "", pos = Vector(0.079, -2.368, -6.355), angle = Angle(-0.703, -90.113, 0), size = Vector(0.12, 0.075, 0.116), color = Color(255, 204, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/combine_teleportplatform.mdl", bone = "ValveBiped.base", rel = "", pos = Vector(-0.002, -0.489, -8.968), angle = Angle(0, -90, -0), size = Vector(0.056, 0.019, 0.052), color = Color(255, 209, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base+++"] = { type = "Model", model = "models/props_c17/light_domelight01_off.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.773, 2.071, -5.448), angle = Angle(0, 0, -80.556), size = Vector(0.043, 0.037, 0.052), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/error/new light1", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_c17/light_domelight01_off.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.69, 0.799, -5.528), angle = Angle(0, 0, 80.789), size = Vector(0.043, 0.037, 0.052), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/error/new light1", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/combine_teleportplatform.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-1.594, 1.468, -3.698), angle = Angle(103.306, 180, 0), size = Vector(0.056, 0.019, 0.052), color = Color(255, 209, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10.47, 1.462, -6.394), angle = Angle(-175.984, -88.995, 11.291), size = Vector(0.025, 0.019, 0.014), color = Color(255, 228, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/eli_pod_inner.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-0.541, 1.491, -6.099), angle = Angle(98.305, 179.197, 0), size = Vector(0.12, 0.075, 0.116), color = Color(255, 204, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +sound.Add( +{ + name = "Weapon_Hurricane.Single", + channel = CHAN_WEAPON, + volume = 0.7, + soundlevel = 100, + pitch = {70,80}, + sound = {"weapons/ar2/fire1.wav"} +}) + +SWEP.Base = "weapon_zs_base" +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.HoldType = "smg" + +SWEP.ViewModel = "models/weapons/c_smg1.mdl" +SWEP.WorldModel = "models/weapons/w_smg1.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.ReloadSound = Sound("Weapon_SMG1.Reload") +SWEP.Primary.Sound = Sound("Weapon_Hurricane.Single") +SWEP.Primary.Damage = 14.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.09 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "pulse" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.TracerName = "AR2Tracer" + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 + +SWEP.ReloadSpeed = 0.9 + +SWEP.ConeMax = 4.3 +SWEP.ConeMin = 2.5 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.Tier = 2 + +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + +SWEP.IronSightsPos = Vector(-6.425, 5, 1.02) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.5375, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.3125, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Typhoon' Pulse SMG", "Less damage, more accuracy, and gains damage if spooled", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.82 + wept.Primary.Delay = wept.Primary.Delay * 2.3 + wept.ConeMax = wept.ConeMax * 0.5 + wept.ConeMin = wept.ConeMin * 0.7 + + wept.GetFireDelay = function(self) return BaseClass.GetFireDelay(self) - (self:GetDTFloat(9) * 0.15) end + wept.ShootBullets = function(self, dmg, numbul, cone) + dmg = dmg + dmg * self:GetDTFloat(9) * 0.6 + + BaseClass.ShootBullets(self, dmg, numbul, cone) + end + + wept.Think = function(self) + if self:GetReloadFinish() == 0 and self:GetOwner():KeyDown(IN_ATTACK) then + self:SetDTFloat(9, math.min(self:GetDTFloat(9) + FrameTime() * 0.12, 1)) + else + self:SetDTFloat(9, math.max(0, self:GetDTFloat(9) - FrameTime() * 0.5)) + end + + BaseClass.Think(self) + end +end) + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + if ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then + ent:AddLegDamageExt(3.6, attacker, attacker:GetActiveWeapon(), SLOWTYPE_PULSE) + end + + if IsFirstTimePredicted() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/cl_init.lua new file mode 100644 index 0000000..da07341 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/cl_init.lua @@ -0,0 +1,42 @@ +INC_CLIENT() + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.HUD3DBone = "v_weapon.p90_Parent" +SWEP.HUD3DPos = Vector(0.1, -7.8, -0.2) +SWEP.HUD3DAng = Angle(0, 0, 0) + +SWEP.ViewModelFOV = 50 +SWEP.ViewModelFlip = false +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/props_combine/combine_interface002.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(-3.22, -0.101, 4.764), angle = Angle(180, 0, 180), size = Vector(0.048, 0.021, 0.07), color = Color(20, 24, 24, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(0.335, 0, -4.156), angle = Angle(180, 90, 0), size = Vector(0.045, 0.045, 0.103), color = Color(52, 52, 64, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(0.669, -0.02, 3.68), angle = Angle(-92.179, 0, 0), size = Vector(0.059, 0.013, 0.045), color = Color(19, 22, 21, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/teleplatform.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(-0.26, 0, -1.509), angle = Angle(0, 0, 0), size = Vector(0.05, 0.029, 0.103), color = Color(33, 33, 33, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(-0.294, -0.101, 5.506), angle = Angle(0, -180, -180), size = Vector(0.056, 0.014, 0.045), color = Color(24, 27, 27, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(1.248, 0, 5.406), angle = Angle(-61.563, 0, 0), size = Vector(0.389, 0.501, 0.593), color = Color(19, 20, 19, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.p90_Parent", rel = "", pos = Vector(0, -4.014, -8.922), angle = Angle(0, -90, 0), size = Vector(0.045, 0.014, 0.059), color = Color(54, 74, 78, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(0.024, 0, 7.936), angle = Angle(0, -90, -90), size = Vector(0.134, 0.547, 0.184), color = Color(24, 27, 27, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["clipbase"] = { type = "Model", model = "models/props_c17/light_decklight01_off.mdl", bone = "v_weapon.p90_Clip", rel = "", pos = Vector(0.119, -0.375, -4.686), angle = Angle(0.279, -90, -90), size = Vector(0.157, 0.495, 0.074), color = Color(45, 30, 30, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/props_wasteland/prison_padlock001a.mdl", bone = "v_weapon.p90_Parent", rel = "base", pos = Vector(1.782, 0, 13.51), angle = Angle(-180, 90, 0), size = Vector(0.703, 0.745, 1.062), color = Color(37, 40, 41, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.024, 0, 7.936), angle = Angle(0, -90, -90), size = Vector(0.134, 0.547, 0.184), color = Color(24, 27, 27, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_wasteland/laundry_basket001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.335, 0, -4.156), angle = Angle(180, 90, 0), size = Vector(0.045, 0.045, 0.103), color = Color(52, 52, 64, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.669, -0.02, 3.68), angle = Angle(-92.179, 0, 0), size = Vector(0.059, 0.013, 0.045), color = Color(19, 22, 21, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/teleplatform.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.26, 0, -1.509), angle = Angle(0, 0, 0), size = Vector(0.05, 0.029, 0.103), color = Color(33, 33, 33, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.294, -0.101, 5.506), angle = Angle(0, -180, -180), size = Vector(0.056, 0.014, 0.045), color = Color(24, 27, 27, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.248, 0, 5.406), angle = Angle(-61.563, 0, 0), size = Vector(0.389, 0.501, 0.593), color = Color(19, 20, 19, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.843, 0.741, -5.005), angle = Angle(80.433, 0, 0), size = Vector(0.045, 0.014, 0.059), color = Color(54, 74, 78, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/props_wasteland/prison_padlock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.782, 0, 13.51), angle = Angle(-180, 90, 0), size = Vector(0.703, 0.745, 1.062), color = Color(37, 40, 41, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["clipbase"] = { type = "Model", model = "models/props_c17/light_decklight01_off.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.352, -0.051, 7.768), angle = Angle(0, 0, 90), size = Vector(0.157, 0.495, 0.074), color = Color(45, 30, 30, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_combine/combine_interface002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-3.22, -0.101, 4.764), angle = Angle(180, 0, 180), size = Vector(0.048, 0.021, 0.07), color = Color(20, 24, 24, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin1", skin = 0, bodygroup = {} } +} + +function SWEP:SecondaryAttack() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/init.lua new file mode 100644 index 0000000..cbf1ee9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/init.lua @@ -0,0 +1,19 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_bomb_sticky" +SWEP.Primary.ProjVelocity = 850 + +function SWEP:EntModify(ent) + self:SetNextSecondaryFire(CurTime() + 0.2) +end + +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() > CurTime() then return end + for k,v in pairs(ents.FindByClass(self.Primary.Projectile)) do + if v:GetOwner() == self:GetOwner() then + v:Explode() + end + end + + self:SetNextSecondaryFire(CurTime() + 0.2) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/shared.lua new file mode 100644 index 0000000..052ff86 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hyena/shared.lua @@ -0,0 +1,64 @@ +SWEP.PrintName = "'Hyena' Sticky Bomb Launcher" +SWEP.Description = "Fires explosives that will stick to surfaces and enemies until detonated. Bombs take 3 seconds to reach maximum damage. Alt fire will remotely detonate bombs." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_p90.mdl" +SWEP.WorldModel = "models/weapons/w_smg_p90.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Delay = 0.2 +SWEP.Primary.ClipSize = 3 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.DefaultClip = 3 +SWEP.Primary.Damage = 80 + +SWEP.ConeMin = 0.0001 +SWEP.ConeMax = 0.0001 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 3 + +SWEP.MaxBombs = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Lynx' Cryo Sticky Launcher", "Fires cryo bombs that deal less damage but slow zombies", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.8 + if SERVER then + wept.EntModify = function(self, ent) + self:SetNextSecondaryFire(CurTime() + 0.2) + ent:SetDTBool(0, true) + end + end + if CLIENT then + wept.VElements.clipbase.color = Color(30, 95, 150) + end +end) + +function SWEP:CanPrimaryAttack() + if self.BaseClass.CanPrimaryAttack(self) then + local c = 0 + for _, ent in pairs(ents.FindByClass("projectile_bomb_sticky")) do + if ent:GetOwner() == self:GetOwner() then + c = c + 1 + end + end + + if c >= self.MaxBombs then return false end + + return true + end + + return false +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/ar2/ar2_altfire.wav", 70, math.random(112, 120), 0.50) + self:EmitSound("weapons/physcannon/superphys_launch1.wav", 70, math.random(145, 155), 0.5, CHAN_AUTO + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inferno.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inferno.lua index 785cc36..a364615 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inferno.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inferno.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Inferno' AUG" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Inferno' AUG" +SWEP.Description = "A very accurate assault rifle with great damage output and a high clip size." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -27,7 +29,7 @@ SWEP.Primary.Damage = 23 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.095 -SWEP.Primary.ClipSize = 30 +SWEP.Primary.ClipSize = 40 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "ar2" GAMEMODE:SetupDefaultClip(SWEP.Primary) @@ -35,10 +37,32 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_AR2 -SWEP.ConeMax = 0.08 -SWEP.ConeMin = 0.02 +SWEP.ConeMax = 4 +SWEP.ConeMin = 1 SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 4 +SWEP.MaxStock = 3 + SWEP.IronSightsAng = Vector(-1, -1, 0) SWEP.IronSightsPos = Vector(-3, 4, 3) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Inferno' Incendiary Rifle", "Fires incendiary assault rifle rounds, but reduced damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.85 + + wept.BulletCallback = function(attacker, tr, dmginfo) + local ent = tr.Entity + if SERVER and math.random(6) == 1 and ent:IsValidLivingZombie() then + ent:Ignite(6) + for __, fire in pairs(ents.FindByClass("entityflame")) do + if fire:IsValid() and fire:GetParent() == ent then + fire:SetOwner(attacker) + fire:SetPhysicsAttacker(attacker) + fire.AttackerForward = attacker + end + end + end + end +end) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_innervator.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_innervator.lua new file mode 100644 index 0000000..22f3a57 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_innervator.lua @@ -0,0 +1,176 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Innervator' Voltgun" +SWEP.Description = "An electric volt cannon." + +if CLIENT then + SWEP.Slot = 3 + SWEP.SlotPos = 0 + + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 49 + + SWEP.HUD3DBone = "v_weapon.xm1014_Bolt" + SWEP.HUD3DPos = Vector(-1.2, -1.1, 2) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.02 + + SWEP.ViewModelBoneMods = { + ["v_weapon.xm1014_Shell"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["v_weapon.xm1014_Parent"] = { scale = Vector(1.2, 1.2, 1.2), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } + } + + SWEP.VElements = { + ["laser+++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0.1, 3, -0.601), angle = Angle(180, 0, -91), size = Vector(0.019, 0.021, 0.3), color = Color(89, 89, 97, 255), surpresslightning = false, material = "models/props/de_nuke/coolingtower", skin = 0, bodygroup = {} }, + ["laser+++++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0.1, 4.9, 0.699), angle = Angle(180, 0, -90), size = Vector(0.449, 1, 0.1), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser++++"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(-0.301, -7.5, 0.5), angle = Angle(0, 180, -120.39), size = Vector(0.129, 0.1, 0.189), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser++++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0.1, 9.869, 0.699), angle = Angle(180, 0, -90), size = Vector(0.5, 1, 0.1), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser+++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0.1, -4.901, 0.699), angle = Angle(180, 0, -90), size = Vector(0.349, 1, 0.4), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser++"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(-1, 15, 2), angle = Angle(0, 180, 90), size = Vector(0.079, 0.039, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.xm1014_Bolt", rel = "", pos = Vector(0, -1.601, -2.401), angle = Angle(0, 0, 90), size = Vector(0.2, 0.2, 0.2), color = Color(0, 255, 186, 255), surpresslightning = false, material = "models/props_lab/eyescanner_disp", skin = 0, bodygroup = {} }, + ["laser+++"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(-0.22, 16, -0.5), angle = Angle(180, 0, 90), size = Vector(0.029, 0.059, 0.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0, 16.104, 0), angle = Angle(0, 0, 0), size = Vector(0.25, 0.25, 0.2), color = Color(0, 255, 186, 255), surpresslightning = false, material = "models/props_lab/eyescanner_disp", skin = 0, bodygroup = {} }, + ["laser++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.xm1014_Bolt", rel = "laser", pos = Vector(0.1, 3, 2.5), angle = Angle(180, 0, -90), size = Vector(0.029, 0.029, 0.449), color = Color(89, 89, 97, 255), surpresslightning = false, material = "models/props/de_nuke/coolingtower", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["laser+++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0.1, 3, -0.601), angle = Angle(180, 0, -91), size = Vector(0.019, 0.021, 0.3), color = Color(89, 89, 97, 255), surpresslightning = false, material = "models/props/de_nuke/coolingtower", skin = 0, bodygroup = {} }, + ["laser++++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0.1, 9.869, 0.699), angle = Angle(180, 0, -90), size = Vector(0.5, 1, 0.1), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser+++++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0.1, 4.9, 0.699), angle = Angle(180, 0, -90), size = Vector(0.449, 1, 0.1), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser++++"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(-0.301, -7.5, 0.5), angle = Angle(0, 180, -120.39), size = Vector(0.129, 0.1, 0.189), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser+++++++"] = { type = "Model", model = "models/props_lab/rotato.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0.009, -4.901, 0.699), angle = Angle(180, 0, -90), size = Vector(0.349, 1, 0.4), color = Color(108, 118, 133, 255), surpresslightning = false, material = "models/props/de_train/fence_sheet01", skin = 0, bodygroup = {} }, + ["laser+++"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(-0.22, 16, -0.5), angle = Angle(180, 0, 90), size = Vector(0.029, 0.059, 0.15), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0, 16.104, 0), angle = Angle(0, 0, 0), size = Vector(0.25, 0.25, 0.2), color = Color(0, 255, 186, 255), surpresslightning = false, material = "models/props_lab/eyescanner_disp", skin = 0, bodygroup = {} }, + ["laser++"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(-1, 15, 2), angle = Angle(0, 180, 90), size = Vector(0.079, 0.039, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8, 1, -5), angle = Angle(0, 90, 10), size = Vector(0.2, 0.2, 0.2), color = Color(0, 255, 186, 255), surpresslightning = false, material = "models/props_lab/eyescanner_disp", skin = 0, bodygroup = {} }, + ["laser++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "laser", pos = Vector(0.1, 3, 2.5), angle = Angle(180, 0, -90), size = Vector(0.029, 0.029, 0.449), color = Color(89, 89, 97, 255), surpresslightning = false, material = "models/props/de_nuke/coolingtower", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_xm1014.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/zs_inner/innershot.ogg") +SWEP.ReloadSound = Sound("ambient/machines/thumper_startup1.wav") +SWEP.Primary.Damage = 11 +SWEP.Primary.NumShots = 5 +SWEP.Primary.Delay = 1.6 +SWEP.Primary.MaxDistance = 288 +SWEP.Primary.BurstShots = 5 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "pulse" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ReloadSpeed = 0.33 + +SWEP.RequiredClip = 6 + +SWEP.ConeMax = 6.5 +SWEP.ConeMin = 5 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.Tier = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.8125) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.625) + +SWEP.TracerName = "tracer_volt" + +function SWEP:EmitFireSound() + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 85, 130, 0.65) + self:EmitSound("weapons/zs_inner/innershot.ogg", 85, 128, 0.85, CHAN_WEAPON + 20) +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:SecondaryAttack() +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("npc/scanner/combat_scan1.wav", 70, 15, 0.9, CHAN_WEAPON + 21) + self:EmitSound("items/battery_pickup.wav", 70, 47, 0.85, CHAN_WEAPON + 22) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("npc/scanner/combat_scan2.wav", 70, 135) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:TakeAmmo() + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:Think() + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/12) + + if self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end +end + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end + +if not CLIENT then return end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 2) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 2.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -35 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/cl_init.lua new file mode 100644 index 0000000..a4e3ae6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/cl_init.lua @@ -0,0 +1,33 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.Glock_Slide" +SWEP.HUD3DPos = Vector(1, 0, -1) +SWEP.HUD3DAng = Angle(90, 0, -10) + +SWEP.ViewModelFOV = 49 +SWEP.ViewModelFlip = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["t2_xbow+++"] = { type = "Model", model = "models/props_c17/lamp_bell_on.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(4, -0.101, -0.201), angle = Angle(90, 1.169, 0), size = Vector(0.05, 0.05, 0.15), color = Color(69, 85, 115, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow++"] = { type = "Model", model = "models/weapons/w_pist_p228.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-0.201, 0, -5.7), angle = Angle(0, 180, 0), size = Vector(0.699, 0.86, 0.899), color = Color(36, 41, 44, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t2_xbow++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6.801, 2.7, -0.101), angle = Angle(0, 115.713, 0), size = Vector(0.007, 0.27, 0.007), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow+"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6.753, 0, -0.301), angle = Angle(90, 90, 0), size = Vector(0.3, 0.3, 0.2), color = Color(49, 64, 95, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++"] = { type = "Model", model = "models/props_phx/trains/monorail_curve.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-5.831, 1.1, -0.519), angle = Angle(0, -54, 0), size = Vector(0.014, 0.014, 0.025), color = Color(51, 39, 31, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t2_xbow++++"] = { type = "Model", model = "models/props_c17/metalladder001.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-16, 0, -1), angle = Angle(0, 90, 92), size = Vector(0.05, 0.029, 0.109), color = Color(70, 80, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow"] = { type = "Model", model = "models/props_wasteland/laundry_cart001.mdl", bone = "v_weapon.Glock_Parent", rel = "", pos = Vector(2.5, -3.201, 0.649), angle = Angle(-3, -17, -79), size = Vector(0.059, 0.016, 0.025), color = Color(168, 165, 147, 0), surpresslightning = false, material = "models/weapons/v_crowbar/head_uvw", skin = 0, bodygroup = {} }, + ["t2_xbow+++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "v_weapon.Glock_Parent", rel = "t2_xbow", pos = Vector(-6.5, -2.701, -0.101), angle = Angle(0, 62.285, 0), size = Vector(0.007, 0.27, 0.007), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["t2_xbow+++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6.5, -2.701, -0.101), angle = Angle(0, 62.285, 0), size = Vector(0.007, 0.239, 0.007), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow+++"] = { type = "Model", model = "models/props_c17/lamp_bell_on.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(4, -0.101, -0.201), angle = Angle(90, 1.169, 0), size = Vector(0.05, 0.05, 0.15), color = Color(69, 85, 115, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow++++++"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_long.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6.801, 2.7, -0.101), angle = Angle(0, 115.713, 0), size = Vector(0.007, 0.27, 0.007), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder003", skin = 0, bodygroup = {} }, + ["t2_xbow+"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-6.753, 0, -0.301), angle = Angle(90, 90, 0), size = Vector(0.3, 0.3, 0.2), color = Color(49, 64, 95, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow+++++"] = { type = "Model", model = "models/props_phx/trains/monorail_curve.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-5.831, 1.1, -0.519), angle = Angle(0, -54, 0), size = Vector(0.014, 0.014, 0.025), color = Color(51, 39, 31, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t2_xbow++++"] = { type = "Model", model = "models/props_c17/metalladder001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-16, 0, -1), angle = Angle(0, 90, 92), size = Vector(0.05, 0.029, 0.109), color = Color(70, 80, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["t2_xbow"] = { type = "Model", model = "models/props_wasteland/laundry_cart001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 0.699, -4), angle = Angle(0, 180, 180), size = Vector(0.059, 0.016, 0.025), color = Color(168, 165, 147, 0), surpresslightning = false, material = "models/weapons/v_crowbar/head_uvw", skin = 0, bodygroup = {} }, + ["t2_xbow++"] = { type = "Model", model = "models/weapons/w_pist_p228.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "t2_xbow", pos = Vector(-0.201, 0, -5.7), angle = Angle(0, 180, 0), size = Vector(0.699, 0.86, 0.899), color = Color(36, 41, 44, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/init.lua new file mode 100644 index 0000000..7065426 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_inq" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/shared.lua new file mode 100644 index 0000000..f760d17 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_inquisitor/shared.lua @@ -0,0 +1,63 @@ +SWEP.PrintName = "'Inquisitor' Crossbow" +SWEP.Description = "A practical design in a one-hand version. Pierces up to two zombies to deal extra damage." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("weapons/crossbow/fire1.wav") +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.Delay = 1.25 +SWEP.Primary.DefaultClip = 15 +SWEP.Primary.Damage = 69 + +SWEP.ConeMax = 0.5 +SWEP.ConeMin = 0 + +SWEP.Recoil = 5 + +SWEP.ReloadSpeed = 0.6 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 2 + +SWEP.Primary.ProjVelocity = 1600 +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.06) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Absolver' Crossbow", "Higher velocity, more damage, but does not pierce, reloads slower", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.2 + wept.Primary.ProjVelocity = 2100 + wept.Primary.Projectile = "projectile_arrow_cha" + wept.ReloadSpeed = wept.ReloadSpeed * 0.85 +end) + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/crossbow/reload1.wav", 70, 130, 1, CHAN_WEAPON + 22) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/galil/galil_boltpull.wav", 70, 150) + end +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/crossbow/fire1.wav", 70, 180, 0.7, CHAN_WEAPON + 20) + self:EmitSound("weapons/crossbow/bolt_skewer1.wav", 70, 243, 0.7, CHAN_WEAPON + 21) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_jackhammer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_jackhammer.lua new file mode 100644 index 0000000..8138583 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_jackhammer.lua @@ -0,0 +1,99 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Jackhammer' Drum Shotgun" +SWEP.Description = "An automatic drum shotgun with a large clip size." + +if CLIENT then + SWEP.Slot = 3 + SWEP.SlotPos = 0 + + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 59 + + SWEP.HUD3DBone = "v_weapon.galil" + SWEP.HUD3DPos = Vector(1.3, -0.3, 2) + SWEP.HUD3DScale = 0.018 + + SWEP.VElements = { + ["t4_shot_part+++++++"] = { type = "Model", model = Model("models/props_pipes/concrete_pipe001a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, 11, 1.5), angle = Angle(90, 0, 0), size = Vector(0.032, 0.009, 0.009), color = Color(30, 30, 30, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part++++++"] = { type = "Model", model = Model("models/props_pipes/pipe02_straight01_long.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, 13, -0.801), angle = Angle(0, 0, 0), size = Vector(0.17, 0.55, 0.17), color = Color(40, 40, 40, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part++++"] = { type = "Model", model = Model("models/props_wasteland/controlroom_filecabinet002a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -13, 0.618), angle = Angle(0, 0, 100), size = Vector(0.039, 0.15, 0.009), color = Color(60, 60, 60, 255), surpresslightning = false, material = "phoenix_storms/metalfloor_2-3", skin = 0, bodygroup = {} }, + ["t4_shot_part+++"] = { type = "Model", model = Model("models/props_junk/ibeam01a_cluster01.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -7.301, 0.66), angle = Angle(180, -90, 0), size = Vector(0.059, 0.029, 0.039), color = Color(47, 22, 1, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["t4_shot_part++"] = { type = "Model", model = Model("models/props_combine/combine_interface003.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -6.301, 2.799), angle = Angle(180, -90, 0), size = Vector(0.059, 0.022, 0.059), color = Color(79, 100, 135, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["t4_shot_part+++++"] = { type = "Model", model = Model("models/props_wasteland/laundry_washer001a.mdl"), bone = "v_weapon.magazine", rel = "", pos = Vector(0, -0.801, 3), angle = Angle(0, 0, 0), size = Vector(0.054, 0.054, 0.07), color = Color(50, 50, 50, 255), surpresslightning = false, material = "models/props_canal/canal_bridge_railing_01c", skin = 0, bodygroup = {} }, + ["t4_shot_part+"] = { type = "Model", model = Model("models/props_combine/combine_train02a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part", pos = Vector(24.5, 4.38, -4.1), angle = Angle(180, 90, 0), size = Vector(0.013, 0.024, 0.009), color = Color(60, 60, 60, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part"] = { type = "Model", model = Model("models/weapons/c_pistol.mdl"), bone = "v_weapon.galil", rel = "", pos = Vector(4.4, -5, -19.8), angle = Angle(90, 0, -90), size = Vector(0.8, 0.8, 1.21), color = Color(60, 60, 60, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["t4_shot_part++++++"] = { type = "Model", model = Model("models/props_pipes/pipe02_straight01_long.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, 13, -0.801), angle = Angle(0, 0, 0), size = Vector(0.17, 0.3, 0.17), color = Color(30, 30, 30, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part+++++++"] = { type = "Model", model = Model("models/props_pipes/concrete_pipe001a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, 11, 1.5), angle = Angle(90, 0, 0), size = Vector(0.032, 0.009, 0.009), color = Color(30, 30, 30, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part++++"] = { type = "Model", model = Model("models/props_wasteland/controlroom_filecabinet002a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -13, 0.618), angle = Angle(0, 0, 100), size = Vector(0.039, 0.15, 0.009), color = Color(60, 60, 60, 255), surpresslightning = false, material = "phoenix_storms/metalfloor_2-3", skin = 0, bodygroup = {} }, + ["t4_shot_part+++"] = { type = "Model", model = Model("models/props_junk/ibeam01a_cluster01.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -7.301, 0.66), angle = Angle(180, -90, 0), size = Vector(0.059, 0.029, 0.039), color = Color(47, 22, 1, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["t4_shot_part++"] = { type = "Model", model = Model("models/props_combine/combine_interface003.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, -6.301, 2.799), angle = Angle(180, -90, 0), size = Vector(0.059, 0.029, 0.059), color = Color(79, 100, 135, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["t4_shot_part+++++"] = { type = "Model", model = Model("models/props_wasteland/laundry_washer001a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part+", pos = Vector(0, 5, 2), angle = Angle(0, 0, 90), size = Vector(0.054, 0.054, 0.07), color = Color(50, 50, 50, 255), surpresslightning = false, material = "models/props_canal/canal_bridge_railing_01c", skin = 0, bodygroup = {} }, + ["t4_shot_part+"] = { type = "Model", model = Model("models/props_combine/combine_train02a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "t4_shot_part", pos = Vector(-3.636, 0, 0.699), angle = Angle(0, 90, 180), size = Vector(0.013, 0.024, 0.009), color = Color(50, 50, 50, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["t4_shot_part"] = { type = "Model", model = Model("models/weapons/w_pistol.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1, -4.5), angle = Angle(0, 180, 180), size = Vector(0.8, 0.8, 1.21), color = Color(50, 50, 50, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } + } + + SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_L_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 0, 21) } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "shotgun" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModel = "models/weapons/cstrike/c_rif_galil.mdl" +SWEP.WorldModel = "models/weapons/w_rif_galil.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/xm1014/xm1014-1.wav") +SWEP.ReloadSound = Sound("Weapon_Deagle.Clipout") +SWEP.Primary.Damage = 10.5 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Delay = 0.31 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 9 +SWEP.ConeMin = 6.5 + +SWEP.ReloadSpeed = 0.65 + +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -1.125) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.81) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Anvil' Drum Shotgun", "Uses 3 shells at once, slightly more damage, reduced accuracy", function(wept) + wept.Primary.NumShots = wept.Primary.NumShots * 3 + wept.Primary.Delay = wept.Primary.Delay * 3.3 + wept.Primary.Damage = wept.Primary.Damage * 1.1 + wept.RequiredClip = 3 + wept.Recoil = 10 + + wept.ConeMin = wept.ConeMin * 1.4 + wept.ConeMax = wept.ConeMax * 1.2 + + wept.EmitFireSound = function(self) + self:EmitSound(self.Primary.Sound, 75, math.random(87, 89), 0.75) + self:EmitSound("weapons/shotgun/shotgun_fire6.wav", 75, math.random(102, 108), 0.65, CHAN_WEAPON + 20) + end +end) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 75, math.random(147, 153), 0.7) + self:EmitSound("weapons/shotgun/shotgun_fire6.wav", 75, math.random(132, 138), 0.6, CHAN_WEAPON + 20) +end + +function SWEP:SecondaryAttack() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_juggernaut.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_juggernaut.lua new file mode 100644 index 0000000..b01a04e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_juggernaut.lua @@ -0,0 +1,119 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Juggernaut' M249" +SWEP.Description = "A light machine gun capable of immense firepower, firing additional red projectiles as it fires." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.HUD3DBone = "v_weapon.m249" + SWEP.HUD3DPos = Vector(1.4, -1.3, 5) + SWEP.HUD3DAng = Angle(180, 0, 0) + SWEP.HUD3DScale = 0.015 +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_mach_m249para.mdl" +SWEP.WorldModel = "models/weapons/w_mach_m249para.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/m249/m249-1.wav") +SWEP.Primary.Damage = 20 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.08 + +SWEP.Primary.ClipSize = 90 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "ar2" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_AR2 + +SWEP.Recoil = 4 + +SWEP.ConeMax = 6 +SWEP.ConeMin = 2.4 + +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.IronSightsAng = Vector(-1, -1, 0) +SWEP.IronSightsPos = Vector(-3, 4, 3) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * (self:Clip1() == 2 and 5 or 1)) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound) + + if self:Clip1() == 1 then + self:EmitSound("weapons/sg552/sg552-1.wav", 70, 45, 0.95, CHAN_AUTO) + end +end + +function SWEP:ShootBullets(dmg, numbul, cone) + local owner = self:GetOwner() + local zeroclip = self:Clip1() == 0 + + self:SendWeaponAnimation() + owner:DoAttackEvent() + if self.Recoil > 0 then + local r2 = zeroclip and 1 or 0 + local r = math.Rand(0.8, 1) * r2 + owner:ViewPunch(Angle(r * -self.Recoil, r * (math.random(2) == 1 and -1 or 1) * self.Recoil, (r2 - r) * (math.random(2) == 1 and -1 or 1) * self.Recoil)) + end + + if SERVER and (self:Clip1() % 10 == 1 or zeroclip) then + for i = 1, zeroclip and 8 or 1 do + local ent = ents.Create("projectile_juggernaut") + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Up(), 90) + ent:SetAngles(angle) + + ent:SetOwner(owner) + ent.ProjDamage = self.Primary.Damage * 0.75 * (owner.ProjectileDamageMul or 1) + ent.ProjSource = self + ent.Team = owner:Team() + + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + + angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Forward(), math.Rand(0, 360)) + angle:RotateAroundAxis(angle:Up(), math.Rand(-cone/1.5, cone/1.5)) + phys:SetVelocityInstantaneous(angle:Forward() * 700 * (owner.ProjectileSpeedMul or 1)) + end + end + end + end + + owner:LagCompensation(true) + owner:FireBulletsLua(owner:GetShootPos(), owner:GetAimVector(), cone, numbul * (zeroclip and 12 or 1), dmg / (zeroclip and 1.5 or 1), nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + owner:LagCompensation(false) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_keyboard.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_keyboard.lua index 1b755d9..fb06e7e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_keyboard.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_keyboard.lua @@ -1,8 +1,8 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Keyboard" +SWEP.PrintName = "Keyboard" +if CLIENT then SWEP.ViewModelFOV = 55 SWEP.ViewModelFlip = false @@ -42,6 +42,11 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingOffset = Vector(0, -30, 0) SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true +SWEP.DismantleDiv = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.075) + function SWEP:PlayHitSound() self:EmitSound("weapons/melee/keyboard/keyboard_hit-0"..math.random(4)..".ogg") end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_kongolaxe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_kongolaxe.lua new file mode 100644 index 0000000..72927c3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_kongolaxe.lua @@ -0,0 +1,72 @@ +AddCSLuaFile() + +SWEP.PrintName = "Kongol Axe" +SWEP.Description = "A very heavy greataxe with no other special properties other than sheer damage output." + +if CLIENT then + SWEP.ViewModelFOV = 65 + SWEP.ViewModelFlip = false + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + SWEP.VElements = { + ["base2+++"] = { type = "Model", model = "models/props_phx/misc/iron_beam1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.519, 14, 0), angle = Angle(0, 90, -90), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base2"] = { type = "Model", model = "models/props_phx/gibs/wooden_wheel2_gib2.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(2, 15.074, -1.5), angle = Angle(0, -45, 0), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props/cs_militia/axe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1.299, -4), angle = Angle(0, 0, 90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base2++++"] = { type = "Model", model = "models/props_phx/construct/metal_angle180.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 15.064, -1), angle = Angle(0, 180, 0), size = Vector(0.2, 0.2, 0.5), color = Color(255, 255, 255, 35), surpresslightning = false, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base2++"] = { type = "Model", model = "models/props_phx/gibs/wooden_wheel2_gib2.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(2.049, 15.064, -1.52), angle = Angle(0, -80, 0), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base2+"] = { type = "Model", model = "models/props_phx/construct/metal_angle180.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 15.064, -1), angle = Angle(0, 180, 0), size = Vector(0.2, 0.2, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props/cs_militia/axe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1.299, -4), angle = Angle(0, 0, 90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base2+++"] = { type = "Model", model = "models/props_phx/misc/iron_beam1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.519, 14, 0), angle = Angle(0, 90, -90), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base2"] = { type = "Model", model = "models/props_phx/gibs/wooden_wheel2_gib2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.699, 15.074, -1.5), angle = Angle(0, -45, 0), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base2++++"] = { type = "Model", model = "models/props_phx/construct/metal_angle180.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 15.064, -1), angle = Angle(0, 180, 0), size = Vector(0.2, 0.2, 0.5), color = Color(255, 255, 255, 35), surpresslightning = false, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base2++"] = { type = "Model", model = "models/props_phx/gibs/wooden_wheel2_gib2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.75, 15.064, -1.52), angle = Angle(0, -80, 0), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} }, + ["base2+"] = { type = "Model", model = "models/props_phx/construct/metal_angle180.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 15.064, -1), angle = Angle(0, 180, 0), size = Vector(0.2, 0.2, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/chairchrome01", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "melee2" + +SWEP.MeleeDamage = 150 +SWEP.MeleeRange = 75 +SWEP.MeleeSize = 3 +SWEP.MeleeKnockBack = 350 + +SWEP.Primary.Delay = 1.3 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.SwingRotation = Angle(60, 0, -80) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingTime = 0.6 +SWEP.SwingHoldType = "melee" + +SWEP.HitDecal = "Manhackcut" + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.13) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(40, 45)) +end + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/golf club/golf_hit-0"..math.random(4)..".ogg", 75, math.random(70, 75)) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/flesh/flesh_bloody_break.wav", 80, math.random(95, 105)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator.lua new file mode 100644 index 0000000..1806e28 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator.lua @@ -0,0 +1,69 @@ +AddCSLuaFile() + +DEFINE_BASECLASS("weapon_zs_fastzombie") + +SWEP.PrintName = "Lacerator" + +SWEP.ViewModel = Model("models/weapons/v_fza.mdl") --Model("models/weapons/v_pza.mdl") +SWEP.WorldModel = "" + +if CLIENT then + SWEP.ViewModelFOV = 42 +end + +sound.Add({ + name = "Weapon_Lacerator.Swinging", + channel = CHAN_AUTO, + volume = 0.55, + level = 75, + pitch = 100, + sound = "npc/antlion_guard/confused1.wav" +}) + +SWEP.MeleeDamage = 9 + +SWEP.SlowMeleeDelay = 0.8 +SWEP.SlowMeleeDamage = 22 +SWEP.PounceDamage = 30 + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = math.floor(damage * 18/22) + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:PlayPounceHitSound() + self:EmitSound("physics/flesh/flesh_strider_impact_bullet1.wav") + self:EmitSound("npc/fast_zombie/wake1.wav", 75, math.random(75, 80), nil, CHAN_AUTO) +end + +function SWEP:PlayPounceStartSound() + self:EmitSound("npc/fast_zombie/leap1.wav", 75, math.random(75, 80), nil, CHAN_AUTO) +end + +function SWEP:PlayPounceSound() + self:EmitSound("npc/ichthyosaur/attack_growl1.wav", 75, math.random(100, 116), nil, CHAN_AUTO) +end + +function SWEP:PlaySwingEndSound() + self:EmitSound("npc/zombie_poison/pz_alert2.wav", 75, nil, nil, CHAN_AUTO) +end + +function SWEP:StartSwingingSound() + self:EmitSound("Weapon_Lacerator.Swinging") +end + +function SWEP:StopSwingingSound() + self:StopSound("Weapon_Lacerator.Swinging") +end + +function SWEP:PlaySlowSwingSound() + self:EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav") +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/zombie/zombie_alert"..math.random(1, 3)..".wav", 75, math.random(80, 85)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator_charging.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator_charging.lua new file mode 100644 index 0000000..4a71fe7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lacerator_charging.lua @@ -0,0 +1,291 @@ +AddCSLuaFile() + +DEFINE_BASECLASS("weapon_zs_zombie") + +SWEP.PrintName = "Charger" + +SWEP.ViewModel = Model("models/weapons/v_pza.mdl") + +SWEP.MeleeDelay = 0.8 +SWEP.MeleeDamage = 23 +SWEP.BleedDamage = 10 +SWEP.MeleeDamageVsProps = 23 +SWEP.Primary.Delay = 1.5 + +SWEP.SwingAnimSpeed = 0.6 + +SWEP.ChargeDamage = 30 +SWEP.ChargeDamageVsPlayerMul = 0.8333 +SWEP.ChargeReach = 26 +SWEP.ChargeSize = 12 +SWEP.ChargeStartDelay = 0.35 +SWEP.ChargeDelay = 2 +SWEP.ChargeRecovery = 0.75 +SWEP.ChargeTime = 2.5 +SWEP.ChargeAccel = 0.5 +SWEP.ChargeKnockdown = 1.75 + +SWEP.Secondary.Automatic = false + +SWEP.NextAllowCharge = 0 +function SWEP:Think() + BaseClass.Think(self) + + local curtime = CurTime() + local owner = self:GetOwner() + + if self.NextAllowJump and self.NextAllowJump <= curtime then + self.NextAllowJump = nil + + owner:ResetJumpPower() + end + + if self:IsCharging() then + if owner:WaterLevel() >= 2 or CurTime() > self:GetChargeStart() + self.ChargeTime then + self:StopCharge() + elseif IsFirstTimePredicted() then + local dir = owner:GetVelocity() + dir:Normalize() + + local chargemul = math.min(self:GetCharge(), owner:GetVelocity():LengthSqr() / 193600) + local traces = owner:CompensatedZombieMeleeTrace(self.ChargeReach, self.ChargeSize, owner:WorldSpaceCenter(), dir) + local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.ChargeDamage * chargemul) + + local hit = false + for _, trace in ipairs(traces) do + if not trace.Hit then continue end + + if trace.HitWorld then + if trace.HitNormal.z < 0.8 then + hit = true + self:MeleeHitWorld(trace) + end + else + local ent = trace.Entity + if ent and ent:IsValid() and not ent:IsProjectile() then + hit = true + self:MeleeHit(ent, trace, damage * (ent:IsPlayer() and self.ChargeDamageVsPlayerMul or ent.PounceWeakness or 1) * (self:IsChargeCritical() and not ent:IsPlayer() and 2 or 1), 1) + if ent:IsPlayer() then + ent:ThrowFromPositionSetZ(trace.StartPos, 120 * chargemul + owner:GetVelocity():Length() * 0.5) + if CurTime() >= (ent.NextKnockdown or 0) and self:IsChargeCritical() then + ent:GiveStatus("knockdown", self.ChargeKnockdown * chargemul) + ent.NextKnockdown = CurTime() + 4 * chargemul + end + end + end + end + end + + if not self.CriticalCharge and self:IsChargeCritical() then + self:PlayCriticalChargeStartSound() + self.CriticalCharge = true + end + + if hit then + self:PlayChargeHitSound() + self:StopCharge() + end + end + elseif self:GetChargeStart() > 0 and CurTime() > self:GetChargeStart() then + self:StartCharge() + elseif self.m_ViewAngles then + self.m_ViewAngles = nil + end + + self:NextThink(curtime) + return true +end + +function SWEP:PlayChargeHitSound() + self:EmitSound("npc/antlion_guard/shove1.wav") + self:EmitSound("npc/fast_zombie/wake1.wav", 75, math.random(75, 80), nil, CHAN_AUTO) +end + +function SWEP:PlayCriticalChargeStartSound() + self:EmitSound("npc/zombie_poison/pz_throw3.wav", 75, math.random(85, 90), nil, CHAN_AUTO) +end + +function SWEP:Move(mv) + local charge = self:GetCharge() + + if self:GetChargeStart() > 0 and charge <= 0 then + mv:SetMaxSpeed(0) + mv:SetMaxClientSpeed(0) + elseif charge > 0 then + mv:SetForwardSpeed(10000) + mv:SetSideSpeed(mv:GetSideSpeed() * 0.1) + + local mul = 1 + charge * 1 + (self:IsChargeCritical() and 0.5 or 0) + mv:SetMaxSpeed(mv:GetMaxSpeed() * mul) + mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * mul) + end +end + +function SWEP:PrimaryAttack() + if self:IsCharging() or self:GetChargeStart() > 0 then return end + + BaseClass.PrimaryAttack(self) +end + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() and not (self:IsCharging() or self:GetChargeStart() > 0) then + damage = self.MeleeDamageVsProps + end + + BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if SERVER and ent:IsPlayer() and not (self:IsCharging() or self:GetChargeStart() > 0) then + local bleed = ent:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(self.BleedDamage) + bleed.Damager = self:GetOwner() + end + end + + BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end + +function SWEP:SecondaryAttack() + if self:IsCharging() or self:GetChargeStart() > 0 then return end + + if self:GetOwner():IsOnGround() then + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or CurTime() < self.NextAllowCharge then return end + + self:SetNextPrimaryFire(math.huge) + self:SetChargeStart(CurTime() + self.ChargeStartDelay) + + self:GetOwner():ResetJumpPower() + if IsFirstTimePredicted() then + self:PlayChargeStartSound() + end + end +end + +function SWEP:StartCharge() + if self:IsCharging() then return end + + local owner = self:GetOwner() + if owner:IsOnGround() then + self:SetCharging(true) + + self.m_ViewAngles = owner:EyeAngles() + + if IsFirstTimePredicted() then + self:PlayChargeSound() + end + owner:SetAnimation(PLAYER_JUMP) + else + self:SetNextSecondaryFire(CurTime()) + self.m_ViewAngles = nil + self.NextAllowJump = CurTime() + self.NextAllowCharge = CurTime() + self.ChargeDelay + self:SetNextPrimaryFire(CurTime() + self.ChargeRecovery) + self:GetOwner():ResetJumpPower() + end +end + +function SWEP:PlayChargeSound() + self:EmitSound("npc/ichthyosaur/attack_growl1.wav", 75, math.random(100,116), nil, CHAN_AUTO) +end + +function SWEP:PlayChargeStartSound() + self:EmitSound("npc/fast_zombie/leap1.wav", 75, math.random(75,80), nil, CHAN_AUTO) +end + +function SWEP:StopCharge() + if not self:IsCharging() then return end + + self:SetChargeStart(0) + self:SetCharging(false) + self:SetNextSecondaryFire(CurTime()) + self.m_ViewAngles = nil + self.NextAllowJump = CurTime() + 0.25 + self.NextAllowCharge = CurTime() + self.ChargeDelay + self:SetNextPrimaryFire(CurTime() + self.ChargeRecovery) + self:GetOwner():ResetJumpPower() + self.CriticalCharge = nil +end + +function SWEP:Reload() + BaseClass.SecondaryAttack(self) +end + +function SWEP:OnRemove() + self.Removing = true + + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:ResetJumpPower() + end + + BaseClass.OnRemove(self) +end + +function SWEP:Holster() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:ResetJumpPower() + end + + BaseClass.Holster(self) +end + +function SWEP:ResetJumpPower(power) + if self.Removing then return end + + if self.NextAllowJump and CurTime() < self.NextAllowJump or self:IsCharging() or self:GetChargeStart() > 0 then + return 1 + end +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav") +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/zombie/zombie_alert"..math.random(1,3)..".wav", 75, math.random(80,85)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:SetChargeStart(time) + self:SetDTFloat(1, time) +end + +function SWEP:GetChargeStart() + return self:GetDTFloat(1) +end + +function SWEP:GetCharge() + if self:GetChargeStart() == 0 then return 0 end + + return math.Clamp((CurTime() - self:GetChargeStart()) / self.ChargeAccel, 0, 1) +end + +function SWEP:IsChargeCritical() + if not self:IsCharging() then return false end + + return CurTime() >= self:GetChargeStart() + self.ChargeTime * 0.6 +end + +function SWEP:SetCharging(charging) + self:SetDTBool(2, charging) +end + +function SWEP:GetCharging() + return self:GetDTBool(2) +end +SWEP.IsCharging = SWEP.GetCharging + +if not CLIENT then return end + +SWEP.ViewModelFOV = 48 + +function SWEP:ViewModelDrawn() + render.SetColorModulation(1, 1, 1) +end + +function SWEP:PreDrawViewModel(vm) + render.SetColorModulation(0.7, 0.17, 0) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ladel.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ladel.lua new file mode 100644 index 0000000..99f62e3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ladel.lua @@ -0,0 +1,51 @@ +AddCSLuaFile() + +SWEP.PrintName = "Ladle" + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_lab/ladel.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.809, 2.072, -6.882), angle = Angle(0.912, -90, 6.249), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_lab/ladel.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.009, 1.833, -6.954), angle = Angle(4.703, -180, 4.718), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 34 +SWEP.MeleeRange = 58 +SWEP.MeleeSize = 1.15 + +SWEP.Primary.Delay = 0.9 + +SWEP.UseMelee1 = true + +SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE +SWEP.MissGesture = SWEP.HitGesture + +SWEP.SwingRotation = Angle(30, -30, -30) +SWEP.SwingTime = 0.25 +SWEP.SwingHoldType = "grenade" + +SWEP.AllowQualityWeapons = true +SWEP.Culinary = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 4) + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/frying_pan/pan_hit-0"..math.random(4)..".ogg", 75, 140) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lamp.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lamp.lua index 3d84f71..5fd83fe 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lamp.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_lamp.lua @@ -1,8 +1,8 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Lamp" +SWEP.PrintName = "Lamp" +if CLIENT then SWEP.ViewModelFOV = 65 SWEP.ViewModelFlip = false @@ -39,6 +39,11 @@ SWEP.SwingOffset = Vector(0, 30, -40) SWEP.SwingTime = 0.4 SWEP.SwingHoldType = "melee" +SWEP.AllowQualityWeapons = true +SWEP.DismantleDiv = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 80, math.Rand(65, 70)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longarm.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longarm.lua new file mode 100644 index 0000000..3e2717f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longarm.lua @@ -0,0 +1,85 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Long Arm' Handgun" +SWEP.Description = "A heavy handgun that consumes 2 pistol rounds that spread into shrapnel on walls." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.HUD3DBone = "Python" + SWEP.HUD3DPos = Vector(0.85, 0, -2.5) + SWEP.HUD3DScale = 0.015 + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_short.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(23, 1, -6.5), angle = Angle(0, -90, -5), size = Vector(0.2, 1, 0.2), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/powerbox02c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 9, 3), angle = Angle(90, 90, 0), size = Vector(0.5, 0.2, 1), color = Color(155, 160, 165, 255), surpresslightning = false, material = "models/weapons/v_grenade/rim", skin = 0, bodygroup = {} } + } + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_pipes/pipe02_straight01_short.mdl", bone = "Python", rel = "", pos = Vector(0, -1.5, 16), angle = Angle(0, 0, 90), size = Vector(0.2, 1, 0.2), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_lab/powerbox02c.mdl", bone = "Python", rel = "base", pos = Vector(0, 9, 3), angle = Angle(90, 90, 0), size = Vector(0.5, 0.2, 1), color = Color(155, 160, 165, 255), surpresslightning = false, material = "models/weapons/v_grenade/rim", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/c_357.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("weapons/zs_longarm/longarm_fire.ogg") +SWEP.Primary.Delay = 0.73 +SWEP.Primary.Damage = 120 +SWEP.Primary.NumShots = 1 + +SWEP.Primary.ClipSize = 10 +SWEP.RequiredClip = 2 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.ConeMax = 3.75 +SWEP.ConeMin = 1.65 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.IronSightsPos = Vector(-4.65, 4, 0.25) +SWEP.IronSightsAng = Vector(0, 0, 1) + +SWEP.WallDivide = 6 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.468) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.206) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.075, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Gunslinger' Handgun", "Fires rapidly, larger clip, but deals less damage and less damage on bounce", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.7 + wept.Primary.Delay = wept.Primary.Delay * 0.68 + wept.Primary.ClipSize = 16 + wept.WallDivide = 8 +end) + +local function DoRicochet(attacker, hitpos, hitnormal, normal, damage) + attacker.RicochetBullet = true + if attacker:IsValid() then + local aw = attacker:GetActiveWeapon() + attacker:FireBulletsLua(hitpos, 2 * hitnormal * hitnormal:Dot(normal * -1) + normal, 5, 6, damage / aw.WallDivide, nil, nil, "tracer_rico", nil, nil, nil, nil, nil, aw) + end + attacker.RicochetBullet = nil +end +function SWEP.BulletCallback(attacker, tr, dmginfo) + if SERVER and tr.HitWorld and not tr.HitSky then + local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() + timer.Simple(0, function() DoRicochet(attacker, hitpos, hitnormal, normal, dmg) end) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longsword.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longsword.lua new file mode 100644 index 0000000..3f37fa7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_longsword.lua @@ -0,0 +1,257 @@ +AddCSLuaFile() + +SWEP.PrintName = "Type XIIIa Longsword" +SWEP.Description = "Can cleave through multiple zombies in one swing." + +if CLIENT then + SWEP.ViewModelFOV = 55 + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/props_trainstation/trainstation_ornament002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(-90, 0, 0), size = Vector(0.035, 0.029, 0.3), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(90, 90, 0), size = Vector(0.223, 0.259, 0.196), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.743, 1.294, 3.095), angle = Angle(6.436, 0, 0), size = Vector(0.412, 0.257, 1.68), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/shoe001a", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_phx/misc/flakshell_big.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, -5.827), angle = Angle(180, 0, 0), size = Vector(0.093, 0.012, 0.97), color = Color(223, 223, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/streetsign002b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, 6.59), angle = Angle(0, 0, 0), size = Vector(0.09, 3.848, 0.09), color = Color(156, 155, 173, 255), surpresslightning = false, material = "models/props_pipes/pipesystem01a_skin1", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_trainstation/trainstation_ornament002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(90, 0, 0), size = Vector(0.035, 0.029, 0.3), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(90, 90, 0), size = Vector(0.223, 0.259, 0.196), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_trainstation/trainstation_ornament002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(90, 0, 0), size = Vector(0.035, 0.029, 0.3), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_junk/popcan01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.665, 1.264, 2.4), angle = Angle(-5.286, 16.554, -2.345), size = Vector(0.412, 0.257, 1.68), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/shoe001a", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_trainstation/trainstation_ornament002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, -5.791), angle = Angle(-90, 0, 0), size = Vector(0.035, 0.029, 0.3), color = Color(209, 209, 228, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/streetsign002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 6.59), angle = Angle(0, 0, 0), size = Vector(0.09, 3.848, 0.09), color = Color(156, 155, 173, 255), surpresslightning = false, material = "models/props_pipes/pipesystem01a_skin1", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_phx/misc/flakshell_big.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, -5.827), angle = Angle(180, 0, 0), size = Vector(0.093, 0.012, 0.97), color = Color(223, 223, 255, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee2" + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 90 +SWEP.MeleeRange = 67 +SWEP.MeleeSize = 2.5 + +SWEP.Primary.Delay = 1.25 + +SWEP.Tier = 3 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.SwingRotation = Angle(30, -20, 10) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingTime = 0.65 +SWEP.SwingHoldType = "melee" + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.125) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 85)) +end + +function SWEP:PlayHitSound() + self:EmitSound("ambient/machines/slicer"..math.random(4)..".wav", 75) +end + +function SWEP:GetTracesNumPlayers(traces) + local numplayers = 0 + + local ent + for _, trace in pairs(traces) do + ent = trace.Entity + if ent and ent:IsValidPlayer() then + numplayers = numplayers + 1 + end + end + + return numplayers +end + +function SWEP:GetDamage(numplayers, basedamage) + basedamage = basedamage or self.MeleeDamage + + if numplayers then + return basedamage * math.Clamp(1.25 - numplayers * 0.25, 0.5, 1) + end + + return basedamage +end + +function SWEP:MeleeSwing() + local owner = self:GetOwner() + + owner:DoAttackEvent() + self:SendWeaponAnim(self.MissAnim) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + local hit = false + local tr = owner:CompensatedPenetratingMeleeTrace(self.MeleeRange * (owner.MeleeRangeMul or 1), self.MeleeSize) + local damage = self:GetDamage(self:GetTracesNumPlayers(tr)) + local ent + + local damagemultiplier = owner:Team() == TEAM_HUMAN and owner.MeleeDamageMultiplier or 1 --(owner.BuffMuscular and owner:Team()==TEAM_HUMAN) and 1.2 or 1 + if owner:IsSkillActive(SKILL_LASTSTAND) then + if owner:Health() <= owner:GetMaxHealth() * 0.25 then + damagemultiplier = damagemultiplier * 2 + else + damagemultiplier = damagemultiplier * 0.85 + end + end + + for _, trace in ipairs(tr) do + if not trace.Hit then continue end + + ent = trace.Entity + + hit = true + + local hitflesh = trace.MatType == MAT_FLESH or trace.MatType == MAT_BLOODYFLESH or trace.MatType == MAT_ANTLION or trace.MatType == MAT_ALIENFLESH + + if hitflesh then + util.Decal(self.BloodDecal, trace.HitPos + trace.HitNormal, trace.HitPos - trace.HitNormal) + + if SERVER then + self:ServerHitFleshEffects(ent, trace, damagemultiplier) + end + + end + + if ent and ent:IsValid() then + if SERVER then + self:ServerMeleeHitEntity(trace, ent, damagemultiplier) + end + + self:MeleeHitEntity(trace, ent, damagemultiplier, damage) + + if SERVER then + self:ServerMeleePostHitEntity(trace, ent, damagemultiplier) + end + + if owner.GlassWeaponShouldBreak then break end + end + end + + if hit then + self:PlayHitSound() + else + self:PlaySwingSound() + + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end +end + +function SWEP:MeleeHitEntity(tr, hitent, damagemultiplier, damage) + if not IsFirstTimePredicted() then return end + + local owner = self:GetOwner() + + if SERVER and hitent:IsPlayer() and owner:IsSkillActive(SKILL_GLASSWEAPONS) then + damagemultiplier = damagemultiplier * 3.5 + owner.GlassWeaponShouldBreak = not owner.GlassWeaponShouldBreak + end + + damage = damage * damagemultiplier + + local dmginfo = DamageInfo() + dmginfo:SetDamagePosition(tr.HitPos) + dmginfo:SetAttacker(owner) + dmginfo:SetInflictor(self) + dmginfo:SetDamageType(self.DamageType) + dmginfo:SetDamage(damage) + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 50 * owner:GetAimVector()) + + local vel + if hitent:IsPlayer() then + + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(self:GetPowerCombo() + 1) + + damage = damage + damage * (owner.MeleePowerAttackMul - 1) * (self:GetPowerCombo()/4) + dmginfo:SetDamage(damage) + + if self:GetPowerCombo() >= 4 then + self:SetPowerCombo(0) + if SERVER then + local pitch = math.Clamp(math.random(90, 110) + 15 * (1 - damage/45), 50 , 200) + owner:EmitSound("npc/strider/strider_skewer1.wav", 75, pitch) + end + end + end + + hitent:MeleeViewPunch(damage) + if hitent:IsHeadcrab() then + damage = damage * 2 + dmginfo:SetDamage(damage) + end + + if SERVER then + hitent:SetLastHitGroup(tr.HitGroup) + if tr.HitGroup == HITGROUP_HEAD then + hitent:SetWasHitInHead() + end + + if hitent:WouldDieFrom(damage, tr.HitPos) then + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 400 * owner:GetAimVector()) + end + end + + vel = hitent:GetVelocity() + else + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + + --if not hitent.LastHeld or CurTime() >= hitent.LastHeld + 0.1 then -- Don't allow people to shoot props out of their hands + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + + hitent:DispatchTraceAttack(dmginfo, tr, owner:GetAimVector()) + + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + -- Invalidate the engine knockback vs. players + if vel then + hitent:SetLocalVelocity(vel) + end + --end + + -- Perform our own knockback vs. players + if hitent:IsPlayer() then + local knockback = self.MeleeKnockBack * (owner.MeleeKnockbackMultiplier or 1) + if knockback > 0 then + hitent:ThrowFromPositionSetZ(tr.StartPos, knockback, nil, true) + end + + if owner.MeleeLegDamageAdd and owner.MeleeLegDamageAdd > 0 then + hitent:AddLegDamage(owner.MeleeLegDamageAdd) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetStart(tr.StartPos) + effectdata:SetNormal(tr.HitNormal) + util.Effect("RagdollImpact", effectdata) + if not tr.HitSky then + effectdata:SetSurfaceProp(tr.SurfaceProps) + effectdata:SetDamageType(self.DamageType) + effectdata:SetHitBox(tr.HitBox) + effectdata:SetEntity(hitent) + util.Effect("Impact", effectdata) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_m4.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_m4.lua index c8d8ee0..76eb73a 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_m4.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_m4.lua @@ -1,30 +1,31 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Stalker' M4" +SWEP.Description = "Using this gun will severely reduce the distance in which zombies can see your aura." +SWEP.Slot = 2 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Stalker' M4" - SWEP.Description = "Using this gun will severely reduce the distance in which zombies can see your aura." - SWEP.Slot = 2 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 SWEP.HUD3DBone = "v_weapon.m4_Parent" SWEP.HUD3DPos = Vector(-0.5, -5, -1.2) - SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DAng = Angle(0, -5, 0) SWEP.HUD3DScale = 0.015 end SWEP.Base = "weapon_zs_base" -SWEP.HoldType = "smg" +SWEP.HoldType = "ar2" SWEP.ViewModel = "models/weapons/cstrike/c_rif_m4a1.mdl" SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_m4a1.Single") -SWEP.Primary.Damage = 24 +SWEP.Primary.Damage = 24.5 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.11 @@ -36,13 +37,106 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 -SWEP.ConeMax = 0.125 -SWEP.ConeMin = 0.045 +SWEP.ConeMax = 5 +SWEP.ConeMin = 1.5 SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 4 +SWEP.MaxStock = 3 + SWEP.IronSightsPos = Vector(-3, 0, 2) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.625) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.187) +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Aspirant' Burst M4", "Increased damage, shoots in a slower, more accurate 3 round burst", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.1 + wept.Primary.Delay = wept.Primary.Delay * 5.7 + wept.Primary.BurstShots = 3 + wept.ConeMin = wept.ConeMin * 0.6 + wept.ConeMax = wept.ConeMax * 0.5 + + wept.PrimaryAttack = function(self) + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + end + + wept.Think = function(self) + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/6) + + if self:Clip1() > 0 and self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end + end + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/m4a1/m4a1_unsil-1.wav", 75, math.random(82, 86), 0.75) + self:EmitSound("weapons/galil/galil-1.wav", 75, math.random(154, 156), 0.6, CHAN_WEAPON + 20) + end + + if CLIENT then + wept.VElements = { + ["lol"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top", pos = Vector(0.317, 0.012, -15.013), angle = Angle(180, 90, 180), size = Vector(0.201, 0.115, 0.261), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["SCOPE1"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_lamp.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "LOL2", pos = Vector(-0.899, -0.706, -0.01), angle = Angle(0, -180, 90), size = Vector(0.136, 0.079, 0.079), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["LOL2"] = { type = "Model", model = "models/Mechanics/robotics/d1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "grip", pos = Vector(-6.801, 0.108, 2.618), angle = Angle(0, 0, 90), size = Vector(0.071, 0.056, 0.048), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_c17/FurnitureBoiler001a.mdl", bone = "v_weapon.m4_Parent", rel = "", pos = Vector(0.092, -4.251, -17.129), angle = Angle(-1.66, -8.7, 180), size = Vector(0.054, 0.054, 0.087), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["SCOPE1+"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_lamp.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "SCOPE1", pos = Vector(-0.916, 0, 0), angle = Angle(0, 180, 0), size = Vector(0.136, 0.079, 0.079), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["grip"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top", pos = Vector(0.017, 0.479, -8.181), angle = Angle(90, 90, 0), size = Vector(0.063, 0.061, 0.057), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["rail"] = { type = "Model", model = "models/combine_apc.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "lol", pos = Vector(-0.225, 0.217, 1.909), angle = Angle(0, 90, 90), size = Vector(0.02, 0.045, 0.035), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["GLASS"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "SCOPE1", pos = Vector(0.37, 0, 0.319), angle = Angle(0, 0, 0), size = Vector(2.65, 0.027, 0.027), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_models/snip_awp/v_awp_scope", skin = 0, bodygroup = {} } + } + + wept.WElements = { + ["GLASS"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "SCOPE1", pos = Vector(0.37, 0, 0.319), angle = Angle(0, 0, 0), size = Vector(2.65, 0.027, 0.027), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/weapons/v_models/snip_awp/v_awp_scope", skin = 0, bodygroup = {} }, + ["SCOPE1"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_lamp.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "LOL2", pos = Vector(-0.899, -0.706, -0.01), angle = Angle(0, -180, 90), size = Vector(0.136, 0.079, 0.079), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["LOL2"] = { type = "Model", model = "models/Mechanics/robotics/d1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "grip", pos = Vector(-9.316, 0.108, 2.97), angle = Angle(0, 0, 90), size = Vector(0.071, 0.056, 0.048), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_c17/FurnitureBoiler001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(23.756, 0.8, -6.969), angle = Angle(0, 90, 99.805), size = Vector(0.054, 0.054, 0.128), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["SCOPE1+"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_lamp.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "SCOPE1", pos = Vector(-0.916, 0, 0), angle = Angle(0, 180, 0), size = Vector(0.136, 0.079, 0.079), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["grip"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top", pos = Vector(-0.062, 0.479, -8.021), angle = Angle(90, 90, 0), size = Vector(0.072, 0.061, 0.057), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["RAIL"] = { type = "Model", model = "models/combine_apc.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lol", pos = Vector(0.172, 0.31, 1.508), angle = Angle(0, 90, 90), size = Vector(0.019, 0.054, 0.032), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["lol"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top", pos = Vector(0.393, 0.192, -17.122), angle = Angle(180, 90, 180), size = Vector(0.21, 0.115, 0.372), color = Color(175, 175, 165, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } + } + + wept.HUD3DPos = Vector(-1.2, -5, -1.2) + end +end) +branch.Killicon = "weapon_zs_aspirant" + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end + function SWEP:GetAuraRange() return 512 end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_magnum.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_magnum.lua index 6a2c8ee..80a2337 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_magnum.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_magnum.lua @@ -1,11 +1,12 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Ricochete' Magnum" +SWEP.Description = "This gun's bullets will bounce off of walls which will then deal extra damage." +SWEP.Slot = 1 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Ricochete' Magnum" - SWEP.Description = "This gun's bullets will bounce off of walls which will then deal extra damage." - SWEP.Slot = 1 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -35,22 +36,56 @@ SWEP.Primary.Ammo = "pistol" SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.075 -SWEP.ConeMin = 0.04 +SWEP.Tier = 2 + +SWEP.ConeMax = 3.75 +SWEP.ConeMin = 2 +SWEP.BounceMulti = 1.5 SWEP.IronSightsPos = Vector(-4.65, 4, 0.25) SWEP.IronSightsAng = Vector(0, 0, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.7, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.35, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.07, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Backlash' Magnum", "Gets more accurate for each direct hit, but less damage on non-bounced shots", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.85 + wept.BounceMulti = 1.764 + wept.GetCone = function(self) + return BaseClass.GetCone(self) * (1 - self:GetDTInt(9)/13) + end + wept.FinishReload = function(self) + self:SetDTInt(9, 0) + BaseClass.FinishReload(self) + end +end) + local function DoRicochet(attacker, hitpos, hitnormal, normal, damage) + local RicoCallback = function(att, tr, dmginfo) + local ent = tr.Entity + local wep = att:GetActiveWeapon() + if wep.Branch == 1 and ent:IsValidZombie() then + wep:SetDTInt(9, wep:GetDTInt(9) + 2) + end + end + attacker.RicochetBullet = true - attacker:FireBullets({Num = 1, Src = hitpos, Dir = 2 * hitnormal * hitnormal:Dot(normal * -1) + normal, Spread = Vector(0, 0, 0), Tracer = 1, TracerName = "rico_trace", Force = damage * 0.15, Damage = damage, Callback = GenericBulletCallback}) + if attacker:IsValid() then + attacker:FireBulletsLua(hitpos, 2 * hitnormal * hitnormal:Dot(normal * -1) + normal, 0, 1, damage, nil, nil, "tracer_rico", RicoCallback, nil, nil, nil, nil, attacker:GetActiveWeapon()) + end attacker.RicochetBullet = nil end function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity if SERVER and tr.HitWorld and not tr.HitSky then - local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() * 1.5 + local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() * attacker:GetActiveWeapon().BounceMulti timer.Simple(0, function() DoRicochet(attacker, hitpos, hitnormal, normal, dmg) end) end - GenericBulletCallback(attacker, tr, dmginfo) + if SERVER then + local wep = attacker:GetActiveWeapon() + if wep.Branch == 1 and ent:IsValidZombie() then + wep:SetDTInt(9, wep:GetDTInt(9) + 1) + end + end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack.lua index e5588f5..1dc1a71 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Manhack" - SWEP.Description = "A deployable, remotely controlled device.\nIdeal for scouting but also can be used for attacking from safety." +SWEP.PrintName = "Manhack" +SWEP.Description = "A deployable, remotely controlled device.\nIdeal for scouting but also can be used for attacking from safety.\nHas sharp blades that pierce into zombies." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 SWEP.ShowViewModel = true @@ -49,11 +49,13 @@ SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Ammo = "dummy" +SWEP.MaxStock = 10 + SWEP.WalkSpeed = SPEED_FAST function SWEP:Initialize() self:SetWeaponHoldType("grenade") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) if CLIENT then self:Anim_Initialize() @@ -61,10 +63,10 @@ function SWEP:Initialize() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end - for _, ent in pairs(ents.FindByClass("prop_manhac*")) do - if ent:GetOwner() == self.Owner then return false end + for _, ent in pairs(ents.FindByClass("prop_manhack*")) do + if ent:GetObjectOwner() == self:GetOwner() then return false end end if self:GetPrimaryAmmoCount() <= 0 then @@ -79,7 +81,7 @@ function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - local owner = self.Owner + local owner = self:GetOwner() self:SendWeaponAnim(ACT_VM_THROW) owner:DoAttackEvent() @@ -90,8 +92,9 @@ function SWEP:PrimaryAttack() local ent = ents.Create(self.DeployClass) if ent:IsValid() then ent:SetPos(owner:GetShootPos()) - ent:SetOwner(owner) ent:Spawn() + ent:SetObjectOwner(owner) + ent:SetupPlayerSkills() local stored = owner:PopPackedItem(ent:GetClass()) if stored then @@ -102,7 +105,7 @@ function SWEP:PrimaryAttack() local phys = ent:GetPhysicsObject() if phys:IsValid() then phys:Wake() - phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 200) + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 200) end if not owner:HasWeapon(self.ControlWeapon) then @@ -129,7 +132,7 @@ function SWEP:Reload() end function SWEP:Deploy() - GAMEMODE:WeaponDeployed(self.Owner, self) + GAMEMODE:WeaponDeployed(self:GetOwner(), self) if self:GetPrimaryAmmoCount() <= 0 then self:SendWeaponAnim(ACT_VM_THROW) @@ -169,7 +172,7 @@ local colWhite = Color(220, 220, 220, 230) SWEP.HUD3DPos = Vector(5, 2, 0) function SWEP:PostDrawViewModel(vm) - if not self.HUD3DPos or GAMEMODE.WeaponHUDMode == 1 then return end + if not self.HUD3DPos or not GAMEMODE:ShouldDraw3DWeaponHUD() then return end local bone = vm:LookupBone("ValveBiped.Bip01_R_Hand") if not bone then return end @@ -199,4 +202,4 @@ function SWEP:PostDrawViewModel(vm) draw.RoundedBox(32, x, y, wid, hei, colBG) draw.SimpleText(clip, "ZS3D2DFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) cam.End3D2D() -end \ No newline at end of file +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack_saw.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack_saw.lua index 3dcb3ac..f1753e9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack_saw.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhack_saw.lua @@ -1,12 +1,10 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Manhack - Saw Attachment" - SWEP.Description = "A modified manhack with a saw blade attachment.\nDoes significantly more damage and is more durable. Slightly less easy to control." -end - SWEP.Base = "weapon_zs_manhack" +SWEP.PrintName = "Manhack - Saw Attachment" +SWEP.Description = "A modified manhack with a saw blade attachment.\nDoes significantly more damage and is more durable. Slightly less easy to control." + SWEP.DeployClass = "prop_manhack_saw" SWEP.ControlWeapon = "weapon_zs_manhackcontrol_saw" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol.lua index 0d99f81..ca46564 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Manhack Control" - SWEP.Description = "Controller for your Manhack." +SWEP.PrintName = "Manhack Control" +SWEP.Description = "Controller for your Manhack." +if CLIENT then SWEP.ViewModelFOV = 50 SWEP.BobScale = 0.5 @@ -41,6 +41,10 @@ SWEP.NoPickupNotification = true SWEP.HoldType = "slam" +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self:SetDeploySpeed(10) @@ -54,12 +58,12 @@ function SWEP:Think() if SERVER then for _, ent in pairs(ents.FindByClass(self.EntityClass)) do - if ent:GetOwner() == self.Owner then + if ent:IsValid() and ent:GetObjectOwner() == self:GetOwner() then return end end - self.Owner:StripWeapon(self:GetClass()) + self:GetOwner():StripWeapon(self:GetClass()) end end @@ -68,7 +72,7 @@ function SWEP:PrimaryAttack() self:SetDTBool(0, not self:GetDTBool(0)) if CLIENT then - LocalPlayer():EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) + MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) end end end @@ -79,9 +83,9 @@ end function SWEP:Reload() return false end - + function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -99,6 +103,6 @@ end if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol_saw.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol_saw.lua index f78fd89..8b75915 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol_saw.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_manhackcontrol_saw.lua @@ -2,9 +2,7 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_manhackcontrol" -if CLIENT then - SWEP.PrintName = "Manhack Control - Saw" - SWEP.Description = "Controller for your modified Manhack." -end +SWEP.PrintName = "Manhack Control - Saw" +SWEP.Description = "Controller for your modified Manhack." SWEP.EntityClass = "prop_manhack_saw" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_meattenderizer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_meattenderizer.lua new file mode 100644 index 0000000..dbc23cc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_meattenderizer.lua @@ -0,0 +1,69 @@ +AddCSLuaFile() + +SWEP.PrintName = "Meat Tenderizer" +SWEP.Description = "A slow swinging meat tenderizer with not much special about it apart from the fact it's a culinary tool." + +if CLIENT then + SWEP.ViewModelFOV = 70 + SWEP.ShowViewModel = true + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["spikes2"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "sledgetop", pos = Vector(-0.051, -5.915, -0.113), angle = Angle(0, 0, -90), size = Vector(0.076, 1.013, 0.356), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes2+"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "sledgetop", pos = Vector(-0.047, 5.934, 0.104), angle = Angle(0, 0, 90), size = Vector(0.076, 1.013, 0.356), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["sledgetop"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.466, 2.184, -22.969), angle = Angle(0, 90, -5.652), size = Vector(0.196, 0.326, 0.284), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "sledgetop", pos = Vector(-0.087, -5.854, 0), angle = Angle(-90, 90, 0), size = Vector(0.059, 0.95, 0.374), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes+"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "sledgetop", pos = Vector(-0.04, 5.888, 0), angle = Angle(90, 90, 0), size = Vector(0.059, 0.95, 0.374), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["top"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "sledge", pos = Vector(0, 0, 26.433), angle = Angle(90, 90, 0), size = Vector(0.196, 0.305, 0.284), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes1++"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "sledge", pos = Vector(-5.422, -0.069, 26.549), angle = Angle(0, -90, 90), size = Vector(0.059, 0.95, 0.374), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes1+++"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "sledge", pos = Vector(5.407, -0.069, 26.538), angle = Angle(0, 90, 90), size = Vector(0.059, 0.95, 0.374), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes1"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "sledge", pos = Vector(-5.487, 0, 26.361), angle = Angle(90, -90, 90), size = Vector(0.076, 1.011, 0.356), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["spikes1+"] = { type = "Model", model = "models/props_phx/mechanics/slider1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "sledge", pos = Vector(5.535, 0.126, 26.361), angle = Angle(90, 90, 90), size = Vector(0.076, 1.011, 0.356), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["sledge"] = { type = "Model", model = "models/weapons/w_sledgehammer.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.203, 1.284, 4.852), angle = Angle(180, 0, 0), size = Vector(0.759, 0.759, 0.759), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee2" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/v_sledgehammer/c_sledgehammer.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 127 +SWEP.MeleeRange = 60 +SWEP.MeleeSize = 3.55 +SWEP.MeleeKnockBack = 240 + +SWEP.Primary.Delay = 1.25 + +SWEP.Tier = 3 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.SwingRotation = Angle(60, 0, -80) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingTime = 0.75 +SWEP.SwingHoldType = "melee" + +SWEP.AllowQualityWeapons = true +SWEP.Culinary = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_IMPACT_DELAY, -0.12) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(25, 35)) +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/metal/metal_canister_impact_hard"..math.random(3)..".wav", 75, math.Rand(70, 74)) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/flesh/flesh_impact_hard"..math.random(2, 3)..".wav", 75, math.Rand(80, 84)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicalkit.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicalkit.lua index c1e2e4c..15c7358 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicalkit.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicalkit.lua @@ -1,12 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Medical Kit" - SWEP.Description = "An advanced kit of medicine, bandages, and morphine.\nVery useful for keeping a group of survivors healthy.\nUse PRIMARY FIRE to heal other players.\nUse SECONDARY FIRE to heal yourself.\nHealing other players is not only faster but you get a nice point bonus!" - SWEP.Slot = 4 - SWEP.SlotPos = 0 +SWEP.PrintName = "Medical Kit" +SWEP.Description = "An advanced kit of medicine, bandages, and morphine.\nVery useful for keeping a group of survivors healthy.\nUse PRIMARY FIRE to heal other players.\nUse SECONDARY FIRE to heal yourself.\nHealing other players is not only faster but you get a nice point bonus!" +SWEP.Slot = 4 +SWEP.SlotPos = 0 - SWEP.ViewModelFOV = 50 +if CLIENT then + SWEP.ViewModelFOV = 57 SWEP.ViewModelFlip = false SWEP.BobScale = 2 @@ -19,15 +19,15 @@ SWEP.WorldModel = "models/weapons/w_medkit.mdl" SWEP.ViewModel = "models/weapons/c_medkit.mdl" SWEP.UseHands = true +SWEP.Heal = 15 SWEP.Primary.Delay = 10 -SWEP.Primary.Heal = 15 SWEP.Primary.ClipSize = 30 SWEP.Primary.DefaultClip = 150 SWEP.Primary.Ammo = "Battery" -SWEP.Secondary.Delay = 20 -SWEP.Secondary.Heal = 10 +SWEP.Secondary.DelayMul = 20 / SWEP.Primary.Delay +SWEP.Secondary.HealMul = 10 / SWEP.Heal SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 @@ -35,13 +35,24 @@ SWEP.Secondary.Ammo = "dummy" SWEP.WalkSpeed = SPEED_NORMAL +SWEP.HealRange = 36 + SWEP.NoMagazine = true +SWEP.AllowQualityWeapons = true SWEP.HoldType = "slam" +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_HEALCOOLDOWN, -0.8) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEALRANGE, 4, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEALING, 1.5) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Restoration Kit", "Always uses the same amount of ammo, increased cooldown", function(wept) + wept.FixUsage = true + wept.Primary.Delay = wept.Primary.Delay * 1.3 +end) + function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) end function SWEP:Think() @@ -54,51 +65,56 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() - owner:LagCompensation(true) - local ent = owner:MeleeTrace(32, 2).Entity - owner:LagCompensation(false) + local trtbl = owner:CompensatedPenetratingMeleeTrace(self.HealRange, 2, nil, nil, true) + local ent + for _, tr in pairs(trtbl) do + local test = tr.Entity + if test and test:IsValidLivingHuman() and gamemode.Call("PlayerCanBeHealed", test) then + ent = test - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == owner:Team() and ent:Alive() and gamemode.Call("PlayerCanBeHealed", ent) then - local health, maxhealth = ent:Health(), ent:GetMaxHealth() - local multiplier = owner.HumanHealMultiplier or 1 - local toheal = math.min(self:GetPrimaryAmmoCount(), math.ceil(math.min(self.Primary.Heal * multiplier, maxhealth - health))) - local totake = math.ceil(toheal / multiplier) - if toheal > 0 then - self:SetNextCharge(CurTime() + self.Primary.Delay * math.min(1, toheal / self.Primary.Heal)) - owner.NextMedKitUse = self:GetNextCharge() - - self:TakeCombinedPrimaryAmmo(totake) - - ent:SetHealth(health + toheal) - self:EmitSound("items/medshot4.wav") - - self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - - owner:DoAttackEvent() - self.IdleAnimation = CurTime() + self:SequenceDuration() - - gamemode.Call("PlayerHealedTeamMember", owner, ent, toheal, self) + break end end -end -function SWEP:SecondaryAttack() - local owner = self.Owner - if not self:CanPrimaryAttack() or not gamemode.Call("PlayerCanBeHealed", owner) then return end + if not ent then return end - local health, maxhealth = owner:Health(), owner:GetMaxHealth() - local multiplier = owner.HumanHealMultiplier or 1 - local toheal = math.min(self:GetPrimaryAmmoCount(), math.ceil(math.min(self.Secondary.Heal * multiplier, maxhealth - health))) - local totake = math.ceil(toheal / multiplier) - if toheal > 0 then - self:SetNextCharge(CurTime() + self.Secondary.Delay * math.min(1, toheal / self.Secondary.Heal)) + local multiplier = self.MedicHealMul or 1 + local cooldownmultiplier = self.MedicCooldownMul or 1 + local healed = owner:HealPlayer(ent, math.min(self:GetCombinedPrimaryAmmo(), self.Heal)) + local totake = self.FixUsage and 15 or math.ceil(healed / multiplier) + + if totake > 0 then + self:SetNextCharge(CurTime() + self.Primary.Delay * math.min(1, healed / self.Heal) * cooldownmultiplier) + owner.NextMedKitUse = self:GetNextCharge() + + self:TakeCombinedPrimaryAmmo(totake) + + self:EmitSound("items/medshot4.wav") + + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + + owner:DoAttackEvent() + self.IdleAnimation = CurTime() + self:SequenceDuration() + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if not self:CanPrimaryAttack() or not gamemode.Call("PlayerCanBeHealed", owner) then return end + + local multiplier = self.MedicHealMul or 1 + local cooldownmultiplier = self.MedicCooldownMul or 1 + local healed = owner:HealPlayer(owner, math.min(self:GetCombinedPrimaryAmmo(), self.Heal * self.Secondary.HealMul)) + local totake = self.FixUsage and 10 or math.ceil(healed / multiplier) + + if totake > 0 then + self:SetNextCharge(CurTime() + self.Primary.Delay * self.Secondary.DelayMul * math.min(1, healed / self.Heal * self.Secondary.HealMul) * cooldownmultiplier) owner.NextMedKitUse = self:GetNextCharge() self:TakeCombinedPrimaryAmmo(totake) - owner:SetHealth(health + toheal) self:EmitSound("items/smallmedkit1.wav") self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) @@ -109,7 +125,7 @@ function SWEP:SecondaryAttack() end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self.IdleAnimation = CurTime() + self:SequenceDuration() @@ -122,7 +138,7 @@ function SWEP:Deploy() end function SWEP:Holster() - if CLIENT then + if CLIENT and self:GetOwner() == MySelf then hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") GAMEMODE.MedicalAura = false end @@ -131,7 +147,7 @@ function SWEP:Holster() end function SWEP:OnRemove() - if CLIENT and self.Owner == LocalPlayer() then + if CLIENT and self:GetOwner() == MySelf then hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") GAMEMODE.MedicalAura = false end @@ -149,7 +165,7 @@ function SWEP:GetNextCharge() end function SWEP:CanPrimaryAttack() - local owner = self.Owner + local owner = self:GetOwner() if owner:IsHolding() or owner:GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then @@ -165,14 +181,13 @@ end if not CLIENT then return end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end local texGradDown = surface.GetTextureID("VGUI/gradient_down") function SWEP:DrawHUD() - local screenscale = BetterScreenScale() - local wid, hei = 256, 16 + local wid, hei = 384, 16 local x, y = ScrW() - wid - 32, ScrH() - hei - 72 local texty = y - 4 - draw.GetFontHeight("ZSHUDFontSmall") @@ -181,15 +196,15 @@ function SWEP:DrawHUD() surface.SetDrawColor(5, 5, 5, 180) surface.DrawRect(x, y, wid, hei) - surface.SetDrawColor(255, 0, 0, 180) + surface.SetDrawColor(50, 255, 50, 180) surface.SetTexture(texGradDown) - surface.DrawTexturedRect(x, y, math.min(1, timeleft / math.max(self.Primary.Delay, self.Secondary.Delay)) * wid, hei) + surface.DrawTexturedRect(x, y, math.min(1, timeleft / math.max(self.Primary.Delay, self.Primary.Delay * self.Secondary.DelayMul)) * wid, hei) - surface.SetDrawColor(255, 0, 0, 180) + surface.SetDrawColor(50, 255, 50, 180) surface.DrawOutlinedRect(x, y, wid, hei) end - draw.SimpleText("Medical Kit", "ZSHUDFontSmall", x, texty, COLOR_GREEN, TEXT_ALIGN_LEFT) + draw.SimpleText(self.PrintName, "ZSHUDFontSmall", x, texty, COLOR_GREEN, TEXT_ALIGN_LEFT) local charges = self:GetPrimaryAmmoCount() if charges > 0 then @@ -198,7 +213,7 @@ function SWEP:DrawHUD() draw.SimpleText(charges, "ZSHUDFontSmall", x + wid, texty, COLOR_DARKRED, TEXT_ALIGN_RIGHT) end - if GetConVarNumber("crosshair") == 1 then + if GetConVar("crosshair"):GetInt() == 1 then self:DrawCrosshairDot() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/cl_init.lua new file mode 100644 index 0000000..1a83d77 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/cl_init.lua @@ -0,0 +1,16 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 70 + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Grenade_body"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 2.5, -7), angle = Angle(0, -90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Anim_Attachment_RH", rel = "", pos = Vector(0, 4, 0.5), angle = Angle(0, 0, -90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/init.lua new file mode 100644 index 0000000..21b4b6f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/init.lua @@ -0,0 +1,5 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_mediccloudbomb" +SWEP.ThrowAngVel = 30 +SWEP.ThrowVel = 600 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/shared.lua new file mode 100644 index 0000000..077640d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_mediccloudbomb/shared.lua @@ -0,0 +1,14 @@ +SWEP.PrintName = "Medic Cloud Bomb" +SWEP.Description = "Explodes in to a cloud of healing gas. Heals 2HP, every second, for 10 seconds." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/healthvial.mdl" + +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "mediccloudbomb" + +SWEP.MaxStock = 4 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun.lua deleted file mode 100644 index e3a908a..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun.lua +++ /dev/null @@ -1,110 +0,0 @@ -AddCSLuaFile() - -if CLIENT then - SWEP.PrintName = "'Savior' Medic Gun" - SWEP.Description = "Fires medical darts which can heal at a range. Although less potent than a full medical kit, it can be fired rapidly and used at a range." - SWEP.Slot = 4 - SWEP.SlotPos = 0 - - SWEP.ViewModelFlip = false - SWEP.ViewModelFOV = 60 - - SWEP.HUD3DBone = "ValveBiped.square" - SWEP.HUD3DPos = Vector(1.1, 0.25, -2) - SWEP.HUD3DScale = 0.015 - - SWEP.WElements = { - ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.5, 2, -3.701), angle = Angle(0, -90, -8), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } - } - SWEP.VElements = { - ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.square", rel = "", pos = Vector(0, 0.5, 3), angle = Angle(0, 0, 90), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } - } -end - -SWEP.Base = "weapon_zs_base" - -SWEP.HoldType = "pistol" - -SWEP.ViewModel = "models/weapons/c_pistol.mdl" -SWEP.WorldModel = "models/weapons/w_pistol.mdl" -SWEP.UseHands = true - -SWEP.CSMuzzleFlashes = false - -SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") - -SWEP.Primary.Delay = 0.25 - -SWEP.Primary.ClipSize = 25 -SWEP.Primary.DefaultClip = 150 -SWEP.Primary.Ammo = "Battery" -SWEP.RequiredClip = 5 - -SWEP.WalkSpeed = SPEED_NORMAL - -SWEP.NoMagazine = true - -SWEP.ConeMax = 0.005 -SWEP.ConeMin = 0.005 - -SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) -SWEP.IronSightsAng = Vector(-0.15, -1, 2) - -function SWEP:ShootBullets(dmg, numbul, cone) - local owner = self.Owner - self:SendWeaponAnimation() - owner:DoAttackEvent() - - if CLIENT then return end - - local aimvec = owner:GetAimVector() - - local ent = ents.Create("projectile_healdart") - if ent:IsValid() then - ent:SetPos(owner:GetShootPos()) - ent:SetAngles(aimvec:Angle()) - ent:SetOwner(owner) - ent:Spawn() - - ent.Heal = math.ceil(ent.Heal * (owner.HumanHealMultiplier or 1)) - - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:SetVelocityInstantaneous(aimvec * 2000) - end - end -end - -function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) - - self.IdleAnimation = CurTime() + self:SequenceDuration() - - if CLIENT then - hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical) - GAMEMODE.MedicalAura = true - end - - return true -end - -function SWEP:Holster() - if CLIENT then - hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") - GAMEMODE.MedicalAura = false - end - - return true -end - -function SWEP:OnRemove() - if CLIENT and self.Owner == LocalPlayer() then - hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") - GAMEMODE.MedicalAura = false - end -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/cl_init.lua new file mode 100644 index 0000000..b306d17 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/cl_init.lua @@ -0,0 +1,54 @@ +INC_CLIENT() + +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.HUD3DBone = "ValveBiped.square" +SWEP.HUD3DPos = Vector(1.1, 0.25, -2) +SWEP.HUD3DScale = 0.015 + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.5, 2, -3.701), angle = Angle(0, -90, -8), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.square", rel = "", pos = Vector(0, 0.5, 3), angle = Angle(0, 0, 90), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +function SWEP:Draw2DHUD() + BaseClass.Draw2DHUD(self) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local player = self:GetSeekedPlayer() + local screenscale = BetterScreenScale() + surface.SetFont("ZSHUDFont") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + local _, nTEXH = surface.GetTextSize(text) + + draw.SimpleTextBlurry(text, "ZSHUDFont", ScrW() - 218 * screenscale, ScrH() - nTEXH * 3.5, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) +end + +function SWEP:Draw3DHUD(vm, pos, ang) + BaseClass.Draw3DHUD(self, vm, pos, ang) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local wid, hei = 180, 200 + local x, y = wid * 0, hei * -1 + + local player = self:GetSeekedPlayer() + surface.SetFont("ZS3D2DFontSmall") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + draw.SimpleTextBlurry(text, "ZS3D2DFontSmall", x, y, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/init.lua new file mode 100644 index 0000000..9eace35 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_healdart" +SWEP.Primary.ProjVelocity = 2000 + +function SWEP:EntModify(ent) + local owner = self:GetOwner() + + ent:SetSeeked(self:GetSeekedPlayer() or nil) + ent.Heal = self.Heal * (owner.MedDartEffMul or 1) + ent.BuffDuration = self.BuffDuration +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/shared.lua new file mode 100644 index 0000000..3b896f6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicgun/shared.lua @@ -0,0 +1,110 @@ +SWEP.PrintName = "'Savior' Medic Gun" +SWEP.Description = "Fires medical darts which can heal at a range, and grant a small speed boost. It can be fired rapidly and used at a range, but can miss the target." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/c_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") + +SWEP.Primary.Delay = 0.25 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Ammo = "Battery" +SWEP.RequiredClip = 5 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.ReloadSpeed = 0.85 + +SWEP.BuffDuration = 10 + +SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) +SWEP.IronSightsAng = Vector(-0.15, -1, 2) + +SWEP.AllowQualityWeapons = true + +SWEP.Heal = 5.1 + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_BUFF_DURATION, 2) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEALING, 0.6) + +function SWEP:GetFireDelay() + local owner = self:GetOwner() + return (self.Primary.Delay * (owner.MedgunFireDelayMul or 1)) / (owner:GetStatus("frost") and 0.7 or 1) +end + +function SWEP:GetReloadSpeedMultiplier() + local owner = self:GetOwner() + return BaseClass.GetReloadSpeedMultiplier(self) * (owner.MedgunReloadSpeedMul or 1) -- Convention is now BaseClass instead of self.BaseClass +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextSecondaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + + self:SetNextSecondaryFire(CurTime() + 0.1) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local targetent = owner:CompensatedMeleeTrace(2048, 2, nil, nil, true).Entity + local locked = targetent and targetent:IsValidLivingHuman() and gamemode.Call("PlayerCanBeHealed", targetent) + + if CLIENT then + self:EmitSound(locked and "npc/scanner/combat_scan4.wav" or "npc/scanner/scanner_scan5.wav", 65, locked and 75 or 200) + end + self:SetSeekedPlayer(locked and targetent) +end + +function SWEP:SetSeekedPlayer(ent) + self:SetDTEntity(6, ent) +end + +function SWEP:GetSeekedPlayer() + return self:GetDTEntity(6) +end + +function SWEP:Deploy() + if CLIENT then + hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical) + GAMEMODE.MedicalAura = true + end + + return BaseClass.Deploy(self) +end + +function SWEP:Holster() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end + + return true +end + +function SWEP:OnRemove() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/cl_init.lua new file mode 100644 index 0000000..60613a8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/cl_init.lua @@ -0,0 +1,94 @@ +INC_CLIENT() + +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 55 +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = true + +SWEP.IronsightsMultiplier = 0.25 +SWEP.HUD3DBone = "v_weapon.scout_Parent" +SWEP.HUD3DPos = Vector(-1.25, -2.75, -6) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.017 + +SWEP.IronSightsPos = Vector(5.015, -8, 2.52) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.VElements = { + ["body2"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-2.431, 0, 7.743), angle = Angle(-180, 90, 0), size = Vector(0.541, 0.736, 1.307), color = Color(85, 120, 195, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-1.833, 0, 11.97), angle = Angle(90, 0, 0), size = Vector(0.717, 0.061, 0.061), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body3"] = { type = "Model", model = "models/props_trainstation/train001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-2.57, 0, -5.768), angle = Angle(0, 90, 90), size = Vector(0.009, 0.016, 0.012), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "v_weapon.scout_Parent", rel = "", pos = Vector(0, -5.212, -11.976), angle = Angle(0, 90, 180), size = Vector(0.368, 0.616, 0.603), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body4"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-5.567, 0, -7.106), angle = Angle(-90, 0, 0), size = Vector(0.009, 0.014, 0.01), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body"] = { type = "Model", model = "models/props_c17/gravestone003a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-2.309, 0, 0.996), angle = Angle(-90, 0, 0), size = Vector(3.167, 0.043, 0.061), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body5"] = { type = "Model", model = "models/props_combine/breenconsole.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-3.738, 0, 5.004), angle = Angle(0, -90, -90), size = Vector(0.096, 0.284, 0.081), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["stuff"] = { type = "Model", model = "models/props_c17/FurnitureDrawer001a_Chunk05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0.041, 0, -5.003), angle = Angle(90, 0, 0), size = Vector(0.05, 0.035, 0.05), color = Color(255, 255, 195, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["body2"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-2.922, 0, 15.505), angle = Angle(-180, 90, 0), size = Vector(0.582, 0.805, 1.307), color = Color(85, 120, 195, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["body3"] = { type = "Model", model = "models/props_trainstation/train001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-2.491, 0, -2.517), angle = Angle(0, 90, 90), size = Vector(0.009, 0.016, 0.012), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-2.411, 0, 16.427), angle = Angle(90, 0, 0), size = Vector(0.99, 0.061, 0.061), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(11.253, 0.721, -7.623), angle = Angle(-100, 0, 0), size = Vector(0.433, 0.616, 0.755), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body4"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-6.316, 0, -2.192), angle = Angle(-90, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body"] = { type = "Model", model = "models/props_c17/gravestone003a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-2.75, 0, 8.814), angle = Angle(-90, 0, 0), size = Vector(3.167, 0.043, 0.065), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["body5"] = { type = "Model", model = "models/props_combine/breenconsole.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-3.738, 0, 12.616), angle = Angle(0, -90, -90), size = Vector(0.096, 0.419, 0.093), color = Color(85, 120, 195, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["stuff"] = { type = "Model", model = "models/props_c17/FurnitureDrawer001a_Chunk05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0.046, 0, -6.447), angle = Angle(90, 0, 0), size = Vector(0.05, 0.035, 0.061), color = Color(255, 255, 195, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} } +} + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) +end + +function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + self:DrawFuturisticScope() + end +end + +function SWEP:Draw2DHUD() + BaseClass.Draw2DHUD(self) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local player = self:GetSeekedPlayer() + local screenscale = BetterScreenScale() + surface.SetFont("ZSHUDFont") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + local _, nTEXH = surface.GetTextSize(text) + + draw.SimpleTextBlurry(text, "ZSHUDFont", ScrW() - 218 * screenscale, ScrH() - nTEXH * 3.5, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) +end + +function SWEP:Draw3DHUD(vm, pos, ang) + BaseClass.Draw3DHUD(self, vm, pos, ang) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local wid, hei = 180, 200 + local x, y = wid * 1.25, hei * -2.25 + + local player = self:GetSeekedPlayer() + surface.SetFont("ZS3D2DFontSmall") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + + cam.Start3D2D(pos, ang, self.HUD3DScale / 3) + draw.SimpleTextBlurry(text, "ZS3D2DFontSmall", x, y, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/init.lua new file mode 100644 index 0000000..55761e0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/init.lua @@ -0,0 +1,12 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_medicrifle" +SWEP.Primary.ProjVelocity = 3500 + +function SWEP:EntModify(ent) + local owner = self:GetOwner() + + ent:SetSeeked(self:GetSeekedPlayer() or nil) + ent.Heal = self.Heal * (owner.MedDartEffMul or 1) + ent.BuffDuration = self.BuffDuration +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/shared.lua new file mode 100644 index 0000000..5876c1c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_medicrifle/shared.lua @@ -0,0 +1,132 @@ +SWEP.PrintName = "'Convalescence' Medical Rifle" +SWEP.Description = "Fires fast-moving medical darts which can heal at a range. Darts can also inflict damage to zombies as well as reduce their damage output." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_scout.mdl" +SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") + +SWEP.Primary.Delay = 0.85 +SWEP.Primary.ClipSize = 64 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Ammo = "Battery" + +SWEP.RequiredClip = 8 +SWEP.Primary.Damage = 75 +SWEP.ReloadSpeed = 1 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.FireAnimSpeed = 1.4 + +SWEP.BuffDuration = 10 + +SWEP.Tier = 2 + +SWEP.AllowQualityWeapons = true + +SWEP.Heal = 10 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_BUFF_DURATION, 3) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEALING, 1.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Invigorator' Strength Rifle", "Strength boost instead of defence, and makes zombies more vulnerable to damage instead", function(wept) + if SERVER then + wept.EntModify = function(self, ent) + local owner = self:GetOwner() + + ent:SetDTBool(0, true) + ent:SetSeeked(self:GetSeekedPlayer() or nil) + ent.Heal = wept.Heal * (owner.MedDartEffMul or 1) + ent.BuffDuration = wept.BuffDuration + end + else + for k,v in pairs(wept.VElements) do + v.color = Color(215, 100, 75, 255) + end + end +end) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/ar2/npc_ar2_altfire.wav", 70, math.random(137, 143), 0.85) + self:EmitSound("weapons/ar2/fire1.wav", 70, math.random(105, 115), 0.85, CHAN_WEAPON + 20) + self:EmitSound("items/smallmedkit1.wav", 70, math.random(165, 170), 0.65, CHAN_WEAPON + 21) +end + +function SWEP:GetFireDelay() + local owner = self:GetOwner() + return (self.Primary.Delay * (owner.MedgunFireDelayMul or 1)) / (owner:GetStatus("frost") and 0.7 or 1) +end + +function SWEP:GetReloadSpeedMultiplier() + local owner = self:GetOwner() + return BaseClass.GetReloadSpeedMultiplier(self) * (owner.MedgunReloadSpeedMul or 1) -- Convention is now BaseClass instead of self.BaseClass +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextSecondaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + + self:SetNextSecondaryFire(CurTime() + 0.1) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local targetent = owner:CompensatedMeleeTrace(2048, 2, nil, nil, true).Entity + local locked = targetent and targetent:IsValidLivingHuman() and gamemode.Call("PlayerCanBeHealed", targetent) + + if CLIENT then + self:EmitSound(locked and "npc/scanner/combat_scan4.wav" or "npc/scanner/scanner_scan5.wav", 65, locked and 75 or 200) + end + self:SetSeekedPlayer(locked and targetent) +end + +function SWEP:SetSeekedPlayer(ent) + self:SetDTEntity(6, ent) +end + +function SWEP:GetSeekedPlayer() + return self:GetDTEntity(6) +end + +function SWEP:Deploy() + if CLIENT then + hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical) + GAMEMODE.MedicalAura = true + end + + return BaseClass.Deploy(self) +end + +function SWEP:Holster() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end + + return true +end + +function SWEP:OnRemove() + if CLIENT and self:GetOwner() == MySelf then + hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical") + GAMEMODE.MedicalAura = false + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_megamasher.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_megamasher.lua index 58c7375..2244593 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_megamasher.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_megamasher.lua @@ -1,19 +1,24 @@ AddCSLuaFile() +SWEP.PrintName = "Mega Masher" + if CLIENT then - SWEP.PrintName = "Mega Masher" SWEP.ViewModelFOV = 75 + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false SWEP.VElements = { ["base2"] = { type = "Model", model = "models/props_wasteland/buoy01.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(12, 0, 0), angle = Angle(0, 90, 270), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base"] = { type = "Model", model = "models/props_junk/iBeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.706, 2.761, -22), angle = Angle(13, -12.5, 0), size = Vector(0.15, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(0, 270, 90), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(0, 270, 90), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base4"] = { type = "Model", model = "models/weapons/w_sledgehammer.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1.299, 11), angle = Angle(0, 0, 180), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.WElements = { - ["base2"] = { type = "Model", model = "models/props_wasteland/buoy01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(12, 0, 0), angle = Angle(90, 0, 90), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base2"] = { type = "Model", model = "models/props_wasteland/buoy01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(12, 0, 0), angle = Angle(0, 90, 270), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base"] = { type = "Model", model = "models/props_junk/iBeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10, 1, -35), angle = Angle(0, 0, 0), size = Vector(0.15, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(90, 0, 90), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(0, 90, 270), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base4"] = { type = "Model", model = "models/weapons/w_sledgehammer.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1.299, 0), angle = Angle(0, 0, 180), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } end @@ -23,13 +28,14 @@ SWEP.HoldType = "melee2" SWEP.DamageType = DMG_CLUB -SWEP.ViewModel = "models/weapons/v_sledgehammer/v_sledgehammer.mdl" -SWEP.WorldModel = "models/weapons/w_sledgehammer.mdl" +SWEP.ViewModel = "models/weapons/v_sledgehammer/c_sledgehammer.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true SWEP.MeleeDamage = 190 SWEP.MeleeRange = 75 SWEP.MeleeSize = 4 -SWEP.MeleeKnockBack = 150 +SWEP.MeleeKnockBack = 420 SWEP.Primary.Delay = 2.25 @@ -40,6 +46,13 @@ SWEP.SwingOffset = Vector(0, -30, 0) SWEP.SwingTime = 1.33 SWEP.SwingHoldType = "melee" +SWEP.Tier = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_IMPACT_DELAY, -0.15, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.15, 1) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(20, 25)) end @@ -53,8 +66,10 @@ function SWEP:PlayHitFleshSound() end function SWEP:OnMeleeHit(hitent, hitflesh, tr) - local effectdata = EffectData() - effectdata:SetOrigin(tr.HitPos) - effectdata:SetNormal(tr.HitNormal) - util.Effect("explosion", effectdata) + if IsFirstTimePredicted() then + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetNormal(tr.HitNormal) + util.Effect("explosion", effectdata) + end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/cl_init.lua index fdd4d9f..45bfee1 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/cl_init.lua @@ -1,28 +1,23 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Message Beacon" -SWEP.Description = "This beacon allows you to display messages to all other humans in range.\nPress SECONDARY ATTACK to select different messages.\nPress PRIMARY ATTACK to deploy.\nPress SPRINT on a deployed message beacon that you own to pick it up." SWEP.DrawCrosshair = false -SWEP.Slot = 4 -SWEP.SlotPos = 0 - function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() @@ -39,7 +34,7 @@ end local Menu function SWEP:SecondaryAttack() - if Menu and Menu:Valid() then + if Menu and Menu:IsValid() then Menu:SetVisible(true) return end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/init.lua index 6b08a0c..da03bc9 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_messagebeacon") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_messagebeacon", false, true) end @@ -40,7 +37,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_messagebeacon if not (status and status:IsValid()) then return end @@ -69,7 +66,7 @@ function SWEP:PrimaryAttack() local stored = owner:PopPackedItem(ent:GetClass()) if stored then - ent.m_Health = stored[1] + ent.ObjHealth = stored[1] end if self:GetPrimaryAmmoCount() <= 0 then @@ -82,7 +79,7 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/shared.lua index 48df276..7f607a7 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_messagebeacon/shared.lua @@ -1,3 +1,8 @@ +SWEP.PrintName = "Message Beacon" +SWEP.Description = "This beacon allows you to display messages to all other humans in range.\nPress SECONDARY ATTACK to select different messages.\nPress PRIMARY ATTACK to deploy.\nPress SPRINT on a deployed message beacon that you own to pick it up." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/props_combine/combine_mine01.mdl") @@ -17,9 +22,13 @@ SWEP.Secondary.Ammo = "dummy" SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOW +SWEP.NoDeploySpeedChange = true + +SWEP.MaxStock = 10 + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() end @@ -41,7 +50,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) @@ -52,7 +61,7 @@ function SWEP:CanPrimaryAttack() end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/cl_init.lua new file mode 100644 index 0000000..f545485 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/cl_init.lua @@ -0,0 +1,46 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false + +SWEP.HUD3DPos = Vector(4, 0, 15) +SWEP.HUD3DAng = Angle(0, 180, 180) +SWEP.HUD3DScale = 0.04 +SWEP.HUD3DBone = "base" + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetInt() == 1 then + self:DrawCrosshairDot() + end +end + +function SWEP:DrawHUD() + local wid, hei = 384, 16 + local x, y = ScrW() - wid - 128, ScrH() - hei - 128 + local texty = y - 4 - draw.GetFontHeight("ZSHUDFont") + + local c = 0 + if not self.NextMineCheckTime or self.NextMineCheckTime < CurTime() then + for _, ent in pairs(ents.FindByClass("projectile_impactmine")) do + if (CLIENT or ent.CreateTime + 300 > CurTime()) and ent:GetOwner() == self:GetOwner() then + c = c + 1 + end + end + self.CachedMines = c + self.NextMineCheckTime = CurTime() + 1 + else + c = self.CachedMines + end + + local charges = self:GetPrimaryAmmoCount() + local chargetxt = "Mines: " .. c .. " / " .. self.MaxMines + if charges > 0 then + draw.SimpleText(chargetxt, "ZSHUDFont", x + wid, texty, COLOR_CYAN, TEXT_ALIGN_RIGHT) + end + + if GAMEMODE:ShouldDraw2DWeaponHUD() then + self:Draw2DHUD() + end + + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/init.lua new file mode 100644 index 0000000..e9afe4f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/init.lua @@ -0,0 +1,8 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_impactmine" +SWEP.Primary.ProjVelocity = 600 + +function SWEP:PhysModify(physobj) + physobj:AddAngleVelocity(VectorRand():GetNormalized() * 90) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/shared.lua new file mode 100644 index 0000000..1c7fdd0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_minelayer/shared.lua @@ -0,0 +1,110 @@ +SWEP.PrintName = "'Carrion' Impact Mine Layer" +SWEP.Description = "A mine layer that shoots out simple tripmines that attach to surfaces." + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_rpg.mdl" +SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" + +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound("weapons/grenade_launcher1.wav") +SWEP.Primary.Delay = 1 + +SWEP.Primary.Damage = 26.67 +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "impactmine" +SWEP.Primary.DefaultClip = 7 + +SWEP.ReloadSound = Sound("weapons/ar2/ar2_reload.wav") + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.WalkSpeed = SPEED_SLOWEST * 0.9 + +SWEP.UseHands = true + +SWEP.MaxMines = 6 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAXIMUM_MINES, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Sparkler' Laser Miner", "Fires damaging laser trip mines that last several seconds", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.22 + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + ent.Branch = true + ent.Range = 64 + end + end +end) + +function SWEP:CanPrimaryAttack() + if self.BaseClass.CanPrimaryAttack(self) then + local c = 0 + for _, ent in pairs(ents.FindByClass("projectile_impactmine")) do + if (CLIENT or ent.CreateTime + 300 > CurTime()) and ent:GetOwner() == self:GetOwner() then + c = c + 1 + end + end + + if c >= self.MaxMines then return false end + + return true + end + + return false +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextSecondaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + + self:SetNextSecondaryFire(CurTime() + 0.1) + + local owner = self:GetOwner() + local hitpos = owner:CompensatedMeleeTrace(2048, 1, nil, nil, false).HitPos + + if SERVER then + for _, ent in pairs(ents.FindInSphere(hitpos, 24)) do + if ent:GetClass() == "projectile_impactmine" and ent:GetOwner() == owner then + local mine = ents.Create("prop_ammo") + if mine:IsValid() then + mine:SetAmmo(1) + mine:SetAmmoType("impactmine") + mine:SetPos(ent:GetStartPos()) + mine:SetAngles(ent:GetAngles()) + mine:Spawn() + end + + if owner:IsValidLivingHuman() then + mine.NoPickupsTime = CurTime() + 15 + mine.NoPickupsOwner = owner + end + + ent:Remove() + end + end + end +end + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 60, math.random(137, 143), 0.5) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound(self.ReloadSound, 60, 110, 0.5, CHAN_WEAPON + 21) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/cl_init.lua new file mode 100644 index 0000000..8a34e51 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/cl_init.lua @@ -0,0 +1,17 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a.mdl", bone = "ValveBiped.cube3", rel = "", pos = Vector(-2.689, -1.606, 0.225), angle = Angle(22.583, 43.495, -80.544), size = Vector(0.972, 0.972, 0.972), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/pipes01_cluster02a.mdl", bone = "ValveBiped.cube3", rel = "base", pos = Vector(-6.965, 2.759, -1.328), angle = Angle(-41.908, 63.826, 30.479), size = Vector(0.019, 0.019, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/rock_junk001a", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/pipes01_cluster02a.mdl", bone = "ValveBiped.cube3", rel = "base", pos = Vector(-6.877, 2.499, -1.168), angle = Angle(-41.908, 63.826, 30.479), size = Vector(0.019, 0.019, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/rock_junk001a", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_junk/glassbottle01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.177, 1.401, -4.493), angle = Angle(171.264, -163.805, 0), size = Vector(0.972, 0.972, 0.972), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_combine/pipes01_cluster02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-7.496, 2.316, -1.423), angle = Angle(-20.43, 91.721, 48.534), size = Vector(0.019, 0.019, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/rock_junk001a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/pipes01_cluster02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-6.965, 2.759, -1.328), angle = Angle(-41.908, 63.826, 30.479), size = Vector(0.019, 0.019, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/rock_junk001a", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/pipes01_cluster02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-7.117, 0.734, -2.342), angle = Angle(-42.299, 17.763, 11.817), size = Vector(0.019, 0.019, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_junk/rock_junk001a", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/init.lua new file mode 100644 index 0000000..62d8308 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/init.lua @@ -0,0 +1,5 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_zsmolotov" +SWEP.ThrowAngVel = 420 +SWEP.ThrowVel = 650 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/shared.lua new file mode 100644 index 0000000..7141bcc --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_molotov/shared.lua @@ -0,0 +1,15 @@ +SWEP.PrintName = "Molotov Cocktail" +SWEP.Description = "A highly flammable concoction.\nThrow at your own risk." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ViewModel = "models/weapons/c_bugbait.mdl" +SWEP.WorldModel = "models/props_junk/glassbottle01a.mdl" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "molotov" +SWEP.Primary.Sound = Sound("ambient/fire/mtov_flame2.wav") + +SWEP.MaxStock = 8 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/cl_init.lua new file mode 100644 index 0000000..6cd2e4c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/cl_init.lua @@ -0,0 +1,16 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 70 + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Grenade_body"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 2.5, -7), angle = Angle(0, -90, 0), size = Vector(1, 1, 1), color = Color(135, 20, 245, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Anim_Attachment_RH", rel = "", pos = Vector(0, 4, 0.5), angle = Angle(0, 0, -90), size = Vector(1, 1, 1), color = Color(135, 20, 245, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/init.lua new file mode 100644 index 0000000..4d9119f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/init.lua @@ -0,0 +1,5 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_nanitecloudbomb" +SWEP.ThrowAngVel = 30 +SWEP.ThrowVel = 600 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/shared.lua new file mode 100644 index 0000000..8f0abeb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nanitecloudbomb/shared.lua @@ -0,0 +1,14 @@ +SWEP.PrintName = "Nanite Cloud Bomb" +SWEP.Description = "Explodes in to a cloud of nanites. Heals all props and deployables in the radius." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ViewModel = "models/weapons/c_grenade.mdl" +SWEP.WorldModel = "models/healthvial.mdl" + +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "nanitecloudbomb" + +SWEP.MaxStock = 4 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nightmare.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nightmare.lua index cd9442c..58b9068 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nightmare.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_nightmare.lua @@ -1,25 +1,53 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Nightmare" -end +SWEP.PrintName = "Nightmare" SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDamage = 49 -SWEP.SlowDownScale = 2 +SWEP.MeleeDamage = 15 +SWEP.BleedDamage = 15 +SWEP.SlowDownScale = 5.4 +SWEP.MeleeDamageVsProps = 40 +SWEP.EnfeebleDurationMul = 10 / SWEP.MeleeDamage function SWEP:Reload() self:SecondaryAttack() end function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") + self:GetOwner():EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") end SWEP.PlayIdleSound = SWEP.PlayAlertSound function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/barnacle/barnacle_bark"..math.random(2)..".wav") + self:EmitSound("npc/barnacle/barnacle_bark"..math.random(2)..".wav") +end + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = self.MeleeDamageVsProps + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if SERVER and ent:IsPlayer() then + local gt = ent:GiveStatus("enfeeble", damage * self.EnfeebleDurationMul) + if gt and gt:IsValid() then + gt.Applier = self:GetOwner() + end + + ent:GiveStatus("dimvision", 10) + + local bleed = ent:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(self.BleedDamage) + bleed.Damager = self:GetOwner() + end + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) end if not CLIENT then return end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/cl_init.lua new file mode 100644 index 0000000..cbd3265 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/cl_init.lua @@ -0,0 +1,57 @@ +INC_CLIENT() + +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.HUD3DBone = "Python" +SWEP.HUD3DPos = Vector(0.85, -0.3, -2.5) +SWEP.HUD3DScale = 0.015 + +SWEP.VElements = { + ["spinner"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "Cylinder", rel = "", pos = Vector(0, 0, 0.243), angle = Angle(-180, 0, 0), size = Vector(0.078, 0.078, 0.041), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel11"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel10", pos = Vector(0.888, 0, 0.159), angle = Angle(10, 0, 0), size = Vector(0.101, 0.273, 0.642), color = Color(153, 124, 139, 255), surpresslightning = false, material = "models/props_junk/shoe001a", skin = 0, bodygroup = {} }, + ["chamber"] = { type = "Model", model = "models/items/boxmrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel7-2"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel7", pos = Vector(0.238, -3.609, 0), angle = Angle(0, 0, -180), size = Vector(0.018, 0.018, 0.018), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["uragan"] = { type = "Model", model = "models/items/357ammo.mdl", bone = "Python", rel = "", pos = Vector(0, 1.615, 0), angle = Angle(90, 0, -90), size = Vector(0.009, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel7-3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel7-2", pos = Vector(-0.638, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.018, 0.018, 0.018), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["ironsight"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel6", pos = Vector(0, -0.24, 1.692), angle = Angle(0, 0, 180), size = Vector(0.019, 0.035, 0.05), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel8"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(0, 0, -0.88), angle = Angle(0, 0, 0), size = Vector(0.36, 0.245, 0.248), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel7"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(3.233, 0, -0.304), angle = Angle(-90, 90, 0), size = Vector(0.039, 0.039, 0.019), color = Color(25, 25, 25, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel13"] = { type = "Model", model = "models/props_junk/meathook001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(0.233, 0, 0.305), angle = Angle(0, -90, 15.102), size = Vector(0.286, 0.305, 0.125), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel6"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel5", pos = Vector(0, 0.8, -0.329), angle = Angle(0, 0, 16.666), size = Vector(0.071, 0.063, 0.128), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["tube2"] = { type = "Model", model = "models/items/battery.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(3.279, 0, 2.448), angle = Angle(90, 0, 0), size = Vector(0.5, 0.273, 0.485), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel5"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(6.534, 0, 2.262), angle = Angle(0, 89.678, -17.173), size = Vector(0.071, 0.071, 0.071), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel3"] = { type = "Model", model = "models/maxofs2d/hover_plate.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(2.701, 0, 2.114), angle = Angle(86.527, 180, 0), size = Vector(0.188, 0.075, 0.467), color = Color(87, 68, 72, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel2"] = { type = "Model", model = "models/maxofs2d/hover_plate.mdl", bone = "Python", rel = "uragan", pos = Vector(-0.849, 0, 2.04), angle = Angle(80, 0, 0), size = Vector(0.188, 0.075, 0.467), color = Color(87, 68, 72, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tube"] = { type = "Model", model = "models/items/boxmrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(5.422, 0, 0.794), angle = Angle(0, 90, 0), size = Vector(0.07, 0.261, 0.15), color = Color(60, 60, 60, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel1"] = { type = "Model", model = "models/maxofs2d/light_tubular.mdl", bone = "Python", rel = "uragan", pos = Vector(-0.55, 0, 1.748), angle = Angle(0, 90, -90), size = Vector(0.68, 0.68, 0.18), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel9"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(-2.118, 0, -0.964), angle = Angle(11.454, 0, 0), size = Vector(0.356, 0.059, 0.174), color = Color(75, 75, 75, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel10"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(-3.944, 0, -3.618), angle = Angle(-19.883, 0, 0), size = Vector(0.101, 0.273, 0.642), color = Color(153, 106, 135, 255), surpresslightning = false, material = "models/props_junk/shoe001a", skin = 0, bodygroup = {} }, + ["barrel12"] = { type = "Model", model = "models/props_junk/meathook001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(1.279, 0, -0.239), angle = Angle(0, 90, 59.189), size = Vector(0.305, 0.111, 0.111), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel4"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(-1.734, 0, 1.445), angle = Angle(0, 90, -70), size = Vector(0.029, 0.092, 0.15), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["tube3"] = { type = "Model", model = "models/props_junk/flare.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "uragan", pos = Vector(5.171, 0, 0.892), angle = Angle(90, -90, -90), size = Vector(0.564, 0.564, 0.428), color = Color(60, 60, 60, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["spinner2"] = { type = "Model", model = "models/items/combine_rifle_ammo01.mdl", bone = "Cylinder", rel = "spinner", pos = Vector(0, 0, 1.572), angle = Angle(-180, 0, 0), size = Vector(0.335, 0.335, 0.317), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["spinner"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(1.45, 0, 1.529), angle = Angle(-90, 0, 0), size = Vector(0.078, 0.078, 0.041), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel4"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-1.734, 0, 1.445), angle = Angle(0, 90, -70), size = Vector(0.029, 0.092, 0.15), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["uragan"] = { type = "Model", model = "models/items/357ammo.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.559, 1.355, -2.738), angle = Angle(0, 0, 180), size = Vector(0.009, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel8"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(0, 0, -0.88), angle = Angle(0, 0, 0), size = Vector(0.36, 0.245, 0.248), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel7"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(3.233, 0, -0.304), angle = Angle(-90, 90, 0), size = Vector(0.039, 0.039, 0.019), color = Color(25, 25, 25, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel13"] = { type = "Model", model = "models/props_junk/meathook001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-0.648, 0, 0.398), angle = Angle(0, -90, 15.102), size = Vector(0.286, 0.305, 0.125), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["tube2"] = { type = "Model", model = "models/items/battery.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(3.279, 0, 2.448), angle = Angle(90, 0, 0), size = Vector(0.5, 0.273, 0.485), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel5"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(6.534, 0, 2.18), angle = Angle(0, 89.678, -17.173), size = Vector(0.071, 0.071, 0.071), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel3"] = { type = "Model", model = "models/maxofs2d/hover_plate.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(2.701, 0, 2.114), angle = Angle(86.527, 180, 0), size = Vector(0.188, 0.075, 0.467), color = Color(87, 68, 72, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["barrel2"] = { type = "Model", model = "models/maxofs2d/hover_plate.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-0.849, 0, 2.04), angle = Angle(80, 0, 0), size = Vector(0.188, 0.075, 0.467), color = Color(87, 68, 72, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["spinner2"] = { type = "Model", model = "models/items/combine_rifle_ammo01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "spinner", pos = Vector(0, 0, 1.572), angle = Angle(-180, 0, 0), size = Vector(0.335, 0.335, 0.317), color = Color(50, 50, 50, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel1"] = { type = "Model", model = "models/maxofs2d/light_tubular.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-0.55, 0, 1.748), angle = Angle(0, 90, -90), size = Vector(0.68, 0.68, 0.18), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel9"] = { type = "Model", model = "models/items/boxsrounds.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-2.118, 0, -0.964), angle = Angle(11.454, 0, 0), size = Vector(0.356, 0.059, 0.174), color = Color(75, 75, 75, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel12"] = { type = "Model", model = "models/props_junk/meathook001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(0.486, 0, -0.239), angle = Angle(0, 90, 59.189), size = Vector(0.305, 0.111, 0.111), color = Color(100, 100, 100, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["tube"] = { type = "Model", model = "models/items/boxmrounds.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(5.422, 0, 0.794), angle = Angle(0, 90, 0), size = Vector(0.07, 0.261, 0.15), color = Color(60, 60, 60, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} }, + ["barrel10"] = { type = "Model", model = "models/items/boxflares.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(-3.944, 0, -3.618), angle = Angle(-19.883, 0, 0), size = Vector(0.101, 0.273, 0.642), color = Color(183, 106, 135, 255), surpresslightning = false, material = "models/props_junk/shoe001a", skin = 0, bodygroup = {} }, + ["tube3"] = { type = "Model", model = "models/props_junk/flare.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "uragan", pos = Vector(5.171, 0, 0.892), angle = Angle(90, -90, -90), size = Vector(0.564, 0.564, 0.428), color = Color(60, 60, 60, 255), surpresslightning = false, material = "maxofs2d/models/hover_plate", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/init.lua new file mode 100644 index 0000000..1d40f31 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_nova" +SWEP.Primary.ProjVelocity = 1500 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/shared.lua new file mode 100644 index 0000000..cfae95d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novablaster/shared.lua @@ -0,0 +1,58 @@ +SWEP.PrintName = "'Nova Blaster' Pulse Revolver" +SWEP.Description = "Combines the ricochet properties of the magnum into a bouncing pulse projectile, that slows zombies." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/c_357.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_357.Single") +SWEP.Primary.Delay = 0.65 +SWEP.Primary.Damage = 46 +SWEP.Primary.NumShots = 1 + +SWEP.Primary.ClipSize = 27 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 27 + +SWEP.RequiredClip = 3 + +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 1.75 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.IronSightsPos = Vector(-4.65, 4, 0.25) +SWEP.IronSightsAng = Vector(0, 0, 1) + +SWEP.Tier = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.7, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.4, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.05, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Nova Helix' Pulse Revolver", "Fires two projectiles in a wavy formation", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.6 + wept.Primary.ProjVelocity = 450 + wept.Primary.NumShots = 2 + wept.Primary.ClipSize = 18 + wept.SameSpread = true + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + ent.Branch = true + end + end +end) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/stunstick/alyx_stunner2.wav", 72, 219, 0.75) + self:EmitSound("weapons/physcannon/superphys_launch1.wav", 72, 208, 0.65, CHAN_AUTO) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novacolt.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novacolt.lua new file mode 100644 index 0000000..184beae --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_novacolt.lua @@ -0,0 +1,113 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Nova Colt' Handcannon" +SWEP.Description = "A heavy handgun which deals impressive burst damage but has a significant reload time." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 56 + + SWEP.HUD3DBone = "v_weapon.Deagle_Parent" + SWEP.HUD3DPos = Vector(0.1, -5.5, 1.22) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.016 + + SWEP.VElements = { + ["novacolt++++++"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 4.524, 4.07), angle = Angle(113.376, -90, 0), size = Vector(0.451, 0.298, 0.365), color = Color(148, 152, 183, 255), surpresslightning = false, material = "models/props_c17/clockwood01", skin = 0, bodygroup = {} }, + ["novacolt++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(-0.612, 3.635, 1.74), angle = Angle(0, 0, 180), size = Vector(0.05, 0.059, 0.059), color = Color(170, 181, 185, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["novacolt"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "", pos = Vector(0, -5.56, -2.725), angle = Angle(0, 0, 0), size = Vector(0.045, 0.045, 0.059), color = Color(80, 87, 99, 255), surpresslightning = false, material = "models/weapons/v_shotgun/vshotgun_albedo", skin = 0, bodygroup = {} }, + ["novacolt+++++"] = { type = "Model", model = "models/props_wasteland/laundry_dryer001.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 0.6, 3), angle = Angle(110, -90, 0), size = Vector(0.019, 0.041, 0.034), color = Color(75, 82, 95, 255), surpresslightning = false, material = "models/props_c17/column02a", skin = 0, bodygroup = {} }, + ["novacolt+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.05), color = Color(92, 108, 118, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} }, + ["novacolt+++++++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, -1.601, 2.2), angle = Angle(66.62, 90, 0), size = Vector(0.129, 0.15, 0.159), color = Color(47, 52, 56, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.Deagle_Parent", rel = "novacolt", pos = Vector(0, 0.47, -5.652), angle = Angle(-180, 180, 90), size = Vector(0.019, 0.028, 0.019), color = Color(75, 87, 79, 255), surpresslightning = false, material = "models/weapons/w_irifle/w_irifle", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["novacolt"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.314, 1.432, -5.409), angle = Angle(0, 90, -86.532), size = Vector(0.045, 0.045, 0.059), color = Color(80, 87, 99, 255), surpresslightning = false, material = "models/weapons/v_shotgun/vshotgun_albedo", skin = 0, bodygroup = {} }, + ["novacolt++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 0.47, -5.652), angle = Angle(-180, 180, 90), size = Vector(0.019, 0.028, 0.019), color = Color(75, 87, 79, 255), surpresslightning = false, material = "models/weapons/w_irifle/w_irifle", skin = 0, bodygroup = {} }, + ["novacolt+++++"] = { type = "Model", model = "models/props_wasteland/laundry_dryer001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 0.6, 3), angle = Angle(110, -90, 0), size = Vector(0.019, 0.041, 0.034), color = Color(75, 82, 95, 255), surpresslightning = false, material = "models/props_c17/column02a", skin = 0, bodygroup = {} }, + ["novacolt+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 3, -0.35), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.05), color = Color(92, 108, 118, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture4", skin = 0, bodygroup = {} }, + ["novacolt++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(-0.612, 3.635, 1.74), angle = Angle(0, 0, 180), size = Vector(0.05, 0.059, 0.059), color = Color(170, 181, 185, 255), surpresslightning = false, material = "models/weapons/v_stunstick/v_stunstick_diffuse", skin = 0, bodygroup = {} }, + ["novacolt+++++++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, -1.601, 2.2), angle = Angle(66.62, 90, 0), size = Vector(0.129, 0.15, 0.159), color = Color(47, 52, 56, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["novacolt++++++"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "novacolt", pos = Vector(0, 4.524, 4.07), angle = Angle(113.376, -90, 0), size = Vector(0.451, 0.298, 0.365), color = Color(148, 152, 183, 255), surpresslightning = false, material = "models/props_c17/clockwood01", skin = 0, bodygroup = {} } + } + + SWEP.IronSightsPos = Vector(-6.321, 0, -0.561) +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.Primary.Damage = 85 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.31 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 3.05 +SWEP.ConeMin = 1.35 + +SWEP.FireAnimSpeed = 1.35 +SWEP.ReloadSpeed = 0.43 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/deagle/deagle-1.wav", 75, math.random(81, 85), 0.8) + self:EmitSound("weapons/galil/galil-1.wav", 75, math.random(142, 148), 0.7, CHAN_WEAPON + 20) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/357/357_reload1.wav", 75, 75, 1, CHAN_WEAPON + 21) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/357/357_spin1.wav", 70, 90) + end +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + + if SERVER and ent and ent:IsValidLivingZombie() then + dmginfo:SetDamageForce(attacker:GetUp() * 7000 + attacker:GetForward() * 25000) + end +end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 0.1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 0.9) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -65 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_noxiousghoul.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_noxiousghoul.lua new file mode 100644 index 0000000..97b69ae --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_noxiousghoul.lua @@ -0,0 +1,113 @@ +AddCSLuaFile() + +SWEP.PrintName = "Noxious Ghoul" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 32 +SWEP.MeleeDamageVsProps = 24 +SWEP.MeleeForceScale = 0.5 +SWEP.SlowDownScale = 0.25 +SWEP.EnfeebleDurationMul = 10 / SWEP.MeleeDamage + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + ent:PoisonDamage(damage, self:GetOwner(), self, trace.HitPos) + if SERVER and ent:IsPlayer() then + local gt = ent:GiveStatus("enfeeble", damage * self.EnfeebleDurationMul) + if gt and gt:IsValid() then + gt.Applier = self:GetOwner() + end + end +end + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = self.MeleeDamageVsProps + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/fast_zombie/fz_alert_close1.wav", 75, math.Rand(70, 80)) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) +end + +local PoisonPattern = { + {-0.66, 0}, + {-0.33, 0}, + {0, 0}, + {0, 1}, + {0, -1}, + {0.33, 0}, + {0.66, 0}, +} + +local function DoFleshThrow(owner, self) + local startpos = owner:GetShootPos() + local aimang = owner:EyeAngles() + local ang + + for k, spr in pairs(PoisonPattern) do + if k == "BaseClass" then continue end + + ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), spr[1] * 12.5) + ang:RotateAroundAxis(ang:Right(), spr[2] * 5) + local heading = ang:Forward() + + local ent = ents.Create(k % 3 == 1 and "projectile_ghoulfleshno" or "projectile_poisonflesh") + if ent:IsValid() then + ent:SetPos(startpos + heading * 8) + ent:SetOwner(owner) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(heading * 400) + end + end + end + + owner:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(105, 115)) +end + + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end + + self:SetNextSecondaryFire(CurTime() + 3) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + self:GetOwner():DoZombieEvent() + self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130)) + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95)) + self:SendWeaponAnim(ACT_VM_HITCENTER) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + if SERVER then + timer.Simple(0.7, function() DoFleshThrow(owner, self) end) + end +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) + render.SetColorModulation(1, 1, 1) +end + +local matSheet = Material("models/weapons/v_zombiearms/ghoulsheet") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) + render.SetColorModulation(0.9, 0.55, 0.9) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oberon.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oberon.lua new file mode 100644 index 0000000..16605d3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oberon.lua @@ -0,0 +1,113 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Oberon' Pulse Shotgun" +SWEP.Description = "Fires a spread of pulse shots that slow targets." + +if CLIENT then + SWEP.Slot = 3 + SWEP.SlotPos = 0 + + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.HUD3DBone = "ValveBiped.Gun" + SWEP.HUD3DPos = Vector(2.12, -1, -8) + SWEP.HUD3DScale = 0.025 + + SWEP.ShowViewModel = true + + SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/Items/boxflares.mdl", bone = "ValveBiped.Gun", rel = "", pos = Vector(-1.283, -2.158, 1.508), angle = Angle(90, -90, -90), size = Vector(0.437, 0.226, 0.446), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/error/new light1", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_mortar01a.mdl", bone = "ValveBiped.Pump", rel = "", pos = Vector(-1.313, 1.697, -20.396), angle = Angle(0.476, 90, 0), size = Vector(0.172, 0.179, 0.256), color = Color(255, 147, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Gun", rel = "", pos = Vector(0.197, 3.431, 3.428), angle = Angle(-90, 0, -90.676), size = Vector(0.071, 0.019, 0.025), color = Color(255, 180, 123, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base++"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(18.329, 1.085, -3.164), angle = Angle(175.024, 0.411, 0), size = Vector(0.037, 0.02, 0.017), color = Color(255, 180, 123, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/Items/boxflares.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(17.725, -0.431, -6.599), angle = Angle(6.518, 180, -90), size = Vector(0.277, 0.277, 0.469), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/error/new light1", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_mortar01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.356, 0.796, -2.659), angle = Angle(-94.139, 1.621, 0), size = Vector(0.129, 0.136, 0.108), color = Color(255, 147, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +sound.Add( +{ + name = "Weapon_Oberon.Single", + channel = CHAN_WEAPON, + volume = 1.0, + soundlevel = 100, + pitch = {85, 92}, + sound = "weapons/gauss/fire1.wav" +}) + +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Oberon.Single") +SWEP.Primary.Damage = 12 +SWEP.Primary.NumShots = 5 +SWEP.Primary.Delay = 0.8 + +SWEP.FireAnimSpeed = 0.55 + +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 30 + +SWEP.ConeMax = 7.5 +SWEP.ConeMin = 5 + +SWEP.ReloadDelay = 0.4 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.TracerName = "AR2Tracer" + +SWEP.PumpSound = Sound("Weapon_Shotgun.Special1") +SWEP.ReloadSound = Sound("Weapon_Shotgun.Reload") + +SWEP.LegDamage = 9 +SWEP.Tier = 3 + +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_LEG_DAMAGE, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Neptune' Pulse Shotgun", "Fast firing and reloading, uses 3x ammo", function(wept) + wept.RequiredClip = 3 + wept.Primary.ClipSize = 21 + wept.Primary.Delay = 0.6 + wept.ReloadDelay = 0.1 + wept.ReloadSound = Sound("npc/scanner/scanner_scan4.wav") + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/stunstick/alyx_stunner2.wav", 72, 115, 0.65, CHAN_AUTO) + self:EmitSound("weapons/gauss/fire1.wav", 72, 108, 0.65) + end + + if CLIENT then + wept.VElements["base+++"].color = Color(0, 255, 255) + end +end) + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + if ent:IsValidLivingZombie() then + ent:AddLegDamageExt(dmginfo:GetInflictor().LegDamage, attacker, attacker:GetActiveWeapon(), SLOWTYPE_PULSE) + end + + if IsFirstTimePredicted() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + end +end + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound) + self:EmitSound("weapons/glock/glock18-1.wav", 75, math.random(162, 168), 0.7, CHAN_WEAPON + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_onyx.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_onyx.lua new file mode 100644 index 0000000..bf7bf6c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_onyx.lua @@ -0,0 +1,120 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Onyx' Rifle" +SWEP.Description = "Reliable balanced sniper rifle with good accuracy, clip size and damage." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.sg550_Parent" + SWEP.HUD3DPos = Vector(-1, -5.2, -2) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.02 + + SWEP.VElements = { + ["svu++"] = { type = "Model", model = "models/props_wasteland/gaspump001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(2, 0, 0.5), angle = Angle(-90, 0, 73.636), size = Vector(0.029, 0.059, 0.1), color = Color(49, 54, 52, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["svu+++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(9, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.034, 0.034, 0.034), color = Color(90, 85, 75, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(-2, 0.6, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.019, 0.039, 0.15), color = Color(69, 94, 138, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["svu++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube1x1x1.mdl", bone = "v_weapon.sg550_Clip", rel = "", pos = Vector(0, 1.6, 0.5), angle = Angle(0, 0, 11), size = Vector(0.013, 0.109, 0.068), color = Color(27, 31, 34, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["svu++++++++++++"] = { type = "Model", model = "models/props_junk/ibeam01a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(2.5, -1, 0.5), angle = Angle(0, 0, 90), size = Vector(0.009, 0.09, 0.15), color = Color(128, 113, 94, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(11, 0.6, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.017, 0.035, 0.14), color = Color(85, 113, 160, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["svu"] = { type = "Model", model = "models/props_phx/torpedo.mdl", bone = "v_weapon.sg550_Parent", rel = "", pos = Vector(0.6, -5, -3), angle = Angle(90, 0, 0), size = Vector(0.15, 0.09, 0.05), color = Color(80, 78, 85, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["svu++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(-14, 0, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.019, 0.019, 0.15), color = Color(74, 94, 138, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["svu+++++++++++++"] = { type = "Model", model = "models/props_junk/ibeam01a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(6.5, -1, 0.5), angle = Angle(0, 0, 90), size = Vector(0.009, 0.09, 0.15), color = Color(128, 113, 94, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(6, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.09), color = Color(161, 163, 132, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++++++++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(9.5, -2.6, 0.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(25, 33, 51, 255), surpresslightning = false, material = "models/props/cs_office/snowmana", skin = 0, bodygroup = {} }, + ["svu++++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(9.5, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.037, 0.037, 0.009), color = Color(72, 67, 62, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+"] = { type = "Model", model = "models/props_wasteland/gaspump001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(13, 0, 0.5), angle = Angle(-90, 0, 90), size = Vector(0.05, 0.119, 0.059), color = Color(49, 44, 49, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["svu+++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight001a.mdl", bone = "v_weapon.sg550_Parent", rel = "svu", pos = Vector(4, -0.741, 0.5), angle = Angle(90, 0, 90), size = Vector(0.119, 0.119, 0.039), color = Color(176, 170, 153, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["svu++"] = { type = "Model", model = "models/props_wasteland/gaspump001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(2, 0, 0.5), angle = Angle(-90, 0, 73.636), size = Vector(0.029, 0.059, 0.1), color = Color(49, 54, 52, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["svu+++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(9, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.034, 0.034, 0.034), color = Color(90, 85, 75, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(-2, 0.6, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.019, 0.039, 0.15), color = Color(69, 94, 138, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["svu+++++"] = { type = "Model", model = "models/props_wasteland/prison_flourescentlight001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(4, -0.741, 0.5), angle = Angle(90, 0, 90), size = Vector(0.119, 0.119, 0.039), color = Color(176, 170, 153, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+"] = { type = "Model", model = "models/props_wasteland/gaspump001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(13, 0, 0.5), angle = Angle(-90, 0, 90), size = Vector(0.05, 0.119, 0.059), color = Color(49, 44, 49, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["svu++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube1x1x1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(-1, 2, 0.25), angle = Angle(90, 0, 11), size = Vector(0.013, 0.109, 0.068), color = Color(27, 31, 34, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["svu"] = { type = "Model", model = "models/props_phx/torpedo.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.5, 0, -4), angle = Angle(171.817, 0, 90), size = Vector(0.15, 0.09, 0.05), color = Color(80, 78, 85, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["svu++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(-14, 0, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.019, 0.019, 0.159), color = Color(74, 94, 138, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} }, + ["svu+++++++++++++"] = { type = "Model", model = "models/props_junk/ibeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(6.5, -1, 0.5), angle = Angle(0, 0, 90), size = Vector(0.009, 0.09, 0.15), color = Color(128, 113, 94, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(6, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.029, 0.029, 0.09), color = Color(161, 163, 132, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++++++++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(9.5, -2.6, 0.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(25, 33, 51, 255), surpresslightning = false, material = "models/props/cs_office/snowmana", skin = 0, bodygroup = {} }, + ["svu++++++++"] = { type = "Model", model = "models/hunter/tubes/tube1x1x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(9.5, -2.6, 0.5), angle = Angle(90, 0, 0), size = Vector(0.037, 0.037, 0.009), color = Color(72, 67, 62, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu++++++++++++"] = { type = "Model", model = "models/props_junk/ibeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(2.5, -1, 0.5), angle = Angle(0, 0, 90), size = Vector(0.009, 0.09, 0.15), color = Color(128, 113, 94, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["svu+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "svu", pos = Vector(11, 0.6, 0.5), angle = Angle(92.337, -90, -90), size = Vector(0.017, 0.035, 0.14), color = Color(85, 113, 160, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} } + } +end + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_sg550.mdl" +SWEP.WorldModel = "models/weapons/w_snip_sg550.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/sg550/sg550-1.wav") +SWEP.Primary.Damage = 86.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "357" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN + +SWEP.ConeMax = 6.5 +SWEP.ConeMin = 0 + +SWEP.IronSightsPos = Vector(11, -9, -2.2) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.Tier = 3 + +SWEP.FireAnimSpeed = 0.6 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1, 1) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 77, 75, 1) + self:EmitSound("weapons/sg552/sg552-1.wav", 70, 185, 0.95, CHAN_AUTO) +end + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +if CLIENT then + SWEP.IronsightsMultiplier = 0.25 + + function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) + end + + function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + self:DrawRegularScope() + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_owens.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_owens.lua index ce52e64..8cb6aa7 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_owens.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_owens.lua @@ -1,10 +1,12 @@ AddCSLuaFile() +SWEP.PrintName = "'Owens' Handgun" +SWEP.Description = "A somewhat less accurate pistol that fires two shots that deal respectable total damage." + +SWEP.Slot = 1 +SWEP.SlotPos = 0 + if CLIENT then - SWEP.PrintName = "'Owens' Handgun" - SWEP.Slot = 1 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -25,17 +27,24 @@ SWEP.CSMuzzleFlashes = false SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") SWEP.Primary.Sound = Sound("Weapon_Pistol.NPC_Single") -SWEP.Primary.Damage = 12 +SWEP.Primary.Damage = 14.2 SWEP.Primary.NumShots = 2 SWEP.Primary.Delay = 0.2 -SWEP.Primary.ClipSize = 12 +SWEP.Primary.ClipSize = 10 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" +SWEP.Primary.ClipMultiplier = 12/10 GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.08 -SWEP.ConeMin = 0.04 +SWEP.ReloadSpeed = 0.7 + +SWEP.ConeMax = 4 +SWEP.ConeMin = 2.5 SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) SWEP.IronSightsAng = Vector(-0.15, -1, 2) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.46, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.22, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.0175, 1) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oxygentank.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oxygentank.lua deleted file mode 100644 index fae8426..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_oxygentank.lua +++ /dev/null @@ -1,83 +0,0 @@ -AddCSLuaFile() - -if CLIENT then - SWEP.PrintName = "Oxygen Tank" - SWEP.Description = "Grants the user much higher air capacity." - - SWEP.ViewModelFOV = 60 - - SWEP.Slot = 4 - - SWEP.ShowViewModel = false - SWEP.ShowWorldModel = false - SWEP.VElements = { - ["base"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 3, -1), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } - } - SWEP.WElements = { - ["base"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 3, -1), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } - } -end - -SWEP.Base = "weapon_zs_basemelee" - -SWEP.ViewModel = "models/weapons/c_grenade.mdl" -SWEP.WorldModel = "models/props_c17/canister01a.mdl" -SWEP.ModelScale = 0.5 -SWEP.UseHands = true - -SWEP.Primary.ClipSize = -1 -SWEP.Primary.DefaultClip = -1 -SWEP.Primary.Ammo = "none" - -SWEP.Secondary.ClipSize = -1 -SWEP.Secondary.DefaultClip = -1 -SWEP.Secondary.Automatic = false -SWEP.Secondary.Ammo = "none" - -SWEP.WalkSpeed = SPEED_NORMAL - -SWEP.HoldType = "slam" - -function SWEP:PrimaryAttack() -end - -function SWEP:SecondaryAttack() -end - -function SWEP:Reload() -end - -if CLIENT then return end - -function SWEP:Initialize() - self.BaseClass.Initialize(self) - - timer.Simple(0, function() - if IsValid(self) then - self:SpawnTank() - end - end) -end - -function SWEP:Deploy() - self.BaseClass.Deploy(self) - - self:SpawnTank() -end - -function SWEP:SpawnTank() - local owner = self.Owner - if not owner:IsValid() then return end - - for _, ent in pairs(ents.FindByClass("status_oxygentank")) do - if ent:GetOwner() == owner then return end - end - - local ent = ents.Create("status_oxygentank") - if ent:IsValid() then - ent:SetPos(owner:EyePos()) - ent:SetParent(owner) - ent:SetOwner(owner) - ent:Spawn() - end -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_peashooter.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_peashooter.lua index 9d05cdd..a6cc67e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_peashooter.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_peashooter.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Peashooter' Handgun" - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Peashooter' Handgun" +SWEP.Description = "A low damage output pistol that only uses half the ammo." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFOV = 60 SWEP.ViewModelFlip = false @@ -23,16 +25,56 @@ SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_P228.Single") -SWEP.Primary.Damage = 16 +SWEP.Primary.Damage = 15.5 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 0.1 +SWEP.Primary.Delay = 0.18 -SWEP.Primary.ClipSize = 18 +SWEP.Primary.ClipSize = 9 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" +SWEP.Primary.ClipMultiplier = 12/18 * 2 -- Battleaxe/Owens have 12 clip size, but this has half ammo usage GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.08 -SWEP.ConeMin = 0.015 +SWEP.ConeMax = 4 +SWEP.ConeMin = 0.75 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Peashooter' Auto Handgun", "Fully automatic, increased clip size at the cost of accuracy", function(wept) + wept.Primary.Delay = 0.15 + wept.Primary.Automatic = true + wept.Primary.ClipSize = math.floor(wept.Primary.ClipSize * 1.25) + + wept.ConeMin = 2.25 +end) SWEP.IronSightsPos = Vector(-6, -1, 2.25) + +function SWEP:SetAltUsage(usage) + self:SetDTBool(1, usage) +end + +function SWEP:GetAltUsage() + return self:GetDTBool(1) +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + self:EmitFireSound() + + local altuse = self:GetAltUsage() + if not altuse then + self:TakeAmmo() + end + self:SetAltUsage(not altuse) + + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +if not CLIENT then return end + +function SWEP:GetDisplayAmmo(clip, spare, maxclip) + local minus = self:GetAltUsage() and 0 or 1 + return math.max(0, (clip * 2) - minus), spare * 2, maxclip * 2 +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pipe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pipe.lua index 8553490..ed297b7 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pipe.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pipe.lua @@ -1,8 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Lead Pipe" +SWEP.PrintName = "Lead Pipe" +SWEP.Description = "The weight of a lead pipe carries enough force to shock a target's focus but has a lower swing speed than other melee weapons." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -25,11 +26,11 @@ SWEP.ViewModel = "models/weapons/c_stunstick.mdl" SWEP.WorldModel = "models/props_canal/mattpipe.mdl" SWEP.UseHands = true -SWEP.MeleeDamage = 40 -SWEP.MeleeRange = 50 +SWEP.MeleeDamage = 45 +SWEP.MeleeRange = 53 SWEP.MeleeSize = 1.15 -SWEP.Primary.Delay = 1.75 +SWEP.Primary.Delay = 1.2 SWEP.UseMelee1 = true @@ -40,6 +41,10 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingTime = 0.4 SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.12) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(55, 65)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_plank.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_plank.lua index c669be7..654bca0 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_plank.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_plank.lua @@ -1,8 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Plank" +SWEP.PrintName = "Plank" +SWEP.Description = "A strip of wood of which repeated swings that connect with it build up momentum and overall damage output." +if CLIENT then SWEP.ViewModelFOV = 55 SWEP.ViewModelFlip = false @@ -27,18 +28,22 @@ SWEP.UseHands = true SWEP.BoxPhysicsMin = Vector(-0.5764, -2.397225, -20.080572) * SWEP.ModelScale SWEP.BoxPhysicsMax = Vector(0.70365, 2.501825, 19.973375) * SWEP.ModelScale -SWEP.MeleeDamage = 20 +SWEP.MeleeDamage = 16 SWEP.MeleeRange = 48 SWEP.MeleeSize = 0.875 SWEP.Primary.Delay = 0.37 -SWEP.WalkSpeed = SPEED_FASTEST +SWEP.WalkSpeed = SPEED_FASTER SWEP.UseMelee1 = true SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE SWEP.MissGesture = SWEP.HitGesture +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 4) + function SWEP:PlaySwingSound() self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav") end @@ -54,7 +59,9 @@ end function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) if hitent:IsValid() and hitent:IsPlayer() then local combo = self:GetDTInt(2) - self:SetNextPrimaryFire(CurTime() + math.max(0.2, self.Primary.Delay * (1 - combo / 10))) + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + math.max(0.2, self.Primary.Delay * (1 - combo / 10)) * armdelay) self:SetDTInt(2, combo + 1) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/cl_init.lua index d07b879..bb86eb8 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/cl_init.lua @@ -1,10 +1,13 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Poison Headcrab" SWEP.ViewModelFOV = 70 SWEP.DrawCrosshair = false function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/init.lua index 25b35c2..3e20b96 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/init.lua @@ -1,4 +1 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/shared.lua index bfe7c55..2fb355b 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonheadcrab/shared.lua @@ -1,8 +1,10 @@ +SWEP.PrintName = "Poison Headcrab" + SWEP.ZombieOnly = true SWEP.IsMelee = true SWEP.ViewModel = "models/weapons/v_knife_t.mdl" -SWEP.WorldModel = "models/weapons/w_knife_t.mdl" +SWEP.WorldModel = "" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 @@ -16,27 +18,26 @@ SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" -SWEP.PounceDamage = 10 -SWEP.PounceDamagePerTick = 5 -SWEP.PounceDamageTicks = 10 -SWEP.PounceDamageTime = 1 -SWEP.PounceDamageVsPropsMultiplier = 2 +SWEP.PounceDamage = 34 +SWEP.PounceWindUp = 0.9 +SWEP.SilentPounceWindUp = 2.1 +SWEP.SpitWindUp = 0.8 function SWEP:Initialize() self:HideViewAndWorldModel() end -local function DoPoisoned(hitent, owner, damage, timername) +--[[local function DoPoisoned(hitent, owner, damage, timername) if not (hitent:IsValid() and hitent:Alive()) then - timer.Destroy(timername) + timer.Remove(timername) return end hitent:PoisonDamage(damage, owner) -end +end]] function SWEP:Think() local curtime = CurTime() - local owner = self.Owner + local owner = self:GetOwner() if self:IsGoingToSpit() and self:GetNextSpit() <= curtime then self:SetNextSpit(0) @@ -45,13 +46,14 @@ function SWEP:Think() if SERVER then owner:EmitSound("weapons/crossbow/bolt_fly4.wav", 74, 150) + owner.LastRangedAttack = CurTime() local ent = ents.Create("projectile_poisonspit") if ent:IsValid() then ent:SetOwner(owner) local aimvec = owner:GetAimVector() - aimvec.z = math.max(aimvec.z, -0.25) - aimvec:Normalize() + --[[aimvec.z = math.max(aimvec.z, -0.25) + aimvec:Normalize()]] local vStart = owner:GetShootPos() local tr = util.TraceLine({start=vStart, endpos=vStart + owner:GetAimVector() * 30, filter=owner}) if tr.Hit then @@ -62,7 +64,7 @@ function SWEP:Think() ent:Spawn() local phys = ent:GetPhysicsObject() if phys:IsValid() then - phys:SetVelocityInstantaneous(aimvec * 510) + phys:SetVelocityInstantaneous(aimvec * 900 --[[510]]) end end end @@ -83,14 +85,15 @@ function SWEP:Think() end end elseif self:IsLeaping() then + local delay = owner:GetMeleeSpeedMul() if owner:IsOnGround() or 1 < owner:WaterLevel() then self:SetLeaping(false) - self:SetNextPrimaryFire(curtime + 0.8) + self:SetNextPrimaryFire(curtime + 0.8 * delay) else - owner:LagCompensation(true) + --owner:LagCompensation(true) local vStart = owner:LocalToWorld(owner:OBBCenter()) - local trace = util.TraceHull({start = vStart, endpos = vStart + owner:GetForward() * (owner:BoundingRadius() + 8), mins = owner:OBBMins() * 0.8, maxs = owner:OBBMaxs() * 0.8, filter = owner:GetMeleeFilter()}) + local trace = owner:CompensatedMeleeTrace(owner:BoundingRadius() + 8, 12, vStart, owner:GetForward()) local ent = trace.Entity if ent:IsValid() then @@ -104,7 +107,7 @@ function SWEP:Think() end self:SetLeaping(false) - self:SetNextPrimaryFire(curtime + 1) + self:SetNextPrimaryFire(curtime + 1 * delay) if SERVER then owner:EmitSound("NPC_BlackHeadcrab.Bite") @@ -113,21 +116,17 @@ function SWEP:Think() if ent:IsPlayer() then ent:MeleeViewPunch(self.PounceDamage) - ent:PoisonDamage(self.PounceDamage, owner, self) - local timername = tostring(ent).."poisonedby"..tostring(owner)..CurTime() - timer.CreateEx(timername, self.PounceDamageTime, self.PounceDamageTicks, DoPoisoned, ent, owner, self.PounceDamagePerTick, timername) - else - ent:PoisonDamage(self.PounceDamage * self.PounceDamageVsPropsMultiplier, owner, self) end + ent:PoisonDamage(self.PounceDamage, owner, self) elseif trace.HitWorld then if SERVER then owner:EmitSound("NPC_BlackHeadcrab.Impact") end self:SetLeaping(false) - self:SetNextPrimaryFire(curtime + 1) + self:SetNextPrimaryFire(curtime + 1 * delay) end - owner:LagCompensation(false) + --owner:LagCompensation(false) end end @@ -136,10 +135,10 @@ function SWEP:Think() end function SWEP:PrimaryAttack() - local owner = self.Owner + local owner = self:GetOwner() if self:IsLeaping() or self:IsGoingToSpit() or self:IsGoingToLeap() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() then return end - self:SetNextLeap(CurTime() + 1.25) + self:SetNextLeap(CurTime() + self.PounceWindUp) self.m_ViewAngles = owner:EyeAngles() @@ -149,30 +148,26 @@ function SWEP:PrimaryAttack() end function SWEP:SecondaryAttack() - if self:IsLeaping() or self:IsGoingToSpit() or self:IsGoingToLeap() or CurTime() < self:GetNextSecondaryFire() or not self.Owner:IsOnGround() then return end + if self:IsLeaping() or self:IsGoingToSpit() or self:IsGoingToLeap() or CurTime() < self:GetNextSecondaryFire() or not self:GetOwner():IsOnGround() then return end - self:SetNextSpit(CurTime() + 1) + self:SetNextSpit(CurTime() + self.SpitWindUp) if SERVER then - self.Owner:EmitSound("npc/headcrab_poison/ph_scream"..math.random(1, 3)..".wav") + self:GetOwner():EmitSound("npc/headcrab_poison/ph_scream"..math.random(3)..".wav") end end function SWEP:Reload() if self:GetNextReload() > CurTime() then return end - self:SetNextReload(CurTime() + 3) + self:SetNextReload(CurTime() + self.SilentPounceWindUp) if SERVER then - self.Owner:LagCompensation(true) - - local ent = self.Owner:MeleeTrace(4096, 24, self.Owner:GetMeleeFilter()).Entity - if ent:IsValid() and ent:IsPlayer() then - self.Owner:EmitSound("npc/headcrab_poison/ph_warning"..math.random(1, 3)..".wav") + local ent = self:GetOwner():CompensatedMeleeTrace(4096, 24).Entity + if ent:IsValidPlayer() then + self:GetOwner():EmitSound("npc/headcrab_poison/ph_warning"..math.random(3)..".wav") else - self.Owner:EmitSound("npc/headcrab_poison/ph_idle"..math.random(1, 3)..".wav") + self:GetOwner():EmitSound("npc/headcrab_poison/ph_idle"..math.random(3)..".wav") end - - self.Owner:LagCompensation(false) end return false @@ -210,11 +205,11 @@ end SWEP.IsLeaping = SWEP.GetLeaping function SWEP:SetNextLeap(time) - self:SetDTFloat(0, time) + self:SetDTFloat(DT_WEAPON_BASE_FLOAT_RELOADEND + 1, time) end function SWEP:GetNextLeap() - return self:GetDTFloat(0) + return self:GetDTFloat(DT_WEAPON_BASE_FLOAT_RELOADEND + 1) end function SWEP:IsGoingToLeap() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/cl_init.lua index 1c6b7fe..8aa6f55 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/cl_init.lua @@ -1,11 +1,3 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Poison Zombie" SWEP.ViewModelFOV = 47 -SWEP.DrawCrosshair = false - -function SWEP:SecondaryAttack() -end - -function SWEP:Reload() -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/init.lua index f370a91..8a137a2 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/init.lua @@ -1,65 +1,41 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") +INC_SERVER() -include("shared.lua") +SWEP.PoisonPattern = { + {-1, 0}, + {-0.66, 0}, + {-0.33, 0}, + {0, 0}, + {0, 1}, + {0, -1}, + {0.33, 0}, + {0.66, 0}, + {1, 0} +} -function SWEP:Reload() - self.BaseClass.SecondaryAttack(self) -end +function SWEP:DoThrow() + local owner = self:GetOwner() + local startpos = owner:GetShootPos() + local aimang = owner:EyeAngles() + local ang -local function DoFleshThrow(pl, wep) - if pl:IsValid() and pl:Alive() and wep:IsValid() then - pl:ResetSpeed() + for k, spr in pairs(self.PoisonPattern) do + if k == "BaseClass" then continue end - local startpos = pl:GetPos() - startpos.z = pl:GetShootPos().z - local aimang = pl:EyeAngles() + ang = Angle(aimang.p, aimang.y, aimang.r) + ang:RotateAroundAxis(ang:Up(), spr[1] * 12.5) + ang:RotateAroundAxis(ang:Right(), spr[2] * 5) + local heading = ang:Forward() - for i=1, 10 do - local ang = Angle(aimang.p, aimang.y, aimang.r) - ang:RotateAroundAxis(ang:Up(), math.Rand(-25, 25)) - ang:RotateAroundAxis(ang:Right(), math.Rand(-5, 5)) - local heading = ang:Forward() + local ent = ents.Create("projectile_poisonflesh") + if ent:IsValid() then + ent:SetPos(startpos + heading * 8) + ent:SetOwner(owner) + ent:Spawn() - local ent = ents.Create("projectile_poisonflesh") - if ent:IsValid() then - ent:SetPos(startpos + heading * 8) - ent:SetOwner(pl) - ent:Spawn() - - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:SetVelocityInstantaneous(heading * math.Rand(340, 550)) - end + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetVelocityInstantaneous(heading * self.PoisonThrowSpeed) end end - - pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.random(70, 80)) - - pl:RawCapLegDamage(CurTime() + 2) end end - -local function DoSwing(pl, wep) - if pl:IsValid() and pl:Alive() and wep:IsValid() then - pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 72, math.random(70, 83)) - if wep.SwapAnims then wep:SendWeaponAnim(ACT_VM_HITCENTER) else wep:SendWeaponAnim(ACT_VM_SECONDARYATTACK) end - wep.IdleAnimation = CurTime() + wep:SequenceDuration() - wep.SwapAnims = not wep.SwapAnims - end -end - -function SWEP:SecondaryAttack() - if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() then return end - - local owner = self.Owner - - owner:DoAnimationEvent(ACT_RANGE_ATTACK2) - owner:EmitSound("NPC_PoisonZombie.Throw") - owner:SetSpeed(1) - self:SetNextSecondaryFire(CurTime() + 4) - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - - timer.Simple(0.6, function() DoSwing(owner, self) end) - timer.Simple(1, function() DoFleshThrow(owner, self) end) -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/shared.lua index fadc95e..8337146 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_poisonzombie/shared.lua @@ -1,18 +1,90 @@ -SWEP.Base = "weapon_zs_zombie" +DEFINE_BASECLASS("weapon_zs_zombie") + +SWEP.PrintName = "Poison Zombie" SWEP.MeleeReach = 48 SWEP.MeleeDelay = 0.9 -SWEP.MeleeSize = 1.5 +SWEP.MeleeSize = 4.5 SWEP.MeleeDamage = 40 SWEP.MeleeDamageType = DMG_SLASH SWEP.MeleeAnimationDelay = 0.35 SWEP.Primary.Delay = 1.6 +SWEP.Secondary.Delay = 4 -SWEP.FleshThrowRecoil = 40 +SWEP.PoisonThrowDelay = 1 +SWEP.PoisonThrowSpeed = 380 SWEP.ViewModel = Model("models/weapons/v_pza.mdl") -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.WorldModel = "" + +function SWEP:Think() + BaseClass.Think(self) + + local time = CurTime() + + if self.NextThrowAnim and time >= self.NextThrowAnim and IsFirstTimePredicted() then + self.NextThrowAnim = nil + + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.random(70, 83)) + self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) + self.IdleAnimation = time + self:SequenceDuration() + end + + if self.NextThrow then + if time >= self.NextThrow and IsFirstTimePredicted() then + self.NextThrow = nil + + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + owner:ResetSpeed() + owner:RawCapLegDamage(CurTime() + 1.5) + + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.random(70, 80)) + + if SERVER then + self:DoThrow() + end + end + + self:NextThink(time) + return true + end +end + +function SWEP:PrimaryAttack() + if not self.NextThrow then + BaseClass.PrimaryAttack(self) + end +end + +function SWEP:SecondaryAttack() + if not IsFirstTimePredicted() then return end + + local time = CurTime() + if time < self:GetNextPrimaryFire() or time < self:GetNextSecondaryFire() then return end + + local owner = self:GetOwner() + + owner:DoAnimationEvent(ACT_RANGE_ATTACK2) + owner:SetSpeed(60) + + self:EmitSound("NPC_PoisonZombie.Throw") + + self:SetNextSecondaryFire(time + self.Secondary.Delay) + self:SetNextPrimaryFire(time + self.Primary.Delay) + + self.NextThrow = time + self.PoisonThrowDelay + self.NextThrowAnim = self.NextThrow - 0.4 +end + +function SWEP:Reload() + if not self.NextThrow then + BaseClass.SecondaryAttack(self) + end +end function SWEP:CheckMoaning() end @@ -24,18 +96,18 @@ function SWEP:StartMoaningSound() end function SWEP:PlayHitSound() - self.Owner:EmitSound("npc/zombie/claw_strike"..math.random(1, 3)..".wav", 75, 80) + self:EmitSound("npc/zombie/claw_strike"..math.random(1, 3)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(1, 2)..".wav", 75, 80) + self:EmitSound("npc/zombie/claw_miss"..math.random(1, 2)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("NPC_PoisonZombie.ThrowWarn") + self:EmitSound("NPC_PoisonZombie.ThrowWarn") end function SWEP:PlayAlertSound() - self.Owner:EmitSound("NPC_PoisonZombie.Alert") + self:GetOwner():EmitSound("NPC_PoisonZombie.Alert") end SWEP.PlayIdleSound = SWEP.PlayAlertSound diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/cl_init.lua new file mode 100644 index 0000000..1831a4e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/cl_init.lua @@ -0,0 +1,50 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.ump45_Release" +SWEP.HUD3DPos = Vector(-1.6, -4, 5) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.02 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModelFOV = 52 +SWEP.ViewModelFlip = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["bio+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0, 12), angle = Angle(0, 0, 0), size = Vector(0.05, 0.05, 0.019), color = Color(69, 62, 36, 255), surpresslightning = false, material = "models/weapons/w_shotgun/w_shotgun", skin = 0, bodygroup = {} }, + ["bio+++++++++++++"] = { type = "Model", model = "models/props_pipes/pipecluster32d_003a.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0.3, 2, 7), angle = Angle(0, 0, 90), size = Vector(0.019, 0.05, 0.019), color = Color(64, 79, 97, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.ump45_Parent", rel = "", pos = Vector(0.2, -5.6, -14), angle = Angle(0, 180, 0), size = Vector(0.05, 0.05, 0.059), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0, 3), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.039), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.079), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++++++++++++++"] = { type = "Model", model = "models/props_c17/gravestone004a.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, -0.5, 19.221), angle = Angle(0, 0, 0), size = Vector(0.1, 0.09, 0.1), color = Color(39, 46, 54, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio++++++++++"] = { type = "Model", model = "models/props_lab/generatortube.mdl", bone = "v_weapon.ump45_Clip", rel = "bio+++++++++", pos = Vector(0.1, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.05, 0.05, 0.05), color = Color(150, 230, 110, 255), surpresslightning = true, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio++++++++++++"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_base.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0.3, -4, 14), angle = Angle(0, 0, 0), size = Vector(0.349, 0.25, 0.23), color = Color(42, 46, 54, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio++++++"] = { type = "Model", model = "models/props_lab/generatortube.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.079, 0.079, 0.079), color = Color(150, 230, 110, 255), surpresslightning = true, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "v_weapon.ump45_Clip", rel = "bio+++++++++", pos = Vector(0.1, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.029, 0.039, 0.009), color = Color(15, 15, 15, 255), surpresslightning = false, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio+++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, -0.5, 15), angle = Angle(0, 0, -90), size = Vector(0.4, 0.5, 0.56), color = Color(47, 49, 49, 255), surpresslightning = false, material = "models/props_lab/teleportgate_sheet", skin = 0, bodygroup = {} }, + ["bio+++++++"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0.6, 12), angle = Angle(178.83, 90, 0), size = Vector(0.059, 0.079, 0.119), color = Color(84, 89, 125, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++++"] = { type = "Model", model = "models/props_c17/furnitureboiler001a.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, 0.6, 16), angle = Angle(0, 0, 0), size = Vector(0.1, 0.1, 0.1), color = Color(70, 75, 90, 255), surpresslightning = false, material = "models/weapons/w_shotgun/w_shotgun", skin = 0, bodygroup = {} }, + ["bio++++++++"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "v_weapon.ump45_Parent", rel = "bio", pos = Vector(0, -4.5, 6.5), angle = Angle(60, 90, 0), size = Vector(0.17, 0.17, 0.079), color = Color(34, 44, 55, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio+++++++++"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "v_weapon.ump45_Clip", rel = "", pos = Vector(0.1, 3, -2), angle = Angle(0, 0, 90), size = Vector(0.025, 0.025, 0.039), color = Color(34, 44, 55, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["bio+++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0, 12), angle = Angle(0, 0, 0), size = Vector(0.05, 0.05, 0.019), color = Color(69, 62, 36, 255), surpresslightning = false, material = "models/weapons/w_shotgun/w_shotgun", skin = 0, bodygroup = {} }, + ["bio+++++++++++++"] = { type = "Model", model = "models/props_pipes/pipecluster32d_003a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0.3, 2, 7), angle = Angle(0, 0, 90), size = Vector(0.019, 0.05, 0.019), color = Color(64, 79, 97, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(18, 2.599, -6), angle = Angle(0, -97.014, 85.324), size = Vector(0.05, 0.05, 0.059), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio+"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0, 3), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.039), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++++++++++++"] = { type = "Model", model = "models/props_wasteland/light_spotlight01_base.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0.3, -4, 14), angle = Angle(0, 0, 0), size = Vector(0.349, 0.25, 0.23), color = Color(42, 46, 54, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio++++++++++"] = { type = "Model", model = "models/props_lab/generatortube.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio++++++++", pos = Vector(1.799, 0, -2.1), angle = Angle(30, 0, 0), size = Vector(0.05, 0.05, 0.039), color = Color(150, 180, 0, 255), surpresslightning = true, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio++++"] = { type = "Model", model = "models/props_c17/furnitureboiler001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0.6, 16), angle = Angle(0, 0, 0), size = Vector(0.1, 0.1, 0.1), color = Color(70, 75, 90, 255), surpresslightning = false, material = "models/weapons/w_shotgun/w_shotgun", skin = 0, bodygroup = {} }, + ["bio++"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.079), color = Color(39, 44, 52, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++++++"] = { type = "Model", model = "models/props_lab/generatortube.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.079, 0.079, 0.079), color = Color(150, 180, 0, 255), surpresslightning = true, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio+++++++++++"] = { type = "Model", model = "models/props_wasteland/laundry_washer001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio++++++++", pos = Vector(0.1, 0, 4), angle = Angle(0, 0, 0), size = Vector(0.029, 0.039, 0.009), color = Color(15, 15, 15, 255), surpresslightning = false, material = "models/props_c17/metalladder002", skin = 0, bodygroup = {} }, + ["bio+++++"] = { type = "Model", model = "models/props_lab/labpart.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, -0.5, 15), angle = Angle(0, 0, -90), size = Vector(0.4, 0.5, 0.56), color = Color(47, 49, 49, 255), surpresslightning = false, material = "models/props_lab/teleportgate_sheet", skin = 0, bodygroup = {} }, + ["bio+++++++"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, 0.6, 12), angle = Angle(178.83, 90, 0), size = Vector(0.059, 0.079, 0.119), color = Color(84, 89, 125, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bio++++++++++++++"] = { type = "Model", model = "models/props_c17/gravestone004a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, -0.5, 19.221), angle = Angle(0, 0, 0), size = Vector(0.1, 0.09, 0.1), color = Color(39, 46, 54, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio++++++++"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, -4.5, 6.5), angle = Angle(60, 90, 0), size = Vector(0.17, 0.17, 0.079), color = Color(34, 44, 55, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} }, + ["bio+++++++++"] = { type = "Model", model = "models/props_phx/construct/metal_wire_angle360x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bio", pos = Vector(0, -7.301, 7), angle = Angle(0, 0, 90), size = Vector(0.025, 0.025, 0.039), color = Color(34, 44, 55, 255), surpresslightning = false, material = "models/props_c17/substation_transformer01a", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/init.lua new file mode 100644 index 0000000..fd5fead --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/init.lua @@ -0,0 +1,7 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_biorifle" +SWEP.Primary.ProjVelocity = 900 + +function SWEP:PhysModify(physobj) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/shared.lua new file mode 100644 index 0000000..464900f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pollutor/shared.lua @@ -0,0 +1,71 @@ +SWEP.PrintName = "'Pollutor' Acid Rifle" +SWEP.Description = "Launches acidic projectiles that have a chance to remove damage resistance" + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "smg" + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_ump45.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "chemical" +SWEP.Primary.Delay = 0.45 +SWEP.Primary.DefaultClip = 20 +SWEP.Primary.Damage = 34 +SWEP.Primary.NumShots = 1 + +SWEP.ConeMax = 3 +SWEP.ConeMin = 2.5 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 3 +SWEP.MaxStock = 3 + +SWEP.FireAnimSpeed = 0.4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.05) + +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Scorch' Napalm Rifle", "Chance to ignite instead of corrode at the cost of damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.86 + + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTInt(5, 1) + end + else + wept.VElements["bio++++++++++"].color = Color(230, 150, 100) + wept.VElements["bio++++++"].color = Color(230, 150, 100) + wept.WElements["bio++++++++++"].color = Color(230, 150, 100) + wept.WElements["bio++++++"].color = Color(230, 150, 100) + end +end) +branch.Colors = {Color(255, 160, 50), Color(215, 120, 50), Color(175, 100, 40)} +branch.NewNames = {"Hot", "Searing", "Torching"} + +branch = GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Glaze' Cryo Rifle", "Launches cryoblobs that slow zombies down at the cost of damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.77 + + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTInt(5, 2) + end + else + wept.VElements["bio++++++++++"].color = Color(100, 190, 230) + wept.VElements["bio++++++"].color = Color(100, 190, 230) + wept.WElements["bio++++++++++"].color = Color(100, 190, 230) + wept.WElements["bio++++++"].color = Color(100, 190, 230) + end +end) +branch.Colors = {Color(50, 160, 255), Color(50, 130, 215), Color(40, 115, 175)} +branch.NewNames = {"Cold", "Arctic", "Glacial"} + +function SWEP:EmitFireSound() + self:EmitSound("^weapons/mortar/mortar_fire1.wav", 70, math.random(88, 92), 0.65) + self:EmitSound("npc/barnacle/barnacle_gulp2.wav", 70, 70, 0.85, CHAN_AUTO + 20) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pot.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pot.lua index 4d69eb0..fb4e4bf 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pot.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pot.lua @@ -1,8 +1,8 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Pot" +SWEP.PrintName = "Pot" +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 @@ -38,6 +38,11 @@ SWEP.SwingRotation = Angle(30, -30, -30) SWEP.SwingTime = 0.3 SWEP.SwingHoldType = "grenade" +SWEP.AllowQualityWeapons = true +SWEP.Culinary = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1) + function SWEP:PlayHitSound() self:EmitSound("weapons/melee/frying_pan/pan_hit-0"..math.random(4)..".ogg") end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_powerfists.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_powerfists.lua new file mode 100644 index 0000000..5380b78 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_powerfists.lua @@ -0,0 +1,71 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_fists" + +SWEP.PrintName = "Power Fists" +SWEP.Description = "A pair of power fists. They are slower than conventional fist combat, but pack a hefty pulse powered punch." + +if CLIENT then + SWEP.ViewModelFOV = 65 + SWEP.ViewModelFlip = false + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1.129, 0.087, -1), angle = Angle(0, 90.421, 90.749), size = Vector(0.18, 0.18, 0.3), color = Color(105, 75, 65, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Finger2", rel = "base", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.28, 0.21, 0.15), color = Color(135, 115, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(1.129, -1.087, 2), angle = Angle(230, 90, 90), size = Vector(0.18, 0.18, 0.3), color = Color(105, 75, 65, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Finger2", rel = "base+", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.28, 0.21, 0.15), color = Color(135, 115, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.129, -1.087, 0), angle = Angle(0, 90.421, 90.749), size = Vector(0.18, 0.18, 0.3), color = Color(105, 75, 65, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Finger2", rel = "base", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.28, 0.21, 0.15), color = Color(135, 115, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(3.129, -1.087, 0), angle = Angle(230, 90, 90), size = Vector(0.18, 0.18, 0.3), color = Color(105, 75, 65, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Finger2", rel = "base+", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.28, 0.21, 0.15), color = Color(135, 115, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + } +end + +SWEP.WalkSpeed = SPEED_FAST +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_arms_hev.mdl" +SWEP.WorldModel = "models/weapons/w_grenade.mdl" + +SWEP.Weight = 4 + +SWEP.MeleeDamage = 86 +SWEP.LegDamage = 17 + +SWEP.Unarmed = false + +SWEP.Undroppable = false +SWEP.NoPickupNotification = false +SWEP.NoDismantle = false + +SWEP.NoGlassWeapons = false + +SWEP.AllowQualityWeapons = true +SWEP.SwingSound = Sound( "weapons/zs_power/power1.ogg" ) +SWEP.HitSound = Sound( "weapons/zs_power/power4.wav" ) + +SWEP.FistKnockback = true +SWEP.MeleeKnockBack = 200 + +SWEP.Primary.Delay = 0.65 + +SWEP.Tier = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.07, 1) + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + + if hitent:IsPlayer() then + hitent:AddLegDamageExt(self.LegDamage, self:GetOwner(), self, SLOWTYPE_PULSE) + hitent:EmitSound("Weapon_StunStick.Melee_Hit") + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proliferator.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proliferator.lua new file mode 100644 index 0000000..4c111ab --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proliferator.lua @@ -0,0 +1,142 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Proliferator' SMG" +SWEP.Description = "Hold right click to use the Storm firing mode: fire rate is reduced to 60% but a wider fan of bullets are fired." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 50 + + SWEP.HUD3DBone = "v_weapon.mac10_bolt" + SWEP.HUD3DPos = Vector(-2.2, 1, 0) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 + + SWEP.VElements = { + ["top2"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top", pos = Vector(0, -1.201, -0.602), angle = Angle(180, 0, 0), size = Vector(0.057, 0.611, 0.068), color = Color(170, 130, 120, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "v_weapon.mac10_parent", rel = "", pos = Vector(-0.064, -3.6, -2), angle = Angle(180, -90, 0), size = Vector(0.167, 0.119, 0.442), color = Color(72, 85, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "v_weapon.mac10_parent", rel = "", pos = Vector(-0.178, -5.091, -1.982), angle = Angle(180, 0, 90), size = Vector(0.021, 0.02, 0.009), color = Color(72, 85, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top2", pos = Vector(0, 0, 0.843), angle = Angle(90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "v_weapon.M3_PARENT", rel = "top2", pos = Vector(0, -0.5, -1.1), angle = Angle(0, -90, 0), size = Vector(0.17, 0.045, 0.045), color = Color(65, 70, 75, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5, 0, -2), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(70, 87, 100, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top2", pos = Vector(0, 0, 0.577), angle = Angle(-90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["top2"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(1.906, 0.238, 3.084), angle = Angle(0, 90, 90), size = Vector(0.057, 0.611, 0.068), color = Color(170, 170, 160, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_c17/TrapPropeller_Engine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.876, 0.9, -3.771), angle = Angle(-91.623, -4.99, 0), size = Vector(0.167, 0.119, 0.442), color = Color(72, 85, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(1.287, 0.241, 2.313), angle = Angle(0, -90, 90), size = Vector(0.021, 0.02, 0.009), color = Color(72, 85, 100, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["laser+"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top2", pos = Vector(0, 0, 0.843), angle = Angle(90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["fracture"] = { type = "Model", model = "models/props_wasteland/laundry_washer003.mdl", bone = "v_weapon.M3_PARENT", rel = "top2", pos = Vector(0, -0.5, -1.1), angle = Angle(0, -90, 0), size = Vector(0.17, 0.045, 0.045), color = Color(65, 70, 75, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["fracture+++++"] = { type = "Model", model = "models/props_c17/utilityconnecter002.mdl", bone = "v_weapon.M3_PARENT", rel = "fracture", pos = Vector(-5, 0, -2), angle = Angle(0, -90, 180), size = Vector(0.2, 0.2, 0.2), color = Color(70, 87, 100, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/hunter/blocks/cube075x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top2", pos = Vector(0, 0, 0.577), angle = Angle(-90, 90, 0), size = Vector(0.023, 0.037, 0.021), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_mac10.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = true +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/zs_scar/scar_fire1.ogg") +SWEP.Primary.Damage = 7.2 +SWEP.Primary.NumShots = 3 +SWEP.Primary.Delay = 0.15 + +SWEP.Primary.ClipSize = 28 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 6.3 +SWEP.ConeMin = 3.5 + +SWEP.ReloadSpeed = 0.95 + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.Tier = 3 + +SWEP.FireAnimSpeed = 1.7 + +SWEP.IronSightsPos = Vector(-7, 15, 0) +SWEP.IronSightsAng = Vector(3, -3, -10) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.9) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.01, 1) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/sg552/sg552-1.wav", 75, 195, 0.45, CHAN_WEAPON + 20) + self:EmitSound(self.Primary.Sound, 75, 199, 0.45, CHAN_WEAPON + 21) +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + local ironsights = self:GetIronsights() + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * (ironsights and 1.2 or 1)) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage * (ironsights and 0.6 or 1), ironsights and 5 or 3, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:SetIronsights(b) + if self:GetIronsights() ~= b then + if b then + self:EmitSound("npc/scanner/scanner_scan4.wav", 40) + else + self:EmitSound("npc/scanner/scanner_scan2.wav", 40) + end + end + + self.BaseClass.SetIronsights(self, b) +end + +function SWEP:CanPrimaryAttack() + if self:GetIronsights() and self:Clip1() == 1 then + self:SetIronsights(false) + end + + return self.BaseClass.CanPrimaryAttack(self) +end + +function SWEP:SecondaryAttack() + if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then + self:SetIronsights(true) + end +end + +function SWEP:ShootBullets(dmg, numbul, cone) + local owner = self:GetOwner() + local ironsights = self:GetIronsights() + local sprd = (ironsights and 2 or 2.75)*cone/6 + local recp = ironsights and 2 or 1.25 + + self:SendWeaponAnimation() + owner:DoAttackEvent() + + owner:LagCompensation(true) + for i = 1, numbul do + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Up(), (i - math.ceil((ironsights and 5 or 3)/2)) * sprd) + + owner:FireBulletsLua(owner:GetShootPos(), angle:Forward(), cone/recp, 1, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + end + owner:LagCompensation(false) +end + +util.PrecacheSound("npc/scanner/scanner_scan4.wav") +util.PrecacheSound("npc/scanner/scanner_scan2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/cl_init.lua new file mode 100644 index 0000000..13a6761 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/cl_init.lua @@ -0,0 +1,19 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 50 + +SWEP.ViewModelBoneMods = { + ["ValveBiped.cube1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube3"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.091, 3.181, 3), angle = Angle(0, 0, 180), size = Vector(0.16, 0.16, 0.16), color = Color(235, 205, 185, 255), surpresslightning = false, material = "models/props_canal/canal_bridge_railing_01c", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/substation_circuitbreaker01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 7), angle = Angle(0, 0, 0), size = Vector(0.02, 0.02, 0.02), color = Color(255, 205, 175, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.181, 2.273, -0.456), angle = Angle(-43.978, 27.614, 70.568), size = Vector(0.16, 0.16, 0.16), color = Color(235, 205, 185, 255), surpresslightning = false, material = "models/props_canal/canal_bridge_railing_01c", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/init.lua new file mode 100644 index 0000000..d5f9a08 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/init.lua @@ -0,0 +1,3 @@ +INC_SERVER() + +SWEP.ThrownProjectile = "projectile_proxymine" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/shared.lua new file mode 100644 index 0000000..5768e77 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_proxymine/shared.lua @@ -0,0 +1,11 @@ +SWEP.PrintName = "Proximity Mine" +SWEP.Description = "A proximity detection mine that jumps into the air then explodes, dealing explosive damage." + +SWEP.Base = "weapon_zs_basethrown" + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Primary.Ammo = "betty" + +SWEP.MaxStock = 8 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus.lua deleted file mode 100644 index cf661c7..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus.lua +++ /dev/null @@ -1,67 +0,0 @@ -AddCSLuaFile() - -SWEP.Base = "weapon_zs_zombie" - -if CLIENT then - SWEP.PrintName = "Puke Pus" -end - -SWEP.Primary.Delay = 3.5 - -SWEP.ViewModel = "models/weapons/v_crowbar.mdl" -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" - -SWEP.NextPuke = 0 -SWEP.PukeLeft = 0 - -function SWEP:Initialize() - self:HideViewAndWorldModel() - - self.BaseClass.Initialize(self) -end - -function SWEP:PrimaryAttack() - if CurTime() < self:GetNextPrimaryFire() then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - - self.PukeLeft = 40 - - self.Owner:EmitSound("npc/barnacle/barnacle_die2.wav") - self.Owner:EmitSound("npc/barnacle/barnacle_digesting1.wav") - self.Owner:EmitSound("npc/barnacle/barnacle_digesting2.wav") -end - -function SWEP:SecondaryAttack() -end - -function SWEP:Reload() -end - -if not SERVER then return end - -function SWEP:Think() - local pl = self.Owner - - if self.PukeLeft > 0 and CurTime() >= self.NextPuke then - self.PukeLeft = self.PukeLeft - 1 - self.NextEmit = CurTime() + 0.1 - - local ent = ents.Create("projectile_poisonpuke") - if ent:IsValid() then - ent:SetPos(pl:EyePos()) - ent:SetOwner(pl) - ent:Spawn() - - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - local ang = pl:EyeAngles() - ang:RotateAroundAxis(ang:Forward(), math.Rand(-30, 30)) - ang:RotateAroundAxis(ang:Up(), math.Rand(-30, 30)) - phys:SetVelocityInstantaneous(ang:Forward() * math.Rand(475, 750)) - end - end - end - - self:NextThink(CurTime()) - return true -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/init.lua new file mode 100644 index 0000000..5baa8f9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/init.lua @@ -0,0 +1,29 @@ +INC_SERVER() + +function SWEP:Think() + local pl = self:GetOwner() + + if self.PukeLeft > 0 and CurTime() >= self.NextPuke then + self.PukeLeft = self.PukeLeft - 1 + self.NextEmit = CurTime() + 0.1 + pl.LastRangedAttack = CurTime() + + local ent = ents.Create(self.PukeLeft % 6 == 1 and "projectile_ghoulfleshpuke" or "projectile_poisonpuke") + if ent:IsValid() then + ent:SetPos(pl:EyePos()) + ent:SetOwner(pl) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + local ang = pl:EyeAngles() + ang:RotateAroundAxis(ang:Forward(), math.Rand(-6, 6)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-22, 22)) + phys:SetVelocityInstantaneous(ang:Forward() * math.Rand(625, 750)) + end + end + end + + self:NextThink(CurTime()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/shared.lua new file mode 100644 index 0000000..589ed1a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pukepus/shared.lua @@ -0,0 +1,36 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Puke Pus" + +SWEP.Primary.Delay = 3.5 + +SWEP.ViewModel = "models/weapons/v_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +SWEP.NextPuke = 0 +SWEP.PukeLeft = 0 + +function SWEP:Initialize() + self:HideViewAndWorldModel() + + self.BaseClass.Initialize(self) +end + +function SWEP:PrimaryAttack() + if CurTime() < self:GetNextPrimaryFire() then return end + local owner = self:GetOwner() + local delay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * delay) + + self.PukeLeft = 35 + + owner:EmitSound("npc/barnacle/barnacle_die2.wav") + owner:EmitSound("npc/barnacle/barnacle_digesting1.wav") + owner:EmitSound("npc/barnacle/barnacle_digesting2.wav") +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pulserifle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pulserifle.lua index e76dc1c..4a92f69 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pulserifle.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pulserifle.lua @@ -1,16 +1,18 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Adonis' Pulse Rifle" +SWEP.Description = "Deals massive damage and slows targets." + +SWEP.Slot = 2 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Adonis' Pulse Rifle" - SWEP.Description = "Deals massive damage and slows targets." - SWEP.Slot = 2 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 SWEP.HUD3DBone = "Vent" - SWEP.HUD3DPos = Vector(1, 0, 0) + SWEP.HUD3DPos = Vector(1, 0, 0) SWEP.HUD3DScale = 0.018 end @@ -26,7 +28,7 @@ SWEP.CSMuzzleFlashes = false SWEP.ReloadSound = Sound("Weapon_SMG1.Reload") SWEP.Primary.Sound = Sound("Airboat.FireGunHeavy") -SWEP.Primary.Damage = 34 +SWEP.Primary.Damage = 29 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.2 @@ -35,28 +37,51 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "pulse" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.06 -SWEP.ConeMin = 0.02 +SWEP.ConeMax = 3 +SWEP.ConeMin = 1 SWEP.WalkSpeed = SPEED_SLOW SWEP.IronSightsPos = Vector(-3, 1, 1) +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + SWEP.TracerName = "AR2Tracer" +SWEP.FireAnimSpeed = 0.4 +SWEP.LegDamage = 5.5 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.014, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Servitor' Pulse Rifle", "Refreshes zapper cooldown on kill, more leg damage, reduced accuracy and reload speed", function(wept) + wept.ConeMin = 2.25 + wept.ConeMax = 3.75 + wept.ReloadSpeed = 0.85 + wept.LegDamage = 8 + + wept.OnZombieKilled = function(self) + local killer = self:GetOwner() + + if killer:IsValid() then + for _,v in pairs(ents.FindByClass("prop_zapper*")) do + if v:GetObjectOwner() == killer then + v:SetNextZap(0) + end + end + end + end +end) + function SWEP.BulletCallback(attacker, tr, dmginfo) local ent = tr.Entity - if ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then - ent:AddLegDamage(4) + if ent:IsValidZombie() then + local activ = attacker:GetActiveWeapon() + ent:AddLegDamageExt(activ.LegDamage, attacker, activ, SLOWTYPE_PULSE) end - local e = EffectData() - e:SetOrigin(tr.HitPos) - e:SetNormal(tr.HitNormal) - e:SetRadius(8) - e:SetMagnitude(1) - e:SetScale(1) - util.Effect("cball_bounce", e) - - GenericBulletCallback(attacker, tr, dmginfo) + if IsFirstTimePredicted() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pushbroom.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pushbroom.lua new file mode 100644 index 0000000..e33a55f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_pushbroom.lua @@ -0,0 +1,62 @@ +AddCSLuaFile() + +SWEP.PrintName = "Push Broom" +SWEP.Description = "BrooooooooooOOOOOOOOOOOOOM!" + +if CLIENT then + SWEP.ViewModelFOV = 70 + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/pushbroom.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 0.5, 8), angle = Angle(-65, -90, 90), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/pushbroom.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3, 1, 5), angle = Angle(247, 90, 283), size = Vector(0.75, 0.75, 0.75), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee2" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 53 +SWEP.MeleeRange = 67 +SWEP.MeleeSize = 1.7 +SWEP.MeleeKnockBack = 90 + +SWEP.Primary.Delay = 1.05 + +SWEP.Tier = 2 + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.SwingRotation = Angle(0, -90, -60) +SWEP.SwingOffset = Vector(0, 30, -40) +SWEP.SwingTime = 0.6 +SWEP.SwingHoldType = "melee" + +SWEP.AllowQualityWeapons = true +SWEP.DismantleDiv = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.08, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3, 1) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 80, math.Rand(60, 65)) +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/wood/wood_plank_impact_hard"..math.random(4)..".wav", 75, math.random(75, 80)) +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("physics/wood/wood_plank_impact_hard"..math.random(4)..".wav", 75, math.random(75, 80)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quasar.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quasar.lua new file mode 100644 index 0000000..1f718e1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quasar.lua @@ -0,0 +1,168 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Quasar' Pulse Rifle" +SWEP.Description = "A scoped pulse rifle that slows targets. Uses 4 pulse per shot." + +if CLIENT then + SWEP.Slot = 3 + SWEP.SlotPos = 0 + + SWEP.ViewModelFlip = false + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base+++"] = { type = "Model", model = Model("models/props_combine/combinecrane002.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(-19.8, -0.774, 2.871), angle = Angle(90, 90, 90), size = Vector(0.026, 0.017, 0.059), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = Model("models/props_combine/combinecrane002.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(-19.8, 0.518, 0.902), angle = Angle(-90, 90, 90), size = Vector(0.026, 0.017, 0.059), color = Color(194, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = Model("models/props_combine/combine_binocular01.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(4.922, 0.052, 1.103), angle = Angle(-9.115, 0, 0), size = Vector(0.246, 0.261, 0.115), color = Color(143, 195, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = Model("models/props_combine/combinethumper002.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(-3.194, -0.471, 2.769), angle = Angle(-180, 90, -90), size = Vector(0.034, 0.052, 0.068), color = Color(165, 214, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = Model("models/props_combine/combine_light002a.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(6.977, 0, 4.546), angle = Angle(-90, -90, 90), size = Vector(0.167, 0.196, 0.273), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = Model("models/props_combine/combine_barricade_bracket01a.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(11.1, -0.592, 2.599), angle = Angle(166.227, 0, 90), size = Vector(0.423, 0.317, 0.291), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bolt"] = { type = "Model", model = Model("models/props_combine/combinecamera001.mdl"), bone = "v_weapon.awm_bolt_action", rel = "", pos = Vector(-2.214, 0.8, -1.382), angle = Angle(-7.282, -6.264, 1.56), size = Vector(0.104, 0.184, 0.209), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = Model("models/props_combine/combinetrain01a.mdl"), bone = "v_weapon.awm_parent", rel = "", pos = Vector(0.082, -2.309, -5.773), angle = Angle(90, -90, 0), size = Vector(0.02, 0.017, 0.014), color = Color(150, 206, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = Model("models/props_c17/light_decklight01_on.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(6.581, 0, 5.449), angle = Angle(0, 0, 90), size = Vector(0.029, 0.039, 0.029), color = Color(150, 200, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["mag"] = { type = "Model", model = Model("models/Items/combine_rifle_cartridge01.mdl"), bone = "v_weapon.awm_clip", rel = "", pos = Vector(0.1, 0.294, -0.501), angle = Angle(127.601, -90, 0), size = Vector(0.321, 0.605, 0.337), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = Model("models/props_combine/combine_barricade_bracket01b.mdl"), bone = "v_weapon.awm_parent", rel = "base", pos = Vector(10.55, -0.592, -3.32), angle = Angle(-172.286, 0, 90), size = Vector(0.423, 0.23, 0.291), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base+++"] = { type = "Model", model = Model("models/props_combine/combinecrane002.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-19.8, -0.774, 2.871), angle = Angle(90, 90, 90), size = Vector(0.026, 0.017, 0.059), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = Model("models/props_combine/combinecrane002.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-19.8, 0.518, 0.902), angle = Angle(-90, 90, 90), size = Vector(0.026, 0.017, 0.059), color = Color(194, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = Model("models/props_combine/combine_binocular01.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(4.922, 0.052, 1.103), angle = Angle(-9.115, 0, 0), size = Vector(0.246, 0.261, 0.115), color = Color(143, 195, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = Model("models/props_combine/combinethumper002.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-3.194, -0.471, 2.769), angle = Angle(-180, 90, -90), size = Vector(0.034, 0.052, 0.068), color = Color(165, 214, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = Model("models/props_combine/combine_light002a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(6.977, 0, 4.546), angle = Angle(-90, -90, 90), size = Vector(0.167, 0.196, 0.273), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = Model("models/props_combine/combine_barricade_bracket01a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(11.1, -0.592, 2.599), angle = Angle(166.227, 0, 90), size = Vector(0.423, 0.317, 0.291), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bolt"] = { type = "Model", model = Model("models/props_combine/combinecamera001.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(1.754, 2.461, 1.468), angle = Angle(-7.752, 89.405, 92.916), size = Vector(0.104, 0.184, 0.209), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = Model("models/props_combine/combinetrain01a.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10.618, 1.266, -2.902), angle = Angle(169.628, 0, 0), size = Vector(0.02, 0.017, 0.014), color = Color(150, 206, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = Model("models/props_combine/combine_barricade_bracket01b.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(10.55, -0.592, -3.32), angle = Angle(-172.286, 0, 90), size = Vector(0.423, 0.23, 0.291), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["mag"] = { type = "Model", model = Model("models/Items/combine_rifle_cartridge01.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.837, 0, -0.113), angle = Angle(62.376, 0, 0), size = Vector(0.321, 0.605, 0.337), color = Color(200, 228, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = Model("models/props_c17/light_decklight01_on.mdl"), bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(6.581, 0, 5.449), angle = Angle(0, 0, 90), size = Vector(0.029, 0.039, 0.029), color = Color(150, 200, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.HUD3DBone = "v_weapon.awm_parent" + SWEP.HUD3DPos = Vector(-1.4, -5.35, -2.5) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 +end + +sound.Add( +{ + name = "Weapon_Quasar.Single", + channel = CHAN_AUTO, + volume = 1, + soundlevel = 100, + pitch = {105,115}, + sound = {"npc/sniper/sniper1.wav"} +}) + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl" +SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" +SWEP.UseHands = true + +SWEP.ReloadSound = Sound("Weapon_AWP.ClipOut") +SWEP.Primary.Sound = Sound("Weapon_Quasar.Single") +SWEP.Primary.Damage = 110 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.05 +SWEP.ReloadDelay = SWEP.Primary.Delay +SWEP.RequiredClip = 4 + +SWEP.Primary.ClipSize = 24 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 25 + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN + +SWEP.ConeMax = 3 +SWEP.ConeMin = 0 +SWEP.IronSightsPos = Vector(5.015, -8, 2.52) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.TracerName = "AR2Tracer" + +SWEP.FireAnimSpeed = 1.3 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 4) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Blazar' Pulse Tri-Rifle", "Shoots 3 pulse shots in a spread out line with more total damage", function(wept) + wept.Primary.NumShots = 3 + wept.Primary.Damage = wept.Primary.Damage * 1.2/3 + + wept.ConeMax = 5 + wept.ConeMin = 4 + wept.ShootBullets = function(self, dmg, numbul, cone) + local owner = self:GetOwner() + + self:SendWeaponAnimation() + owner:DoAttackEvent() + + owner:LagCompensation(true) + for i = 1, numbul do + local angle = owner:GetAimVector():Angle() + angle:RotateAroundAxis(angle:Up(), (i - math.ceil(3/2)) * 2.75*cone/6) + + owner:FireBulletsLua(owner:GetShootPos(), angle:Forward(), cone/2, 1, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + end + owner:LagCompensation(false) + end + + wept.EmitFireSound = function(self) + self:EmitSound(self.Primary.Sound) + self:EmitSound("weapons/flaregun/fire.wav", 70, math.random(95, 105), 1, CHAN_WEAPON) + self:EmitSound("weapons/physcannon/superphys_launch1.wav", 72, 158, 0.75, CHAN_WEAPON + 1) + end +end) + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound) + self:EmitSound("weapons/flaregun/fire.wav", 70, math.random(95, 105), 1, CHAN_WEAPON) +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + if ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then + ent:AddLegDamageExt(8, attacker, attacker:GetActiveWeapon(), SLOWTYPE_PULSE) + end + + if IsFirstTimePredicted() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + end +end + +if CLIENT then + SWEP.IronsightsMultiplier = 0.25 + + function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) + end + + function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if not self:IsScoped() then return end + + self:DrawFuturisticScope() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quicksilver.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quicksilver.lua new file mode 100644 index 0000000..98193ab --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_quicksilver.lua @@ -0,0 +1,82 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Quicksilver' Semi-Auto Rifle" +SWEP.Description = "A semi automatic sniper rifle. Has good fire rate, large clip size and a decent damage per shot." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.g3sg1_Parent" + SWEP.HUD3DPos = Vector(-1.2, -5.75, -1) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_g3sg1.mdl" +SWEP.WorldModel = "models/weapons/w_snip_g3sg1.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("Weapon_G3SG1.Single") +SWEP.Primary.Damage = 78.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.38 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "357" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN + +SWEP.ConeMax = 6.5 +SWEP.ConeMin = 0 + +SWEP.IronSightsPos = Vector(11, -9, -2.2) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.05) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Mercurial' Birdshot Rifle", "Fires a spread of less accurate shots that deal more total damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage / 5 + wept.Primary.NumShots = 6 + wept.ConeMin = 3 +end) + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +if CLIENT then + SWEP.IronsightsMultiplier = 0.25 + + function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) + end + + function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + self:DrawRegularScope() + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_reaper.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_reaper.lua index bc43802..94abc9e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_reaper.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_reaper.lua @@ -1,15 +1,17 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Reaper' UMP" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Reaper' UMP" +SWEP.Description = "A hard hitting SMG that provides a short duration stacking damage buff if you earn a kill." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 SWEP.HUD3DBone = "v_weapon.ump45_Release" - SWEP.HUD3DPos = Vector(-1.1, -3, 2) + SWEP.HUD3DPos = Vector(-1.5, -3, 2) SWEP.HUD3DAng = Angle(0, 0, 0) SWEP.HUD3DScale = 0.02 end @@ -23,11 +25,11 @@ SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_UMP45.Single") -SWEP.Primary.Damage = 24 +SWEP.Primary.Damage = 19.125 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 0.13 +SWEP.Primary.Delay = 0.12 -SWEP.Primary.ClipSize = 28 +SWEP.Primary.ClipSize = 30 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" GAMEMODE:SetupDefaultClip(SWEP.Primary) @@ -35,10 +37,61 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_AR2 -SWEP.ConeMax = 0.08 -SWEP.ConeMin = 0.045 +SWEP.ConeMax = 4 +SWEP.ConeMin = 2.1 -SWEP.WalkSpeed = SPEED_SLOW +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.ReloadSpeed = 1.05 + +SWEP.Tier = 4 +SWEP.MaxStock = 3 SWEP.IronSightsPos = Vector(-5.3, -3, 4.4) SWEP.IronSightsAng = Vector(-1, 0.2, 2.55) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.015) + +function SWEP:OnZombieKilled() + local killer = self:GetOwner() + + if killer:IsValid() then + local reaperstatus = killer:GiveStatus("reaper", 14) + if reaperstatus and reaperstatus:IsValid() then + reaperstatus:SetDTInt(1, math.min(reaperstatus:GetDTInt(1) + 1, 3)) + killer:EmitSound("hl1/ambience/particle_suck1.wav", 55, 150 + reaperstatus:GetDTInt(1) * 30, 0.45) + end + end +end + +function SWEP.BulletCallback(attacker, tr) + local hitent = tr.Entity + if hitent:IsValidLivingZombie() and hitent:Health() <= hitent:GetMaxHealthEx() * 0.04 and gamemode.Call("PlayerShouldTakeDamage", hitent, attacker) then + if SERVER then + hitent:SetWasHitInHead() + end + hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, attacker, attacker:GetActiveWeapon(), tr.HitPos) + hitent:EmitSound("npc/roller/blade_out.wav", 80, 125) + end +end + +if not CLIENT then return end + +function SWEP:Draw3DHUD(vm, pos, ang) + self.BaseClass.Draw3DHUD(self, vm, pos, ang) + + local wid, hei = 180, 200 + local x, y = wid * -0.6, hei * -0.5 + + cam.Start3D2D(pos, ang, self.HUD3DScale) + local owner = self:GetOwner() + local ownerstatus = owner:GetStatus("reaper") + if ownerstatus then + local text = "" + for i = 0, ownerstatus:GetDTInt(1)-1 do + text = text .. "+" + end + draw.SimpleTextBlurry(text, "ZS3D2DFontSmall", x + wid/2, y + hei * 0.15, Color(60, 30, 175, 230), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + end + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rebarmace.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rebarmace.lua new file mode 100644 index 0000000..f6770f0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rebarmace.lua @@ -0,0 +1,96 @@ +AddCSLuaFile() + +SWEP.PrintName = "Rebar Mace" +SWEP.Description = "Disorients zombies hit." + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_debris/rebar004b_48.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.194, 2.111, -16.512), angle = Angle(0, 0, 0), size = Vector(0.8, 0.8, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_debris/rebar004b_48.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.244, 3.529, -15.808), angle = Angle(-3.796, 1.958, -4.97), size = Vector(0.8, 0.8, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/c_stunstick.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "melee2" + +SWEP.MeleeDamage = 135 +SWEP.MeleeRange = 70 +SWEP.MeleeSize = 3 +SWEP.MeleeKnockBack = 300 + +SWEP.Primary.Delay = 1.4 + +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.SwingRotation = Angle(60, 0, -80) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingTime = 0.8 +SWEP.SwingHoldType = "melee" + +SWEP.Tier = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.15) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Rebar Ward Hammer", "Grants defence on kill, does not knockback zombie vision, faster but less damage and knockback", function(wept) + wept.Primary.Delay = wept.Primary.Delay * 0.8 + wept.MeleeDamage = wept.MeleeDamage * 0.75 + wept.MeleeKnockBack = 200 + + wept.OnZombieKilled = function(self, zombie, total, dmginfo) + local killer = self:GetOwner() + + if killer:IsValid() then + killer:GiveStatus("medrifledefboost", 15) + end + end + + if SERVER then + wept.OnMeleeHit = function() end + end +end) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(55, 65)) +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/concrete/concrete_break"..math.random(2,3)..".wav", 75, math.random(95, 105)) +end + +if SERVER then +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and CurTime() >= (hitent._NextLeadPipeEffect or 0) then + hitent._NextLeadPipeEffect = CurTime() + 1.5 + + --hitent:GiveStatus("disorientation") + local x = math.Rand(0.75, 1) + x = x * (math.random(2) == 2 and 1 or -1) + + local ang = Angle(1 - x, x, 0) * 50 + hitent:ViewPunch(ang) + + local eyeangles = hitent:EyeAngles() + eyeangles:RotateAroundAxis(eyeangles:Up(), ang.yaw) + eyeangles:RotateAroundAxis(eyeangles:Right(), ang.pitch) + eyeangles.pitch = math.Clamp(ang.pitch, -89, 89) + eyeangles.roll = 0 + hitent:SetEyeAngles(eyeangles) + end +end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redeemers.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redeemers.lua index 5802695..0b30b1c 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redeemers.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redeemers.lua @@ -1,10 +1,10 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Redeemers' Dual Handguns" - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Redeemers' Dual Handguns" +SWEP.Slot = 1 +SWEP.SlotPos = 0 +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 @@ -31,8 +31,10 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "pistol" SWEP.Primary.DefaultClip = 150 -SWEP.ConeMax = 0.055 -SWEP.ConeMin = 0.05 +SWEP.ConeMax = 2.75 +SWEP.ConeMin = 2.5 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) function SWEP:SecondaryAttack() end @@ -40,3 +42,18 @@ end function SWEP:SendWeaponAnimation() self:SendWeaponAnim(self:Clip1() % 2 == 0 and ACT_VM_PRIMARYATTACK or ACT_VM_SECONDARYATTACK) end + +if not CLIENT then return end + +function SWEP:GetTracerOrigin() + local owner = self:GetOwner() + if owner:IsValid() then + local vm = owner:GetViewModel() + if vm and vm:IsValid() then + local attachment = vm:GetAttachment(self:Clip1() % 2 + 3) + if attachment then + return attachment.Pos + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redmarrow.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redmarrow.lua new file mode 100644 index 0000000..5ea803b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_redmarrow.lua @@ -0,0 +1,45 @@ +AddCSLuaFile() + +if CLIENT then + SWEP.PrintName = "Red Marrow" +end + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 30 +--SWEP.MeleeDamageShielded = 20 + +--[[function SWEP:MeleeHit(ent, trace, damage, forcescale) + local owner = self:GetOwner() + if owner:GetStatus("redmarrow") then + damage = self.MeleeDamageShielded + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end]] + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/fast_zombie/fz_scream1.wav", 75, math.random(60,70), 0.5) + self:GetOwner():EmitSound("npc/fast_zombie/fz_scream1.wav", 75, math.random(70,80), 0.5) +end +SWEP.PlayIdleSound = SWEP.PlayAlertSound + +function SWEP:PlayAttackSound() + self:GetOwner():EmitSound("npc/combine_soldier/die"..math.random(1,3)..".wav", 75, math.random(70,75), 0.5) + self:GetOwner():EmitSound("npc/combine_soldier/die"..math.random(1,3)..".wav", 75, math.random(78,90), 0.5) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) +end + +local matSheet = Material("Models/flesh") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/cl_init.lua new file mode 100644 index 0000000..dff273f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/cl_init.lua @@ -0,0 +1,42 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:DrawHUD() + if GetConVarNumber("crosshair") ~= 1 then return end + self:DrawCrosshairDot() +end + +function SWEP:PrimaryAttack() +end + +function SWEP:DrawWeaponSelection(...) + return self:BaseDrawWeaponSelection(...) +end + +function SWEP:Think() + if self:GetOwner():KeyDown(IN_ATTACK2) then + self:RotateGhost(FrameTime() * 60) + end + if self:GetOwner():KeyDown(IN_RELOAD) then + self:RotateGhost(FrameTime() * -60) + end +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + return true +end + +local nextclick = 0 +function SWEP:RotateGhost(amount) + if nextclick <= RealTime() then + surface.PlaySound("npc/headcrab_poison/ph_step4.wav") + nextclick = RealTime() + 0.3 + end + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/init.lua new file mode 100644 index 0000000..834f622 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/init.lua @@ -0,0 +1,82 @@ +INC_SERVER() + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self:SpawnGhost() + + return true +end + +function SWEP:OnRemove() + self:RemoveGhost() +end + +function SWEP:Holster() + self:RemoveGhost() + return true +end + +function SWEP:SpawnGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:GiveStatus("ghost_remantler") + end +end + +function SWEP:RemoveGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:RemoveStatus("ghost_remantler", false, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local status = owner.status_ghost_remantler + if not (status and status:IsValid()) then return end + status:RecalculateValidity() + if not status:GetValidPlacement() then return end + + local pos, ang = status:RecalculateValidity() + if not pos or not ang then return end + + self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + + local ent = ents.Create("prop_remantler") + if ent:IsValid() then + ent:SetPos(pos) + ent:SetAngles(ang) + ent:Spawn() + + ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() + + ent:EmitSound("npc/dog/dog_servo12.wav") + + ent:GhostAllPlayersInMe(5) + + self:TakePrimaryAmmo(1) + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + ent:SetScraps(stored[2]) + end + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end +end + +function SWEP:Think() + local count = self:GetPrimaryAmmoCount() + if count ~= self:GetReplicatedAmmo() then + self:SetReplicatedAmmo(count) + self:GetOwner():ResetSpeed() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/shared.lua new file mode 100644 index 0000000..d3875b9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_remantler/shared.lua @@ -0,0 +1,64 @@ +SWEP.PrintName = "Weapon Remantler" +SWEP.Description = "A deployable device capable of disassembling weapons into scrap, and upgrading weapons with scrap.\nIt can be used to assemble trinkets with scrap also.\nPress PRIMARY ATTACK to deploy the remantler.\nPress SECONDARY ATTACK and RELOAD to rotate the remantler." + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = Model("models/props_lab/powerbox01a.mdl") + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Ammo = "remantler" +SWEP.Primary.Delay = 1 +SWEP.Primary.Automatic = true + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "dummy" + +SWEP.MaxStock = 5 + +SWEP.WalkSpeed = SPEED_NORMAL +SWEP.FullWalkSpeed = SPEED_SLOWEST + +function SWEP:Initialize() + self:SetWeaponHoldType("slam") + self:SetDeploySpeed(1.1) + self:HideViewAndWorldModel() +end + +function SWEP:SetReplicatedAmmo(count) + self:SetDTInt(0, count) +end + +function SWEP:GetReplicatedAmmo() + return self:GetDTInt(0) +end + +function SWEP:GetWalkSpeed() + if self:GetPrimaryAmmoCount() > 0 then + return self.FullWalkSpeed + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:Holster() + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_renegade.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_renegade.lua new file mode 100644 index 0000000..198cd0f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_renegade.lua @@ -0,0 +1,146 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Renegade' Rifle" +SWEP.Description = "A rifle with high headshot damage and a decent clip size. Receives a resistance penetration buff if you score enough headshot kills with it." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 63.70351758794 + + SWEP.HUD3DBone = "v_weapon.sg550_Parent" + SWEP.HUD3DPos = Vector(-2, -5.2, -2) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.02 + + SWEP.VElements = { + ["kickstand_hold"] = { type = "Model", model = "models/Mechanics/robotics/a1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "canister_front", pos = Vector(-0.242, 0, 4.394), angle = Angle(0, 90, 90), size = Vector(0.254, 0.144, 0.144), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["scopebase"] = { type = "Model", model = "models/Mechanics/roboticslarge/g1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-2.064, 0, -0.262), angle = Angle(0, 0, 90), size = Vector(0.061, 0.037, 0.129), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["kickstand"] = { type = "Model", model = "models/props_c17/metalladder002b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel", pos = Vector(-6.031, 0, 25.576), angle = Angle(135, 0, 180), size = Vector(0.164, 0.245, 0.368), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["clip"] = { type = "Model", model = "models/props_c17/consolebox01a.mdl", bone = "v_weapon.sg550_Clip", rel = "", pos = Vector(0.902, 3.177, 0.266), angle = Angle(0, 90, -90), size = Vector(0.104, 0.134, 0.15), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["canister_front"] = { type = "Model", model = "models/props_c17/canister_propane01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0.779, 0, -1.066), angle = Angle(-90, 0, 0), size = Vector(0.1, 0.1, 0.15), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_lab/citizenradio.mdl", bone = "v_weapon.sg550_Parent", rel = "", pos = Vector(0, -6.222, -4.554), angle = Angle(-90, 90, 0), size = Vector(0.731, 0.127, 0.182), color = Color(75, 65, 55, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom_grip"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom", pos = Vector(0, -2.5, -6.072), angle = Angle(0, -90, 0), size = Vector(0.882, 0.865, 0.992), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_rooftop/roof_vent001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "canister_front", pos = Vector(0, 0, 36.013), angle = Angle(180, 0, 0), size = Vector(0.173, 0.36, 0.727), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["thing_that_moves_back_when_you_shoot"] = { type = "Model", model = "models/props_rooftop/roof_vent001.mdl", bone = "v_weapon.sg550_Chamber", rel = "", pos = Vector(-0.077, 1.86, -2.192), angle = Angle(90, 0, 0), size = Vector(0.18, 0.18, 0.063), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["blackbars"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "canister_front", pos = Vector(0, 0, 4.34), angle = Angle(0, -90, 90), size = Vector(0.179, 0.5, 0.25), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["scope_screen"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(-3.105, 0, 1.746), angle = Angle(0, -90, 0), size = Vector(0.078, 0.116, 0.064), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} }, + ["bottom_back"] = { type = "Model", model = "models/props_c17/furniturefridge001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "bottom", pos = Vector(0, -12.132, 0.768), angle = Angle(0, -90, 0), size = Vector(0.057, 0.133, 0.052), color = Color(65, 65, 65, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["bottom"] = { type = "Model", model = "models/props_trainstation/train003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "barrel", pos = Vector(-1.348, 0, 39.881), angle = Angle(0, 90, 90), size = Vector(0.027, 0.048, 0.019), color = Color(75, 85, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["kickstand_hold"] = { type = "Model", model = "models/Mechanics/robotics/a1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "canister_front", pos = Vector(-0.242, 0, 4.394), angle = Angle(0, 90, 90), size = Vector(0.254, 0.144, 0.144), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["scopebase"] = { type = "Model", model = "models/Mechanics/roboticslarge/g1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-2.064, 0, -0.262), angle = Angle(0, 0, 90), size = Vector(0.061, 0.037, 0.129), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["kickstand"] = { type = "Model", model = "models/props_c17/metalladder002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(-6.031, 0, 19.576), angle = Angle(135, 0, 180), size = Vector(0.164, 0.245, 0.368), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["clip"] = { type = "Model", model = "models/props_c17/consolebox01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom", pos = Vector(0.758, 4.119, -3.109), angle = Angle(90, 0, 0), size = Vector(0.104, 0.134, 0.15), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["canister_front"] = { type = "Model", model = "models/props_c17/canister_propane01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(0.779, 0, -1.066), angle = Angle(-90, 0, 0), size = Vector(0.1, 0.1, 0.15), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_lab/citizenradio.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.354, 1.194, -6.069), angle = Angle(-171.883, 180, 0), size = Vector(0.731, 0.127, 0.182), color = Color(75, 65, 55, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["bottom_grip"] = { type = "Model", model = "models/weapons/w_pist_elite_single.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom", pos = Vector(0, -2.5, -6.072), angle = Angle(0, -90, 0), size = Vector(0.882, 0.865, 0.992), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_rooftop/roof_vent001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "canister_front", pos = Vector(0, 0, 29.892), angle = Angle(180, 0, 0), size = Vector(0.173, 0.36, 0.579), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["thing_that_moves_back_when_you_shoot"] = { type = "Model", model = "models/props_rooftop/roof_vent001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom", pos = Vector(0.153, 5.056, 0.425), angle = Angle(-90, 0, 0), size = Vector(0.18, 0.18, 0.063), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} }, + ["bottom"] = { type = "Model", model = "models/props_trainstation/train003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "barrel", pos = Vector(-1.348, 0, 33.347), angle = Angle(0, 90, 90), size = Vector(0.027, 0.048, 0.019), color = Color(75, 85, 95, 255), surpresslightning = false, material = "models/props_pipes/valve001_skin2", skin = 0, bodygroup = {} }, + ["bottom_back"] = { type = "Model", model = "models/props_c17/furniturefridge001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bottom", pos = Vector(0, -12.132, 0.768), angle = Angle(0, -90, 0), size = Vector(0.057, 0.133, 0.052), color = Color(65, 65, 65, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} }, + ["scope_screen"] = { type = "Model", model = "models/props_junk/cardboard_box001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scope", pos = Vector(-3.105, 0, 1.746), angle = Angle(0, -90, 0), size = Vector(0.078, 0.116, 0.064), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} }, + ["blackbars"] = { type = "Model", model = "models/props_c17/playground_teetertoter_stan.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "canister_front", pos = Vector(0, 0, 4.34), angle = Angle(0, -90, 90), size = Vector(0.179, 0.5, 0.25), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/weapons/v_stunbaton/w_shaft01a", skin = 0, bodygroup = {} } + } +end + +sound.Add( +{ + name = "Weapon_Renegade.Single", + channel = CHAN_AUTO, + volume = 0.7, + soundlevel = 80, + pitchstart = 55, + pitchend = 60, + sound = {"weapons/zs_scar/scar_fire1.ogg"} +}) + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_sg550.mdl" +SWEP.WorldModel = "models/weapons/w_snip_sg550.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("Weapon_Renegade.Single") +SWEP.Primary.Damage = 127 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.2 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "357" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN + +SWEP.ConeMax = 6 +SWEP.ConeMin = 0 +SWEP.HeadshotMulti = 2.45 + +SWEP.IronSightsPos = Vector(11, -9, -2.2) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.FireAnimSpeed = 0.5 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.13, 1) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound) + self:EmitSound("npc/sniper/sniper1.wav", 80, 125, 0.85, CHAN_AUTO) + self:EmitSound("weapons/sg552/sg552-1.wav", 80, 145, 0.75, CHAN_WEAPON + 20) +end + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +function SWEP:OnZombieKilled(zombie) + local killer = self:GetOwner() + + if killer:IsValid() and zombie:WasHitInHead() then + killer.RenegadeHeadshots = (killer.RenegadeHeadshots or 0) + 1 + + if killer.RenegadeHeadshots >= 3 then + killer:GiveStatus("renegade", 17) + killer.RenegadeHeadshots = 0 + end + end +end + +if CLIENT then + SWEP.IronsightsMultiplier = 0.25 + + function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) + end + + function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + self:DrawFuturisticScope() + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/cl_init.lua new file mode 100644 index 0000000..f075855 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/cl_init.lua @@ -0,0 +1,43 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetBool() then + self:DrawCrosshairDot() + end +end + +function SWEP:PrimaryAttack() +end + +function SWEP:DrawWeaponSelection(...) + return self:BaseDrawWeaponSelection(...) +end + +function SWEP:Think() + if self:GetOwner():KeyDown(IN_ATTACK2) then + self:RotateGhost(FrameTime() * 60) + end + if self:GetOwner():KeyDown(IN_RELOAD) then + self:RotateGhost(FrameTime() * -60) + end +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + return true +end + +local nextclick = 0 +function SWEP:RotateGhost(amount) + if nextclick <= RealTime() then + surface.PlaySound("npc/headcrab_poison/ph_step4.wav") + nextclick = RealTime() + 0.3 + end + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/init.lua new file mode 100644 index 0000000..dcf5a43 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/init.lua @@ -0,0 +1,90 @@ +INC_SERVER() + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self:SpawnGhost() + + return true +end + +function SWEP:OnRemove() + self:RemoveGhost() +end + +function SWEP:Holster() + self:RemoveGhost() + return true +end + +function SWEP:SpawnGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:GiveStatus(self.GhostStatus) + end +end + +function SWEP:RemoveGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:RemoveStatus(self.GhostStatus, false, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local status = owner:GetStatus(self.GhostStatus) + if not (status and status:IsValid()) then return end + status:RecalculateValidity() + if not status:GetValidPlacement() then return end + + local pos, ang = status:RecalculateValidity() + if not pos or not ang then return end + + self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + + local ent = ents.Create(self.DeployClass) + if ent:IsValid() then + ent:SetPos(pos) + ent:SetAngles(ang) + ent:Spawn() + + ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() + + ent:EmitSound("npc/dog/dog_servo12.wav") + + ent:SetNextRepairPulse(CurTime() + 4) + + self:TakePrimaryAmmo(1) + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + end + + local ammo = math.min(owner:GetAmmoCount("pulse"), 150) + ent:SetAmmo(ammo) + owner:RemoveAmmo(ammo, "pulse") + + ent.DeployableAmmo = self.Primary.Ammo + ent.HealValue = self.Repair + ent.MaxDistance = self.MaxDistance + ent.SWEP = self:GetClass() + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end +end + +function SWEP:Think() + local count = self:GetPrimaryAmmoCount() + if count ~= self:GetReplicatedAmmo() then + self:SetReplicatedAmmo(count) + self:GetOwner():ResetSpeed() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/shared.lua new file mode 100644 index 0000000..5a71f31 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_repairfield/shared.lua @@ -0,0 +1,80 @@ +SWEP.PrintName = "'Sentinel' Repair Field Emitter" +SWEP.Description = "A repair field which slowly repairs all props in a radius with a energy pulse. Consumes pulse ammo.\nPress PRIMARY ATTACK to deploy the repair field.\nPress SECONDARY ATTACK and RELOAD to rotate the repair field." + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = Model("models/props/de_nuke/smokestack01.mdl") + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Ammo = "repairfield" +SWEP.Primary.Delay = 1 +SWEP.Primary.Automatic = true + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "dummy" + +SWEP.ModelScale = 0.55 + +SWEP.MaxStock = 5 + +SWEP.Repair = 8 +SWEP.MaxDistance = 75 + +SWEP.WalkSpeed = SPEED_NORMAL +SWEP.FullWalkSpeed = SPEED_SLOWEST + +SWEP.ResupplyAmmoType = "pulse" + +SWEP.GhostStatus = "ghost_repairfield" +SWEP.DeployClass = "prop_repairfield" + +SWEP.NoDeploySpeedChange = true +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_REPAIR, 0.75) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_DISTANCE, 4) + +function SWEP:Initialize() + self:SetWeaponHoldType("slam") + self:SetDeploySpeed(1.1) + self:HideViewAndWorldModel() +end + +function SWEP:SetReplicatedAmmo(count) + self:SetDTInt(0, count) +end + +function SWEP:GetReplicatedAmmo() + return self:GetDTInt(0) +end + +function SWEP:GetWalkSpeed() + if self:GetPrimaryAmmoCount() > 0 then + return self.FullWalkSpeed + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:Holster() + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/cl_init.lua index 1bdf74e..67949da 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/cl_init.lua @@ -1,35 +1,33 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Resupply Box" -SWEP.Description = "Allows survivors to get ammunition for their current weapon. Each person can only use the box once every so often.\nPress PRIMARY ATTACK to deploy the box.\nPress SECONDARY ATTACK and RELOAD to rotate the box." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end @@ -40,5 +38,5 @@ function SWEP:RotateGhost(amount) surface.PlaySound("npc/headcrab_poison/ph_step4.wav") nextclick = RealTime() + 0.3 end - RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/init.lua index df2bdb1..0f53d53 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_resupplybox") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_resupplybox", false, true) end @@ -37,15 +34,13 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_resupplybox if not (status and status:IsValid()) then return end - status:RecalculateValidity() - if not status:GetValidPlacement() then return end local pos, ang = status:RecalculateValidity() - if not pos or not ang then return end + if not status:GetValidPlacement() or not pos or not ang then return end self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) @@ -56,6 +51,7 @@ function SWEP:PrimaryAttack() ent:Spawn() ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() ent:EmitSound("npc/dog/dog_servo12.wav") @@ -78,6 +74,6 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/shared.lua index 04af369..b88d8db 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_resupplybox/shared.lua @@ -1,3 +1,6 @@ +SWEP.PrintName = "Resupply Box" +SWEP.Description = "Allows survivors to get ammunition for their current weapon. Each person can only use the box once every so often.\nPress PRIMARY ATTACK to deploy the box.\nPress SECONDARY ATTACK and RELOAD to rotate the box." + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/Items/ammocrate_ar2.mdl") @@ -11,15 +14,18 @@ SWEP.Primary.Automatic = true SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 -SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "dummy" +SWEP.MaxStock = 5 + SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOWEST +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() end @@ -44,7 +50,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/cl_init.lua new file mode 100644 index 0000000..5d38e07 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/cl_init.lua @@ -0,0 +1,77 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.Glock_Parent" +SWEP.HUD3DPos = Vector(3.338, -3.442, 1.976) +SWEP.HUD3DAng = Angle(270, 0, 0) +SWEP.HUD3DScale = 0.015 + +SWEP.ViewModelFOV = 70 +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["METALSPIKES"] = { type = "Model", model = "models/Mechanics/gears2/pinion_20t1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALFRONT", pos = Vector(-0.83, 0, 0), angle = Angle(0, -90, 0), size = Vector(0.201, 0.328, 0.166), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["projectilepart2"] = { type = "Model", model = "models/items/combine_rifle_ammo01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "projectile", pos = Vector(0, 0, -0.579), angle = Angle(0, 0, 0), size = Vector(0.92, 0.92, 0.09), color = Color(130, 125, 120, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALback", pos = Vector(1.743, 0, 1.736), angle = Angle(0, 0, 0), size = Vector(0.134, 0.134, 0.085), color = Color(100, 90, 120, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["METALFRONT"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "v_weapon.Glock_Parent", rel = "", pos = Vector(-1.338, -4.442, 0.976), angle = Angle(-11.62, -107.073, -5), size = Vector(0.236, 0.621, 0.105), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALback"] = { type = "Model", model = "models/props_combine/combine_interface003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALFRONT+", pos = Vector(-6.52, -10.306, 0), angle = Angle(0, 90, 90), size = Vector(0.167, 0.043, 0.15), color = Color(125, 120, 130, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["projectile"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALFRONT", pos = Vector(2.355, -1.673, 0), angle = Angle(0, 90, 90), size = Vector(0.224, 0.224, 0.564), color = Color(130, 125, 120, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALTOP"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALFRONT", pos = Vector(2.826, -7.87, 0), angle = Angle(0, 64.527, 90), size = Vector(0.63, 0.598, 0.63), color = Color(125, 120, 130, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["METALGASCAN"] = { type = "Model", model = "models/props_c17/canister_propane01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "METALFRONT+", pos = Vector(1.205, -5.669, 0), angle = Angle(90, 0, 0), size = Vector(0.104, 0.105, 0.089), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALFRONT+"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "v_weapon.Glock_Parent", rel = "METALFRONT", pos = Vector(3.799, 1.751, 0), angle = Angle(180, 0, 0), size = Vector(0.236, 0.621, 0.105), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["METALSPIKES"] = { type = "Model", model = "models/Mechanics/gears2/pinion_20t1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT", pos = Vector(-0.83, 0, 0), angle = Angle(0, -90, 0), size = Vector(0.347, 0.328, 0.166), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["projectilepart2"] = { type = "Model", model = "models/items/combine_rifle_ammo01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "projectile", pos = Vector(0, 0, -0.579), angle = Angle(0, 0, 0), size = Vector(0.92, 0.92, 0.09), color = Color(130, 125, 120, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALback", pos = Vector(2.243, 0, 1.736), angle = Angle(0, 0, 0), size = Vector(0.134, 0.134, 0.085), color = Color(100, 90, 120, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["METALFRONT"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(21.676, 0.808, -9.053), angle = Angle(90.266, 0, 90), size = Vector(0.236, 1.067, 0.105), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALback"] = { type = "Model", model = "models/props_combine/combine_interface003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT+", pos = Vector(-6.603, -17.254, 0), angle = Angle(0, 92.513, 90), size = Vector(0.232, 0.043, 0.15), color = Color(105, 100, 110, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["projectile"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT", pos = Vector(2.355, -6.348, 0), angle = Angle(90, 0, 0), size = Vector(0.224, 0.224, 0.564), color = Color(130, 125, 120, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALTOP"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT", pos = Vector(2.826, -11.686, 0), angle = Angle(0, 64.527, 90), size = Vector(0.63, 0.598, 0.63), color = Color(100, 90, 120, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["METALGASCAN"] = { type = "Model", model = "models/props_c17/canister_propane01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT+", pos = Vector(1.281, -11.554, 0), angle = Angle(90, 0, 0), size = Vector(0.104, 0.105, 0.098), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["METALFRONT+"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "METALFRONT", pos = Vector(3.799, 1.49, 0), angle = Angle(180, 0, 0), size = Vector(0.236, 1.258, 0.105), color = Color(110, 100, 90, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +function SWEP:PostDrawViewModel(vm, pl, wep) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local lol = self:Clip1() == 0 and 0 or (CurTime() - self:GetLastFired())^1.2 + local resize = math.Clamp(lol, 0, 0.224) + + local rotsize = self.VElements["projectile"].size + local rotsize2 = self.VElements["projectilepart2"].size + rotsize.x = resize + rotsize.y = resize + rotsize2.y = resize * 4 + rotsize2.x = resize * 4 + + local rots= self.VElements["projectile"].angle + rots.x = rots.x + 1.5 +end + + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -35 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/init.lua new file mode 100644 index 0000000..ba4df5a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_disc_razor" +SWEP.Primary.ProjVelocity = 1500 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/shared.lua new file mode 100644 index 0000000..fd5e41d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ripper/shared.lua @@ -0,0 +1,73 @@ +SWEP.PrintName = "'Ripper' Discblade Launcher" +SWEP.Description = "An unusual weapon capable of launching sharp discs which bounce and that can headshot zombies." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" + +SWEP.UseHands = false + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Crossbow.Single") +SWEP.Primary.Delay = 15/33 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 62 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.DefaultClip = 15 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.Tier = 4 + +SWEP.ConeMax = 1.35 +SWEP.ConeMin = 0.95 + +SWEP.HeadshotMulti = 2.2 + +SWEP.ReloadSpeed = 0.72 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.04) + +function SWEP:EmitFireSound(secondary) + self:EmitSound("npc/roller/blade_cut.wav", 75, secondary and 56 or 66, 0.73) + self:EmitSound("weapons/m249/m249-1.wav", 75, secondary and 86 or 146, 0.67, CHAN_AUTO+20) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/357/357_reload1.wav", 75, 65, 1, CHAN_WEAPON + 21) + self:EmitSound("weapons/ar2/ar2_reload_push.wav", 70, 67, 0.85, CHAN_WEAPON + 22) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/galil/galil_boltpull.wav", 70, 110) + end +end + +function SWEP:SetLastFired(float) + self:SetDTFloat(8, float) +end + +function SWEP:GetLastFired() + return self:GetDTFloat(8) +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:SetLastFired(CurTime()) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollermine.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollermine.lua new file mode 100644 index 0000000..b5944fd --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollermine.lua @@ -0,0 +1,205 @@ +AddCSLuaFile() + +SWEP.PrintName = "Rollermine" +SWEP.Description = "A deployable, remotely controlled device.\nRolls along the ground, bouncing off zombies and dealing damage.\nCan jump with the JUMP key." + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 50 + SWEP.ShowViewModel = true + SWEP.ShowWorldModel = false + + SWEP.ViewModelBoneMods = { + ["ValveBiped.cube1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube3"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.cube"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } + } + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/roller.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 4, 0), angle = Angle(-54.206, 58.294, -50.114), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/roller.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 5, 0), angle = Angle(-43.978, 27.614, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_bugbait.mdl" +SWEP.WorldModel = "models/roller.mdl" +SWEP.UseHands = true + +SWEP.DeployClass = "prop_rollermine" +SWEP.ControlWeapon = "weapon_zs_rollerminecontrol" + +SWEP.HoldType = "grenade" + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "rollermine" +SWEP.Primary.Delay = 1 +SWEP.Primary.DefaultClip = 1 + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Ammo = "dummy" + +SWEP.MaxStock = 10 + +SWEP.WalkSpeed = SPEED_FAST + +function SWEP:Initialize() + self:SetWeaponHoldType("grenade") + GAMEMODE:DoChangeDeploySpeed(self) + + if CLIENT then + self:Anim_Initialize() + end +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + for _, ent in pairs(ents.FindByClass("prop_rollermine*")) do + if ent:GetObjectOwner() == self:GetOwner() then return false end + end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + local owner = self:GetOwner() + self:SendWeaponAnim(ACT_VM_THROW) + owner:DoAttackEvent() + + self:TakePrimaryAmmo(1) + self.NextDeploy = CurTime() + 0.75 + + if SERVER then + local ent = ents.Create(self.DeployClass) + if ent:IsValid() then + ent:SetPos(owner:GetShootPos()) + ent:Spawn() + ent:SetObjectOwner(owner) + ent:SetupPlayerSkills() + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + end + + ent:EmitSound("WeaponFrag.Throw") + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:Wake() + phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 200) + end + + if not owner:HasWeapon(self.ControlWeapon) then + owner:Give(self.ControlWeapon) + end + owner:SelectWeapon(self.ControlWeapon) + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:CanSecondaryAttack() + return false +end + +function SWEP:Reload() + return false +end + +function SWEP:Deploy() + GAMEMODE:WeaponDeployed(self:GetOwner(), self) + + if self:GetPrimaryAmmoCount() <= 0 then + self:SendWeaponAnim(ACT_VM_THROW) + end + + return true +end + +function SWEP:Holster() + self.NextDeploy = nil + + if CLIENT then + self:Anim_Holster() + end + + return true +end + +function SWEP:Think() + if self.NextDeploy and self.NextDeploy <= CurTime() then + self.NextDeploy = nil + + if 0 < self:GetPrimaryAmmoCount() then + self:SendWeaponAnim(ACT_VM_DRAW) + else + self:SendWeaponAnim(ACT_VM_THROW) + if SERVER then + self:Remove() + end + end + end +end + +local colBG = Color(16, 16, 16, 90) +local colWhite = Color(220, 220, 220, 230) + +SWEP.HUD3DPos = Vector(5, 2, 0) + +function SWEP:PostDrawViewModel(vm) + if not self.HUD3DPos or not GAMEMODE:ShouldDraw3DWeaponHUD() then return end + + local bone = vm:LookupBone("ValveBiped.Bip01_R_Hand") + if not bone then return end + + local m = vm:GetBoneMatrix(bone) + if not m then return end + + local pos, ang = m:GetTranslation(), m:GetAngles() + + local offset = self.HUD3DPos + + pos = pos + ang:Forward() * offset.x + ang:Right() * offset.y + ang:Up() * offset.z + + ang:RotateAroundAxis(ang:Up(), math.sin(CurTime() * math.pi) * 20) + ang:RotateAroundAxis(ang:Right(), CurTime() * 180) + + pos = pos + ang:Forward() * 7 + + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 180) + + local wid, hei = 144, 144 + local x, y = wid * -0.5, hei * -0.5 + local clip = self:GetPrimaryAmmoCount() + + cam.Start3D2D(pos, ang, 0.0125) + draw.RoundedBox(32, x, y, wid, hei, colBG) + draw.SimpleText(clip, "ZS3D2DFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollerminecontrol.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollerminecontrol.lua new file mode 100644 index 0000000..5723f31 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_rollerminecontrol.lua @@ -0,0 +1,108 @@ +AddCSLuaFile() + +SWEP.PrintName = "Rollermine Control" +SWEP.Description = "Controller for your Rollermine." + +if CLIENT then + SWEP.ViewModelFOV = 50 + + SWEP.BobScale = 0.5 + SWEP.SwayScale = 0.5 + + SWEP.Slot = 4 + SWEP.SlotPos = 0 +end + +SWEP.ViewModel = "models/weapons/c_slam.mdl" +SWEP.WorldModel = "models/weapons/w_slam.mdl" +SWEP.UseHands = true + +SWEP.EntityClass = "prop_rollermine" + +SWEP.Primary.Delay = 0 +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.Delay = 20 +SWEP.Secondary.Heal = 10 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.NoMagazine = true +SWEP.Undroppable = true +SWEP.NoPickupNotification = true + +SWEP.HoldType = "slam" + +SWEP.NoDeploySpeedChange = true +SWEP.NoTransfer = true +SWEP.AutoSwitchFrom = false + +function SWEP:Initialize() + self:SetWeaponHoldType(self.HoldType) + self:SetDeploySpeed(10) +end + +function SWEP:Think() + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end + + if SERVER then + for _, ent in pairs(ents.FindByClass(self.EntityClass)) do + if ent:IsValid() and ent:GetObjectOwner() == self:GetOwner() then + return + end + end + + self:GetOwner():StripWeapon(self:GetClass()) + end +end + +function SWEP:PrimaryAttack() + if IsFirstTimePredicted() then + self:SetDTBool(0, not self:GetDTBool(0)) + + if CLIENT then + MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0) + end + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() + return false +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + + return true +end + +function SWEP:Holster() + self:SetDTBool(0, false) + + return true +end + +function SWEP:Reload() +end + +if not CLIENT then return end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawedoff.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawedoff.lua new file mode 100644 index 0000000..062b680 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawedoff.lua @@ -0,0 +1,241 @@ +AddCSLuaFile() + +--in memory of Gormaoife 1999-2016 rip + +SWEP.PrintName = "'Splinter' Sawed-Off Shotgun" +SWEP.Description = "Can fire both rounds at once for higher burst damage." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 70 + + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(0.052, 1.702, -7.329), angle = Angle(-54.559, -90, -180), size = Vector(0.057, 0.035, 0.041), color = Color(190, 150, 95, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-5.421, -0.101, -0.819), angle = Angle(-52.792, 0, 0), size = Vector(0.187, 0.382, 0.035), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "break", pos = Vector(-1.89, 0.186, 1.929), angle = Angle(0, 36.453, 0), size = Vector(0.1, 0.019, 0.019), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["break"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-1.063, 0.196, 2.507), angle = Angle(-126.469, 90, 90), size = Vector(0.019, 0.019, 0.045), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_lab/blastdoor001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-6.325, -0.13, -4.14), angle = Angle(0, 90, -36.279), size = Vector(0.211, 0.05, 0.014), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["barrel+"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "break", pos = Vector(-1.89, 0.186, 0.338), angle = Angle(0, 36.453, 0), size = Vector(0.1, 0.019, 0.019), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_interface003.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-2.258, 0, -1.691), angle = Angle(35.486, 0, 0), size = Vector(0.097, 0.041, 0.071), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/combine_dropship_container.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "break", pos = Vector(-1.009, 1.552, 1.004), angle = Angle(0, 37.951, -90), size = Vector(0.018, 0.019, 0.014), color = Color(190, 150, 95, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["break"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-8.749, -1.099, -4.579), angle = Angle(135, 0, 90), size = Vector(0.019, 0.019, 0.045), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-5.421, -0.101, -0.819), angle = Angle(-52.792, 0, 0), size = Vector(0.187, 0.382, 0.035), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["barrel"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-10.634, 0.66, -4.819), angle = Angle(37.5, 0, 0), size = Vector(0.1, 0.019, 0.019), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["handle"] = { type = "Model", model = "models/combine_dropship_container.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-9.98, -0.201, -6.435), angle = Angle(39.694, 0, 0), size = Vector(0.018, 0.019, 0.014), color = Color(190, 150, 95, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/headcrabcannister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.888, 1.406, -0.543), angle = Angle(130.128, 5.808, 0), size = Vector(0.057, 0.035, 0.041), color = Color(190, 150, 95, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["barrel+"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-10.634, -0.854, -4.819), angle = Angle(37.5, 0, 0), size = Vector(0.1, 0.019, 0.019), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_interface003.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-2.258, 0, -1.691), angle = Angle(35.486, 0, 0), size = Vector(0.097, 0.041, 0.071), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_lab/blastdoor001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-6.325, -0.13, -4.14), angle = Angle(0, 90, -36.279), size = Vector(0.211, 0.05, 0.014), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} } + } + + SWEP.HUD3DBone = "ValveBiped.Crossbow_base" + SWEP.HUD3DPos = Vector(1.8, -0.65, -3.3) + SWEP.HUD3DScale = 0.015 +end + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Base = "weapon_zs_baseshotgun" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("weapons/zs_sawnoff/sawnoff_fire1.ogg") +SWEP.Primary.Damage = 11.35 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Delay = 0.6 +SWEP.Primary.ClipSize = 2 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "buckshot" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ReloadSound = Sound("weapons/zs_sawnoff/barrelup.ogg") +SWEP.ReloadFinishSound = Sound("weapons/zs_sawnoff/barreldown.ogg") +SWEP.ReloadPlugSound = Sound("Weapon_Shotgun.Reload") + +SWEP.ConeMax = 9 +SWEP.ConeMin = 7.75 +SWEP.Recoil = 7.5 + +SWEP.WalkSpeed = SPEED_SLOWER +SWEP.ReloadSpeed = 0.6 +SWEP.ReloadDelay = 0.5 + +SWEP.Tier = 2 + +SWEP.DryFireSound = Sound("Weapon_Shotgun.Empty") + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -1.125, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -1.069, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Splinter' Slug Gun", "Single accurate slug round, less total damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 5.5 + wept.Primary.NumShots = 1 + wept.ConeMin = wept.ConeMin * 0.15 + wept.ConeMax = wept.ConeMax * 0.3 +end) + +SWEP.ReloadStartActivity = ACT_VM_RELOAD +SWEP.ReloadActivity = ACT_VM_HOLSTER + +function SWEP:StartReloading() + local delay = self:GetReloadDelay() + self:SetDTFloat(3, CurTime() + delay) + self:SetDTBool(2, true) -- force one shell load + self:SetNextPrimaryFire(CurTime() + math.max(self.Primary.Delay, delay)) + + self:GetOwner():DoReloadEvent() + + if self.ReloadStartActivity then + self:SendWeaponAnim(self.ReloadStartActivity) + self:ProcessReloadAnim() + self:SetNextPlugSound(CurTime() + delay * 0.9) + self:SetNextStateChange(CurTime() + delay * 0.8) + end + + self:EmitSound(self.ReloadSound) +end + +function SWEP:StopReloading() + self:SetDTFloat(3, 0) + self:SetDTBool(2, false) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * 0.45) + self:SetNextStateChange(CurTime()) + + if self:Clip1() > 0 then + self:EmitSound(self.ReloadFinishSound) + self:SendWeaponAnim(ACT_VM_IDLE) + self:ProcessReloadAnim() + end +end + +function SWEP:Think() + if self:ShouldDoReload() then + self:DoReload() + end + + if self:GetNextPlugSound() ~= 0 and CurTime() > self:GetNextPlugSound() then + if self:Clip1() ~= 2 then + self:EmitSound(self.ReloadPlugSound) + end + self:SetNextPlugSound(0) + end + + if self:GetNextStateChange() ~= 0 and CurTime() > self:GetNextStateChange() then + self:SetSawnoffState((self:GetSawnoffState() + 1) % 2) + self:SetNextStateChange(0) + end + + self:NextThink(CurTime()) + return true +end + +function SWEP:DoReload() + if not self:CanReload() then + self:StopReloading() + return + end + + local delay = self:GetReloadDelay() + if self.ReloadActivity then + self:SendWeaponAnim(self.ReloadActivity) + self:ProcessReloadAnim() + self:SetNextPlugSound(CurTime() + delay * 0.9) + + timer.Simple(0, function() if IsValid(self) then self:SendWeaponAnim(ACT_VM_RELOAD) end end) + end + + self:GetOwner():RemoveAmmo(1, self.Primary.Ammo, false) + self:SetClip1(self:Clip1() + 1) + + self:SetDTBool(2, false) + self:SetDTFloat(3, CurTime() + delay) + + self:SetNextPrimaryFire(CurTime() + math.max(self.Primary.Delay, delay)) +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:Clip1() <= 0 then + self:EmitSound("Weapon_Shotgun.Empty") + self:SetNextPrimaryFire(CurTime() + 0.25) + + return false + end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() then return end + + local multiplier = self:Clip1() + + self.Primary.NumShots = self.Primary.NumShots * multiplier + self.RequiredClip = multiplier + self.OldEmitFireSound = self.EmitFireSound + self.EmitFireSound = self.EmitFireSoundDouble + + self:PrimaryAttack() + + self.Primary.NumShots = self.Primary.NumShots / multiplier + self.RequiredClip = 1 + self.EmitFireSound = self.OldEmitFireSound +end + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 80, math.random(97, 103), 1, CHAN_WEAPON + 20) +end + +function SWEP:EmitFireSoundDouble() + if self:Clip1() == 2 then + self:EmitSound(self.Primary.Sound, 80, math.random(80, 85), 1, CHAN_WEAPON + 20) + else + self:OldEmitFireSound() + end +end + +function SWEP:GetNextPlugSound() + return self:GetDTFloat(10) +end + +function SWEP:SetNextPlugSound(nexttime) + self:SetDTFloat(10, nexttime) +end + +function SWEP:GetNextStateChange() + return self:GetDTFloat(11) +end + +function SWEP:SetNextStateChange(nexttime) + self:SetDTFloat(11, nexttime) +end + +function SWEP:GetSawnoffState() + return self:GetDTInt(10) +end + +function SWEP:SetSawnoffState(state) + self:SetDTInt(10, state) +end + +if CLIENT then + function SWEP:PreDrawViewModel(vm) + self.BaseClass.PreDrawViewModel(self, vm) + + local ang = self.VElements["break"].angle + ang.pitch = math.Approach(ang.pitch, self:GetSawnoffState() == 1 and 16 or -126, FrameTime() * 730) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawhack.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawhack.lua index 9c8fe94..f05575c 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawhack.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sawhack.lua @@ -1,20 +1,23 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Sawhack" +SWEP.PrintName = "Sawhack" +if CLIENT then SWEP.ViewModelFOV = 60 + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + SWEP.VElements = { - ["base1+"] = { type = "Model", model = "models/props_lab/tpplug.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-1.45, 0, -0.25), angle = Angle(270, 0, 0), size = Vector(0.4, 0.4, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base1"] = { type = "Model", model = "models/props_lab/tpplug.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-1.45, 0, 0.394), angle = Angle(90, 0, 0), size = Vector(0.4, 0.4, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7.956, 2.181, -18.506), angle = Angle(0, -6.212, 90), size = Vector(0.4, 0.4, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["axe"] = { type = "Model", model = "models/props/cs_militia/axe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.184, 1.501, -7.421), angle = Angle(2.427, -10, 90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["saw"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "axe", pos = Vector(0, 14, -0.021), angle = Angle(0, 0, 0), size = Vector(0.449, 0.449, 0.805), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["saw2"] = { type = "Model", model = "models/XQM/Rails/trackball_1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "axe", pos = Vector(0, 14, 0), angle = Angle(0, 90, 0), size = Vector(0.234, 0.234, 0.133), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} } } SWEP.WElements = { - ["base1+"] = { type = "Model", model = "models/props_lab/tpplug.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.45, 0, -0.25), angle = Angle(270, 0, 0), size = Vector(0.4, 0.4, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base1"] = { type = "Model", model = "models/props_lab/tpplug.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.45, 0, 0.394), angle = Angle(90, 0, 0), size = Vector(0.4, 0.4, 0.1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7, 2, -22.5), angle = Angle(0, 0, 90), size = Vector(0.4, 0.4, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["axe"] = { type = "Model", model = "models/props/cs_militia/axe.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.023, 2.147, -8.32), angle = Angle(-6.166, 20.881, 86.675), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["saw2"] = { type = "Model", model = "models/XQM/Rails/trackball_1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "axe", pos = Vector(0, 14, 0), angle = Angle(0, 90, 0), size = Vector(0.234, 0.234, 0.133), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["saw"] = { type = "Model", model = "models/props_junk/sawblade001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "axe", pos = Vector(0, 14, -0.021), angle = Angle(0, 0, 0), size = Vector(0.449, 0.449, 0.805), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } end @@ -31,7 +34,8 @@ SWEP.Primary.Delay = 0.45 SWEP.MeleeDamage = 32 SWEP.MeleeRange = 55 SWEP.MeleeSize = 1.9 -SWEP.MeleeKnockBack = 10 +SWEP.MeleeKnockBack = 100 +SWEP.MeleeViewPunchScale = 0.25 SWEP.WalkSpeed = SPEED_FAST @@ -44,8 +48,28 @@ SWEP.SwingHoldType = "melee2" SWEP.HitDecal = "Manhackcut" SWEP.HitAnim = ACT_VM_MISSCENTER +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.04, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_KNOCK, 10, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Razorhack", "Increased attack delay, but deals more damage while bleeding", function(wept) + wept.Primary.Delay = wept.Primary.Delay * 1.25 + wept.OnMeleeHit = function(self, hitent, hitflesh, tr) + if self:GetOwner():GetBleedDamage() > 1 then + self.MeleeDamage = wept.MeleeDamage * 1.5 + end + end + + wept.PostOnMeleeHit = function(self, hitent, hitflesh, tr) + self.MeleeDamage = wept.MeleeDamage + end +end) + SWEP.NoHitSoundFlesh = true +SWEP.Tier = 2 +SWEP.DismantleDiv = 2 + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(75, 80)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scar.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scar.lua new file mode 100644 index 0000000..df00ec6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scar.lua @@ -0,0 +1,138 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Terminus' SCAR-L" +SWEP.Description = "A powerful assault rifle that gets more accurate for every shot that hits in a clip." + +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 60 + + SWEP.ViewModelFlip = false + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + + SWEP.HUD3DBone = "v_weapon.sg550_Parent" + SWEP.HUD3DPos = Vector(-1.3, -5.56, -2) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.02 + + SWEP.VElements = { + ["base+++++"] = { type = "Model", model = "models/props_trainstation/trainstation_column001.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.399, -10.077, 0.458), angle = Angle(0, 0, -90), size = Vector(0.09, 0.09, 0.041), color = Color(200, 200, 200, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++++++++++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_2x.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(-1.147, -5.325, 0.579), angle = Angle(0, 90, 90), size = Vector(0.019, 0.008, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(0.133, -6.993, -0.058), angle = Angle(0, 0, 0), size = Vector(0.093, 0.067, 0.109), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_2x.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(-0.431, -3.07, -1.063), angle = Angle(0, 90, 0), size = Vector(0.029, 0.004, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["mag"] = { type = "Model", model = "models/hunter/blocks/cube1x1x1.mdl", bone = "v_weapon.sg550_Clip", rel = "", pos = Vector(-0.03, 2.838, -0.187), angle = Angle(0, 0, 11.232), size = Vector(0.017, 0.14, 0.068), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube1x1x025.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.401, 18.51, -1.601), angle = Angle(92.424, -90, 0), size = Vector(0.129, 0.028, 0.054), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(0, -5.474, -0.886), angle = Angle(0, 0, 0), size = Vector(0.074, 0.097, 0.078), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++++++++++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.429, -10.79, 3.95), angle = Angle(-180, 90, 0), size = Vector(0.004, 0.009, 0.009), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_8x.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(-0.431, -3.901, 2.5), angle = Angle(180, 90, 0), size = Vector(0.017, 0.004, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/weapons/w_pist_glock18.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.452, 7.76, -6.605), angle = Angle(0.172, 90, 0), size = Vector(1.18, 0.879, 1.059), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete0", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(-0.11, 0, 1.697), angle = Angle(0, 0, 0), size = Vector(0.054, 0.214, 0.056), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++++++++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.581, 9.357, 2.319), angle = Angle(0, 0, 0), size = Vector(0.014, 0.012, 0.006), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++++++++++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "v_weapon.sg550_Chamber", rel = "", pos = Vector(-0.633, -0.877, -4.751), angle = Angle(-180, 0, 0), size = Vector(0.008, 0.004, 0.004), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_binocular01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.429, -10.709, 2.403), angle = Angle(-180, 90, 0), size = Vector(0.104, 0.076, 0.054), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "v_weapon.sg550_Parent", rel = "", pos = Vector(0.398, -4.837, -6.283), angle = Angle(0, 0, -90), size = Vector(0.074, 0.214, 0.142), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.464, 12.635, -0.173), angle = Angle(13.321, 85.75, -18.448), size = Vector(0.123, 0.065, 0.14), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x1x025.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(0.05, 1.534, -2.869), angle = Angle(0, 0, 9.149), size = Vector(0.079, 0.082, 0.207), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete0", skin = 0, bodygroup = {} }, + ["base++++++++++"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1c.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.401, 16.805, -1.68), angle = Angle(92.424, -90, 0), size = Vector(0.063, 0.027, 0.059), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base++++++++++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "v_weapon.sg550_Parent", rel = "base", pos = Vector(-0.565, 1.32, 1.84), angle = Angle(0, 0, 0), size = Vector(0.02, 0.052, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/props_trainstation/trainstation_column001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.399, -10.077, 0.458), angle = Angle(0, 0, -90), size = Vector(0.09, 0.09, 0.041), color = Color(200, 200, 200, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++++++++++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_2x.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.282, -5.325, 0.579), angle = Angle(0, 90, -90), size = Vector(0.019, 0.008, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++++++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_2x.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-1.147, -5.325, 0.579), angle = Angle(0, 90, 90), size = Vector(0.019, 0.008, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.133, -6.993, -0.058), angle = Angle(0, 0, 0), size = Vector(0.093, 0.067, 0.109), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_2x.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.431, -3.07, -1.063), angle = Angle(0, 90, 0), size = Vector(0.029, 0.004, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube1x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.401, 18.51, -1.601), angle = Angle(92.424, -90, 0), size = Vector(0.129, 0.028, 0.054), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -5.474, -0.886), angle = Angle(0, 0, 0), size = Vector(0.074, 0.097, 0.078), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++++++++++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.429, -10.79, 3.95), angle = Angle(-180, 90, 0), size = Vector(0.004, 0.009, 0.009), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_phx/trains/tracks/track_8x.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.431, -3.901, 2.5), angle = Angle(180, 90, 0), size = Vector(0.017, 0.004, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/weapons/w_pist_glock18.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.452, 7.76, -6.605), angle = Angle(0.172, 90, 0), size = Vector(1.18, 0.879, 1.059), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete0", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.11, 0, 1.697), angle = Angle(0, 0, 0), size = Vector(0.054, 0.214, 0.056), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++++++++"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.581, 9.357, 2.319), angle = Angle(0, 0, 0), size = Vector(0.014, 0.012, 0.006), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(11.472, 0.644, -4.957), angle = Angle(-180, -84.611, 9.975), size = Vector(0.074, 0.214, 0.142), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_binocular01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.429, -10.709, 2.403), angle = Angle(-180, 90, 0), size = Vector(0.104, 0.076, 0.054), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["mag"] = { type = "Model", model = "models/hunter/blocks/cube1x1x1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.408, 1.106, -5.235), angle = Angle(0, 0, 102.095), size = Vector(0.017, 0.14, 0.068), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.464, 12.635, -0.173), angle = Angle(13.321, 85.75, -18.448), size = Vector(0.123, 0.065, 0.14), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x1x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.05, 1.534, -2.869), angle = Angle(0, 0, 9.149), size = Vector(0.079, 0.082, 0.207), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete0", skin = 0, bodygroup = {} }, + ["base++++++++++"] = { type = "Model", model = "models/hunter/triangles/trapezium3x3x1c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.401, 16.805, -1.68), angle = Angle(92.424, -90, 0), size = Vector(0.063, 0.027, 0.059), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete1", skin = 0, bodygroup = {} }, + ["base++++++++++++++++++"] = { type = "Model", model = "models/hunter/blocks/cube025x2x025.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.565, 1.32, 1.84), angle = Angle(0, 0, 0), size = Vector(0.02, 0.052, 0.029), color = Color(80, 80, 80, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} } + } +end + +sound.Add( +{ + name = "Weapon_Scar.Single", + channel = CHAN_WEAPON, + volume = 1, + level = 85, + pitch = {85,90}, + sound = {"weapons/zs_scar/scar_fire1.ogg"} +}) + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_sg550.mdl" +SWEP.WorldModel = "models/weapons/w_snip_sg550.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("Weapon_Scar.Single") +SWEP.Primary.Damage = 27.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.1 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "ar2" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 +SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_AR2 + +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 1.4 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.FireAnimSpeed = 0.65 + +SWEP.IronSightsPos = Vector(-7.361, 0, 0.62) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 3) + +function SWEP:SetHitStacks(stacks) + self:SetDTInt(9, stacks) +end + +function SWEP:GetHitStacks() + return self:GetDTInt(9) +end + +function SWEP:FinishReload() + self:SetHitStacks(0) + BaseClass.FinishReload(self) +end + +function SWEP:GetCone() + return BaseClass.GetCone(self) * (1 - self:GetHitStacks()/35) +end + +function SWEP.BulletCallback(attacker, tr, dmginfo) + local ent = tr.Entity + if SERVER then + local wep = attacker:GetActiveWeapon() + if ent:IsValidZombie() then + wep:SetHitStacks(wep:GetHitStacks() + 1) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/cl_init.lua new file mode 100644 index 0000000..1f55b73 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/cl_init.lua @@ -0,0 +1,70 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 70 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.VElements = { + ["stick1+++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0, -0.327, -11.448), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["stick1+"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0, 2.653, 19.566), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["BLADE"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 34.348), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["BLADE+++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 12.956, 31.569), angle = Angle(-174.937, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["BLADE++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 32.708), angle = Angle(-171.433, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["stick1"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.157, 1.488, 2.286), angle = Angle(180, 78.477, -7.24), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["stick1++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 1.58, 34.312), angle = Angle(180, 0, 0), size = Vector(0.827, 0.652, 1.215), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["BACK"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.141, 0.136, 33.291), angle = Angle(7.782, -90, 99.166), size = Vector(0.061, 0.264, 0.065), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["BLADE+"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 33.519), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["blade++++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 12.956, 31.569), angle = Angle(-174.937, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["pole+"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0, 2.812, 19.566), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["blade++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 13.444, 33.519), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["blade+"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 13.444, 34.348), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["blade+++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 12.956, 32.708), angle = Angle(-171.433, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["pole++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 1.58, 34.312), angle = Angle(180, 0, 0), size = Vector(0.827, 0.652, 1.215), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.141, 0.136, 33.291), angle = Angle(7.782, -90, 99.166), size = Vector(0.061, 0.264, 0.065), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }, + ["pole"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.213, 1.246, 2.063), angle = Angle(177.371, 63.734, -7.24), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }, + ["pole+++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0, -0.327, -11.448), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} } +} + +local ghostlerp = 0 +function SWEP:GetViewModelPosition(pos, ang) + local owner = self:GetOwner() + if self:IsSwinging() then + local rot = self:GetDTInt(10) == 1 and Angle(0, -240, -70) or self.SwingRotation + local offset = self:GetDTInt(10) == 1 and Vector(-200, 30, -40) or self.SwingOffset + local armdelay = owner:GetMeleeSpeedMul() + local swingtime = self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay + + ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy + + local swingend = self:GetSwingEnd() + local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime) + local power = CosineInterpolation(0, 1, delta / swingtime) + + if power >= 0.9 then + power = (1 - power) ^ 0.4 * 2 + end + + pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up() + + ang:RotateAroundAxis(ang:Right(), rot.pitch * power) + ang:RotateAroundAxis(ang:Up(), rot.yaw * power) + ang:RotateAroundAxis(ang:Forward(), rot.roll * power) + end + + if owner:GetBarricadeGhosting() then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 5) + end + + if ghostlerp > 0 then + pos = pos + 3.5 * ghostlerp * ang:Up() + ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/shared.lua new file mode 100644 index 0000000..8952340 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_scythe/shared.lua @@ -0,0 +1,248 @@ +SWEP.PrintName = "Great Scythe" +SWEP.Description = "A great scythe that can pierce and cut through multiple zombies. Has a 3 hit combo, the last hit deals extra damage." + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.HoldType = "melee2" + +SWEP.DamageType = DMG_CLUB + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.UseHands = true + +SWEP.MeleeDamage = 97.5 +SWEP.MeleeRange = 75 +SWEP.MeleeSize = 3.5 +SWEP.MeleeKnockBack = 0 + +SWEP.Primary.Delay = 1.4 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.SwingRotation = Angle(0, -120, -70) +SWEP.SwingOffset = Vector(0, 30, -40) +SWEP.SwingTime = 0.35 +SWEP.SwingHoldType = "melee" + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.12) + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(55, 65)) +end + +function SWEP:PlayHitSound() + self:EmitSound("ambient/machines/slicer"..math.random(4)..".wav", 75, 90) + self:EmitSound("physics/metal/metal_computer_impact_hard2.wav", 65, 90, 0.5, CHAN_WEAPON + 1) +end + +function SWEP:GetTracesNumPlayers(traces) + local numplayers = 0 + + local ent + for _, trace in pairs(traces) do + ent = trace.Entity + if ent and ent:IsValidPlayer() then + numplayers = numplayers + 1 + end + end + + return numplayers +end + +function SWEP:GetDamage(numplayers, basedamage) + basedamage = basedamage or self.MeleeDamage + + if numplayers then + return basedamage * math.Clamp(1.25 - numplayers * 0.25, 0.5, 1) + end + + return basedamage +end + +function SWEP:MeleeSwing() + local owner = self:GetOwner() + local combo = self:GetDTInt(10) + + owner:DoAttackEvent() + self:SendWeaponAnim(self.MissAnim) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + local hit = false + local tr = owner:CompensatedPenetratingMeleeTrace(self.MeleeRange * (owner.MeleeRangeMul or 1), self.MeleeSize) + local damage = self:GetDamage(self:GetTracesNumPlayers(tr)) + local ent + + local damagemultiplier = owner:Team() == TEAM_HUMAN and owner.MeleeDamageMultiplier or 1 --(owner.BuffMuscular and owner:Team()==TEAM_HUMAN) and 1.2 or 1 + if owner:IsSkillActive(SKILL_LASTSTAND) then + if owner:Health() <= owner:GetMaxHealth() * 0.25 then + damagemultiplier = damagemultiplier * 2 + else + damagemultiplier = damagemultiplier * 0.85 + end + end + + if combo == 2 then + damagemultiplier = damagemultiplier * 1.35 + end + + for _, trace in ipairs(tr) do + if not trace.Hit then continue end + + ent = trace.Entity + + hit = true + + local hitflesh = trace.MatType == MAT_FLESH or trace.MatType == MAT_BLOODYFLESH or trace.MatType == MAT_ANTLION or trace.MatType == MAT_ALIENFLESH + + if hitflesh then + util.Decal(self.BloodDecal, trace.HitPos + trace.HitNormal, trace.HitPos - trace.HitNormal) + + if SERVER then + self:ServerHitFleshEffects(ent, trace, damagemultiplier) + end + + end + + if ent and ent:IsValid() then + if SERVER then + self:ServerMeleeHitEntity(trace, ent, damagemultiplier) + end + + self:MeleeHitEntity(trace, ent, damagemultiplier, damage) + + if SERVER then + self:ServerMeleePostHitEntity(trace, ent, damagemultiplier) + end + + if owner.GlassWeaponShouldBreak then break end + end + end + + if hit then + self:PlayHitSound() + else + self:PlaySwingSound() + + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + + self.Primary.Delay * (combo < 2 and 0.36 or 1.25) * armdelay + ) + + self:SetDTInt(10, combo >= 2 and 0 or combo + 1) +end + +function SWEP:MeleeHitEntity(tr, hitent, damagemultiplier, damage) + if not IsFirstTimePredicted() then return end + + local owner = self:GetOwner() + + if SERVER and hitent:IsPlayer() and owner:IsSkillActive(SKILL_GLASSWEAPONS) then + damagemultiplier = damagemultiplier * 3.5 + owner.GlassWeaponShouldBreak = not owner.GlassWeaponShouldBreak + end + + damage = damage * damagemultiplier + + local dmginfo = DamageInfo() + dmginfo:SetDamagePosition(tr.HitPos) + dmginfo:SetAttacker(owner) + dmginfo:SetInflictor(self) + dmginfo:SetDamageType(self.DamageType) + dmginfo:SetDamage(damage) + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 50 * owner:GetAimVector()) + + local vel + if hitent:IsPlayer() then + + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(self:GetPowerCombo() + 1) + + damage = damage + damage * (owner.MeleePowerAttackMul - 1) * (self:GetPowerCombo()/4) + dmginfo:SetDamage(damage) + + if self:GetPowerCombo() >= 4 then + self:SetPowerCombo(0) + if SERVER then + local pitch = math.Clamp(math.random(90, 110) + 15 * (1 - damage/45), 50 , 200) + owner:EmitSound("npc/strider/strider_skewer1.wav", 75, pitch) + end + end + end + + hitent:MeleeViewPunch(damage) + if hitent:IsHeadcrab() then + damage = damage * 2 + dmginfo:SetDamage(damage) + end + + if SERVER then + hitent:SetLastHitGroup(tr.HitGroup) + if tr.HitGroup == HITGROUP_HEAD then + hitent:SetWasHitInHead() + end + + if hitent:WouldDieFrom(damage, tr.HitPos) then + dmginfo:SetDamageForce(math.min(self.MeleeDamage, 50) * 400 * owner:GetAimVector()) + end + end + + vel = hitent:GetVelocity() + else + if owner.MeleePowerAttackMul and owner.MeleePowerAttackMul > 1 then + self:SetPowerCombo(0) + end + end + + --if not hitent.LastHeld or CurTime() >= hitent.LastHeld + 0.1 then -- Don't allow people to shoot props out of their hands + if self.PointsMultiplier then + POINTSMULTIPLIER = self.PointsMultiplier + end + + hitent:DispatchTraceAttack(dmginfo, tr, owner:GetAimVector()) + + if self.PointsMultiplier then + POINTSMULTIPLIER = nil + end + + -- Invalidate the engine knockback vs. players + if vel then + hitent:SetLocalVelocity(vel) + end + --end + + -- Perform our own knockback vs. players + if hitent:IsPlayer() then + local knockback = self.MeleeKnockBack * (owner.MeleeKnockbackMultiplier or 1) + if knockback > 0 then + hitent:ThrowFromPositionSetZ(tr.StartPos, knockback, nil, true) + end + + if owner.MeleeLegDamageAdd and owner.MeleeLegDamageAdd > 0 then + hitent:AddLegDamage(owner.MeleeLegDamageAdd) + end + end + + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetStart(tr.StartPos) + effectdata:SetNormal(tr.HitNormal) + util.Effect("RagdollImpact", effectdata) + if not tr.HitSky then + effectdata:SetSurfaceProp(tr.SurfaceProps) + effectdata:SetDamageType(self.DamageType) + effectdata:SetHitBox(tr.HitBox) + effectdata:SetEntity(hitent) + util.Effect("Impact", effectdata) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_seditionist.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_seditionist.lua new file mode 100644 index 0000000..099b5a7 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_seditionist.lua @@ -0,0 +1,112 @@ +AddCSLuaFile() + +SWEP.PrintName = "'Seditionist' Handgun" +SWEP.Description = "This high-powered handgun has the ability to pierce through multiple zombies." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFlip = false + SWEP.ViewModelFOV = 55 + + SWEP.HUD3DBone = "v_weapon.Deagle_Slide" + SWEP.HUD3DPos = Vector(-1.5, 0, 1) + SWEP.HUD3DAng = Angle(0, 0, 0) + SWEP.HUD3DScale = 0.015 + + SWEP.IronSightsPos = Vector(-6.36, 5, 1.6) + + SWEP.VElements = { + ["laserbeam"] = { type = "Sprite", sprite = "sprites/glow01", bone = "ValveBiped.Bip01_Spine4", rel = "back", pos = Vector(-0.018, -3.799, -1.691), size = { x = 0.79, y = 0.79 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["back++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.Deagle_Parent", rel = "back", pos = Vector(0, -0.387, -1.553), angle = Angle(0, 0, -180), size = Vector(0.018, 0.01, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.Deagle_Parent", rel = "", pos = Vector(0.02, -3.869, -4.113), angle = Angle(0, 0, -90), size = Vector(0.018, 0.013, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back+", pos = Vector(2.154, 0, 2.752), angle = Angle(90, 0, 0), size = Vector(0.028, 0.024, 0.098), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["scopeinnard+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0.426, 0, 0.323), angle = Angle(90, 0, 0), size = Vector(0.025, 0.024, 0.019), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["back+"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "v_weapon.Deagle_Slide", rel = "", pos = Vector(0, 1.519, 1.187), angle = Angle(90, -0.288, -90), size = Vector(0.01, 0.021, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["back+++++"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "v_weapon.Deagle_Parent", rel = "back", pos = Vector(0, -3.51, -0.551), angle = Angle(0, 0, -90), size = Vector(0.03, 0.03, 0.03), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["dribble+"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back", pos = Vector(-1.209, 3.344, 0.642), angle = Angle(-105, 0, -90), size = Vector(0.025, 0.016, 0.026), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["scopeinnard"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scope", pos = Vector(0.423, 0, 0.323), angle = Angle(90, 180, 0), size = Vector(0.025, 0.024, 0.019), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/props_phx/trains/wheel_medium.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back", pos = Vector(0, -3.399, -1.675), angle = Angle(0, 0, -90), size = Vector(0.016, 0.016, 0.05), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["dribble"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "back", pos = Vector(1.208, 3.344, 0.094), angle = Angle(105, 0, -90), size = Vector(0.025, 0.016, 0.026), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["scopeinnard+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0.029, 8.166, 1.659), angle = Angle(180, 90, 0), size = Vector(0.025, 0.024, 0.025), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["laserbegins"] = { type = "Sprite", sprite = "sprites/glow01", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(-0.018, -3.799, -1.691), size = { x = 0.79, y = 0.79 }, color = Color(255, 0, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["scopeinnard++"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0.029, 8.166, 1.659), angle = Angle(0, 90, 0), size = Vector(0.025, 0.024, 0.014), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/v_smg1/texture5", skin = 0, bodygroup = {} }, + ["scope"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0.029, 7.666, 1.121), angle = Angle(90, 90, 0), size = Vector(0.028, 0.024, 0.098), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["back"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10.425, 2.095, -4.106), angle = Angle(180, -94.622, 2.526), size = Vector(0.018, 0.013, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["back+"] = { type = "Model", model = "models/props_combine/combinetrain01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.125, 1.56, -2.293), angle = Angle(178.087, -4.79, 0), size = Vector(0.01, 0.021, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["back+++++"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0, -3.51, -0.551), angle = Angle(0, 0, -90), size = Vector(0.03, 0.03, 0.03), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["back++++"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0, -0.387, -1.553), angle = Angle(0, 0, -180), size = Vector(0.018, 0.01, 0.01), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["dribble+"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(-1.209, 3.344, 0.642), angle = Angle(-105, 0, -90), size = Vector(0.025, 0.016, 0.026), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["laser"] = { type = "Model", model = "models/props_phx/trains/wheel_medium.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(0, -3.399, -1.675), angle = Angle(0, 0, -90), size = Vector(0.016, 0.016, 0.05), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/combine_train002", skin = 0, bodygroup = {} }, + ["dribble"] = { type = "Model", model = "models/props_combine/combinethumper002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "back", pos = Vector(1.208, 3.344, 0.094), angle = Angle(105, 0, -90), size = Vector(0.025, 0.016, 0.026), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" +SWEP.UseHands = true + +SWEP.Primary.Damage = 53 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.32 +SWEP.Primary.KnockbackScale = 2 + +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 3.75 +SWEP.ConeMin = 1.5 + +SWEP.FireAnimSpeed = 1.3 + +SWEP.Tier = 4 + +SWEP.Pierces = 4 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_BULLET_PIERCES, 1) + +function SWEP:EmitFireSound() + self:EmitSound("weapons/deagle/deagle-1.wav", 75, math.random(122, 130), 0.6) + self:EmitSound("weapons/elite/elite-1.wav", 75, math.random(82, 88), 0.4, CHAN_WEAPON + 20) +end + +function SWEP:ShootBullets(dmg, numbul, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + local dir = owner:GetAimVector() + local dirang = dir:Angle() + local start = owner:GetShootPos() + + dirang:RotateAroundAxis(dirang:Forward(), util.SharedRandom("bulletrotate1", 0, 360)) + dirang:RotateAroundAxis(dirang:Up(), util.SharedRandom("bulletangle1", -cone, cone)) + + dir = dirang:Forward() + local tr = owner:CompensatedPenetratingMeleeTrace(2048, 0.01, start, dir) + local ent + + owner:LagCompensation(true) + owner:FireBulletsLua(start, dir, cone, numbul, dmg, nil, self.Primary.KnockbackScale, self.TracerName, self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + for i, trace in ipairs(tr) do + if i == 1 or not trace.Hit then continue end + if i > self.Pierces then break end + + ent = trace.Entity + + if ent and ent:IsValid() then + owner:FireBulletsLua(trace.HitPos, dir, 0, numbul, dmg/i, nil, self.Primary.KnockbackScale, "", self.BulletCallback, self.Primary.HullSize, nil, self.Primary.MaxDistance, nil, self) + end + end + owner:LagCompensation(false) + +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shade.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shade.lua index 195449a..d4e1847 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shade.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shade.lua @@ -2,6 +2,8 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Shade" + SWEP.ViewModel = Model("models/weapons/v_fza.mdl") SWEP.WorldModel = Model("models/weapons/w_crowbar.mdl") @@ -12,6 +14,9 @@ end SWEP.Primary.Automatic = false SWEP.Secondary.Automatic = false +SWEP.ShadeControl = "env_shadecontrol" +SWEP.ShadeProjectile = "projectile_shaderock" + function SWEP:Initialize() self:HideWorldModel() end @@ -20,29 +25,30 @@ function SWEP:Think() end function SWEP:PrimaryAttack() - if CurTime() <= self:GetNextPrimaryFire() then return end - self:SetNextSecondaryFire(CurTime() + 0.65) + local owner = self:GetOwner() + if CurTime() <= self:GetNextPrimaryFire() or (owner.ShadeShield and owner.ShadeShield:IsValid()) then return end - for _, ent in pairs(ents.FindByClass("env_shadecontrol")) do - if ent:IsValid() and ent:GetOwner() == self.Owner then + for _, ent in pairs(ents.FindByClass(self.ShadeControl)) do + if ent:IsValid() and ent:GetOwner() == owner then local obj = ent:GetParent() if obj:IsValid() then - self.Owner:DoAttackEvent() + self:SetNextSecondaryFire(CurTime() + 0.65) + + owner:DoAttackEvent() if CLIENT then return end - local filt = team.GetPlayers(TEAM_UNDEAD) - table.insert(filt, obj) - local vel = (self.Owner:TraceLine(10240, MASK_SOLID, filt).HitPos - obj:LocalToWorld(obj:OBBCenter())):GetNormalized() * 1000 + local vel = owner:GetAimVector() * 1000 local phys = obj:GetPhysicsObject() if phys:IsValid() and phys:IsMoveable() and phys:GetMass() <= 300 then phys:Wake() phys:SetVelocity(vel) - obj:SetPhysicsAttacker(self.Owner) + obj:SetPhysicsAttacker(owner) phys:AddGameFlag(FVPHYSICS_WAS_THROWN) obj:EmitSound(")weapons/physcannon/superphys_launch"..math.random(4)..".wav") + obj.LastShadeLaunch = CurTime() end end @@ -51,44 +57,100 @@ function SWEP:PrimaryAttack() end end -function SWEP:SecondaryAttack() - if CurTime() <= self:GetNextSecondaryFire() then return end - self:SetNextPrimaryFire(CurTime() + 0.25) - self:SetNextSecondaryFire(CurTime() + 0.4) +function SWEP:CanGrab() + local owner = self:GetOwner() + if CurTime() <= self:GetNextSecondaryFire() or (owner.ShadeShield and owner.ShadeShield:IsValid()) then return end + self:SetNextSecondaryFire(CurTime() + 0.1) - if CLIENT then return end - - for _, ent in pairs(ents.FindByClass("env_shadecontrol")) do - if ent:IsValid() and ent:GetOwner() == self.Owner then - ent:Remove() - return + if SERVER then + for _, ent in pairs(ents.FindByClass(self.ShadeControl)) do + if ent:IsValid() and ent:GetOwner() == owner then + ent:Remove() + return + end end end - local ent = self:GetOwner():TraceHull(400, MASK_SOLID, 4, player.GetAll()).Entity - if ent:IsValid() and ent:IsPhysicsModel() then + return true +end + +function SWEP:SecondaryAttack() + if not self:CanGrab() then return end + + local owner = self:GetOwner() + local ent = owner:CompensatedMeleeTrace(400, 4).Entity + if ent:IsValid() and (ent:IsPhysicsModel() or ent.IsShadeGrabbable or ent.IsPhysbox) then + self:SetNextPrimaryFire(CurTime() + 0.25) + self:SetNextSecondaryFire(CurTime() + 0.4) + + if SERVER then local phys = ent:GetPhysicsObject() if phys:IsValid() and phys:IsMoveable() and phys:GetMass() <= 300 then - for _, ent2 in pairs(ents.FindByClass("env_shadecontrol")) do + for _, ent2 in pairs(ents.FindByClass(self.ShadeControl)) do if ent2:IsValid() and ent2:GetParent() == ent then ent2:Remove() return end end - local con = ents.Create("env_shadecontrol") + for _, status in pairs(ents.FindByClass("status_human_holding")) do + if status:IsValid() and status:GetObject() == ent then + status:Remove() + end + end + + local con = ents.Create(self.ShadeControl) if con:IsValid() then con:Spawn() - con:SetOwner(self.Owner) + con:SetOwner(owner) con:AttachTo(ent) ent:EmitSound(")weapons/physcannon/physcannon_claws_close.wav") end end + end end end function SWEP:Reload() + if not self:CanGrab() then return end + + local owner = self:GetOwner() + + local vStart = owner:GetShootPos() + local vEnd = vStart + owner:GetForward() * 40 + + local tr = util.TraceHull({start=vStart, endpos=vEnd, filter=owner, mins=owner:OBBMins()/2, maxs=owner:OBBMaxs()/2}) + self:SetNextPrimaryFire(CurTime() + 0.9) + self:SetNextSecondaryFire(CurTime() + 0.9) + + if SERVER then + local rock = ents.Create(self.ShadeProjectile) + if rock:IsValid() then + local pos = owner:GetPos() - owner:GetForward() * 5 + if not tr.Hit then + pos = pos + owner:GetForward() * 30 + end + + rock:SetPos(pos) + rock:SetOwner(owner) + rock:Spawn() + local con = ents.Create(self.ShadeControl) + if con:IsValid() then + con:Spawn() + con:SetOwner(owner) + con:AttachTo(rock) + rock.Control = con + + util.ScreenShake(owner:GetPos(), 3, 1, 0.75, 400) + + con:EmitSound("physics/concrete/concrete_break3.wav", 85, 60) + rock:EmitSound(")weapons/physcannon/physcannon_claws_close.wav") + + owner.LastRangedAttack = CurTime() + end + end + end end function SWEP:OnRemove() @@ -100,15 +162,15 @@ end if not CLIENT then return end function SWEP:PreDrawViewModel(vm) - local owner = self.Owner + local owner = self:GetOwner() if owner:IsValid() then - owner:CallZombieFunction("PreRenderEffects", vm) + owner:CallZombieFunction1("PreRenderEffects", vm) end end function SWEP:PostDrawViewModel(vm) - local owner = self.Owner + local owner = self:GetOwner() if owner:IsValid() then - owner:CallZombieFunction("PostRenderEffects", vm) + owner:CallZombieFunction1("PostRenderEffects", vm) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowcorruptor.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowcorruptor.lua new file mode 100644 index 0000000..74bad6b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowcorruptor.lua @@ -0,0 +1,90 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl" +SWEP.WorldModel = "" +SWEP.UseHands = true +SWEP.ViewModelFOV = 40 + +SWEP.MeleeDelay = 0 +SWEP.MeleeReach = 16 +SWEP.MeleeDamage = 3 +SWEP.MeleeForceScale = 0.025 +SWEP.MeleeSize = 1 --0.5 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.Primary.Delay = 0.32 + +function SWEP:Think() + self.BaseClass.Think(self) + + local curtime = CurTime() + local owner = self:GetOwner() + + if self:GetSwinging() then + if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then + self:SetSwinging(false) + self.SwingStop = nil + end + end + + self:NextThink(CurTime()) + return true +end + +function SWEP:Swung() + self.SwingStop = CurTime() + 0.5 + + if not self:GetSwinging() then + self:SetSwinging(true) + end + + self.AltSwing = not self.AltSwing + + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence(self.AltSwing and "fists_left" or "fists_right")) + + self.BaseClass.Swung(self) +end + +function SWEP:Deploy() + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) + + return self.BaseClass.Deploy(self) +end + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65, 85) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65) +end + +function SWEP:PlayAttackSound() +end + +function SWEP:PlayHitSound() + self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 65, math.random(130, 140), nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 65, math.random(140, 150), nil, CHAN_AUTO) +end + +function SWEP:SetSwinging(swinging) + self:SetDTBool(2, swinging) +end + +function SWEP:GetSwinging() + return self:GetDTBool(2) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/cl_init.lua new file mode 100644 index 0000000..b44dc87 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function SWEP:PreDrawViewModel(vm) + render_SetBlend(0.55) + render_SetColorModulation(0.1, 0.1, 0.1) +end + +function SWEP:PostDrawViewModel(vm) + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/init.lua new file mode 100644 index 0000000..6c64b1a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/init.lua @@ -0,0 +1,9 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsPlayer() then + ent:GiveStatus("dimvision", 2.5) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/shared.lua new file mode 100644 index 0000000..de9eb5a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowgorechild/shared.lua @@ -0,0 +1,60 @@ +SWEP.Base = "weapon_zs_gorechild" + +SWEP.PrintName = "Shadow Child" + +SWEP.MeleeDamage = 2 + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if ent:IsPlayer() then + local owner = self:GetOwner() + + if owner.Master and owner.Master:IsValidLivingZombie() then + owner.Master:AddLifeHumanDamage(damage) + end + end + + self.BaseClass.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:Think() + self.BaseClass.BaseClass.Think(self) + + if IsFirstTimePredicted() then + local curtime = CurTime() + local owner = self:GetOwner() + + if self:GetSwinging() then + if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then + self:SetSwinging(false) + self.SwingStop = nil + end + end + end + + self:NextThink(CurTime()) + return true +end + +function SWEP:Swung() + if not IsFirstTimePredicted() then return end + + self.SwingStop = CurTime() + 0.5 + + if not self:GetSwinging() then + self:SetSwinging(true) + end + + self.AltSwing = not self.AltSwing + + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence(self.AltSwing and "fists_left" or "fists_right")) + + self.BaseClass.BaseClass.Swung(self) +end + +function SWEP:Deploy() + local vm = self:GetOwner():GetViewModel() + vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw")) + + return self.BaseClass.BaseClass.Deploy(self) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/cl_init.lua new file mode 100644 index 0000000..fe754c6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function SWEP:PreDrawViewModel(vm) + render_SetBlend(0.45) + render_SetColorModulation(0.1, 0.1, 0.1) +end + +function SWEP:PostDrawViewModel(vm) + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/init.lua new file mode 100644 index 0000000..7316ad4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/init.lua @@ -0,0 +1,9 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsPlayer() then + ent:GiveStatus("dimvision", 5) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/shared.lua new file mode 100644 index 0000000..dc0fadb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowlurker/shared.lua @@ -0,0 +1,26 @@ +SWEP.Base = "weapon_zs_zombietorso" + +SWEP.PrintName = "Shadow Lurker" + +SWEP.MeleeDelay = 0.25 +SWEP.MeleeDamage = 20 + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie_poison/pz_warn"..math.random(2)..".wav", 70, math.random(200, 210), nil, CHAN_AUTO) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/antlion/idle"..math.random(5)..".wav", 70, math.random(60, 66)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(80, 90)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/cl_init.lua new file mode 100644 index 0000000..fe754c6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/cl_init.lua @@ -0,0 +1,14 @@ +INC_CLIENT() + +local render_SetBlend = render.SetBlend +local render_SetColorModulation = render.SetColorModulation + +function SWEP:PreDrawViewModel(vm) + render_SetBlend(0.45) + render_SetColorModulation(0.1, 0.1, 0.1) +end + +function SWEP:PostDrawViewModel(vm) + render_SetBlend(1) + render_SetColorModulation(1, 1, 1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/init.lua new file mode 100644 index 0000000..ed48408 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/init.lua @@ -0,0 +1,9 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsPlayer() then + ent:GiveStatus("dimvision", 6) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/shared.lua new file mode 100644 index 0000000..ff7aa5b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shadowwalker/shared.lua @@ -0,0 +1,39 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Shadow Walker" + +SWEP.MeleeDamage = 30 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayHitSound() + self:EmitSound("NPC_FastZombie.AttackHit", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("NPC_FastZombie.AttackMiss", nil, nil, nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie_poison/pz_warn"..math.random(2)..".wav", 70, math.random(180, 190), nil, CHAN_AUTO) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/antlion/idle"..math.random(5)..".wav", 70, math.random(60, 66)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(80, 90)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/init.lua new file mode 100644 index 0000000..1c7f234 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/init.lua @@ -0,0 +1,23 @@ +INC_SERVER() + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsValid() then + --[[local vel = ent:GetPos() - self:GetOwner():GetPos() + vel.z = 0 + vel:Normalize() + vel = vel * 800 + vel.z = 350 + + ent:KnockDown() + ent:SetGroundEntity(NULL) + ent:SetVelocity(vel)]] + local noknockdown = true + if CurTime() >= (ent.NextKnockdown or 0) then + noknockdown = false + ent.NextKnockdown = CurTime() + 4 + end + ent:ThrowFromPositionSetZ(trace.StartPos, ent:IsPlayer() and 600 or 1600, nil, noknockdown) + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/shared.lua new file mode 100644 index 0000000..de3f057 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shitslapper/shared.lua @@ -0,0 +1,45 @@ +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Shit Slapper" + +SWEP.MeleeDelay = 0.25 +SWEP.MeleeReach = 74 +SWEP.MeleeDamage = 38 +SWEP.MeleeSize = 16 +SWEP.SwingAnimSpeed = 2.82 + +SWEP.DelayWhenDeployed = true + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayHitSound() + self:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav", 75, math.random(80, 90), nil, CHAN_AUTO) +end + +function SWEP:PlayMissSound() + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 75, math.random(80, 90), nil, CHAN_AUTO) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie/zo_attack"..math.random(2)..".wav", 75, math.random(80, 90)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/zombie/zombie_alert"..math.random(3)..".wav", 75, math.random(80, 90)) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/zombie/zombie_voice_idle"..math.random(14)..".wav", 75, math.random(80, 90)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shovel.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shovel.lua index 7572f9d..c033b1d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shovel.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_shovel.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Shovel" - SWEP.Description = "Instantly kills zombies that are knocked down." +SWEP.PrintName = "Shovel" +SWEP.Description = "A shovel instantly kills zombies that are knocked down, and it's an effective melee weapon even otherwise." +if CLIENT then SWEP.ViewModelFOV = 60 SWEP.ShowViewModel = false @@ -30,10 +30,12 @@ SWEP.UseHands = true SWEP.MeleeDamage = 50 SWEP.MeleeRange = 68 SWEP.MeleeSize = 1.5 -SWEP.MeleeKnockBack = 40 +SWEP.MeleeKnockBack = 230 SWEP.Primary.Delay = 1.2 +SWEP.Tier = 2 + SWEP.WalkSpeed = SPEED_SLOWER SWEP.SwingRotation = Angle(0, -90, -60) @@ -41,6 +43,12 @@ SWEP.SwingOffset = Vector(0, 30, -40) SWEP.SwingTime = 0.65 SWEP.SwingHoldType = "melee" +SWEP.AllowQualityWeapons = true +SWEP.DismantleDiv = 2 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.09, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_IMPACT_DELAY, -0.06, 1) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(65, 70)) end @@ -53,8 +61,8 @@ function SWEP:PlayHitFleshSound() self:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav") end -function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() and hitent:IsPlayer() and hitent.Revive and hitent.Revive:IsValid() and gamemode.Call("PlayerShouldTakeDamage", hitent, self.Owner) then - hitent:SetHealth(1) +function SWEP:PostOnMeleeHit(hitent, hitflesh, tr) + if hitent:IsValid() and hitent:IsPlayer() and hitent.Revive and hitent.Revive:IsValid() and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then + hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, self:GetOwner(), self, tr.HitPos) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/cl_init.lua new file mode 100644 index 0000000..6a41a82 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/cl_init.lua @@ -0,0 +1,51 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 70 +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.ViewModelBoneMods = { + ["ValveBiped.cube3"] = { scale = Vector(0.001, 0.001, 0.001), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} + +SWEP.VElements = { + ["main"] = { type = "Model", model = "", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1, 5, 1), angle = Angle(-61.949, 87.662, 127.402), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(-1.558, -1.558, 0.2), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["base+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1+++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(0.518, 1, 1.557), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["1+"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(1.557, 0, 0.2), angle = Angle(0, 99.35, 52.597), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_wasteland/medbridge_post01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "main", pos = Vector(0, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(166, 200, 255, 255), surpresslightning = true, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["main"] = { type = "Model", model = "", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 5, -0.5), angle = Angle(-17.532, 45.583, 127.402), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(-1.558, -1.558, 0.2), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1++", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["base+"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, 0, 0), size = { x = 2, y = 2 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1+++"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0.518, 1, 1.557), angle = Angle(75.973, -43.248, -24.546), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_wasteland/medbridge_post01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, -1.5), angle = Angle(0, 0, 0), size = Vector(0.029, 0.029, 0.029), color = Color(166, 200, 255, 255), surpresslightning = true, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Sprite", sprite = "sprites/light_glow02", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(0, 0, 0), size = { x = 10, y = 10 }, color = Color(123, 208, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["1+"] = { type = "Model", model = "models/props_junk/rock001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "main", pos = Vector(1.557, 0, 0.2), angle = Angle(0, 99.35, 52.597), size = Vector(0.05, 0.05, 0.05), color = Color(72, 127, 200, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +} + +function SWEP:DrawWorldModel() + local time = UnPredictedCurTime() * 45 + local vang = self.WElements.main.angle + vang.p = time % 360 + vang.y = vang.p + + self.BaseClass.DrawWorldModel(self) +end +SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel + +function SWEP:PostDrawViewModel(vm) + local time = UnPredictedCurTime() * 45 + local vang = self.VElements.main.angle + vang.p = time % 360 + vang.y = vang.p +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/init.lua new file mode 100644 index 0000000..b97fd08 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/init.lua @@ -0,0 +1,19 @@ +INC_SERVER() + +function SWEP:DoTeleport(target) + local owner = self:GetOwner() + + local effectdata = EffectData() + effectdata:SetOrigin(owner:WorldSpaceCenter()) + effectdata:SetEntity(owner) + util.Effect(self.TeleportEffect, effectdata, true, true) + effectdata:SetOrigin(target:WorldSpaceCenter()) + util.Effect(self.TeleportEffect, effectdata, true, true) + + owner:SetPos(target:GetPos()) + owner:SetBarricadeGhosting(true, true) + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/shared.lua new file mode 100644 index 0000000..1a303b4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilfragment/shared.lua @@ -0,0 +1,136 @@ +SWEP.PrintName = "Sigil Fragment" +SWEP.Description = "A mysterious stone that holds some power over the world.\nReturns you to any uncorrupted Sanity Sigil that you're pointing towards." + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_bugbait.mdl" +SWEP.WorldModel = "models/weapons/w_bugbait.mdl" +SWEP.UseHands = true + +SWEP.HoldType = "slam" + +SWEP.WalkSpeed = SPEED_FAST + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "sigilfragment" +SWEP.Primary.Delay = 1 +SWEP.Primary.DefaultClip = 1 + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "dummy" + +SWEP.BoxPhysicsMin = Vector(-4, -4, -4) +SWEP.BoxPhysicsMax = Vector(4, 4, 4) + +SWEP.TeleportStatus = "sigilteleport" +SWEP.TeleportEffect = "sigil_teleport" + +function SWEP:Initialize() + self:SetWeaponHoldType(self.HoldType) + GAMEMODE:DoChangeDeploySpeed(self) + + if CLIENT then + self:Anim_Initialize() + end +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or GAMEMODE:NumUncorruptedSigils() <= 0 then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + 3) + + local owner = self:GetOwner() + local vm = owner:GetViewModel() + if IsValid(vm) then + vm:SendViewModelMatchingSequence(vm:LookupSequence("squeeze") or 0) + end + owner:DoAttackEvent() + + self:EmitSound("ambient/levels/labs/teleport_preblast_suckin1.wav", 70, 140) + + self.Teleport = CurTime() + 1.5 + self.NextDeploy = nil + self.NextIdle = nil + + if SERVER then + local status = owner:GiveStatus(self.TeleportStatus) + if status:IsValid() then + status:SetFromSigil(self) + status:SetEndTime(CurTime() + 1.5 * (owner.SigilTeleportTimeMul or 1)) + end + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:CanSecondaryAttack() + return false +end + +function SWEP:Reload() + return false +end + +function SWEP:Deploy() + GAMEMODE:WeaponDeployed(self:GetOwner(), self) + + if self:GetPrimaryAmmoCount() <= 0 then + self:SendWeaponAnim(ACT_VM_THROW) + else + self:SendWeaponAnim(ACT_VM_DEPLOY) + end + + self.NextIdle = CurTime() + 2 + + return true +end + +function SWEP:Holster() + self.NextDeploy = nil + self.NextIdle = nil + self.Teleport = nil + + if CLIENT then + self:Anim_Holster() + end + + return true +end + +function SWEP:Think() + if self.Teleport and CurTime() >= self.Teleport then + self.Teleport = nil + self.NextIdle = CurTime() + 1 + elseif self.NextIdle and CurTime() >= self.NextIdle then + self.NextIdle = nil + + self:SendWeaponAnim(ACT_VM_IDLE) + elseif self.NextDeploy and self.NextDeploy <= CurTime() then + self.NextDeploy = nil + + if 0 < self:GetPrimaryAmmoCount() then + self:SendWeaponAnim(ACT_VM_DRAW) + else + self:SendWeaponAnim(ACT_VM_THROW) + if SERVER then + self:Remove() + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilplacer/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilplacer/shared.lua index 02e62b8..b289266 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilplacer/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sigilplacer/shared.lua @@ -14,6 +14,14 @@ SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" +local placers = { + ["STEAM_0:0:32163864"] = true, + ["STEAM_0:0:25307180"] = true +} +local function CanPlace(pl) + return pl:IsValid() and (pl:IsSuperAdmin() or placers[pl:SteamID()]) +end + function SWEP:Initialize() if SERVER then self:RefreshSigils() @@ -39,8 +47,8 @@ function SWEP:Holster() end function SWEP:PrimaryAttack() - local owner = self.Owner - if not owner:IsSuperAdmin() then return end + local owner = self:GetOwner() + if not CanPlace(owner) then return end owner:DoAttackEvent() @@ -53,13 +61,13 @@ function SWEP:PrimaryAttack() self:RefreshSigils() GAMEMODE.ProfilerIsPreMade = true - GAMEMODE:SaveProfilerPreMade(GAMEMODE.ProfilerNodes) + GAMEMODE:SaveProfilerPreMade() end end function SWEP:SecondaryAttack() - local owner = self.Owner - if not owner:IsSuperAdmin() then return end + local owner = self:GetOwner() + if not CanPlace(owner) then return end owner:DoAttackEvent() @@ -69,7 +77,7 @@ function SWEP:SecondaryAttack() local newpoints = {} for _, point in pairs(GAMEMODE.ProfilerNodes) do - if point:Distance(tr.HitPos) > 64 then + if point:DistToSqr(tr.HitPos) > 4096 then table.insert(newpoints, point) end end @@ -78,12 +86,12 @@ function SWEP:SecondaryAttack() self:RefreshSigils() GAMEMODE.ProfilerIsPreMade = true - GAMEMODE:SaveProfilerPreMade(GAMEMODE.ProfilerNodes) + GAMEMODE:SaveProfilerPreMade() end function SWEP:Reload() - local owner = self.Owner - if not owner:IsSuperAdmin() then return end + local owner = self:GetOwner() + if not CanPlace(owner) then return end owner:DoAttackEvent() @@ -98,7 +106,7 @@ end if SERVER then function SWEP:Think() if self.StartReload2 then - if not self.Owner:KeyDown(IN_RELOAD) then + if not self:GetOwner():KeyDown(IN_RELOAD) then self.StartReload2 = nil return end @@ -106,7 +114,7 @@ function SWEP:Think() if CurTime() >= self.StartReload2 + 3 then self.StartReload2 = nil - self.Owner:ChatPrint("Deleted everything including generated nodes. Turned off generated mode.") + self:GetOwner():ChatPrint("Deleted everything including generated nodes. Turned off generated mode.") GAMEMODE.ProfilerIsPreMade = true GAMEMODE:DeleteProfilerPreMade() @@ -116,7 +124,7 @@ function SWEP:Think() self:RefreshSigils() end elseif self.StartReload then - if not self.Owner:KeyDown(IN_RELOAD) then + if not self:GetOwner():KeyDown(IN_RELOAD) then self.StartReload = nil return end @@ -124,7 +132,7 @@ function SWEP:Think() if CurTime() >= self.StartReload + 3 then self.StartReload = nil - self.Owner:ChatPrint("Deleted all pre-made sigil points and reverted to generated mode. Keep holding reload to delete ALL nodes.") + self:GetOwner():ChatPrint("Deleted all pre-made sigil points and reverted to generated mode. Keep holding reload to delete ALL nodes.") GAMEMODE.ProfilerIsPreMade = false GAMEMODE:DeleteProfilerPreMade() @@ -136,6 +144,12 @@ function SWEP:Think() end end end + +concommand.Add("zs_sigilplacer", function(sender) + if CanPlace(sender) then + sender:Give("weapon_zs_sigilplacer") + end +end) end function SWEP:RefreshSigils() @@ -152,12 +166,6 @@ function SWEP:RefreshSigils() end end -concommand.Add("zs_sigilplacer", function(sender) - if sender:IsValid() and sender:IsSuperAdmin() then - sender:Give("weapon_zs_sigilplacer") - end -end) - local ENT = {} ENT.Type = "anim" @@ -173,9 +181,8 @@ end if CLIENT then ENT.RenderGroup = RENDERGROUP_TRANSLUCENT function ENT:DrawTranslucent() - local lp = LocalPlayer() - if lp:IsValid() then - local wep = lp:GetActiveWeapon() + if MySelf:IsValid() then + local wep = MySelf:GetActiveWeapon() if wep:IsValid() and wep:GetClass() == "weapon_zs_sigilplacer" then cam.IgnoreZ(true) render.SetBlend(0.5) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_silencer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_silencer.lua index efba691..4012eb4 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_silencer.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_silencer.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Silencer' SMG" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Silencer' SMG" +SWEP.Description = "Shrouds your aura and has very high burst DPS for an SMG, but poor accuracy." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -23,7 +25,7 @@ SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_TMP.Single") -SWEP.Primary.Damage = 22 +SWEP.Primary.Damage = 20 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.06 @@ -32,12 +34,24 @@ SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" GAMEMODE:SetupDefaultClip(SWEP.Primary) +SWEP.ReloadSpeed = 0.72 +SWEP.FireAnimSpeed = 3 + SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 -SWEP.ConeMax = 0.13 -SWEP.ConeMin = 0.1 +SWEP.ConeMax = 6.5 +SWEP.ConeMin = 3.6 SWEP.WalkSpeed = SPEED_NORMAL +SWEP.Tier = 3 + SWEP.IronSightsPos = Vector(-7, 3, 2.5) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.8125) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.45) + +function SWEP:GetAuraRange() + return 512 +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skelesham.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skelesham.lua new file mode 100644 index 0000000..84181d6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skelesham.lua @@ -0,0 +1,46 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Skeletal Shambler" + +SWEP.MeleeDamage = 33 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound(string.format("npc/strider/creak%d.wav", math.random(4)), 70, math.random(95, 105)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(110, 120)) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/wake1.wav", 70, math.random(95, 105)) + self:EmitSound("npc/metropolice/pain"..math.random(4)..".wav", 74, math.Rand(105, 115), 0.65, CHAN_WEAPON + 20) +end + +if not CLIENT then return end + +local matSheet = Material("models/props_c17/doll01") + +function SWEP:PreDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(matSheet) +end + +function SWEP:PostDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(nil) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeletallurker.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeletallurker.lua new file mode 100644 index 0000000..cfa6e03 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeletallurker.lua @@ -0,0 +1,46 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombietorso" + +SWEP.PrintName = "Skeletal Crawler" + +SWEP.MeleeDelay = 0.25 +SWEP.MeleeDamage = 20 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound(string.format("npc/strider/creak%d.wav", math.random(4)), 70, math.random(125, 135)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(120, 130)) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/wake1.wav", 70, math.random(125, 150)) +end + +if not CLIENT then return end + +local matSheet = Material("models/props_c17/doll01") + +function SWEP:PreDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(matSheet) +end + +function SWEP:PostDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(nil) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeleton.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeleton.lua new file mode 100644 index 0000000..aaab649 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_skeleton.lua @@ -0,0 +1,45 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_zombie" + +SWEP.PrintName = "Skeletal Walker" + +SWEP.MeleeDamage = 27 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:StartMoaning() +end + +function SWEP:StopMoaning() +end + +function SWEP:IsMoaning() + return false +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound(string.format("npc/strider/creak%d.wav", math.random(4)), 70, math.random(115, 125)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/stalker/breathing3.wav", 70, math.random(110, 120)) +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/fast_zombie/wake1.wav", 70, math.random(115, 140)) +end + +if not CLIENT then return end + +local matSheet = Material("models/props_c17/doll01") + +function SWEP:PreDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(matSheet) +end + +function SWEP:PostDrawViewModel(vm, wep, pl) + render.ModelMaterialOverride(nil) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sledgehammer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sledgehammer.lua index 6365d6e..e3f854b 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sledgehammer.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sledgehammer.lua @@ -1,7 +1,9 @@ AddCSLuaFile() +SWEP.PrintName = "Sledgehammer" +SWEP.Description = "A heavy, but powerful melee weapon. A target struck by the force of it will receive considerable knockback." + if CLIENT then - SWEP.PrintName = "Sledgehammer" SWEP.ViewModelFOV = 75 end @@ -11,16 +13,19 @@ SWEP.HoldType = "melee2" SWEP.DamageType = DMG_CLUB -SWEP.ViewModel = "models/weapons/v_sledgehammer/v_sledgehammer.mdl" +SWEP.ViewModel = "models/weapons/v_sledgehammer/c_sledgehammer.mdl" SWEP.WorldModel = "models/weapons/w_sledgehammer.mdl" +SWEP.UseHands = true SWEP.MeleeDamage = 75 SWEP.MeleeRange = 64 SWEP.MeleeSize = 1.75 -SWEP.MeleeKnockBack = 70 +SWEP.MeleeKnockBack = 270 SWEP.Primary.Delay = 1.3 +SWEP.Tier = 2 + SWEP.WalkSpeed = SPEED_SLOWEST SWEP.SwingRotation = Angle(60, 0, -80) @@ -28,6 +33,11 @@ SWEP.SwingOffset = Vector(0, -30, 0) SWEP.SwingTime = 0.75 SWEP.SwingHoldType = "melee" +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_IMPACT_DELAY, -0.1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.1, 1) + function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(35, 45)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/cl_init.lua new file mode 100644 index 0000000..c08479a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/cl_init.lua @@ -0,0 +1,78 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.p228_Slide" +SWEP.HUD3DPos = Vector(-1.4, 0.15, 0) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.017 + +SWEP.VElements = { + ["BACKING+"] = { type = "Model", model = "models/props_wasteland/light_spotlight02_base.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "train", pos = Vector(-0.101, -1.787, -0.027), angle = Angle(111.536, 90, 0), size = Vector(0.18, 0.504, 1.327), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["BOLT"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "train", pos = Vector(-0.042, 11.982, 1.141), angle = Angle(0, 90, 0), size = Vector(0.65, 0.65, 0.65), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["train"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "v_weapon.p228_Parent", rel = "", pos = Vector(0, -3.579, -2.291), angle = Angle(180, 0, -90), size = Vector(0.023, 0.019, 0.009), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["backa"] = { type = "Model", model = "models/props_wasteland/tram_bracket01.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "train", pos = Vector(-0.065, 4.964, 0.18), angle = Angle(0, -90, 0), size = Vector(0.043, 0.043, 0.043), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["BACKING"] = { type = "Model", model = "models/props_wasteland/light_spotlight02_base.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "train", pos = Vector(-0.062, -3.317, 1.368), angle = Angle(93.779, 90, 0), size = Vector(0.18, 0.504, 1.327), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["BACKING+"] = { type = "Model", model = "models/props_wasteland/light_spotlight02_base.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "train", pos = Vector(-0.101, -1.787, -0.027), angle = Angle(111.536, 90, 0), size = Vector(0.18, 0.504, 1.327), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["BOLT"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "train", pos = Vector(-0.042, 11, 1.141), angle = Angle(0, 90, 0), size = Vector(0.65, 0.65, 0.65), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["train"] = { type = "Model", model = "models/props_combine/combine_train02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7.178, 1.909, -3.55), angle = Angle(180, 85.359, -2.799), size = Vector(0.023, 0.019, 0.009), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["BACKING"] = { type = "Model", model = "models/props_wasteland/light_spotlight02_base.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "train", pos = Vector(-0.062, -3.317, 1.368), angle = Angle(93.779, 90, 0), size = Vector(0.18, 0.504, 1.327), color = Color(75, 75, 75, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["backa"] = { type = "Model", model = "models/props_wasteland/tram_bracket01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "train", pos = Vector(-0.065, 4.964, 0.18), angle = Angle(0, -90, 0), size = Vector(0.043, 0.043, 0.043), color = Color(100, 100, 100, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelFOV = 65 +SWEP.ViewModelFlip = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +function SWEP:ShootBullets(damage, numshots, cone) + local owner = self:GetOwner() + self:SendWeaponAnimation() + owner:DoAttackEvent() + + if self.Recoil > 0 then + local r = math.Rand(0.8, 1) + owner:ViewPunch(Angle(r * -self.Recoil, 0, (1 - r) * (math.random(2) == 1 and -1 or 1) * self.Recoil)) + end + + self.ProjShootTime = CurTime() +end + + +function SWEP:PostDrawViewModel(vm, pl, wep) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local veles = self.VElements + + local boltpos = veles["BOLT"].pos + local backang = veles["BACKING"].angle + + local time = CurTime() + local reloadfinish = self:GetReloadFinish() + local reloadstart = self:GetReloadStart() + + local col1, col2 = Color(0, 0, 0, 0), Color(255, 255, 140, 255) + if (reloadfinish == 0 and self:Clip1() < 1) or (reloadfinish - time * 5) > (time - reloadstart) then + veles["BOLT"].color = col1 + else + veles["BOLT"].color = col2 + end + + if time < reloadfinish then + local lowertime = math.min(reloadfinish - time, time - reloadstart) + local delta = math.Clamp(lowertime * 4 / (reloadfinish - reloadstart), 0, 1) + + boltpos.y = Lerp(delta, 11, 5) + backang.pitch = Lerp(delta, 105, 120) + else + boltpos.y = 11 + backang.pitch = 95 + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/init.lua new file mode 100644 index 0000000..1d46865 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_sli" +SWEP.Primary.ProjVelocity = 1550 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/shared.lua new file mode 100644 index 0000000..22dcd86 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slinger/shared.lua @@ -0,0 +1,78 @@ +SWEP.PrintName = "'Slinger' Bolt Pistol" +SWEP.Description = "A slow loading, inaccurate bolt pistol with no special properties." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "revolver" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_p228.mdl" +SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" +SWEP.UseHands = true + +SWEP.ShowViewModel = true +SWEP.ShowWorldModel = true +SWEP.ViewModelBoneMods = {} + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Crossbow.Single") +SWEP.Primary.Delay = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 59 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.ClipMultiplier = 2 +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 1.2 + +SWEP.NextZoom = 0 + +SWEP.ReloadSpeed = 0.59 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.07) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Darter' Bolt Pistol", "Deals less damage but has much higher velocity", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.9 + wept.Primary.ProjVelocity = 2300 + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + end + end +end) +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Hurler' Bolt Pistol", "Greater maximum accuracy, less damage at close range and more damage from afar", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.75 + wept.ConeMin = 0.3 + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTBool(1, true) + end + end +end) +branch.Colors = {Color(255, 160, 150), Color(215, 120, 150), Color(175, 100, 140)} +branch.NewNames = {"Range", "Seeker", "Searcher"} + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/galil/galil_boltpull.wav", 70, 190) + end +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/g3sg1/g3sg1_clipout.wav", 70, 135, 0.9, CHAN_AUTO) + end +end + +function SWEP:EmitFireSound() + self:EmitSound("weapons/crossbow/fire1.wav", 70, 230, 0.9, CHAN_WEAPON) +end + +util.PrecacheSound("weapons/crossbow/bolt_load1.wav") +util.PrecacheSound("weapons/crossbow/bolt_load2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slugrifle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slugrifle.lua index a1a1c88..785fe72 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slugrifle.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slugrifle.lua @@ -1,13 +1,14 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_baseshotgun") + +SWEP.PrintName = "'Tiny' Slug Rifle" +SWEP.Description = "This powerful rifle deals massive damage on a head shot." +SWEP.Slot = 3 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Tiny' Slug Rifle" - SWEP.Description = "This powerful rifle instantly kills any zombie with a head shot." - SWEP.Slot = 3 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false - SWEP.ViewModelFOV = 50 + SWEP.ViewModelFOV = 60 SWEP.HUD3DBone = "v_weapon.xm1014_Bolt" SWEP.HUD3DPos = Vector(-1, 0, 0) @@ -15,19 +16,36 @@ if CLIENT then SWEP.HUD3DScale = 0.02 SWEP.VElements = { - ["base"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360x2.mdl", bone = "v_weapon.xm1014_Parent", rel = "", pos = Vector(0, -6, -9), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.094), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "v_weapon.xm1014_Parent", rel = "base", pos = Vector(0, 0, 8.5), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "models/screenspace", skin = 0, bodygroup = {} }, - ["base++"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "v_weapon.xm1014_Parent", rel = "base", pos = Vector(0, 0, 2), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["scopemid"] = { type = "Model", model = "models/xqm/rails/funnel.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(4.645, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.02, 0.02, 0.075), color = Color(95, 95, 95, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "v_weapon.xm1014_Parent", rel = "", pos = Vector(0.079, -6.515, -0.695), angle = Angle(-90, 0, 0), size = Vector(0.019, 0.041, 0.041), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["knobs+"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(5.763, -0.769, 0), angle = Angle(180, 90, 98.054), size = Vector(0.079, 0.079, 0.079), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["mount"] = { type = "Model", model = "models/XQM/CoasterTrack/track_guide.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(6.022, 1.996, 0), angle = Angle(90, -90, 0), size = Vector(0.037, 0.041, 0.056), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopemid+"] = { type = "Model", model = "models/xqm/rails/funnel.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(8.166, 0, 0), angle = Angle(-90, 0, 0), size = Vector(0.02, 0.02, 0.014), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning+++"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "v_weapon.xm1014_Parent", rel = "scopebeginning", pos = Vector(9.295, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.014, 0.041, 0.041), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["midsection"] = { type = "Model", model = "models/props_phx/misc/smallcannonball.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(5.747, -0.026, -0.81), angle = Angle(-90, 0, 0), size = Vector(0.114, 0.114, 0.114), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning++"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "v_weapon.xm1014_Parent", rel = "scopebeginning", pos = Vector(7.31, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.043, 0.019, 0.017), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning+"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "v_weapon.xm1014_Parent", rel = "scopebeginning", pos = Vector(4.828, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.028, 0.019, 0.014), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["glass"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(-0.238, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.039), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/dome_side", skin = 0, bodygroup = {} }, + ["knobs"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "scopebeginning", pos = Vector(5.763, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.159, 0.079, 0.079), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } } SWEP.WElements = { - ["base"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(13, 1, -7), angle = Angle(80, 0, 0), size = Vector(0.014, 0.014, 0.094), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 8.5), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base++"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 2), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["scopemid"] = { type = "Model", model = "models/xqm/rails/funnel.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(4.645, 0, -0.04), angle = Angle(90, 0, 0), size = Vector(0.02, 0.02, 0.075), color = Color(95, 95, 95, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.928, 0.908, -5.581), angle = Angle(-10, 0, -90), size = Vector(0.019, 0.041, 0.041), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["knobs+"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(5.763, -0.769, 0), angle = Angle(180, 90, 98.054), size = Vector(0.079, 0.079, 0.079), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["glass+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(9.529, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.039), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/dome_side", skin = 0, bodygroup = {} }, + ["mount"] = { type = "Model", model = "models/XQM/CoasterTrack/track_guide.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(6.022, 1.996, 0), angle = Angle(90, -90, 0), size = Vector(0.037, 0.041, 0.056), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["glass"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(-0.238, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.039, 0.039, 0.039), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/dome_side", skin = 0, bodygroup = {} }, + ["scopebeginning+++"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(9.274, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.014, 0.041, 0.041), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning++"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(7.31, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.043, 0.019, 0.017), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopemid+"] = { type = "Model", model = "models/xqm/rails/funnel.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(8.166, 0, 0.05), angle = Angle(-90, 0, 0), size = Vector(0.02, 0.02, 0.014), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["scopebeginning+"] = { type = "Model", model = "models/XQM/deg360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(4.828, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.028, 0.019, 0.014), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["midsection"] = { type = "Model", model = "models/props_phx/misc/smallcannonball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(5.747, -0.026, -0.81), angle = Angle(-90, 0, 0), size = Vector(0.114, 0.114, 0.114), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["knobs"] = { type = "Model", model = "models/XQM/cylinderx1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "scopebeginning", pos = Vector(5.763, 0, 0), angle = Angle(90, 0, 0), size = Vector(0.159, 0.079, 0.079), color = Color(105, 105, 105, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } } end -SWEP.Base = "weapon_zs_base" +SWEP.Base = "weapon_zs_baseshotgun" SWEP.HoldType = "ar2" @@ -36,103 +54,83 @@ SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_AWP.Single") -SWEP.Primary.Damage = 135 +SWEP.Primary.Damage = 118 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 1.5 -SWEP.ReloadDelay = SWEP.Primary.Delay +SWEP.Primary.Delay = 1.3 +SWEP.ReloadDelay = 0.6 -SWEP.Primary.ClipSize = 2 +SWEP.Primary.ClipSize = 4 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "357" SWEP.Primary.DefaultClip = 10 +SWEP.HeadshotMulti = 2.5 + SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN -SWEP.ConeMax = 0.12 -SWEP.ConeMin = 0.005 +SWEP.ConeMax = 6 +SWEP.ConeMin = 0.25 -SWEP.IronSightsPos = Vector() --Vector(-7.3, 9, 2.3) +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.IronSightsPos = Vector(0, 0, 0) SWEP.IronSightsAng = Vector(0, -1, 0) SWEP.WalkSpeed = SPEED_SLOWER +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.135) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.09, 1) + function SWEP:IsScoped() return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() end +function SWEP:SecondaryAttack() + return BaseClass.BaseClass.SecondaryAttack(self) +end + +function SWEP:Think() + if self:GetIronsights() and not self:GetOwner():KeyDown(IN_ATTACK2) then + self:SetIronsights(false) + end + + BaseClass.Think(self) +end + if CLIENT then SWEP.IronsightsMultiplier = 0.25 function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then return pos + ang:Up() * 256, ang end - return self.BaseClass.GetViewModelPosition(self, pos, ang) + return BaseClass.GetViewModelPosition(self, pos, ang) end - local matScope = Material("zombiesurvival/scope") function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then - local scrw, scrh = ScrW(), ScrH() - local size = math.min(scrw, scrh) - surface.SetMaterial(matScope) - surface.SetDrawColor(255, 255, 255, 255) - surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size) - surface.SetDrawColor(0, 0, 0, 255) - if scrw > size then - local extra = (scrw - size) * 0.5 - surface.DrawRect(0, 0, extra, scrh) - surface.DrawRect(scrw - extra, 0, extra, scrh) - end - if scrh > size then - local extra = (scrh - size) * 0.5 - surface.DrawRect(0, 0, scrw, extra) - surface.DrawRect(0, scrh - extra, scrw, extra) - end + self:DrawRegularScope() end end end -SWEP.NextReload = 0 -function SWEP:Reload() - if CurTime() < self.NextReload then return end - - self.NextReload = CurTime() + self.ReloadDelay - - local owner = self.Owner - - if self:Clip1() < self.Primary.ClipSize and 0 < owner:GetAmmoCount(self.Primary.Ammo) then - self:DefaultReload(ACT_VM_RELOAD) - owner:DoReloadEvent() - self:SetNextPrimaryFire(CurTime() + self.ReloadDelay) - - timer.Simple(0.25, function() - if self:IsValid() and IsValid(owner) then - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - end - end) - end -end - function SWEP.BulletCallback(attacker, tr, dmginfo) if tr.HitGroup == HITGROUP_HEAD then local ent = tr.Entity - if ent:IsValid() and ent:IsPlayer() then - if ent:Team() == TEAM_UNDEAD and ent:GetZombieClassTable().Boss then - GenericBulletCallback(attacker, tr, dmginfo) - return - end - - ent.Gibbed = CurTime() + if ent:IsValidLivingZombie() and ent:GetZombieClassTable().Boss then + return end if gamemode.Call("PlayerShouldTakeDamage", ent, attacker) then - INFDAMAGEFLOATER = true - ent:SetHealth(math.max(ent:Health() - 400, 1)) + dmginfo:SetDamageType(DMG_DIRECT) + dmginfo:SetDamage(dmginfo:GetDamage() + ent:GetMaxHealthEx() * 0.55) end end - - GenericBulletCallback(attacker, tr, dmginfo) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/cl_init.lua new file mode 100644 index 0000000..b1eafb8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/cl_init.lua @@ -0,0 +1,75 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "v_weapon.M3_PARENT" +SWEP.HUD3DPos = Vector(-0.5, -4.2, -0) +SWEP.HUD3DAng = Angle(0, 0, -20) +SWEP.HUD3DScale = 0.015 + +SWEP.ViewModelFOV = 70 +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.VElements = { + ["edgeleft++"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(2.305, -17.574, 0), angle = Angle(180, 0, 0), size = Vector(0.351, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_vehicles/carparts_tire01a.mdl", bone = "v_weapon.M3_PARENT", rel = "", pos = Vector(0.039, -0.797, -15.662), angle = Angle(180, 0, -90), size = Vector(0.174, 0.847, 0.174), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["1+"] = { type = "Model", model = "models/props_vehicles/carparts_tire01a.mdl", bone = "v_weapon.M3_PARENT", rel = "1", pos = Vector(0, -17.782, 0), angle = Angle(0, 0, 0), size = Vector(0.174, 0.838, 0.174), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["pipe"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(3.494, -14.778, 0.214), angle = Angle(90, 90, 0), size = Vector(0.118, 0.118, 0.208), color = Color(125, 125, 115, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["shellpusher"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(0, -19.056, 0), angle = Angle(0, 90, 0), size = Vector(8, 0.079, 0.079), color = Color(125, 125, 115, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["edgeleft+++"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(-2.306, -17.574, 0), angle = Angle(180, 180, 0), size = Vector(0.351, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["edgeleft+"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(-2.306, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.345, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["SHELL"] = { type = "Model", model = "models/props_phx/misc/flakshell_big.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(0, -3.961, 0), angle = Angle(0, 0, 90), size = Vector(0.127, 0.127, 0.18), color = Color(245, 215, 0, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["pipe+"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(-3.495, -14.778, 0.214), angle = Angle(90, 90, 0), size = Vector(0.118, 0.118, 0.208), color = Color(125, 125, 115, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["black_filler"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(0, -3.412, 0), angle = Angle(0, 90, 0), size = Vector(1.694, 0.079, 0.079), color = Color(0, 0, 0, 255), surpresslightning = false, material = "models/debug/debugwhite", skin = 0, bodygroup = {} }, + ["edgeleft"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "1", pos = Vector(2.305, 0, 0), angle = Angle(180, 0, 0), size = Vector(0.345, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["edgeleft"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(2.305, 0, 0), angle = Angle(180, 0, 0), size = Vector(0.345, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["1"] = { type = "Model", model = "models/props_vehicles/carparts_tire01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(21.385, 1.429, -5.041), angle = Angle(180, 90, 0), size = Vector(0.174, 0.847, 0.174), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["1+"] = { type = "Model", model = "models/props_vehicles/carparts_tire01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(0, -14.903, 0), angle = Angle(0, 0, 0), size = Vector(0.174, 0.838, 0.174), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["clip"] = { type = "Model", model = "models/Items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, 2.381, -2.79), angle = Angle(-87.457, -90, 0), size = Vector(0.741, 1.69, 0.741), color = Color(115, 115, 115, 255), surpresslightning = false, material = "models/props_canal/metalwall005b", skin = 0, bodygroup = {} }, + ["pipe"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(3.494, -12.018, 0.214), angle = Angle(90, 90, 0), size = Vector(0.118, 0.118, 0.115), color = Color(125, 125, 115, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["black_filler+"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(0, -16.862, 0), angle = Angle(0, 90, 0), size = Vector(6.394, 0.079, 0.079), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["edgeleft++"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(2.305, -14.907, 0), angle = Angle(180, 0, 0), size = Vector(0.351, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["edgeleft+++"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(-2.306, -14.907, 0), angle = Angle(180, 180, 0), size = Vector(0.351, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["edgeleft+"] = { type = "Model", model = "models/props_lab/monitor01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(-2.306, 0, 0), angle = Angle(180, 180, 0), size = Vector(0.345, 0.556, 0.435), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["GRIP"] = { type = "Model", model = "models/weapons/w_pist_usp.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1+", pos = Vector(0, -2.672, -6.75), angle = Angle(0, -90, 0), size = Vector(0.575, 1, 1), color = Color(100, 75, 0, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["pipe+"] = { type = "Model", model = "models/props_pipes/valve002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(-3.495, -12.018, 0.214), angle = Angle(90, 90, 0), size = Vector(0.118, 0.118, 0.115), color = Color(125, 125, 115, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["SHELL"] = { type = "Model", model = "models/props_phx/misc/flakshell_big.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(0, -3.961, 0), angle = Angle(0, 0, 90), size = Vector(0.127, 0.127, 0.18), color = Color(245, 215, 0, 255), surpresslightning = false, material = "models/props_lab/door_klab01", skin = 0, bodygroup = {} }, + ["black_filler"] = { type = "Model", model = "models/XQM/panel360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "1", pos = Vector(0, -1.961, 0), angle = Angle(0, 90, 0), size = Vector(6.394, 0.079, 0.079), color = Color(0, 0, 0, 255), surpresslightning = false, material = "models/debug/debugwhite", skin = 0, bodygroup = {} } +} + +function SWEP:PostDrawViewModel(vm, pl, wep) + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local lol = self:Clip1() == 0 and 0 or (CurTime() - self:GetLastFired())^3.5 + local shelllol = math.Clamp(lol, 0, 1) * 20 + + local shellpos = self.VElements["SHELL"].pos + shellpos.y = -24 + shelllol +end + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + if self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 1.5) + end + + if ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -15 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/init.lua new file mode 100644 index 0000000..a1ed126 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_flak" +SWEP.Primary.ProjVelocity = 1500 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/shared.lua new file mode 100644 index 0000000..080392e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smelter/shared.lua @@ -0,0 +1,119 @@ +SWEP.PrintName = "'Smelter' Flak Cannon" +SWEP.Description = "Launches a spray of hot shards of scrap in a flak pattern." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" +SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" + +SWEP.UseHands = false + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_Crossbow.Single") +SWEP.Primary.Delay = 1.25 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 20.5 +SWEP.Primary.NumShots = 7 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Ammo = "scrap" +SWEP.Primary.DefaultClip = 15 + +SWEP.Recoil = 7 + +SWEP.WalkSpeed = SPEED_SLOWEST + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.ConeMax = 6.5 +SWEP.ConeMin = 5.75 + +SWEP.ReloadSpeed = 0.45 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.05) + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/g3sg1/g3sg1_slide.wav", 75, 45, 1, CHAN_WEAPON + 23) + self:EmitSound("weapons/ump45/ump45_boltslap.wav", 70, 47, 0.85, CHAN_WEAPON + 24) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/galil/galil_boltpull.wav", 70, 110) + self:EmitSound("weapons/zs_flak/load1.wav", 75, 100, 0.85, CHAN_WEAPON + 20) + end +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_VM_DRAW) +end + +function SWEP:SendWeaponAnimation() + self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed * 0.25) + + timer.Simple(0.4, function() + if IsValid(self) then + self:SendWeaponAnim(ACT_VM_DRAW) + self:GetOwner():GetViewModel():SetPlaybackRate(self.FireAnimSpeed * 10.5) + end + end) + + timer.Simple(0.55, function() + if IsValid(self) and self:GetOwner() == MySelf and self:Clip1() > 0 then + self:EmitSound("weapons/zs_flak/load1.wav", 75, 100, 0.85, CHAN_WEAPON + 20) + end + end) +end + +function SWEP:EmitFireSound(secondary) + self:EmitSound(secondary and "weapons/stinger_fire1.wav" or "doors/door_metal_thin_close2.wav", 75, secondary and 250 or 70, 0.65) + self:EmitSound("weapons/shotgun/shotgun_fire6.wav", 75, secondary and 105 or 115, 0.55, CHAN_WEAPON + 20) + self:EmitSound("weapons/zs_flak/shot1.wav", 70, secondary and 65 or 100, 0.65, CHAN_WEAPON + 21) +end + +function SWEP:SetLastFired(float) + self:SetDTFloat(8, float) +end + +function SWEP:GetLastFired() + return self:GetDTFloat(8) +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:SetLastFired(CurTime()) + + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:SecondaryAttack() + if self:Clip1() <= 1 or not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * 1.2) + self:SetLastFired(CurTime()) + + self:EmitFireSound(true) + self:TakeAmmo(); self:TakeAmmo() + + self.Primary.Projectile = "projectile_flakbomb" + self.Primary.ProjVelocity = 1000 + + self:ShootBullets(self.Primary.Damage, 1, self:GetCone()/2) + + self.Primary.Projectile = "projectile_flak" + self.Primary.ProjVelocity = 1500 + + self.IdleAnimation = CurTime() + self:SequenceDuration() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smg.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smg.lua index 811e321..4ce5107 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smg.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_smg.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Shredder' SMG" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Shredder' SMG" +SWEP.Description = "Simple SMG capable of very good damage output at the cost of long range accuracy." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 @@ -23,7 +25,7 @@ SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" SWEP.UseHands = true SWEP.Primary.Sound = Sound("Weapon_MP5Navy.Single") -SWEP.Primary.Damage = 18 +SWEP.Primary.Damage = 21 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.09 @@ -35,10 +37,32 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 -SWEP.ConeMax = 0.11 -SWEP.ConeMin = 0.05 +SWEP.ConeMax = 5.5 +SWEP.ConeMin = 2.5 SWEP.WalkSpeed = SPEED_SLOW +SWEP.Tier = 3 + SWEP.IronSightsAng = Vector(0.8, 0, 0) SWEP.IronSightsPos = Vector(-5.33, 7, 1.8) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Smasher' SMG", "Additional damage to skeletal enemies, inflicts force, but fires and reloads slower", function(wept) + wept.Primary.Delay = 0.15 + wept.ReloadSpeed = 0.9 + + wept.BulletCallback = function(attacker, tr, dmginfo) + local trent = tr.Entity + + if SERVER and trent and trent:IsValidZombie() then + if trent:GetZombieClassTable().Skeletal then + dmginfo:SetDamage(dmginfo:GetDamage() * 1.2) + end + + if math.random(6) == 1 then + trent:ThrowFromPositionSetZ(tr.StartPos, 150, nil, true) + end + end + end +end) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/cl_init.lua index 3d390d0..ccb5075 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/cl_init.lua @@ -1,4 +1,7 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Will O' Wisp" SWEP.DrawCrosshair = false + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/init.lua index c3b2be0..828fcfd 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - self.Owner:CreateAmbience("ambience_wow") + self:GetOwner():CreateAmbience("ambience_wow") return true end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/shared.lua index c721eb8..729dba5 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_special_wow/shared.lua @@ -1,49 +1,63 @@ +SWEP.PrintName = "Will O' Wisp" + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = true +SWEP.Secondary.Ammo = "none" + SWEP.ZombieOnly = true SWEP.IsMelee = true SWEP.ViewModel = "models/weapons/v_knife_t.mdl" SWEP.WorldModel = "models/weapons/w_knife_t.mdl" +util.PrecacheSound("npc/scanner/scanner_nearmiss1.wav") +util.PrecacheSound("npc/scanner/scanner_nearmiss2.wav") +util.PrecacheSound("npc/scanner/scanner_talk1.wav") +util.PrecacheSound("npc/scanner/scanner_talk2.wav") + +SWEP.NextAmbientSound = 0 + function SWEP:Initialize() self:HideViewAndWorldModel() end function SWEP:Think() - if self:GetAttackDown() and not self.Owner:KeyDown(IN_ATTACK) then - self:SetAttackDown(false) - end end function SWEP:PrimaryAttack() - if not self:GetAttackDown() then - self:SetAttackDown(true) - self:EmitSound("npc/scanner/scanner_nearmiss"..math.random(2)..".wav") + if CurTime() < self:GetNextPrimaryAttack() then return end + self:SetNextPrimaryAttack(CurTime() + 4) + + local owner = self:GetOwner() + + owner.LastRangedAttack = CurTime() + + if SERVER then + owner:GodEnable() + util.BlastDamageEx(self, owner, owner:GetShootPos(), 64, 5, DMG_DISSOLVE) + owner:GodDisable() + end + + if IsFirstTimePredicted() then + local effectdata = EffectData() + effectdata:SetOrigin(owner:GetShootPos()) + effectdata:SetNormal(owner:GetAimVector()) + util.Effect("explosion_wispball", effectdata) end end function SWEP:SecondaryAttack() - if CurTime() >= self:GetNextPrimaryAttack() then - self:SetNextPrimaryAttack(CurTime() + 8) - self:EmitSound("npc/scanner/scanner_talk1.wav") - end end function SWEP:Reload() - if CurTime() >= self:GetNextPrimaryAttack() then - self:SetNextPrimaryAttack(CurTime() + 5) + if CurTime() >= self:GetNextSecondaryAttack() then + self:SetNextSecondaryAttack(CurTime() + 5) self:EmitSound("npc/scanner/scanner_talk2.wav") end end - -function SWEP:SetAttackDown(attackdown) - self:SetDTBool(0, attackdown) -end - -function SWEP:GetAttackDown() - return self:GetDTBool(0) -end - -util.PrecacheSound("npc/scanner/scanner_nearmiss1.wav") -util.PrecacheSound("npc/scanner/scanner_nearmiss2.wav") -util.PrecacheSound("npc/scanner/scanner_talk1.wav") -util.PrecacheSound("npc/scanner/scanner_talk2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/cl_init.lua new file mode 100644 index 0000000..2339edb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/cl_init.lua @@ -0,0 +1,27 @@ +INC_CLIENT() + +SWEP.HUD3DBone = "ValveBiped.Crossbow_base" +SWEP.HUD3DPos = Vector(-0.3, -1, -4.54) +SWEP.HUD3DScale = 0.035 +SWEP.HUD3DAng = Angle(180, 0, -55) + +SWEP.ViewModelFOV = 62 +SWEP.ViewModelFlip = false + +SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-0, -1.854, 0.455), angle = Angle(-24.781, 90, 180), size = Vector(0.307, 0.476, 0.423), color = Color(103, 168, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/props_combine/combine_binocular01.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-0, 1.748, -1.219), angle = Angle(-9.438, 90, -0), size = Vector(0.316, 0.428, 0.321), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/combine_fence01b.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-3.401, -0.851, 6.88), angle = Angle(0, -90, 0), size = Vector(0.174, 0.174, 0.174), color = Color(142, 197, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combinecrane002.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(0.391, -2.362, 14.17), angle = Angle(-180, 0, 0), size = Vector(0.032, 0.029, 0.067), color = Color(125, 193, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_fence01a.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(3.4, -0.851, 6.88), angle = Angle(0, -90, 0), size = Vector(0.174, 0.174, 0.174), color = Color(142, 197, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/breentp_rings.mdl", bone = "ValveBiped.bolt", rel = "", pos = Vector(0, -0.468, 1.162), angle = Angle(0, 0, 90), size = Vector(0.054, 0.054, 0.014), color = Color(42, 173, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base+++++"] = { type = "Model", model = "models/props_combine/combine_binocular01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(7.879, 1.001, -0.686), angle = Angle(-100.002, 7.423, 0), size = Vector(0.316, 0.428, 0.321), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_combine/breentp_rings.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(13.13, -0.075, -5.329), angle = Angle(0, 0, 0), size = Vector(0.054, 0.054, 0.014), color = Color(42, 173, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/combine_fence01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(15.503, 3.358, -4.2), angle = Angle(90, -170, 0), size = Vector(0.174, 0.174, 0.174), color = Color(142, 197, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combinecrane002.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(22.2, -1.374, -5.395), angle = Angle(180, -79.429, 90), size = Vector(0.032, 0.029, 0.067), color = Color(125, 193, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+++"] = { type = "Model", model = "models/props_lab/eyescanner.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.237, 0.861, -5.441), angle = Angle(-57.536, -171.206, 0), size = Vector(0.307, 0.476, 0.423), color = Color(103, 168, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_combine/combine_fence01b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(14.208, -3.931, -4.16), angle = Angle(90, -170, 0), size = Vector(0.174, 0.174, 0.174), color = Color(142, 197, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/init.lua new file mode 100644 index 0000000..683c283 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_disc" +SWEP.Primary.ProjVelocity = 1500 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/shared.lua new file mode 100644 index 0000000..c949fa8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spinfusor/shared.lua @@ -0,0 +1,64 @@ +SWEP.PrintName = "'Spinfusor' Pulse Disc Launcher" +SWEP.Description = "Launches pulse projectiles that react on walls, sending energy back in the direction they travelled." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +sound.Add( +{ + name = "Weapon_Slayer.Single", + channel = CHAN_AUTO, + volume = 1, + soundlevel = 100, + pitch = {125, 135}, + sound = {"weapons/physcannon/superphys_launch2.wav", "weapons/physcannon/superphys_launch3.wav"} +}) + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Damage = 86 +SWEP.Primary.Delay = 1.2 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.Sound = Sound("Weapon_Slayer.Single") + +SWEP.Primary.ClipSize = 7 +SWEP.Primary.DefaultClip = 30 +SWEP.RequiredClip = 7 + +SWEP.ReloadSpeed = 0.9 + +SWEP.Recoil = 3 + +SWEP.WalkSpeed = SPEED_SLOWER + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.Tier = 5 +SWEP.MaxStock = 2 + +SWEP.FireAnimSpeed = 0.65 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1) + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/ar2/ar2_reload.wav", 75, 100, 1, CHAN_WEAPON + 21) + self:EmitSound("weapons/smg1/smg1_reload.wav", 75, 100, 1, CHAN_WEAPON + 22) + end +end + +util.PrecacheSound("weapons/ar2/ar2_reload.wav") +util.PrecacheSound("weapons/smg1/smg1_reload.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/cl_init.lua index f13ae8a..67949da 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/cl_init.lua @@ -1,35 +1,33 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Spot Lamp" -SWEP.Description = "This lamp is a watchful eye which illuminates an area.\nPress PRIMARY ATTACK to deploy.\nPress SECONDARY ATTACK and RELOAD to rotate." SWEP.DrawCrosshair = false SWEP.Slot = 4 SWEP.SlotPos = 0 function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end function SWEP:PrimaryAttack() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end function SWEP:Think() - if self.Owner:KeyDown(IN_ATTACK2) then + if self:GetOwner():KeyDown(IN_ATTACK2) then self:RotateGhost(FrameTime() * 60) end - if self.Owner:KeyDown(IN_RELOAD) then + if self:GetOwner():KeyDown(IN_RELOAD) then self:RotateGhost(FrameTime() * -60) end end function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) return true end @@ -40,5 +38,5 @@ function SWEP:RotateGhost(amount) surface.PlaySound("npc/headcrab_poison/ph_step4.wav") nextclick = RealTime() + 0.3 end - RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount)) + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/init.lua index 5d0e7eb..7687f8d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/init.lua @@ -1,10 +1,7 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() function SWEP:Deploy() - gamemode.Call("WeaponDeployed", self.Owner, self) + gamemode.Call("WeaponDeployed", self:GetOwner(), self) self:SpawnGhost() @@ -21,14 +18,14 @@ function SWEP:Holster() end function SWEP:SpawnGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:GiveStatus("ghost_spotlamp") end end function SWEP:RemoveGhost() - local owner = self.Owner + local owner = self:GetOwner() if owner and owner:IsValid() then owner:RemoveStatus("ghost_spotlamp", false, true) end @@ -37,7 +34,7 @@ end function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end - local owner = self.Owner + local owner = self:GetOwner() local status = owner.status_ghost_spotlamp if not (status and status:IsValid()) then return end @@ -78,6 +75,6 @@ function SWEP:Think() local count = self:GetPrimaryAmmoCount() if count ~= self:GetReplicatedAmmo() then self:SetReplicatedAmmo(count) - self.Owner:ResetSpeed() + self:GetOwner():ResetSpeed() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/shared.lua index f49a4b2..838c887 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_spotlamp/shared.lua @@ -1,3 +1,6 @@ +SWEP.PrintName = "Spot Lamp" +SWEP.Description = "This lamp is a watchful eye which illuminates an area.\nPress PRIMARY ATTACK to deploy.\nPress SECONDARY ATTACK and RELOAD to rotate." + SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = Model("models/props_combine/combine_light001a.mdl") @@ -17,9 +20,11 @@ SWEP.Secondary.Ammo = "dummy" SWEP.WalkSpeed = SPEED_NORMAL SWEP.FullWalkSpeed = SPEED_SLOWEST +SWEP.NoDeploySpeedChange = true + function SWEP:Initialize() self:SetWeaponHoldType("slam") - self:SetDeploySpeed(1.1) + GAMEMODE:DoChangeDeploySpeed(self) self:HideViewAndWorldModel() end @@ -44,7 +49,7 @@ function SWEP:Reload() end function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end if self:GetPrimaryAmmoCount() <= 0 then self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/cl_init.lua new file mode 100644 index 0000000..ae2d5f5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/cl_init.lua @@ -0,0 +1,112 @@ +INC_CLIENT() + +SWEP.ViewModelFlip = false +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.ViewModelFOV = 48 + +SWEP.HUD3DBone = "v_weapon.g3sg1_Parent" +SWEP.HUD3DPos = Vector(-1.5, -5.5, -5) +SWEP.HUD3DAng = Angle(0, 0, 0) +SWEP.HUD3DScale = 0.015 + +SWEP.VElements = { + ["base+++"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, -0.431, 9.47), angle = Angle(0, 90, 90), size = Vector(0.453, 0.247, 0.291), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, -0.401, -10.211), angle = Angle(90, 0, 0), size = Vector(0.048, 0.009, 0.009), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_c17/signpole001.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, 0.402, -7.619), angle = Angle(0, 180, 180), size = Vector(0.4, 0.4, 0.045), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, 0.972, 6.742), angle = Angle(0, 90, -90), size = Vector(0.219, 0.799, 0.071), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/items/ar2_grenade.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(-0.151, 1.45, -15.332), angle = Angle(-90, 88.5, 90), size = Vector(1.707, 0.69, 0.129), color = Color(180, 180, 200, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} }, + ["base++++++++++++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, 2.158, 13.34), angle = Angle(176.8, 90, 90), size = Vector(0.101, 0.115, 0.342), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, -0.091, 11.701), angle = Angle(0, 90, 0), size = Vector(0.012, 0.008, 0.026), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, -0.826, 10.39), angle = Angle(-180, 90, 0), size = Vector(0.006, 0.006, 0.02), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, 1.36, 16.593), angle = Angle(180, -180, 179.335), size = Vector(0.791, 0.662, 0.561), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "v_weapon.g3sg1_Parent", rel = "", pos = Vector(0, -5.053, -14.992), angle = Angle(0, 0, 0), size = Vector(0.043, 0.078, 0.308), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base+++++++++++"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(-0.171, 1.807, 13.182), angle = Angle(-180, 90, 90), size = Vector(0.039, 0.035, 0.075), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++++++++"] = { type = "Model", model = "models/gibs/helicopter_brokenpiece_03.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0.116, 3.184, 23.489), angle = Angle(96.251, -87.704, -53.169), size = Vector(0.159, 0.119, 0.119), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/props_c17/substation_transformer01c.mdl", bone = "v_weapon.g3sg1_Parent", rel = "base", pos = Vector(0, -0.494, 12.083), angle = Angle(0, 0, -26.507), size = Vector(0.014, 0.012, 0.012), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base+++"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -0.431, 9.47), angle = Angle(0, 90, 90), size = Vector(0.453, 0.247, 0.291), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++"] = { type = "Model", model = "models/props_pipes/concrete_pipe001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -0.401, -10.211), angle = Angle(90, 0, 0), size = Vector(0.048, 0.009, 0.009), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+++++++"] = { type = "Model", model = "models/props_c17/signpole001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0.402, -7.619), angle = Angle(0, 180, 180), size = Vector(0.4, 0.4, 0.045), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/light_decklight01_on.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0.972, 6.742), angle = Angle(0, 90, -90), size = Vector(0.219, 0.799, 0.071), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base+++++"] = { type = "Model", model = "models/props_c17/substation_transformer01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -0.494, 12.083), angle = Angle(0, 0, -26.507), size = Vector(0.014, 0.012, 0.012), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -0.091, 11.701), angle = Angle(0, 90, 0), size = Vector(0.012, 0.008, 0.026), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base++++++"] = { type = "Model", model = "models/props_combine/combine_booth_short01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -0.826, 10.39), angle = Angle(-180, 90, 0), size = Vector(0.006, 0.006, 0.02), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base+++++++++++"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.171, 1.807, 13.182), angle = Angle(-180, 90, 90), size = Vector(0.039, 0.035, 0.075), color = Color(130, 158, 180, 255), surpresslightning = false, material = "models/props_pipes/guttermetal01a", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(18.819, 0.592, -6.156), angle = Angle(0, 90, -79.467), size = Vector(0.043, 0.078, 0.308), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base+++++++++"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 1.36, 16.593), angle = Angle(180, -180, 179.335), size = Vector(0.791, 0.662, 0.561), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base++++++++++"] = { type = "Model", model = "models/gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.116, 3.184, 23.489), angle = Angle(96.251, -87.704, -53.169), size = Vector(0.159, 0.119, 0.119), color = Color(165, 100, 0, 255), surpresslightning = false, material = "models/props_wasteland/wood_fence01a", skin = 0, bodygroup = {} }, + ["base++++++++"] = { type = "Model", model = "models/items/ar2_grenade.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.151, 1.45, -15.332), angle = Angle(-90, 88.5, 90), size = Vector(1.707, 0.69, 0.129), color = Color(180, 180, 200, 255), surpresslightning = false, material = "models/props_pipes/pipemetal004a", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.Bip01_L_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(2.371, 2.433, 0) }, + ["ValveBiped.Bip01_R_Forearm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-6.566, -10.653, 3.877) }, + ["ValveBiped.Bip01_R_UpperArm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(19.531, 0.202, -5.178) }, + ["ValveBiped.Bip01_R_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-32.656, -1.759, -3.086) } +} + +local ghostlerp = 0 +function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang) + local owner = self:GetOwner() + if self:IsSwinging() then + local rot = self.SwingRotation + local offset = self.SwingOffset + local armdelay = owner:GetMeleeSpeedMul() + local swingtime = self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay + + ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy + + local swingend = self:GetSwingEnd() + local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime) + local power = CosineInterpolation(0, 1, delta / swingtime) + + if power >= 0.9 then + power = (1 - power) ^ 0.4 * 2 + end + + pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up() + + ang:RotateAroundAxis(ang:Right(), rot.pitch * power) + ang:RotateAroundAxis(ang:Up(), rot.yaw * power) + ang:RotateAroundAxis(ang:Forward(), rot.roll * power) + elseif CurTime() < self:GetNextSecondaryFire() then + local rot = -self.SwingRotation * 0.6 + local offset = -self.SwingOffset * 0.5 + local swingtime = 0.2 + + ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy + + local swingend = self:GetNextSecondaryFire() - 1.25 + local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime) + local power = math.Clamp(delta / swingtime, 0, 1) + + if power >= 0.85 then + power = (1 - power) ^ 0.4 * 2 + end + + pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up() + + ang:RotateAroundAxis(ang:Right(), rot.pitch * power) + ang:RotateAroundAxis(ang:Up(), rot.yaw * power) + ang:RotateAroundAxis(ang:Forward(), rot.roll * power) + end + + if self:GetOwner():GetBarricadeGhosting() then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) + elseif self:GetReloadFinish() > 0 then + ghostlerp = math.min(1, ghostlerp + FrameTime() * 1.2) + elseif ghostlerp > 0 then + ghostlerp = math.max(0, ghostlerp - FrameTime() * 4) + end + + if ghostlerp > 0 and self:GetReloadFinish() > 0 then + ang:RotateAroundAxis(ang:Right(), -16 * ghostlerp) + elseif ghostlerp > 0 then + ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp) + end + + return pos, ang +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/init.lua new file mode 100644 index 0000000..323b8b8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/init.lua @@ -0,0 +1,16 @@ +INC_SERVER() + +local BaseClassMelee = baseclass.Get("weapon_zs_basemelee") -- Don't swap these two around. The order matters...but only in this file. For some reason. +DEFINE_BASECLASS("weapon_zs_base") + +function SWEP:ServerMeleeHitEntity(tr, hitent, damagemultiplier) + BaseClassMelee.ServerMeleeHitEntity(self, tr, hitent, damagemultiplier) +end + +function SWEP:ServerMeleePostHitEntity(tr, hitent, damagemultiplier) + BaseClassMelee.ServerMeleePostHitEntity(self, tr, hitent, damagemultiplier) +end + +function SWEP:ServerHitFleshEffects(hitent, tr, damagemultiplier) + BaseClassMelee.ServerHitFleshEffects(self, hitent, tr, damagemultiplier) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/shared.lua new file mode 100644 index 0000000..2ef0f84 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stabber/shared.lua @@ -0,0 +1,169 @@ +DEFINE_BASECLASS("weapon_zs_base") +local BaseClassMelee = baseclass.Get("weapon_zs_basemelee") + +SWEP.PrintName = "'Stabber' M1 Garand" + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "ar2" + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_g3sg1.mdl" +SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" +SWEP.UseHands = true + +SWEP.Primary.Damage = 65 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.36 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "357" +SWEP.Primary.DefaultClip = 25 + +SWEP.MeleeDamage = 45 +SWEP.MeleeRange = 72 +SWEP.MeleeSize = 0.95 +SWEP.MeleeKnockBack = 0 + +SWEP.DamageType = DMG_SLASH + +SWEP.BloodDecal = "Blood" + +SWEP.SwingTime = 0.35 +SWEP.SwingRotation = Angle(-8, -20, 0) +SWEP.SwingOffset = Vector(0, -30, 0) + +SWEP.Secondary.Automatic = true +SWEP.Secondary.Delay = 1.3 + +SWEP.ConeMax = 2.75 +SWEP.ConeMin = 1.25 + +SWEP.WalkSpeed = SPEED_SLOW + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.03, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.5, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Puncturer' M1 Garand", "Additional damage to targets stabbed with the bayonet recently, reduced bullet damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.85 + wept.BulletCallback = function(attacker, tr, dmginfo) + local ent = tr.Entity + if SERVER and ent:IsValidLivingZombie() and ent.PuncStabbed and ent.PuncStabbed > CurTime() then + dmginfo:SetDamage(dmginfo:GetDamage() * 1.7) + end + end + wept.MeleeHitEntity = function(self, tr, hitent, damagemultiplier) + hitent.PuncStabbed = CurTime() + 3 + BaseClassMelee.MeleeHitEntity(self, tr, hitent, damagemultiplier) + end +end) + +SWEP.ReloadSpeed = 1.3 +SWEP.MeleeFlagged = true + +SWEP.Tier = 2 + +function SWEP:EmitFireSound() + self:EmitSound("weapons/ak47/ak47-1.wav", 75, 76, 0.53) + self:EmitSound("weapons/scout/scout_fire-1.wav", 75, 86, 0.67, CHAN_AUTO+20) +end + +function SWEP:PlaySwingSound() + self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav") +end + +function SWEP:PlayStartSwingSound() +end + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/golf club/golf_hit-0"..math.random(4)..".ogg") +end + +function SWEP:PlayHitFleshSound() + self:EmitSound("weapons/knife/knife_stab.wav", 70, math.random(95, 105), 1, CHAN_AUTO+20) +end + +function SWEP:ShootBullets(dmg, numbul, cone) + if self:Clip1() == 0 then + self:EmitSound("npc/roller/blade_out.wav", 70, math.random(80, 84), 0.5, CHAN_AUTO+21) + self:EmitSound("physics/metal/metal_solid_impact_bullet4.wav", 70, 100, 0.5, CHAN_AUTO+22) + end + + BaseClass.ShootBullets(self, dmg, numbul, cone) +end + +function SWEP:Think() + if self:IsSwinging() and self:GetSwingEnd() <= CurTime() then + self:StopSwinging() + + BaseClassMelee.MeleeSwing(self) + end + + BaseClass.Think(self) +end + +function SWEP:CanSecondaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + return self:GetNextSecondaryFire() <= CurTime() and not self:IsSwinging() +end + +function SWEP:SecondaryAttack() + if not self:CanSecondaryAttack() then return end + self:SetNextAttack() + + if self.SwingTime == 0 then + BaseClassMelee.MeleeSwing(self) + else + BaseClassMelee.StartSwinging(self) + end +end + +function SWEP:DoMeleeAttackAnim() + self:GetOwner():DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_SLAM) +end + +function SWEP:SetNextAttack() + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay + self.SwingTime * armdelay) + self:SetNextSecondaryFire(CurTime() + self.Secondary.Delay * armdelay) +end + +function SWEP:Holster() + return BaseClassMelee.Holster(self) +end + +function SWEP:MeleeHitEntity(tr, hitent, damagemultiplier) + BaseClassMelee.MeleeHitEntity(self, tr, hitent, damagemultiplier) +end + +function SWEP:PlayerHitUtil(owner, damage, hitent, dmginfo) + BaseClassMelee.PlayerHitUtil(self, owner, damage, hitent, dmginfo) +end + +function SWEP:PostHitUtil(owner, hitent, dmginfo, tr, vel) + BaseClassMelee.PostHitUtil(self, owner, hitent, dmginfo, tr, vel) +end + +function SWEP:SetupDataTables() + BaseClassMelee.SetupDataTables(self) +end + +function SWEP:StopSwinging() + BaseClassMelee.StopSwinging(self) +end + +function SWEP:IsSwinging() + return BaseClassMelee.IsSwinging(self) +end + +function SWEP:SetSwingEnd(swingend) + self:SetDTFloat(3, swingend) +end + +function SWEP:GetSwingEnd() + return self:GetDTFloat(3) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stone.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stone.lua index eb6ae3e..c87e3e3 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stone.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stone.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Stone" - SWEP.Description = "A simple stone found laying pretty much anywhere." +SWEP.PrintName = "Stone" +SWEP.Description = "A simple stone found laying pretty much anywhere." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 SWEP.ShowViewModel = true @@ -24,164 +24,13 @@ if CLIENT then } end -SWEP.Base = "weapon_zs_basemelee" +SWEP.Base = "weapon_zs_basethrown" SWEP.ViewModel = "models/weapons/c_bugbait.mdl" SWEP.WorldModel = "models/props_junk/rock001a.mdl" -SWEP.UseHands = true -SWEP.HoldType = "grenade" - -SWEP.WalkSpeed = SPEED_FAST - -SWEP.AmmoIfHas = true - -SWEP.Primary.ClipSize = 1 -SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "stone" -SWEP.Primary.Delay = 1 -SWEP.Primary.DefaultClip = 1 -SWEP.Secondary.ClipSize = 1 -SWEP.Secondary.DefaultClip = 1 -SWEP.Secondary.Automatic = false -SWEP.Secondary.Ammo = "dummy" - -SWEP.WalkSpeed = SPEED_FAST - -function SWEP:Initialize() - self:SetWeaponHoldType("grenade") - self:SetDeploySpeed(1.1) - - if CLIENT then - self:Anim_Initialize() - end -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:GetPrimaryAmmoCount() <= 0 then - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - return false - end - - return true -end - -function SWEP:PrimaryAttack() - if not self:CanPrimaryAttack() then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - - local owner = self.Owner - self:SendWeaponAnim(ACT_VM_THROW) - owner:DoAttackEvent() - - self:TakePrimaryAmmo(1) - self.NextDeploy = CurTime() + 0.75 - - if SERVER then - local ent = ents.Create("projectile_stone") - if ent:IsValid() then - ent:SetPos(owner:GetShootPos()) - ent:SetOwner(owner) - ent:Spawn() - ent.Team = owner:Team() - ent:EmitSound("WeaponFrag.Throw") - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:AddAngleVelocity(VectorRand() * 360) - phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 900) - end - end - - if self:GetPrimaryAmmoCount() <= 0 then - owner:StripWeapon(self:GetClass()) - end - end -end - -function SWEP:SecondaryAttack() -end - -function SWEP:CanSecondaryAttack() - return false -end - -function SWEP:Reload() - return false -end - -function SWEP:Deploy() - GAMEMODE:WeaponDeployed(self.Owner, self) - - if self:GetPrimaryAmmoCount() <= 0 then - self:SendWeaponAnim(ACT_VM_THROW) - end - - return true -end - -function SWEP:Holster() - self.NextDeploy = nil - - if CLIENT then - self:Anim_Holster() - end - - return true -end - -function SWEP:Think() - if self.NextDeploy and self.NextDeploy <= CurTime() then - self.NextDeploy = nil - - if 0 < self:GetPrimaryAmmoCount() then - self:SendWeaponAnim(ACT_VM_DRAW) - else - self:SendWeaponAnim(ACT_VM_THROW) - if SERVER then - self:Remove() - end - end - end -end - -local colBG = Color(16, 16, 16, 90) -local colWhite = Color(220, 220, 220, 230) - -SWEP.HUD3DPos = Vector(5, 2, 0) - -function SWEP:PostDrawViewModel(vm) - if not self.HUD3DPos or GAMEMODE.WeaponHUDMode == 1 then return end - - local bone = vm:LookupBone("ValveBiped.Bip01_R_Hand") - if not bone then return end - - local m = vm:GetBoneMatrix(bone) - if not m then return end - - local pos, ang = m:GetTranslation(), m:GetAngles() - - local offset = self.HUD3DPos - - pos = pos + ang:Forward() * offset.x + ang:Right() * offset.y + ang:Up() * offset.z - - ang:RotateAroundAxis(ang:Up(), math.sin(CurTime() * math.pi) * 20) - ang:RotateAroundAxis(ang:Right(), CurTime() * 180) - - pos = pos + ang:Forward() * 5 - - ang:RotateAroundAxis(ang:Right(), 270) - ang:RotateAroundAxis(ang:Up(), 180) - - local wid, hei = 144, 144 - local x, y = wid * -0.5, hei * -0.5 - local clip = self:GetPrimaryAmmoCount() - - cam.Start3D2D(pos, ang, 0.0075) - draw.RoundedBox(32, x, y, wid, hei, colBG) - draw.SimpleText(clip, "ZS3D2DFontBig", x + wid * 0.5, y + hei * 0.5, colWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) - cam.End3D2D() -end \ No newline at end of file +SWEP.ThrownProjectile = "projectile_stone" +SWEP.ThrowAngVel = 360 +SWEP.ThrowVel = 900 \ No newline at end of file diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/cl_init.lua new file mode 100644 index 0000000..c129fc9 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/cl_init.lua @@ -0,0 +1,54 @@ +INC_CLIENT() + +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.HUD3DBone = "ValveBiped.square" +SWEP.HUD3DPos = Vector(1.1, 0.25, -2) +SWEP.HUD3DScale = 0.015 + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.5, 2, -3.701), angle = Angle(0, -90, -8), size = Vector(0.5, 0.5, 0.5), color = Color(255, 50, 50, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.square", rel = "", pos = Vector(0, 0.5, 3), angle = Angle(0, 0, 90), size = Vector(0.5, 0.5, 0.5), color = Color(255, 50, 50, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +function SWEP:Draw2DHUD() + BaseClass.Draw2DHUD(self) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local player = self:GetSeekedPlayer() + local screenscale = BetterScreenScale() + surface.SetFont("ZSHUDFont") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + local _, nTEXH = surface.GetTextSize(text) + + draw.SimpleTextBlurry(text, "ZSHUDFont", ScrW() - 218 * screenscale, ScrH() - nTEXH * 3.5, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) +end + +function SWEP:Draw3DHUD(vm, pos, ang) + BaseClass.Draw3DHUD(self, vm, pos, ang) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local wid, hei = 180, 200 + local x, y = wid * 0, hei * -1 + + local player = self:GetSeekedPlayer() + surface.SetFont("ZS3D2DFontSmall") + local text = player:IsValidLivingHuman() and player:Name() or "No Target" + + cam.Start3D2D(pos, ang, self.HUD3DScale / 2) + draw.SimpleTextBlurry(text, "ZS3D2DFontSmall", x, y, text ~= "No Target" and COLOR_LIMEGREEN or COLOR_RED, TEXT_ALIGN_CENTER) + cam.End3D2D() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/init.lua new file mode 100644 index 0000000..163d2e4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/init.lua @@ -0,0 +1,9 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_strengthdart" +SWEP.Primary.ProjVelocity = 2000 + +function SWEP:EntModify(ent) + ent:SetSeeked(self:GetSeekedPlayer() or nil) + ent.BuffDuration = self.BuffDuration +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/shared.lua new file mode 100644 index 0000000..398f0f5 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_strengthshot/shared.lua @@ -0,0 +1,89 @@ +SWEP.PrintName = "Strength Shot Gun" +SWEP.Description = "Fires performance enhancing darts which can increase target damage.\nThe extra damage is given to you as points." +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +SWEP.Base = "weapon_zs_baseproj" +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/c_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.ReloadSound = Sound("Weapon_Pistol.Reload") + +SWEP.Primary.Delay = 0.25 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Ammo = "Battery" +SWEP.RequiredClip = 5 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.ReloadSpeed = 0.85 + +SWEP.BuffDuration = 10 + +SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) +SWEP.IronSightsAng = Vector(-0.15, -1, 2) + +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 5) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_BUFF_DURATION, 2) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "Defence Shot Gun", "Provides players with a defence boost instead of a strength boost", function(wept) + if SERVER then + wept.EntModify = function(self, ent) + ent:SetDTBool(0, true) + ent:SetSeeked(self:GetSeekedPlayer() or nil) + ent.BuffDuration = wept.BuffDuration + end + else + for k,v in pairs(wept.VElements) do + v.color = Color(100, 120, 215, 255) + end + end +end) + +function SWEP:GetFireDelay() + local owner = self:GetOwner() + return (self.Primary.Delay * (owner.MedgunFireDelayMul or 1)) / (owner:GetStatus("frost") and 0.7 or 1) +end + +function SWEP:GetReloadSpeedMultiplier() + local owner = self:GetOwner() + return BaseClass.GetReloadSpeedMultiplier(self) * (owner.MedgunReloadSpeedMul or 1) -- Convention is now BaseClass instead of self.BaseClass +end + +function SWEP:SetSeekedPlayer(ent) + self:SetDTEntity(6, ent) +end + +function SWEP:GetSeekedPlayer() + return self:GetDTEntity(6) +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()/2) + + local owner = self:GetOwner() + if not owner:IsSkillActive(SKILL_SMARTTARGETING) then return end + + local targetent = owner:CompensatedMeleeTrace(2048, 2, nil, nil, true).Entity + local locked = targetent and targetent:IsValidLivingHuman() + + if CLIENT then + self:EmitSound(locked and "npc/scanner/combat_scan4.wav" or "npc/scanner/scanner_scan5.wav", 65, locked and 75 or 200) + end + self:SetSeekedPlayer(locked and targetent) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stubber.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stubber.lua index 9617988..2525664 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stubber.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stubber.lua @@ -1,10 +1,13 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Stubber' Rifle" +SWEP.Description = "Your basic bolt action sniper rifle, capable of providing good damage on headshots." + +SWEP.Slot = 3 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Stubber' Rifle" - SWEP.Slot = 3 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.HUD3DBone = "v_weapon.scout_Parent" @@ -23,9 +26,9 @@ SWEP.UseHands = true SWEP.ReloadSound = Sound("Weapon_Scout.ClipOut") SWEP.Primary.Sound = Sound("Weapon_Scout.Single") -SWEP.Primary.Damage = 50 +SWEP.Primary.Damage = 55 SWEP.Primary.NumShots = 1 -SWEP.Primary.Delay = 1.5 +SWEP.Primary.Delay = 1.25 SWEP.ReloadDelay = SWEP.Primary.Delay SWEP.Primary.ClipSize = 5 @@ -36,7 +39,7 @@ SWEP.Primary.DefaultClip = 25 SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN -SWEP.ConeMax = 0.075 +SWEP.ConeMax = 3.75 SWEP.ConeMin = 0 SWEP.IronSightsPos = Vector(5.015, -8, 2.52) @@ -44,6 +47,15 @@ SWEP.IronSightsAng = Vector(0, 0, 0) SWEP.WalkSpeed = SPEED_SLOW +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Prodder' Rifle", "Slightly more headshot damage and zoom, half clip and increased fire delay", function(wept) + wept.HeadshotMulti = 2.2 + wept.Primary.ClipSize = math.ceil(wept.Primary.ClipSize / 2) + wept.Primary.Delay = wept.Primary.Delay * 1.7 + + wept.IronsightsMultiplier = 0.15 +end) + function SWEP:IsScoped() return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() end @@ -56,32 +68,20 @@ if CLIENT then SWEP.IronsightsMultiplier = 0.25 function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then return pos + ang:Up() * 256, ang end - return self.BaseClass.GetViewModelPosition(self, pos, ang) + return BaseClass.GetViewModelPosition(self, pos, ang) end - local matScope = Material("zombiesurvival/scope") function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if self:IsScoped() then - local scrw, scrh = ScrW(), ScrH() - local size = math.min(scrw, scrh) - surface.SetMaterial(matScope) - surface.SetDrawColor(255, 255, 255, 255) - surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size) - surface.SetDrawColor(0, 0, 0, 255) - if scrw > size then - local extra = (scrw - size) * 0.5 - surface.DrawRect(0, 0, extra, scrh) - surface.DrawRect(scrw - extra, 0, extra, scrh) - end - if scrh > size then - local extra = (scrh - size) * 0.5 - surface.DrawRect(0, 0, scrw, extra) - surface.DrawRect(0, scrh - extra, scrw, extra) - end + self:DrawRegularScope() end end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stunbaton.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stunbaton.lua index ea01110..3d6112d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stunbaton.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_stunbaton.lua @@ -1,11 +1,10 @@ AddCSLuaFile() +SWEP.PrintName = "Stun Baton" +SWEP.Description = "This baton has the ability to slow zombies with pulse slowing technology and it gains +25% extra points." + if CLIENT then - SWEP.PrintName = "Stun Baton" - SWEP.ViewModelFOV = 50 - - SWEP.Description = "Although weak compared to the other weapons, this baton\nhas the ability to slow zombies with an electric shock." end SWEP.Base = "weapon_zs_basemelee" @@ -16,8 +15,8 @@ SWEP.UseHands = true SWEP.HoldType = "melee" -SWEP.MeleeDamage = 27 -SWEP.StunDamage = 20 +SWEP.MeleeDamage = 32 +SWEP.LegDamage = 20 SWEP.MeleeRange = 49 SWEP.MeleeSize = 1.5 SWEP.Primary.Delay = 0.9 @@ -27,6 +26,13 @@ SWEP.SwingRotation = Angle(60, 0, 0) SWEP.SwingOffset = Vector(0, -50, 0) SWEP.SwingHoldType = "grenade" +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.09) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_LEG_DAMAGE, 2) + function SWEP:PlaySwingSound() self:EmitSound("Weapon_StunStick.Swing") end @@ -41,6 +47,6 @@ end function SWEP:OnMeleeHit(hitent, hitflesh, tr) if hitent:IsValid() and hitent:IsPlayer() then - hitent:AddLegDamage(self.StunDamage) + hitent:AddLegDamageExt(self.LegDamage, self:GetOwner(), self, SLOWTYPE_PULSE) end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_superzombie.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_superzombie.lua index d07c6e0..8f29436 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_superzombie.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_superzombie.lua @@ -2,6 +2,8 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Super Zombie" + SWEP.MeleeDamage = 45 function SWEP:Reload() @@ -23,9 +25,9 @@ function SWEP:Move(mv) mv:SetMaxSpeed(0) mv:SetMaxClientSpeed(0) - local owner = self.Owner + local owner = self:GetOwner() local tr = self:GetClimbSurface() - local angs = self.Owner:SyncAngles() + local angs = mv:GetAngles() --owner:SyncAngles() local dir = tr and tr.Hit and (tr.HitNormal.z <= -0.5 and (angs:Forward() * -1) or math.abs(tr.HitNormal.z) < 0.75 and tr.HitNormal:Angle():Up()) or Vector(0, 0, 1) local vel = Vector(0, 0, 4) @@ -53,15 +55,14 @@ end SWEP.NextClimbSound = 0 function SWEP:Think() - local curtime = CurTime() - local owner = self.Owner + local owner = self:GetOwner() if self:GetClimbing() then if self:GetClimbSurface() and owner:KeyDown(IN_ATTACK2) then if SERVER and CurTime() >= self.NextClimbSound then - local speed = owner:GetVelocity():Length() - if speed >= 16 then - if speed >= 50 then + local speed = owner:GetVelocity():LengthSqr() + if speed >= 256 then + if speed >= 2500 then self.NextClimbSound = CurTime() + 0.75 else self.NextClimbSound = CurTime() + 1 @@ -95,7 +96,7 @@ end local climbtrace = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-5, -5, -5), maxs = Vector(5, 5, 5)} function SWEP:GetClimbSurface() - local owner = self.Owner + local owner = self:GetOwner() local fwd = owner:SyncAngles():Forward() local up = owner:GetUp() @@ -125,7 +126,7 @@ end function SWEP:SecondaryAttack() if self:IsClimbing() then return end - if not self.Owner:IsOnGround() and self.Owner:GetVelocity():Length() < 200 and self:GetClimbSurface() then + if not GAMEMODE.ZombieEscape and not self:GetOwner():IsOnGround() and self:GetOwner():GetVelocity():LengthSqr() < 40000 and self:GetClimbSurface() then self:StartClimbing() else self.BaseClass.SecondaryAttack(self) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sweepershotgun.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sweepershotgun.lua index 6951c27..8851435 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sweepershotgun.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_sweepershotgun.lua @@ -1,10 +1,11 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Sweeper' Shotgun" - SWEP.Slot = 3 - SWEP.SlotPos = 0 +SWEP.Base = "weapon_zs_baseshotgun" +SWEP.PrintName = "'Sweeper' Shotgun" +SWEP.Description = "A pump shotgun with a modest shell number and packs a hefty punch." + +if CLIENT then SWEP.ViewModelFlip = false SWEP.HUD3DBone = "v_weapon.M3_PARENT" @@ -13,7 +14,7 @@ if CLIENT then SWEP.HUD3DScale = 0.015 end -SWEP.Base = "weapon_zs_base" +SWEP.Base = "weapon_zs_baseshotgun" SWEP.HoldType = "shotgun" @@ -21,88 +22,25 @@ SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" SWEP.UseHands = true -SWEP.ReloadDelay = 0.4 +SWEP.ReloadDelay = 0.45 SWEP.Primary.Sound = Sound("Weapon_M3.Single") -SWEP.Primary.Damage = 28 -SWEP.Primary.NumShots = 6 -SWEP.Primary.Delay = 1 +SWEP.Primary.Damage = 14.75 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Delay = 0.87 SWEP.Primary.ClipSize = 6 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "buckshot" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.14 -SWEP.ConeMin = 0.105 +SWEP.ConeMax = 5 +SWEP.ConeMin = 3.75 +SWEP.FireAnimSpeed = 1.2 SWEP.WalkSpeed = SPEED_SLOWER -SWEP.reloadtimer = 0 -SWEP.nextreloadfinish = 0 +SWEP.Tier = 4 +SWEP.MaxStock = 3 -function SWEP:Reload() - if self.reloading then return end - - if self:Clip1() < self.Primary.ClipSize and 0 < self.Owner:GetAmmoCount(self.Primary.Ammo) then - self:SetNextPrimaryFire(CurTime() + self.ReloadDelay) - self.reloading = true - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) - self.Owner:RestartGesture(ACT_HL2MP_GESTURE_RELOAD_SHOTGUN) - end - - self:SetIronsights(false) -end - -function SWEP:Think() - if self.reloading and self.reloadtimer < CurTime() then - self.reloadtimer = CurTime() + self.ReloadDelay - self:SendWeaponAnim(ACT_VM_RELOAD) - - self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) - self:SetClip1(self:Clip1() + 1) - - if self.Primary.ClipSize <= self:Clip1() or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 then - self.nextreloadfinish = CurTime() + self.ReloadDelay - self.reloading = false - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) - end - end - - local nextreloadfinish = self.nextreloadfinish - if nextreloadfinish ~= 0 and nextreloadfinish < CurTime() then - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - self.nextreloadfinish = 0 - end - - if self:GetIronsights() and not self.Owner:KeyDown(IN_ATTACK2) then - self:SetIronsights(false) - end -end - -function SWEP:CanPrimaryAttack() - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:Clip1() <= 0 then - self:EmitSound("Weapon_Shotgun.Empty") - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - if self.reloading then - if 0 < self:Clip1() then - self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) - else - self:SendWeaponAnim(ACT_VM_IDLE) - end - self.reloading = false - self:SetNextPrimaryFire(CurTime() + 0.25) - return false - end - - return true -end - -function SWEP:SecondaryAttack() -end +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_swissarmyknife.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_swissarmyknife.lua index 7cf6c16..34361a0 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_swissarmyknife.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_swissarmyknife.lua @@ -1,9 +1,9 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Knife" - SWEP.Description = "Deals double damage to the back." +SWEP.PrintName = "Knife" +SWEP.Description = "A small bladed weapon that deals double damage to the back." +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 end @@ -34,6 +34,10 @@ SWEP.MissAnim = ACT_VM_PRIMARYATTACK SWEP.NoHitSoundFlesh = true +SWEP.AllowQualityWeapons = true + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.085) + function SWEP:PlaySwingSound() self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav") end @@ -47,7 +51,7 @@ function SWEP:PlayHitFleshSound() end function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if hitent:IsValid() and hitent:IsPlayer() and not self.m_BackStabbing and math.abs(hitent:GetForward():Angle().yaw - self.Owner:GetForward():Angle().yaw) <= 90 then + if hitent:IsValid() and hitent:IsPlayer() and not self.m_BackStabbing and math.abs(hitent:GetForward():Angle().yaw - self:GetOwner():GetForward():Angle().yaw) <= 90 then self.m_BackStabbing = true self.MeleeDamage = self.MeleeDamage * 2 end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_doomorgan.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_doomorgan.lua new file mode 100644 index 0000000..b77f912 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_doomorgan.lua @@ -0,0 +1,49 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basetrinket" + +SWEP.PrintName = "Doom Organ" +SWEP.Description = "Reduces the duration of Dim Vision and allows you to cleanse harmful statuses every 20 seconds." + +if CLIENT then + SWEP.VElements = { + ["doom_organ"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Grenade_body", rel = "", pos = Vector(0, 0, -2), angle = Angle(0, 0, 0), size = Vector(0.885, 0.8, 1.08), color = Color(65, 45, 36, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["doom_organ++"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Grenade_body", rel = "doom_organ", pos = Vector(0, 0, 3.635), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 1), color = Color(45, 35, 25, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["doom_organ+++"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Grenade_body", rel = "doom_organ", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.15, 0.2, 4.193), color = Color(65, 55, 45, 255), surpresslightning = false, material = "models/flesh", skin = 0, bodygroup = {} }, + ["doom_organ+"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Grenade_body", rel = "doom_organ", pos = Vector(0, 0, -3), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 1), color = Color(45, 35, 25, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["doom_organ"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 1.5, 0.518), angle = Angle(0, 0, 0), size = Vector(0.885, 0.8, 1.08), color = Color(65, 45, 36, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["doom_organ++"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "doom_organ", pos = Vector(0, 0, 3.635), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 1), color = Color(45, 35, 25, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["doom_organ+++"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "doom_organ", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.15, 0.2, 4.193), color = Color(65, 55, 45, 255), surpresslightning = false, material = "models/flesh", skin = 0, bodygroup = {} }, + ["doom_organ+"] = { type = "Model", model = "models/weapons/w_bugbait.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "doom_organ", pos = Vector(0, 0, -3), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 1), color = Color(45, 35, 25, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false +end + +SWEP.Primary.Automatic = false +SWEP.Primary.Delay = 1 + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + local owner = self:GetOwner() + if SERVER and not owner.LastDoomOrganCleanse or (owner.LastDoomOrganCleanse and owner.LastDoomOrganCleanse + 20 < CurTime()) then + owner.LastDoomOrganCleanse = CurTime() + owner:EmitSound("weapons/bugbait/bugbait_squeeze3.wav", 70, 70) + owner:EmitSound("physics/flesh/flesh_squishy_impact_hard3.wav", 65, 135, 1, CHAN_AUTO) + + owner:SendLua("util.WhiteOut(0.25)") + + local statuses = {"enfeeble", "slow", "dimvision", "frost"} + for _, status in pairs(statuses) do + if owner:GetStatus(status) then + owner:RemoveStatus(status) + end + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_electromagnet.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_electromagnet.lua new file mode 100644 index 0000000..dea59de --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_electromagnet.lua @@ -0,0 +1,4 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_t_magnet" +SWEP.PrintName = "Electromagnet" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_extinctionorgan.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_extinctionorgan.lua new file mode 100644 index 0000000..61ac0d3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_extinctionorgan.lua @@ -0,0 +1,6 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_t_doomorgan" + +SWEP.PrintName = "Extinction Organ" +SWEP.Description = "Increases healing received and allows you to cleanse harmful statuses every 20 seconds." diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_magnet.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_magnet.lua new file mode 100644 index 0000000..d8bdf9b --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_magnet.lua @@ -0,0 +1,19 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basetrinket" + +SWEP.PrintName = "Magnet" + +if CLIENT then + SWEP.VElements = { + ["perf"] = { type = "Model", model = "models/props_lab/reciever01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.299, 2.5, -2), angle = Angle(5, 180, 92.337), size = Vector(0.2, 0.699, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["perf"] = { type = "Model", model = "models/props_lab/reciever01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 1.5, -2), angle = Angle(5, 180, 92.337), size = Vector(0.2, 0.699, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false +end + +SWEP.IsMagnet = true diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_nightvision.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_nightvision.lua new file mode 100644 index 0000000..ff3c2a2 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_nightvision.lua @@ -0,0 +1,31 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basetrinket" + +SWEP.PrintName = "Night Vision Goggles" +SWEP.Description = "Allows you to see in the dark and reduce the intensity of dim vision." + +if CLIENT then + SWEP.VElements = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 1.557, -2.597), angle = Angle(5.843, 90, 0), size = Vector(0.25, 0.15, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 0.5, -2), angle = Angle(5, 90, 0), size = Vector(0.25, 0.15, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false +end + +SWEP.Primary.Automatic = false +SWEP.Primary.Delay = 1 + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + if CLIENT and IsFirstTimePredicted() then + surface.PlaySound(GAMEMODE.m_NightVision and "items/nvg_off.wav" or "items/nvg_on.wav") + GAMEMODE.m_NightVision = not GAMEMODE.m_NightVision + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_oxygentank.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_oxygentank.lua new file mode 100644 index 0000000..63afff4 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_oxygentank.lua @@ -0,0 +1,24 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basetrinket" +SWEP.ModelScale = 0.5 + +SWEP.PrintName = "Oxygen Tank" +SWEP.Description = "Grants significantly more underwater breathing time to the user." + +SWEP.WorldModel = "models/props_c17/canister01a.mdl" + +if CLIENT then + SWEP.ViewModelFOV = 60 + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 3, -1), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 3, -1), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } +end + +SWEP.TrinketStatus = "status_oxygentank" diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_resupplypack.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_resupplypack.lua new file mode 100644 index 0000000..1764cd6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_t_resupplypack.lua @@ -0,0 +1,35 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_basetrinket" + +SWEP.PrintName = "Resupply Pack" +SWEP.Description = "Allows humans to resupply from you.\nPress LMB with the pack in your hand to resupply yourself." + +if CLIENT then + SWEP.VElements = { + ["base"] = { type = "Model", model = "models/Items/ammocrate_ar2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.35, 0.35, 0.35), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + SWEP.WElements = { + ["base"] = { type = "Model", model = "models/Items/ammocrate_ar2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.35, 0.35, 0.35), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + } + + SWEP.ShowViewModel = false + SWEP.ShowWorldModel = false +end + +SWEP.Primary.Automatic = false +SWEP.Primary.Delay = 1 + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + if CLIENT then return end + + local owner = self:GetOwner() + for _, ent in pairs(ents.FindByClass("status_resupplypack")) do + if ent:GetOwner() == owner then + owner:Resupply(owner, ent) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tempest.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tempest.lua new file mode 100644 index 0000000..1b1d000 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tempest.lua @@ -0,0 +1,155 @@ +AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Tempest' Burst Pistol" +SWEP.Description = "Fires in bursts and uses ammunition extremely quickly." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + +if CLIENT then + SWEP.ViewModelFOV = 60 + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.FIVESEVEN_PARENT" + SWEP.HUD3DPos = Vector(-1, -2.5, -1) + SWEP.HUD3DAng = Angle(0, 0, 0) + + SWEP.VElements = { + ["top2"] = { type = "Model", model = "models/combine_turrets/ground_turret.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top+", pos = Vector(0.1, 0, 1.5), angle = Angle(-90, 0, 0), size = Vector(0.2, 0.079, 0.1), color = Color(208, 229, 255, 255), surpresslightning = false, material = "models/weapons/v_models/pist_fiveseven/pist_fiveseven", skin = 0, bodygroup = {} }, + ["bottom"] = { type = "Model", model = "models/props_combine/combinethumper001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "top+", pos = Vector(0.699, 0, -2), angle = Angle(0, 90, 0), size = Vector(0.009, 0.014, 0.019), color = Color(171, 191, 204, 255), surpresslightning = false, material = "models/weapons/v_models/pist_fiveseven/pist_fiveseven", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "v_weapon.FIVESEVEN_SLIDE", rel = "", pos = Vector(0, 7.989, -0.28), angle = Angle(-90, 90, 0), size = Vector(0.029, 0.028, 0.104), color = Color(49, 55, 62, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["top+"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "", pos = Vector(0, -2, -9.429), angle = Angle(0, -90, 0), size = Vector(0.025, 0.035, 0.108), color = Color(49, 52, 55, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} } + } + + SWEP.WElements = { + ["top2"] = { type = "Model", model = "models/combine_turrets/ground_turret.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top+", pos = Vector(0.1, 0, 1.5), angle = Angle(-90, 0, 0), size = Vector(0.2, 0.079, 0.1), color = Color(208, 229, 255, 255), surpresslightning = false, material = "models/weapons/v_models/pist_fiveseven/pist_fiveseven", skin = 0, bodygroup = {} }, + ["bottom"] = { type = "Model", model = "models/props_combine/combinethumper001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top+", pos = Vector(0.699, 0, -2), angle = Angle(0, 90, 0), size = Vector(0.009, 0.014, 0.019), color = Color(171, 191, 204, 255), surpresslightning = false, material = "models/weapons/v_models/pist_fiveseven/pist_fiveseven", skin = 0, bodygroup = {} }, + ["top+"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10.5, 2.2, -2.5), angle = Angle(90, 174, 180), size = Vector(0.025, 0.035, 0.108), color = Color(49, 52, 55, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} }, + ["top"] = { type = "Model", model = "models/props_lab/hev_case.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "top+", pos = Vector(-2, 0, -0.101), angle = Angle(180, 0, 180), size = Vector(0.029, 0.028, 0.104), color = Color(49, 55, 62, 255), surpresslightning = false, material = "phoenix_storms/concrete2", skin = 0, bodygroup = {} } + } +end + +SWEP.Base = "weapon_zs_base" + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_fiveseven.mdl" +SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl" +SWEP.UseHands = true + +SWEP.Primary.Sound = Sound("weapons/ar2/npc_ar2_altfire.wav") +SWEP.Primary.Damage = 37 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.41 +SWEP.Primary.BurstShots = 3 + +SWEP.Primary.ClipSize = 21 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "pistol" +GAMEMODE:SetupDefaultClip(SWEP.Primary) + +SWEP.ConeMax = 3.6 +SWEP.ConeMin = 1.8 + +SWEP.Tier = 3 +SWEP.FireAnimSpeed = 1.5 + +SWEP.ReloadSpeed = 1.05 + +SWEP.IronSightsPos = Vector(-5.95, 0, 2.5) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.37, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.25, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.03, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Tempest' Automatic Pistol", "Makes the pistol fully automatic at the cost of damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.9 + wept.Primary.Delay = wept.Primary.Delay * 0.375 + wept.PrimaryAttack = function(self, ent) BaseClass.PrimaryAttack(self) end +end) +local branch = GAMEMODE:AddNewRemantleBranch(SWEP, 2, "'Cosmos' Pulse Blaster", "Turns the Tempest in a burst pulse ammo blaster", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.55 + wept.Primary.Delay = wept.Primary.Delay * 1.5 + wept.ConeMin = wept.ConeMin * 0.75 + + wept.MaxDistance = 512 + wept.TracerName = "tracer_cosmos" + wept.Primary.Ammo = "pulse" + + wept.EmitFireSound = function(self) + self:EmitSound("weapons/stunstick/alyx_stunner2.wav", 70, 155, 0.65, CHAN_AUTO) + self:EmitSound("weapons/stunstick/alyx_stunner2.wav", 70, 157, 0.65, CHAN_WEAPON + 20) + end + + wept.EmitReloadFinishSound = function(self) + if IsFirstTimePredicted() then + self:EmitSound("items/battery_pickup.wav", 70, 156, 0.85, CHAN_AUTO) + end + end + + wept.VElements = { + ["lucasarts+"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "", pos = Vector(0, -2, -5), angle = Angle(0, 90, 0), size = Vector(0.449, 0.899, 1.08), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["lucasarts++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "lucasarts+", pos = Vector(0.5, 0, 1.899), angle = Angle(0, 0, 90), size = Vector(0.079, 0.37, 0.2), color = Color(112, 125, 133, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["lucasarts+++"] = { type = "Model", model = "models/items/car_battery01.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "lucasarts+", pos = Vector(1, 0, 2), angle = Angle(0, 90, 90), size = Vector(0.109, 0.5, 0.119), color = Color(204, 255, 255, 255), surpresslightning = false, material = "models/props_building_details/courtyard_template001c_bars_dark", skin = 0, bodygroup = {} }, + ["lucasarts++++"] = { type = "Model", model = "models/items/grenadeammo.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "lucasarts+", pos = Vector(1, 0, -7), angle = Angle(0, 90, 0), size = Vector(0.4, 0.4, 1.2), color = Color(92, 110, 135, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["lucasarts"] = { type = "Model", model = "models/props_pipes/valve001.mdl", bone = "v_weapon.FIVESEVEN_PARENT", rel = "lucasarts+", pos = Vector(-2, 0, -2), angle = Angle(0, 90, 0), size = Vector(0.1, 0.2, 0.05), color = Color(90, 102, 123, 255), surpresslightning = false, material = "models/props_interiors/radiator01c", skin = 0, bodygroup = {} } + } + + wept.WElements = { + ["lucasarts+"] = { type = "Model", model = "models/items/combine_rifle_cartridge01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 1.5, -3), angle = Angle(-90, -5, 180), size = Vector(0.449, 0.899, 1.08), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["lucasarts++"] = { type = "Model", model = "models/props_lab/reciever01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lucasarts+", pos = Vector(0.5, 0, 1.899), angle = Angle(0, 0, 90), size = Vector(0.079, 0.37, 0.2), color = Color(112, 125, 133, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["lucasarts+++"] = { type = "Model", model = "models/items/car_battery01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lucasarts+", pos = Vector(1, 0, 2), angle = Angle(0, 90, 90), size = Vector(0.109, 0.5, 0.119), color = Color(204, 255, 255, 255), surpresslightning = false, material = "models/props_building_details/courtyard_template001c_bars_dark", skin = 0, bodygroup = {} }, + ["lucasarts++++"] = { type = "Model", model = "models/items/grenadeammo.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lucasarts+", pos = Vector(1, 0, -7), angle = Angle(0, 90, 0), size = Vector(0.4, 0.4, 1.2), color = Color(92, 110, 135, 255), surpresslightning = false, material = "models/props_lab/ravendoor_sheet", skin = 0, bodygroup = {} }, + ["lucasarts"] = { type = "Model", model = "models/props_pipes/valve001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lucasarts+", pos = Vector(-2, 0, -2), angle = Angle(0, 90, 0), size = Vector(0.1, 0.2, 0.05), color = Color(90, 102, 123, 255), surpresslightning = false, material = "models/props_interiors/radiator01c", skin = 0, bodygroup = {} } + } +end) +branch.Colors = {Color(100, 130, 180), Color(90, 120, 170), Color(70, 100, 160)} +branch.NewNames = {"Jovial", "Orbital", "Celestial"} +branch.Killicon = "weapon_zs_cosmos" + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() +end + +function SWEP:Think() + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/6) + + if self:Clip1() > 0 and self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end +end + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ticklemonster.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ticklemonster.lua index a4d5ad0..5022b18 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ticklemonster.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_ticklemonster.lua @@ -1,26 +1,33 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "The Tickle Monster" -end +SWEP.PrintName = "The Tickle Monster" SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDamage = 22 -SWEP.MeleeReach = 160 +SWEP.MeleeDamage = 24 +SWEP.MeleeDamageVsProps = 28 +SWEP.MeleeReach = 150 SWEP.MeleeSize = 5 function SWEP:Reload() self:SecondaryAttack() end +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = self.MeleeDamageVsProps + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") + self:GetOwner():EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") end SWEP.PlayIdleSound = SWEP.PlayAlertSound function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/barnacle/barnacle_bark"..math.random(2)..".wav") + self:EmitSound("npc/barnacle/barnacle_bark"..math.random(2)..".wav") end if not CLIENT then return end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/cl_init.lua new file mode 100644 index 0000000..7f2316e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/cl_init.lua @@ -0,0 +1,37 @@ +INC_CLIENT() + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.HUD3DBone = "ValveBiped.Gun" +SWEP.HUD3DPos = Vector(2.12, -1, -8) +SWEP.HUD3DScale = 0.025 + +SWEP.VElements = { + ["tithonus_parts+++"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "ValveBiped.Gun", rel = "tithonus_parts", pos = Vector(-4, 0, -10), angle = Angle(0, -90, 90), size = Vector(0.029, 0.039, 0.039), color = Color(59, 92, 161, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts+"] = { type = "Model", model = "models/props_combine/combine_emitter01.mdl", bone = "ValveBiped.Gun", rel = "tithonus_parts", pos = Vector(-5, 0, -10.91), angle = Angle(-90, 0, 0), size = Vector(0.8, 0.2, 0.367), color = Color(67, 94, 127, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts"] = { type = "Model", model = "models/props_combine/combine_dispenser.mdl", bone = "ValveBiped.Gun", rel = "", pos = Vector(0, 0, -2.799), angle = Angle(0, 90, 180), size = Vector(0.15, 0.14, 0.3), color = Color(36, 85, 123, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts++"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Gun", rel = "tithonus_parts", pos = Vector(-1, -1, -8.832), angle = Angle(-180, 0, 0), size = Vector(0.4, 0.219, 1.014), color = Color(72, 87, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["tithonus_parts++"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "tithonus_parts", pos = Vector(-1, -1, -8.832), angle = Angle(-180, 0, 0), size = Vector(0.4, 0.219, 1.014), color = Color(72, 87, 130, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts+"] = { type = "Model", model = "models/props_combine/combine_emitter01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "tithonus_parts", pos = Vector(-5, 0, -10.91), angle = Angle(-90, 0, 0), size = Vector(0.8, 0.2, 0.367), color = Color(67, 94, 127, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts"] = { type = "Model", model = "models/props_combine/combine_dispenser.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.5, 1, -6.753), angle = Angle(-92.338, 180, 0), size = Vector(0.15, 0.14, 0.3), color = Color(36, 85, 123, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["tithonus_parts+++"] = { type = "Model", model = "models/props_combine/combine_train02b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "tithonus_parts", pos = Vector(-4, 0, -10), angle = Angle(0, -90, 90), size = Vector(0.029, 0.039, 0.039), color = Color(59, 92, 161, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +function SWEP:Think() + if self:GetReloadFinish() > 0 then + if CurTime() >= self:GetReloadFinish() then + self:FinishReload() + end + + return + end + + self:CheckCharge() +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/init.lua new file mode 100644 index 0000000..4baa1e0 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/init.lua @@ -0,0 +1,17 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_tithonus" +SWEP.Primary.ProjVelocity = 1100 + +function SWEP:Think() + self:CheckCharge() + + if self:GetReloadFinish() > 0 then + if CurTime() >= self:GetReloadFinish() then + self:FinishReload() + end + elseif self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/shared.lua new file mode 100644 index 0000000..42d61ac --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tithonus/shared.lua @@ -0,0 +1,155 @@ +DEFINE_BASECLASS("weapon_zs_baseproj") + +SWEP.PrintName = "'Tithonus' Charged Shotgun" +SWEP.Description = "Charges a up shotgun blast of pulse projectiles." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "shotgun" + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("Weapon_357.Single") +SWEP.Primary.Damage = 17.5 +SWEP.Primary.NumShots = 4 +SWEP.Primary.Delay = 0.85 + +SWEP.Primary.ClipSize = 18 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pulse" +SWEP.Primary.DefaultClip = 18 + +SWEP.RequiredClip = 3 + +SWEP.ConeMax = 5.5 +SWEP.ConeMin = 4.25 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.IronSightsPos = Vector(-4.65, 4, 0.25) +SWEP.IronSightsAng = Vector(0, 0, 1) + +SWEP.Tier = 4 + +SWEP.ReloadSpeed = 0.2 +SWEP.FireAnimSpeed = 0.35 +SWEP.MaxCharge = 3 +SWEP.ChargeTime = 0.6 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.02) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Triton' Charged Shotgun", "Focuses on firing quickly charged blasts, but reloads slower and has limited range", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.3 + wept.Primary.ProjVelocity = 1000 + wept.Primary.NumShots = 3 + wept.Primary.ClipSize = 15 + wept.MaxCharge = 5 + wept.ChargeTime = 0.4 + wept.ReloadSpeed = wept.ReloadSpeed * 0.8 + wept.Primary.Projectile = "projectile_drone_pulse" +end) + +function SWEP:Initialize() + BaseClass.Initialize(self) + + self.ChargeSound = CreateSound(self, "ambient/levels/citadel/extract_loop1.wav") +end + +function SWEP:CanPrimaryAttack() + if self:GetCharging() or self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() or self:GetReloadFinish() > 0 then return false end + + if self:Clip1() < self.RequiredClip then + self:EmitSound(self.DryFireSound) + self:SetNextPrimaryFire(CurTime() + math.max(0.25, self.Primary.Delay)) + return false + end + + return self:GetNextPrimaryFire() <= CurTime() +end + +function SWEP:SecondaryAttack() + if not self:CanPrimaryAttack() or self:GetCharging() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:SetGunCharge(1) + self:SetLastChargeTime(CurTime()) + self:TakeAmmo() + self:SetCharging(true) +end + +function SWEP:CheckCharge() + if self:GetCharging() then + if not self:GetOwner():KeyDown(IN_ATTACK2) then + self:EmitFireSound() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots * self:GetGunCharge(), self:GetCone()) + self.IdleAnimation = CurTime() + self:SequenceDuration() + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:SetCharging(false) + self:SetLastChargeTime(CurTime()) + self:SetGunCharge(0) + elseif self:GetGunCharge() < self.MaxCharge and self:Clip1() ~= 0 and self:GetLastChargeTime() + self.ChargeTime < CurTime() then + self:SetGunCharge(self:GetGunCharge() + 1) + self:SetLastChargeTime(CurTime()) + self:TakeAmmo() + end + + self.ChargeSound:PlayEx(1, math.min(255, 165 + self:GetGunCharge() * 18)) + else + self.ChargeSound:Stop() + end +end + +function SWEP:SetLastChargeTime(lct) + self:SetDTFloat(8, lct) +end + +function SWEP:GetLastChargeTime() + return self:GetDTFloat(8) +end + +function SWEP:SetGunCharge(charge) + self:SetDTInt(1, charge) +end + +function SWEP:GetGunCharge(charge) + return self:GetDTInt(1) +end + +function SWEP:SetCharging(charge) + self:SetDTBool(1, charge) +end + +function SWEP:GetCharging() + return self:GetDTBool(1) +end + +function SWEP:EmitFireSound() + local deduct = (self:GetGunCharge() - 1) * 15 + + self:EmitSound("weapons/stunstick/alyx_stunner2.wav", 72, 111 - deduct, 0.75) + --self:EmitSound("weapons/physcannon/superphys_launch1.wav", 72, 141 - deduct, 0.65, CHAN_AUTO) + self:EmitSound("weapons/zs_inner/innershot.ogg", 72, 151 - deduct, 0.65, CHAN_AUTO) +end + +function SWEP:SendReloadAnimation() + self:SendWeaponAnim(ACT_SHOTGUN_PUMP) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/physcannon/physcannon_charge.wav", 70, 95, 0.65, CHAN_WEAPON + 21) + self:EmitSound("items/battery_pickup.wav", 70, 57, 0.85, CHAN_WEAPON + 22) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/ump45/ump45_boltslap.wav", 70, 72) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/shared.lua new file mode 100644 index 0000000..2cb2f7f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tormentedwraith/shared.lua @@ -0,0 +1,101 @@ +SWEP.Base = "weapon_zs_wraith" +DEFINE_BASECLASS("weapon_zs_wraith") + +SWEP.PrintName = "Tormented Wraith" + +SWEP.MeleeDelay = 0.4 +SWEP.MeleeReach = 48 +SWEP.MeleeSize = 4.5 +SWEP.MeleeDamage = 20 +SWEP.MeleeDamageType = DMG_SLASH +SWEP.MeleeAnimationDelay = 0 + +SWEP.Secondary.Delay = 0.88 + +SWEP.ViewModel = Model("models/weapons/v_pza.mdl") +SWEP.WorldModel = "" + +AccessorFuncDT(SWEP, "Tormented", "Float", 1) + +function SWEP:PrimaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() then return end + + local armdelay = owner:GetMeleeSpeedMul() * ((CurTime() < self:GetTormented() + 2) and 0.75 or 1) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * armdelay) + + self.MeleeDelay = 0.8 + self.MeleeDamage = 43 + self:StartSwinging() +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() then return end + + local armdelay = owner:GetMeleeSpeedMul() * ((CurTime() < self:GetTormented() + 2) and 0.75 or 1) + self:SetNextPrimaryFire(CurTime() + self.Secondary.Delay * armdelay) + + self.MeleeDelay = 0.4 + self.MeleeDamage = 21 + self:StartSwinging(true) +end + +function SWEP:StartSwinging(secondary) + if not IsFirstTimePredicted() then return end + + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + + self.MeleeAnimationMul = 1 / armdelay + if self.MeleeAnimationDelay then + self.NextAttackAnim = CurTime() + self.MeleeAnimationDelay * armdelay + else + self:SendAttackAnim() + end + + if not secondary then + self:DoSwingEvent() + else + owner:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE) + end + + self:PlayAttackSound(secondary) + + self:StopMoaning() + + if self.FrozenWhileSwinging then + self:GetOwner():SetSpeed(1) + end + + if self.MeleeDelay > 0 then + self:SetSwingEndTime(CurTime() + self.MeleeDelay * armdelay) + + local trace = owner:CompensatedMeleeTrace(self.MeleeReach, self.MeleeSize) + if trace.HitNonWorld and not trace.Entity:IsPlayer() then + trace.IsPreHit = true + self.PreHit = trace + end + + self.IdleAnimation = CurTime() + (self:SequenceDuration() + (self.MeleeAnimationDelay or 0)) * armdelay + else + self:Swung() + end +end + +function SWEP:PlayAttackSound(secondary) + if secondary then + self:EmitSound("npc/fast_zombie/wake1.wav", 75, 125, 0.75) + self:EmitSound("npc/antlion/attack_single2.wav", 75, 215, 0.75, CHAN_AUTO) + else + BaseClass.PlayAttackSound(self) + end +end + +function SWEP:PlayHitSound() + if self.MeleeDamage > 20 then + self:EmitSound("ambient/machines/slicer"..math.random(4)..".wav", 75, 80, nil, CHAN_AUTO) + else + self:EmitSound("npc/fast_zombie/claw_strike"..math.random(3)..".wav", 70, 80, nil, CHAN_AUTO) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tosser.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tosser.lua index 710856f..87de02b 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tosser.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tosser.lua @@ -1,10 +1,13 @@ AddCSLuaFile() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.PrintName = "'Tosser' SMG" +SWEP.Description = "A relatively simple SMG with a decent fire rate and reload speed." + +SWEP.Slot = 2 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Tosser' SMG" - SWEP.Slot = 2 - SWEP.SlotPos = 0 - SWEP.HUD3DBone = "ValveBiped.base" SWEP.HUD3DPos = Vector(1.5, 0.25, -2) SWEP.HUD3DScale = 0.02 @@ -25,11 +28,11 @@ SWEP.CSMuzzleFlashes = false SWEP.ReloadSound = Sound("Weapon_SMG1.Reload") SWEP.Primary.Sound = Sound("Weapon_AR2.NPC_Single") -SWEP.Primary.Damage = 15 +SWEP.Primary.Damage = 14 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.15 -SWEP.Primary.ClipSize = 25 +SWEP.Primary.ClipSize = 24 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" GAMEMODE:SetupDefaultClip(SWEP.Primary) @@ -37,10 +40,65 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 -SWEP.ConeMax = 0.055 -SWEP.ConeMin = 0.029 +SWEP.ReloadSpeed = 0.78 +SWEP.FireAnimSpeed = 0.55 -SWEP.WalkSpeed = SPEED_NORMAL +SWEP.ConeMax = 4.5 +SWEP.ConeMin = 2.5 ---SWEP.IronSightsPos = Vector(-6.42, 4, 2.53) SWEP.IronSightsPos = Vector(-6.425, 5, 1.02) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.015) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Thrower' Burst SMG", "Increased damage but makes the tosser burst fire", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 1.1 + wept.Primary.Delay = wept.Primary.Delay * 3.9 + wept.Primary.BurstShots = 3 + + wept.PrimaryAttack = function(self) + if not self:CanPrimaryAttack() then return end + + self:SetNextPrimaryFire(CurTime() + self:GetFireDelay()) + self:EmitFireSound() + + self:SetNextShot(CurTime()) + self:SetShotsLeft(self.Primary.BurstShots) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + end + + wept.Think = function(self) + BaseClass.Think(self) + + local shotsleft = self:GetShotsLeft() + if shotsleft > 0 and CurTime() >= self:GetNextShot() then + self:SetShotsLeft(shotsleft - 1) + self:SetNextShot(CurTime() + self:GetFireDelay()/6) + + if self:Clip1() > 0 and self:GetReloadFinish() == 0 then + self:EmitFireSound() + self:TakeAmmo() + self:ShootBullets(self.Primary.Damage, self.Primary.NumShots, self:GetCone()) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + else + self:SetShotsLeft(0) + end + end + end +end) + +function SWEP:SetNextShot(nextshot) + self:SetDTFloat(5, nextshot) +end + +function SWEP:GetNextShot() + return self:GetDTFloat(5) +end + +function SWEP:SetShotsLeft(shotsleft) + self:SetDTInt(1, shotsleft) +end + +function SWEP:GetShotsLeft() + return self:GetDTInt(1) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/cl_init.lua new file mode 100644 index 0000000..a91c969 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/cl_init.lua @@ -0,0 +1,28 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetInt() ~= 1 then return end + self:DrawCrosshairDot() +end + +function SWEP:Deploy() + self.IdleAnimation = CurTime() + self:SequenceDuration() + + return true +end + +function SWEP:DrawWorldModel() +end +SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel + +function SWEP:PrimaryAttack() +end + +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/init.lua new file mode 100644 index 0000000..fb0df8f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/init.lua @@ -0,0 +1,73 @@ +INC_SERVER() + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + + self:SpawnGhost() + + return true +end + +function SWEP:OnRemove() + self:RemoveGhost() +end + +function SWEP:Holster() + self:RemoveGhost() + return true +end + +function SWEP:SpawnGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:GiveStatus(self.GhostStatus) + end +end + +function SWEP:RemoveGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:RemoveStatus(self.GhostStatus, false, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local status = owner:GetStatus(self.GhostStatus) + if not (status and status:IsValid()) then return end + status:RecalculateValidity() + if not status:GetValidPlacement() then return end + + local pos, ang = status:RecalculateValidity() + if not pos or not ang then return end + + self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + + local ent = ents.Create(self.DeployClass) + if ent:IsValid() then + ent:SetPos(pos) + ent:SetAngles(ang) + ent.PreOwn = owner + ent:Spawn() + + ent:SetObjectOwner(owner) + + ent:EmitSound("npc/dog/dog_servo12.wav") + + self:TakePrimaryAmmo(1) + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + end + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/shared.lua new file mode 100644 index 0000000..bd56737 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_tv/shared.lua @@ -0,0 +1,85 @@ +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = Model("models/props_c17/tv_monitor01.mdl") + +SWEP.PrintName = "Camera TV" +SWEP.Description = "Allows remote observation of other areas without owning a camera viewer." + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "tv" +SWEP.Primary.Delay = 2 + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +--SWEP.MaxStock = 20 + +SWEP.WalkSpeed = SPEED_NORMAL + +SWEP.GhostStatus = "ghost_tv" +SWEP.DeployClass = "prop_tv" + +SWEP.NoDeploySpeedChange = true + +function SWEP:Initialize() + self:SetWeaponHoldType("slam") + GAMEMODE:DoChangeDeploySpeed(self) + self:HideViewAndWorldModel() +end + +function SWEP:SetReplicatedAmmo(count) + self:SetDTInt(0, count) +end + +function SWEP:GetReplicatedAmmo() + return self:GetDTInt(0) +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:Think() + if self.IdleAnimation and self.IdleAnimation <= CurTime() then + self.IdleAnimation = nil + self:SendWeaponAnim(ACT_VM_IDLE) + end + + if SERVER then + local count = self:GetPrimaryAmmoCount() + if count ~= self:GetReplicatedAmmo() then + self:SetReplicatedAmmo(count) + self:GetOwner():ResetSpeed() + end + end +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self.IdleAnimation = CurTime() + self:SequenceDuration() + + return true +end + +function SWEP:Holster() + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_uzi.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_uzi.lua index 2c5f95f..426ebe3 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_uzi.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_uzi.lua @@ -1,10 +1,12 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Sprayer' Uzi 9mm" - SWEP.Slot = 2 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Sprayer' Uzi 9mm" +SWEP.Description = "Quite inaccurate, but has good, cheap and reliable firepower potential." +SWEP.Slot = 2 +SWEP.SlotPos = 0 + +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 50 @@ -27,7 +29,7 @@ SWEP.Primary.Damage = 17 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.075 -SWEP.Primary.ClipSize = 40 +SWEP.Primary.ClipSize = 35 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" GAMEMODE:SetupDefaultClip(SWEP.Primary) @@ -35,10 +37,36 @@ GAMEMODE:SetupDefaultClip(SWEP.Primary) SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1 -SWEP.ConeMax = 0.13 -SWEP.ConeMin = 0.06 +SWEP.ConeMax = 5.5 +SWEP.ConeMin = 2.5 + +SWEP.FireAnimSpeed = 1.5 SWEP.WalkSpeed = SPEED_NORMAL +SWEP.Tier = 2 + SWEP.IronSightsPos = Vector(-7, 15, 0) SWEP.IronSightsAng = Vector(3, -3, -10) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.58, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MIN_SPREAD, -0.27, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 3, 1) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Disperser' Uzi", "Decreases the clip size but increases the fire rate, and the last few shots bounce", function(wept) + wept.Primary.ClipSize = math.floor(wept.Primary.ClipSize * 0.53) + wept.Primary.Delay = 0.06 + + local function DoRicochet(attacker, hitpos, hitnormal, normal, damage) + attacker.RicochetBullet = true + if attacker:IsValid() then + attacker:FireBulletsLua(hitpos, 2 * hitnormal * hitnormal:Dot(normal * -1) + normal, 0, 1, damage, nil, nil, "tracer_rico", nil, nil, nil, nil, nil, attacker:GetActiveWeapon()) + end + attacker.RicochetBullet = nil + end + wept.BulletCallback = function(attacker, tr, dmginfo) + if SERVER and tr.HitWorld and not tr.HitSky and attacker:GetActiveWeapon():Clip1() < 8 then + local hitpos, hitnormal, normal, dmg = tr.HitPos, tr.HitNormal, tr.Normal, dmginfo:GetDamage() * 1.5 + timer.Simple(0, function() DoRicochet(attacker, hitpos, hitnormal, normal, dmg) end) + end + end +end) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/cl_init.lua new file mode 100644 index 0000000..03d171d --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/cl_init.lua @@ -0,0 +1,12 @@ +INC_CLIENT() + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) + render.SetColorModulation(1, 1, 1) +end + +local matSheet = Material("Models/Barnacle/barnacle_sheet") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) + render.SetColorModulation(0.16, 0.3, 0.12) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/init.lua new file mode 100644 index 0000000..3b13bd1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/init.lua @@ -0,0 +1,31 @@ +INC_SERVER() + +function SWEP:Think() + self.BaseClass.Think(self) + + local pl = self:GetOwner() + + if self.PukeLeft > 0 and CurTime() >= self.NextPuke then + self.PukeLeft = self.PukeLeft - 1 + self.NextPuke = CurTime() + 0.1 + pl.LastRangedAttack = CurTime() + + local ent = ents.Create("projectile_poisonflesh") + if ent:IsValid() then + ent:SetPos(pl:EyePos()) + ent:SetOwner(pl) + ent:Spawn() + + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + local ang = pl:EyeAngles() + ang:RotateAroundAxis(ang:Forward(), math.Rand(-10, 10)) + ang:RotateAroundAxis(ang:Up(), math.Rand(-10, 10)) + phys:SetVelocityInstantaneous(ang:Forward() * 400) + end + end + end + + self:NextThink(CurTime()) + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/shared.lua new file mode 100644 index 0000000..db49e3f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_vilebloatedzombie/shared.lua @@ -0,0 +1,71 @@ +SWEP.PrintName = "Vile Bloated Zombie" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 32 +SWEP.PoisonDmgMul = 0.5 +SWEP.MeleeForceScale = 1.25 + +SWEP.Primary.Delay = 1.4 + +SWEP.NextPuke = 0 +SWEP.PukeLeft = 0 + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if ent:IsPlayer() then + ent:PoisonDamage(damage / 2, self:GetOwner(), self, trace.HitPos) + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage / 2) + else + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) + end +end + +function SWEP:Reload() + self.BaseClass.SecondaryAttack(self) +end + +function SWEP:PlayAlertSound() + self:PlayAttackSound() +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/barnacle/barnacle_tongue_pull"..math.random(3)..".wav") +end + +function SWEP:PlayAttackSound() + if SERVER then + local owner = self:GetOwner() + local sndname = "npc/ichthyosaur/attack_growl"..math.random(3)..".wav" + for i = 1, 4 do + timer.Simple(0.04 * i, + function() if owner:IsValid() then owner:EmitSound(sndname, 75, 170 + i*8, 0.4, CHAN_AUTO) end + end) + end + end +end + +function SWEP:SecondaryAttack() + local owner = self:GetOwner() + if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end + + self:SetNextSecondaryFire(CurTime() + 3.5) + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + + owner:DoReloadEvent() + self:PlayAttackSound() + self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.random(70, 83)) + + if SERVER then + timer.Simple(0.8, function() + if self:IsValid() then + self.PukeLeft = 4 + + if owner:IsValidLivingZombie() then + owner:EmitSound("npc/barnacle/barnacle_die2.wav") + owner:EmitSound("npc/barnacle/barnacle_digesting1.wav") + owner:EmitSound("npc/barnacle/barnacle_digesting2.wav") + end + end + end) + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_waraxe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_waraxe.lua index 1fa2bf6..1c90a44 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_waraxe.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_waraxe.lua @@ -1,37 +1,71 @@ AddCSLuaFile() -SWEP.Base = "weapon_zs_battleaxe" +SWEP.PrintName = "'Waraxe' Handgun" +SWEP.Slot = 1 +SWEP.SlotPos = 0 if CLIENT then - SWEP.PrintName = "'Waraxe' Handgun" + SWEP.ViewModelFOV = 50 + SWEP.ViewModelFlip = false + + SWEP.HUD3DBone = "v_weapon.Glock_Slide" + SWEP.HUD3DPos = Vector(-1.55, 0.25, 0.1) + SWEP.HUD3DAng = Angle(90, 0, 0) SWEP.VElements = { - ["base"] = { type = "Model", model = "models/props_c17/concrete_barrier001a.mdl", bone = "v_weapon.USP_Parent", rel = "", pos = Vector(-0.69, -3.5, -1.5), angle = Angle(0, 0, 90), size = Vector(0.019, 0.019, 0.019), color = Color(203, 233, 236, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+++"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "v_weapon.USP_Parent", rel = "base+", pos = Vector(-1.201, 0, -0.7), angle = Angle(90, 0, 0), size = Vector(0.129, 0.129, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+"] = { type = "Model", model = "models/props_junk/cinderblock01a.mdl", bone = "v_weapon.USP_Parent", rel = "base", pos = Vector(0.5, 3, 0), angle = Angle(0, 90, 90), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base++"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "v_weapon.USP_Parent", rel = "base+", pos = Vector(-1.201, 0, 0.699), angle = Angle(90, 0, 0), size = Vector(0.129, 0.129, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["barrel"] = { type = "Model", model = "models/props_phx/wheels/drugster_front.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, 0, -4.448), angle = Angle(180, 0, 0), size = Vector(0.019, 0.019, 0.025), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_trainstation/pole_448Connection002b.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(3.292, 0.305, -0.005), angle = Angle(13.053, -90.301, 89.9), size = Vector(0.085, 0.045, 0.02), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["sides"] = { type = "Model", model = "models/props_trainstation/Column_Arch001a.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(-0.06, 0, -0.08), angle = Angle(0, 0, 0), size = Vector(0.119, 0.013, 0.09), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } } SWEP.WElements = { - ["base"] = { type = "Model", model = "models/props_c17/concrete_barrier001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6.659, 2.4, -3.651), angle = Angle(0, 85, 0), size = Vector(0.019, 0.019, 0.019), color = Color(203, 233, 236, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+++"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base+", pos = Vector(-1.201, 0, -0.7), angle = Angle(90, 0, 0), size = Vector(0.129, 0.129, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base+"] = { type = "Model", model = "models/props_junk/cinderblock01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.5, 3, 0), angle = Angle(0, 90, 90), size = Vector(0.119, 0.119, 0.119), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, - ["base++"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base+", pos = Vector(-1.201, 0, 0.699), angle = Angle(90, 0, 0), size = Vector(0.129, 0.129, 0.059), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } + ["barrel"] = { type = "Model", model = "models/props_phx/wheels/drugster_front.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, -4.448), angle = Angle(180, 0, 0), size = Vector(0.019, 0.019, 0.025), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["base"] = { type = "Model", model = "models/props_trainstation/pole_448Connection002b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6, 1.71, -3.711), angle = Angle(87.421, -5.053, 0), size = Vector(0.085, 0.045, 0.02), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} }, + ["sides"] = { type = "Model", model = "models/props_trainstation/Column_Arch001a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-0.06, 0, -0.072), angle = Angle(0, 0, 0), size = Vector(0.119, 0.013, 0.09), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/metal_combinebridge001", skin = 0, bodygroup = {} } } end -SWEP.Primary.Damage = 14 -SWEP.Primary.NumShots = 2 -SWEP.Primary.Delay = 0.2 +SWEP.Base = "weapon_zs_base" -SWEP.Primary.ClipSize = 14 +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" +SWEP.UseHands = true + +SWEP.Primary.Damage = 14 +SWEP.Primary.NumShots = 3 +SWEP.Primary.Delay = 0.3 + +SWEP.Primary.ClipSize = 9 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" +SWEP.Primary.Sound = ")weapons/usp/usp_unsil-1.wav" GAMEMODE:SetupDefaultClip(SWEP.Primary) -SWEP.ConeMax = 0.07 -SWEP.ConeMin = 0.03 +SWEP.ConeMax = 2.75 +SWEP.ConeMin = 1.2 +SWEP.HeadshotMulti = 2 + +SWEP.Tier = 2 + +SWEP.IronSightsPos = Vector(-5.75, 10, 2.7) + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_CLIP_SIZE, 1, 1) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_HEADSHOT_MULTI, 0.07) +GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Halberd' Handgun", "Deals extra damage to zombies with full health, but less overall damage", function(wept) + wept.Primary.Damage = wept.Primary.Damage * 0.85 + + wept.BulletCallback = function(attacker, tr, dmginfo) + if SERVER then + local hitent = tr.Entity + if hitent:IsValidLivingZombie() and hitent:Health() == hitent:GetMaxHealthEx() and gamemode.Call("PlayerShouldTakeDamage", hitent, attacker) then + hitent:TakeSpecialDamage(hitent:Health() * 0.1, DMG_DIRECT, attacker, attacker:GetActiveWeapon(), tr.HitPos) + end + end + end +end) function SWEP:EmitFireSound() - self:EmitSound(self.Primary.Sound, 80, 75) + self:EmitSound(self.Primary.Sound, 80, math.random(78, 82)) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/cl_init.lua new file mode 100644 index 0000000..8c2b865 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/cl_init.lua @@ -0,0 +1,12 @@ +INC_CLIENT() + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) + render.SetColorModulation(1, 1, 1) +end + +local matSheet = Material("Models/headcrab/allinonebacup2.vtf") +function SWEP:PreDrawViewModel(vm) + render.ModelMaterialOverride(matSheet) + render.SetColorModulation(0.7, 0.9, 0.2) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/init.lua new file mode 100644 index 0000000..1d84290 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/init.lua @@ -0,0 +1,17 @@ +INC_SERVER() + +SWEP.PoisonPattern = { + {-1, 0}, + {-0.66, 0}, + {-0.33, 0}, + {0, 0}, + {0, 1}, + {0, -1}, + {0.33, 0}, + {0.66, 0}, + {1, 0}, + {-0.5, -0.5}, + {-0.5, 0.5}, + {0.5, -0.5}, + {0.5, 0.5} +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/shared.lua new file mode 100644 index 0000000..c92a92a --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wildpoisonzombie/shared.lua @@ -0,0 +1,11 @@ +DEFINE_BASECLASS("weapon_zs_poisonzombie") + +SWEP.PrintName = "Wild Poison Zombie" + +SWEP.MeleeDamage = 45 +SWEP.PoisonThrowSpeed = 420 + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie_poison/pz_warn"..math.random(2)..".wav", 74, math.random(88, 95), 0.5, CHAN_AUTO) + self:EmitSound("npc/antlion_guard/angry"..math.random(3)..".wav", 74, math.random(112, 115), 0.5, CHAN_AUTO) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/cl_init.lua index e8ea16e..55ba278 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/cl_init.lua @@ -1,28 +1,27 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Wraith" SWEP.ViewModelFOV = 47 --[[function SWEP:Holster() - if self.Owner:IsValid() and self.Owner == MySelf then - self.Owner:SetBarricadeGhosting(false) + if self:GetOwner():IsValid() and self:GetOwner() == MySelf then + self:GetOwner():SetBarricadeGhosting(false) end return self.BaseClass.Holster(self) end]] function SWEP:PreDrawViewModel(vm) - self.Owner:CallZombieFunction("PrePlayerDraw") + self:GetOwner():CallZombieFunction0("PrePlayerDraw") end function SWEP:PostDrawViewModel(vm) - self.Owner:CallZombieFunction("PostPlayerDraw") + self:GetOwner():CallZombieFunction0("PostPlayerDraw") end --[[function SWEP:Think() self.BaseClass.Think(self) - if self.Owner:IsValid() and MySelf == self.Owner then + if self:GetOwner():IsValid() and MySelf == self:GetOwner() then self:BarricadeGhostingThink() end end]] diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/init.lua index 623c98e..67b4e2e 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() SWEP.MoanDelay = 3 @@ -12,8 +9,8 @@ SWEP.MoanDelay = 3 end function SWEP:Holster() - if self.Owner:IsValid() then - self.Owner:SetBarricadeGhosting(false) + if self:GetOwner():IsValid() then + self:GetOwner():SetBarricadeGhosting(false) end return self.BaseClass.Holster(self) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/shared.lua index b0a8854..69a28bc 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wraith/shared.lua @@ -1,80 +1,40 @@ SWEP.Base = "weapon_zs_zombie" -SWEP.MeleeDelay = 0.5 +SWEP.PrintName = "Wraith" + +SWEP.MeleeDelay = 0.8 SWEP.MeleeReach = 48 -SWEP.MeleeSize = 1.5 -SWEP.MeleeDamage = 40 +SWEP.MeleeSize = 4.5 +SWEP.MeleeDamage = 43 SWEP.MeleeDamageType = DMG_SLASH +SWEP.MeleeAnimationDelay = 0.25 SWEP.AlertDelay = 6 -SWEP.Primary.Delay = 2 +SWEP.Primary.Delay = 1.8 SWEP.ViewModel = Model("models/weapons/v_pza.mdl") -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" - ---[[function SWEP:BarricadeGhostingThink() - local pl = self.Owner - if not pl:IsValid() then return end - - if pl:KeyDown(IN_SPEED) and pl:OnGround() then - if not pl:GetBarricadeGhosting() then - pl:SetBarricadeGhosting(true) - pl:ResetJumpPower() - end - elseif not pl:ActiveBarricadeGhosting(true) then - pl:SetBarricadeGhosting(false) - pl:ResetJumpPower() - end - - self:NextThink(CurTime()) - return true -end]] - -function SWEP:Initialize() - self:HideWorldModel() -end - -function SWEP:Precache() - util.PrecacheSound("npc/antlion/distract1.wav") - util.PrecacheSound("ambient/machines/slicer1.wav") - util.PrecacheSound("ambient/machines/slicer2.wav") - util.PrecacheSound("ambient/machines/slicer3.wav") - util.PrecacheSound("ambient/machines/slicer4.wav") - util.PrecacheSound("npc/zombie/claw_miss1.wav") - util.PrecacheSound("npc/zombie/claw_miss2.wav") -end +SWEP.WorldModel = "" function SWEP:StopMoaningSound() end function SWEP:StartMoaningSound() - self.Owner:EmitSound("zombiesurvival/wraithdeath"..math.random(4)..".ogg") + self:GetOwner():EmitSound("zombiesurvival/wraithdeath"..math.random(4)..".ogg") end function SWEP:PlayHitSound() - self.Owner:EmitSound("ambient/machines/slicer"..math.random(4)..".wav", 90, 80) + self:EmitSound("ambient/machines/slicer"..math.random(4)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(1, 2)..".wav", 90, 80) + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", 75, 80, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/antlion/distract1.wav") + self:EmitSound("npc/antlion/distract1.wav") end -function SWEP:Swung() - self.Owner:SetMoveType(MOVETYPE_WALK) - - self.BaseClass.Swung(self) -end - -function SWEP:StartSwinging() - self.Owner:SetMoveType(MOVETYPE_NONE) - - self.BaseClass.StartSwinging(self) -end local function viewpunch(ent, power) if ent:IsValid() and ent:Alive() then @@ -83,17 +43,18 @@ local function viewpunch(ent, power) end function SWEP:DoAlert() - local owner = self.Owner + local owner = self:GetOwner() - owner:EmitSound("npc/stalker/go_alert2a.wav") + owner:EmitSound("npc/stalker/go_alert2a.wav", 90) owner:ViewPunch(Angle(-20, 0, math.Rand(-10, 10))) + owner:DoReloadEvent() owner:LagCompensation(true) local mouthpos = owner:EyePos() + owner:GetUp() * -3 local screampos = mouthpos + owner:GetAimVector() * 16 for _, ent in pairs(ents.FindInSphere(screampos, 92)) do - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_HUMAN then + if ent and ent:IsValidHuman() then local entearpos = ent:EyePos() local dist = screampos:Distance(entearpos) if dist <= 92 and TrueVisible(entearpos, screampos) then @@ -109,8 +70,10 @@ function SWEP:DoAlert() owner:LagCompensation(false) end ---[[function SWEP:PrimaryAttack() - if self.Owner:IsBarricadeGhosting() then return end - - self.BaseClass.PrimaryAttack(self) -end]] +util.PrecacheSound("npc/antlion/distract1.wav") +util.PrecacheSound("ambient/machines/slicer1.wav") +util.PrecacheSound("ambient/machines/slicer2.wav") +util.PrecacheSound("ambient/machines/slicer3.wav") +util.PrecacheSound("ambient/machines/slicer4.wav") +util.PrecacheSound("npc/zombie/claw_miss1.wav") +util.PrecacheSound("npc/zombie/claw_miss2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench.lua deleted file mode 100644 index 2b9f466..0000000 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench.lua +++ /dev/null @@ -1,81 +0,0 @@ -AddCSLuaFile() - -if CLIENT then - SWEP.PrintName = "Mechanic's Wrench" - - SWEP.ViewModelFOV = 55 - SWEP.ViewModelFlip = false - - SWEP.ShowViewModel = false - SWEP.ShowWorldModel = false - SWEP.VElements = { - ["base"] = { type = "Model", model = "models/props_c17/tools_wrench01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 2, 0), angle = Angle(190, 0, 90), size = Vector(1.5, 1.5, 1.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } - } - SWEP.WElements = { - ["base"] = { type = "Model", model = "models/props_c17/tools_wrench01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 1, 0), angle = Angle(190, 90, 90), size = Vector(1.5, 1.5, 1.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } - } - - SWEP.Description = "This tool can be used to repair deployables as long as they were not damaged recently." -end - -SWEP.Base = "weapon_zs_basemelee" - -SWEP.ViewModel = "models/weapons/c_crowbar.mdl" -SWEP.WorldModel = "models/props_c17/tools_wrench01a.mdl" -SWEP.ModelScale = 1.5 -SWEP.UseHands = true - -SWEP.HoldType = "melee" - -SWEP.Primary.Delay = 0.8 -SWEP.MeleeDamage = 28 -SWEP.MeleeRange = 50 -SWEP.MeleeSize = 0.875 - -SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE -SWEP.MissGesture = SWEP.HitGesture - -SWEP.SwingTime = 0.19 -SWEP.SwingRotation = Angle(30, -30, -30) -SWEP.SwingOffset = Vector(0, -30, 0) -SWEP.SwingHoldType = "grenade" - -SWEP.HealStrength = 13 - -function SWEP:PlayHitSound() - self:EmitSound("weapons/melee/crowbar/crowbar_hit-"..math.random(4)..".ogg", 75, math.random(120, 125)) -end - -function SWEP:PlayRepairSound(hitent) - hitent:EmitSound("npc/dog/dog_servo"..math.random(7, 8)..".wav", 70, math.random(100, 105)) -end - -if CLIENT then return end - -function SWEP:OnMeleeHit(hitent, hitflesh, tr) - if not hitent:IsValid() then return end - - if hitent.HitByWrench and hitent:HitByWrench(self, self.Owner, tr) then - return - end - - if hitent.GetObjectHealth then - local oldhealth = hitent:GetObjectHealth() - if oldhealth <= 0 or oldhealth >= hitent:GetMaxObjectHealth() or hitent.m_LastDamaged and CurTime() < hitent.m_LastDamaged + 4 then return end - - local healstrength = (self.Owner.HumanRepairMultiplier or 1) * self.HealStrength * (hitent.WrenchRepairMultiplier or 1) - - hitent:SetObjectHealth(math.min(hitent:GetMaxObjectHealth(), hitent:GetObjectHealth() + healstrength)) - local healed = hitent:GetObjectHealth() - oldhealth - self:PlayRepairSound(hitent) - gamemode.Call("PlayerRepairedObject", self.Owner, hitent, healed / 2, self) - - local effectdata = EffectData() - effectdata:SetOrigin(tr.HitPos) - effectdata:SetNormal(tr.HitNormal) - effectdata:SetMagnitude(1) - util.Effect("nailrepaired", effectdata, true, true) - - return true - end -end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/cl_init.lua new file mode 100644 index 0000000..58bac4e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/cl_init.lua @@ -0,0 +1,15 @@ +INC_CLIENT() + +SWEP.ViewModelFOV = 55 +SWEP.ViewModelFlip = false + +SWEP.ShowViewModel = false +SWEP.ShowWorldModel = false + +SWEP.VElements = { + ["base"] = { type = "Model", model = "models/props_c17/tools_wrench01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 2, 0), angle = Angle(190, 0, 90), size = Vector(1.5, 1.5, 1.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["base"] = { type = "Model", model = "models/props_c17/tools_wrench01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2, 1, 0), angle = Angle(190, 90, 90), size = Vector(1.5, 1.5, 1.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_c17/metalladder001", skin = 0, bodygroup = {} } +} diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/init.lua new file mode 100644 index 0000000..f3f006e --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/init.lua @@ -0,0 +1,35 @@ +INC_SERVER() + +function SWEP:PlayRepairSound(hitent) + hitent:EmitSound("npc/dog/dog_servo"..math.random(7, 8)..".wav", 70, math.random(100, 105)) +end + +function SWEP:OnMeleeHit(hitent, hitflesh, tr) + if CLIENT or not hitent:IsValid() then return end + + local owner = self:GetOwner() + + if hitent.HitByWrench and hitent:HitByWrench(self, owner, tr) then + return + end + + if hitent.GetObjectHealth then + local oldhealth = hitent:GetObjectHealth() + if oldhealth <= 0 or oldhealth >= hitent:GetMaxObjectHealth() or hitent.m_LastDamaged and CurTime() < hitent.m_LastDamaged + 4 then return end + + local healstrength = self.HealStrength * (owner.RepairRateMul or 1) * (hitent.WrenchRepairMultiplier or 1) + + hitent:SetObjectHealth(math.min(hitent:GetMaxObjectHealth(), hitent:GetObjectHealth() + healstrength)) + local healed = hitent:GetObjectHealth() - oldhealth + self:PlayRepairSound(hitent) + gamemode.Call("PlayerRepairedObject", owner, hitent, healed / 2, self) + + local effectdata = EffectData() + effectdata:SetOrigin(tr.HitPos) + effectdata:SetNormal(tr.HitNormal) + effectdata:SetMagnitude(1) + util.Effect("nailrepaired", effectdata, true, true) + + return true + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/shared.lua new file mode 100644 index 0000000..026c4b1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_wrench/shared.lua @@ -0,0 +1,39 @@ +SWEP.PrintName = "Mechanic's Wrench" +SWEP.Description = "This tool can be used to repair deployables as long as they were not damaged recently." + +SWEP.Base = "weapon_zs_basemelee" + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/props_c17/tools_wrench01a.mdl" +SWEP.ModelScale = 1.5 +SWEP.UseHands = true + +SWEP.HoldType = "melee" + +SWEP.DamageType = DMG_CLUB + +SWEP.Primary.Delay = 0.8 +SWEP.MeleeDamage = 28 +SWEP.MeleeRange = 50 +SWEP.MeleeSize = 0.875 + +SWEP.MaxStock = 5 + +SWEP.HitGesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE +SWEP.MissGesture = SWEP.HitGesture + +SWEP.SwingTime = 0.19 +SWEP.SwingRotation = Angle(30, -30, -30) +SWEP.SwingOffset = Vector(0, -30, 0) +SWEP.SwingHoldType = "grenade" + +SWEP.HealStrength = 13 + +SWEP.AllowQualityWeapons = true + +GAMEMODE:SetPrimaryWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.04) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MELEE_RANGE, 3, 1) + +function SWEP:PlayHitSound() + self:EmitSound("weapons/melee/crowbar/crowbar_hit-"..math.random(4)..".ogg", 75, math.random(120, 125)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_z9000.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_z9000.lua index 7241d26..1db2685 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_z9000.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_z9000.lua @@ -1,11 +1,11 @@ AddCSLuaFile() +SWEP.PrintName = "'Z9000' Pulse Pistol" +SWEP.Description = "Although the Z9000 does not deal that much damage, the pulse shots it fires will slow targets." +SWEP.Slot = 1 +SWEP.SlotPos = 0 + if CLIENT then - SWEP.PrintName = "'Z9000' Pulse Pistol" - SWEP.Description = "Although the Z9000 does not deal that much damage, the pulse shots it fires will slow targets." - SWEP.Slot = 1 - SWEP.SlotPos = 0 - SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 @@ -30,9 +30,9 @@ SWEP.UseHands = true SWEP.CSMuzzleFlashes = false -SWEP.ReloadSound = Sound("Weapon_Alyx_Gun.Reload") -SWEP.Primary.Sound = Sound("Weapon_Alyx_Gun.Single") -SWEP.Primary.Damage = 14 +SWEP.ReloadSound = Sound("weapons/alyx_gun/alyx_shotgun_cock1.wav") +SWEP.Primary.Sound = Sound("weapons/alyx_gun/alyx_gun_fire3.wav") +SWEP.Primary.Damage = 14.5 SWEP.Primary.NumShots = 1 SWEP.Primary.Delay = 0.2 @@ -41,27 +41,26 @@ SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pulse" SWEP.Primary.DefaultClip = 50 -SWEP.ConeMax = 0.04 -SWEP.ConeMin = 0.03 +SWEP.ConeMax = 2 +SWEP.ConeMin = 1.5 SWEP.IronSightsPos = Vector(-5.95, 3, 2.75) SWEP.IronSightsAng = Vector(-0.15, -1, 2) SWEP.TracerName = "AR2Tracer" +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_MAX_SPREAD, -0.25) +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_FIRE_DELAY, -0.0175, 1) + +SWEP.PointsMultiplier = GAMEMODE.PulsePointsMultiplier + function SWEP.BulletCallback(attacker, tr, dmginfo) local ent = tr.Entity - if ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then - ent:AddLegDamage(8) + if ent:IsValidZombie() then + ent:AddLegDamageExt(4.5, attacker, attacker:GetActiveWeapon(), SLOWTYPE_PULSE) end - local e = EffectData() - e:SetOrigin(tr.HitPos) - e:SetNormal(tr.HitNormal) - e:SetRadius(8) - e:SetMagnitude(1) - e:SetScale(1) - util.Effect("cball_bounce", e) - - GenericBulletCallback(attacker, tr, dmginfo) + if IsFirstTimePredicted() then + util.CreatePulseImpactEffect(tr.HitPos, tr.HitNormal) + end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/cl_init.lua new file mode 100644 index 0000000..f075855 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/cl_init.lua @@ -0,0 +1,43 @@ +INC_CLIENT() + +SWEP.DrawCrosshair = false + +SWEP.Slot = 4 +SWEP.SlotPos = 0 + +function SWEP:DrawHUD() + if GetConVar("crosshair"):GetBool() then + self:DrawCrosshairDot() + end +end + +function SWEP:PrimaryAttack() +end + +function SWEP:DrawWeaponSelection(...) + return self:BaseDrawWeaponSelection(...) +end + +function SWEP:Think() + if self:GetOwner():KeyDown(IN_ATTACK2) then + self:RotateGhost(FrameTime() * 60) + end + if self:GetOwner():KeyDown(IN_RELOAD) then + self:RotateGhost(FrameTime() * -60) + end +end + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + return true +end + +local nextclick = 0 +function SWEP:RotateGhost(amount) + if nextclick <= RealTime() then + surface.PlaySound("npc/headcrab_poison/ph_step4.wav") + nextclick = RealTime() + 0.3 + end + RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVar("_zs_ghostrotation"):GetFloat() + amount)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/init.lua new file mode 100644 index 0000000..4765cb6 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/init.lua @@ -0,0 +1,90 @@ +INC_SERVER() + +function SWEP:Deploy() + gamemode.Call("WeaponDeployed", self:GetOwner(), self) + + self:SpawnGhost() + + return true +end + +function SWEP:OnRemove() + self:RemoveGhost() +end + +function SWEP:Holster() + self:RemoveGhost() + return true +end + +function SWEP:SpawnGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:GiveStatus(self.GhostStatus) + end +end + +function SWEP:RemoveGhost() + local owner = self:GetOwner() + if owner and owner:IsValid() then + owner:RemoveStatus(self.GhostStatus, false, true) + end +end + +function SWEP:PrimaryAttack() + if not self:CanPrimaryAttack() then return end + + local owner = self:GetOwner() + + local status = owner:GetStatus(self.GhostStatus) + if not (status and status:IsValid()) then return end + status:RecalculateValidity() + if not status:GetValidPlacement() then return end + + local pos, ang = status:RecalculateValidity() + if not pos or not ang then return end + + self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay) + + local ent = ents.Create(self.DeployClass) + if ent:IsValid() then + ent:SetPos(pos) + ent:SetAngles(ang) + ent:Spawn() + + ent:SetObjectOwner(owner) + ent:SetupDeployableSkillHealth() + + ent:EmitSound("npc/dog/dog_servo12.wav") + + ent:SetNextZap(CurTime() + 2) + + self:TakePrimaryAmmo(1) + + local stored = owner:PopPackedItem(ent:GetClass()) + if stored then + ent:SetObjectHealth(stored[1]) + end + + local ammo = math.min(owner:GetAmmoCount("pulse"), 150) + ent:SetAmmo(ammo) + owner:RemoveAmmo(ammo, "pulse") + + ent.DeployableAmmo = self.Primary.Ammo + ent.Damage = self.Primary.Damage + ent.LegDamage = self.LegDamage + ent.SWEP = self:GetClass() + + if self:GetPrimaryAmmoCount() <= 0 then + owner:StripWeapon(self:GetClass()) + end + end +end + +function SWEP:Think() + local count = self:GetPrimaryAmmoCount() + if count ~= self:GetReplicatedAmmo() then + self:SetReplicatedAmmo(count) + self:GetOwner():ResetSpeed() + end +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/shared.lua new file mode 100644 index 0000000..f8c6bb1 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper/shared.lua @@ -0,0 +1,79 @@ +SWEP.PrintName = "'Stinger' Zapper" +SWEP.Description = "Zaps any zombies that enter proximity, prioritizing headcrabs. Has a long recharge and uses pulse ammo.\nPress PRIMARY ATTACK to deploy the zapper.\nPress SECONDARY ATTACK and RELOAD to rotate the zapper." + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = Model("models/props_c17/utilityconnecter006c.mdl") + +SWEP.AmmoIfHas = true + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 1 +SWEP.Primary.Ammo = "zapper" +SWEP.Primary.Delay = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 25 + +SWEP.Secondary.ClipSize = 1 +SWEP.Secondary.DefaultClip = 1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "dummy" + +SWEP.ModelScale = 0.75 + +SWEP.MaxStock = 5 + +SWEP.WalkSpeed = SPEED_NORMAL +SWEP.FullWalkSpeed = SPEED_SLOWEST + +SWEP.ResupplyAmmoType = "pulse" + +SWEP.GhostStatus = "ghost_zapper" +SWEP.DeployClass = "prop_zapper" + +SWEP.NoDeploySpeedChange = true +SWEP.AllowQualityWeapons = true + +SWEP.LegDamage = 10 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_LEG_DAMAGE, 2) + +function SWEP:Initialize() + self:SetWeaponHoldType("slam") + self:SetDeploySpeed(1.1) + self:HideViewAndWorldModel() +end + +function SWEP:SetReplicatedAmmo(count) + self:SetDTInt(0, count) +end + +function SWEP:GetReplicatedAmmo() + return self:GetDTInt(0) +end + +function SWEP:GetWalkSpeed() + if self:GetPrimaryAmmoCount() > 0 then + return self.FullWalkSpeed + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:Reload() +end + +function SWEP:CanPrimaryAttack() + if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end + + if self:GetPrimaryAmmoCount() <= 0 then + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + return false + end + + return true +end + +function SWEP:Holster() + return true +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/cl_init.lua new file mode 100644 index 0000000..57d06eb --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/cl_init.lua @@ -0,0 +1 @@ +INC_CLIENT() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/init.lua new file mode 100644 index 0000000..3e20b96 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/init.lua @@ -0,0 +1 @@ +INC_SERVER() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/shared.lua new file mode 100644 index 0000000..c163f93 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zapper_arc/shared.lua @@ -0,0 +1,13 @@ +SWEP.PrintName = "'Dynamo' Arc Zapper" +SWEP.Description = "Zaps zombies that enter its range, and arcs between them. Has a very long recharge and uses pulse ammo.\nPress PRIMARY ATTACK to deploy the zapper.\nPress SECONDARY ATTACK and RELOAD to rotate the zapper." + +SWEP.Base = "weapon_zs_zapper" + +SWEP.Primary.Ammo = "zapper_arc" + +SWEP.GhostStatus = "ghost_zapper_arc" +SWEP.DeployClass = "prop_zapper_arc" + +SWEP.Primary.Damage = 55 + +SWEP.Tier = 3 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeakbar.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeakbar.lua index ea4a2bb..f017105 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeakbar.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeakbar.lua @@ -4,10 +4,14 @@ SWEP.Base = "weapon_zs_akbar" SWEP.Primary.Damage = 85 -SWEP.ConeMax = 0.05 -SWEP.ConeMin = 0.02 +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 1 SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE SWEP.Primary.DefaultClip = 99999 + +SWEP.ReloadSpeed = 1 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeamigo.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeamigo.lua new file mode 100644 index 0000000..bcd317c --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeamigo.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_amigo" + +SWEP.Primary.Damage = 92 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebattleaxe.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebattleaxe.lua new file mode 100644 index 0000000..3e5a030 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebattleaxe.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_battleaxe" + +SWEP.Primary.Damage = 170 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebulletstorm.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebulletstorm.lua index edc1c53..3590f2f 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebulletstorm.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zebulletstorm.lua @@ -6,57 +6,10 @@ SWEP.Primary.Damage = 60 SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 2.5 + SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE SWEP.Primary.DefaultClip = 99999 -function SWEP:SetIronsights(b) - if self:GetIronsights() ~= b then - if b then - self.Primary.NumShots = self.Primary.IronsightsNumShots - self.Primary.Delay = self.Primary.IronsightsDelay - - self:EmitSound("npc/scanner/scanner_scan4.wav", 40) - else - self.Primary.NumShots = self.Primary.DefaultNumShots - self.Primary.Delay = self.Primary.DefaultDelay - - self:EmitSound("npc/scanner/scanner_scan2.wav", 40) - end - end - - self:SetDTBool(0, b) - - if self.IronSightsHoldType then - if b then - self:SetWeaponHoldType(self.IronSightsHoldType) - else - self:SetWeaponHoldType(self.HoldType) - end - end - - gamemode.Call("WeaponDeployed", self.Owner, self) -end - -function SWEP:CanPrimaryAttack() - if self:GetIronsights() and self:Clip1() == 1 then - self:SetIronsights(false) - end - - if self.Owner:IsHolding() or self.Owner:GetBarricadeGhosting() then return false end - - if self:Clip1() <= 0 then - self:EmitSound("Weapon_Pistol.Empty") - self:SetNextPrimaryFire(CurTime() + math.max(0.25, self.Primary.Delay)) - return false - end - - return self:GetNextPrimaryFire() <= CurTime() -end - -function SWEP:TakeAmmo() - if self:GetIronsights() then - self:TakePrimaryAmmo(2) - else - self:TakePrimaryAmmo(1) - end -end +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zedeagle.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zedeagle.lua index 481fc22..61ef759 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zedeagle.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zedeagle.lua @@ -1,10 +1,10 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "'Zombie Drill' Desert Eagle" - SWEP.Slot = 1 - SWEP.SlotPos = 0 +SWEP.PrintName = "'Zombie Drill' Desert Eagle" +SWEP.Slot = 1 +SWEP.SlotPos = 0 +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 @@ -33,10 +33,11 @@ SWEP.Primary.ClipSize = 7 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" -SWEP.ConeMax = 0.06 -SWEP.ConeMin = 0.03 - +SWEP.ConeMax = 3 +SWEP.ConeMin = 1.5 SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeeraser.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeeraser.lua new file mode 100644 index 0000000..489c236 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeeraser.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_eraser" + +SWEP.Primary.Damage = 115 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeglock.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeglock.lua new file mode 100644 index 0000000..71f424f --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeglock.lua @@ -0,0 +1,18 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_glock3" + +SWEP.Primary.Damage = 90 +SWEP.Primary.Delay = 0.27 + +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 1.75 + +SWEP.ReloadSpeed = 1 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeinferno.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeinferno.lua new file mode 100644 index 0000000..c33c881 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeinferno.lua @@ -0,0 +1,15 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_inferno" + +SWEP.Primary.Damage = 80 + +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 0.8 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeknife.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeknife.lua index 4c4a42c..5f30dac 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeknife.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeknife.lua @@ -1,8 +1,8 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Knife" +SWEP.PrintName = "Knife" +if CLIENT then SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 55 end @@ -33,6 +33,8 @@ SWEP.MissAnim = ACT_VM_PRIMARYATTACK SWEP.NoHitSoundFlesh = true +SWEP.AllowQualityWeapons = false + function SWEP:PlaySwingSound() self:EmitSound("weapons/knife/knife_slash"..math.random(2)..".wav") end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zem4.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zem4.lua new file mode 100644 index 0000000..7fc8034 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zem4.lua @@ -0,0 +1,17 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_m4" + +SWEP.Primary.Damage = 85 + +SWEP.ConeMax = 2.5 +SWEP.ConeMin = 1 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.GetAuraRange = nil + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zequicksilver.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zequicksilver.lua new file mode 100644 index 0000000..47fccae --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zequicksilver.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_quicksilver" + +SWEP.Primary.Damage = 280 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOWER + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesilencer.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesilencer.lua new file mode 100644 index 0000000..8b49379 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesilencer.lua @@ -0,0 +1,17 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_silencer" + +SWEP.Primary.Damage = 70 + +SWEP.ConeMax = 3.5 +SWEP.ConeMin = 2.5 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.ReloadSpeed = 0.8 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesmg.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesmg.lua index 1513ae6..c7cd972 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesmg.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesmg.lua @@ -4,10 +4,12 @@ SWEP.Base = "weapon_zs_smg" SWEP.Primary.Damage = 75 -SWEP.ConeMax = 0.06 -SWEP.ConeMin = 0.04 +SWEP.ConeMax = 3 +SWEP.ConeMin = 2 SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zestubber.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zestubber.lua index bf907e5..295e6f8 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zestubber.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zestubber.lua @@ -2,62 +2,13 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_stubber" -SWEP.Primary.Damage = 750 +SWEP.Primary.Damage = 700 SWEP.Primary.ClipSize = 5 +SWEP.Primary.Delay = 1.5 SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE SWEP.Primary.DefaultClip = 99999 -if CLIENT then - local ghostlerp = 0 - function SWEP:GetViewModelPosition(pos, ang) - if self:IsScoped() then - return pos + ang:Up() * 256 - end - - local bIron = self:GetIronsights() - - if bIron ~= self.bLastIron then - self.bLastIron = bIron - self.fIronTime = CurTime() - - if bIron then - self.SwayScale = 0.3 - self.BobScale = 0.1 - else - self.SwayScale = 2.0 - self.BobScale = 1.5 - end - end - - local Mul = math.Clamp((CurTime() - (self.fIronTime or 0)) * 4, 0, 1) - if not bIron then Mul = 1 - Mul end - - if Mul > 0 then - local Offset = self.IronSightsPos - if self.IronSightsAng then - ang = Angle(ang.p, ang.y, ang.r) - ang:RotateAroundAxis(ang:Right(), self.IronSightsAng.x * Mul) - ang:RotateAroundAxis(ang:Up(), self.IronSightsAng.y * Mul) - ang:RotateAroundAxis(ang:Forward(), self.IronSightsAng.z * Mul) - end - - pos = pos + Offset.x * Mul * ang:Right() + Offset.y * Mul * ang:Forward() + Offset.z * Mul * ang:Up() - end - - if self.Owner:GetBarricadeGhosting() then - ghostlerp = math.min(1, ghostlerp + FrameTime() * 4) - elseif ghostlerp > 0 then - ghostlerp = math.max(0, ghostlerp - FrameTime() * 5) - end - - if ghostlerp > 0 then - pos = pos + 3.5 * ghostlerp * ang:Up() - ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp) - end - - return pos, ang - end -end +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesweeper.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesweeper.lua index 8ebed8b..a1a5291 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesweeper.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zesweeper.lua @@ -2,9 +2,14 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_sweepershotgun" -SWEP.Primary.Damage = 70 +SWEP.Primary.Damage = 135 SWEP.Primary.DefaultClip = 99999 SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE -SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOWER +SWEP.ConeMax = 4 +SWEP.ConeMin = 2.5 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_SLOW + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zetempest.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zetempest.lua new file mode 100644 index 0000000..24cf528 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zetempest.lua @@ -0,0 +1,12 @@ +AddCSLuaFile() + +SWEP.Base = "weapon_zs_tempest" + +SWEP.Primary.Damage = 77.5 + +SWEP.WalkSpeed = SPEED_ZOMBIEESCAPE_NORMAL + +SWEP.Primary.KnockbackScale = ZE_KNOCKBACKSCALE +SWEP.Primary.DefaultClip = 99999 + +SWEP.AllowQualityWeapons = false diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/cl_init.lua new file mode 100644 index 0000000..600c9ba --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/cl_init.lua @@ -0,0 +1,97 @@ +INC_CLIENT() +DEFINE_BASECLASS("weapon_zs_base") + +SWEP.VElements = { + ["bolt+"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.bolt", rel = "bolt", pos = Vector(0, 0, 0), angle = Angle(0, 0, 79.724), size = Vector(1.016, 1.062, 1.062), color = Color(0, 255, 255, 255), surpresslightning = false, material = "models/props_combine/tpballglow", skin = 1, bodygroup = {} }, + ["energy_stuff+"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "BASE", pos = Vector(8.802, -2.152, 6.893), angle = Angle(127.42, -180, -88.65), size = Vector(0.075, 0.23, 0.35), color = Color(115, 155, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["electric_shit2+"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "BASE", pos = Vector(0, -0.872, 11.138), angle = Angle(0, 90, 0), size = Vector(0.072, 0.04, 0.469), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["energy_stuff"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "BASE", pos = Vector(-8.903, -2.073, 6.71), angle = Angle(127.42, 0, 89.919), size = Vector(0.075, 0.23, 0.35), color = Color(115, 155, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["BASE"] = { type = "Model", model = "models/props_debris/wood_board06a.mdl", bone = "ValveBiped.Crossbow_base", rel = "", pos = Vector(-0.073, 0.164, 7.967), angle = Angle(0, 0, 0), size = Vector(0.975, 0.093, 0.319), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} }, + ["element_name+"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.bolt", rel = "BASE", pos = Vector(0, 2.153, -3.922), size = { x = 2.85, y = 2.85 }, color = Color(0, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["electric_shit2++"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "BASE", pos = Vector(0, 2.167, 3.907), angle = Angle(0, -90, 0), size = Vector(0.522, 0.672, 0.754), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bolt"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.bolt", rel = "", pos = Vector(-0.12, -0.046, 17.42), angle = Angle(-90, 0, 0), size = Vector(1.016, 1.062, 1.062), color = Color(0, 255, 255, 255), surpresslightning = false, material = "models/props_combine/tpballglow", skin = 1, bodygroup = {} } +} + +SWEP.WElements = { + ["bolt"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(27.947, -2.761, -3.977), angle = Angle(0.462, -170.174, -177.191), size = Vector(1.016, 1.062, 1.062), color = Color(0, 255, 255, 255), surpresslightning = false, material = "models/props_combine/tpballglow", skin = 1, bodygroup = {} }, + ["electric_shit2++"] = { type = "Model", model = "models/props_combine/breenlight.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "BASE", pos = Vector(0.035, 2.154, 2.749), angle = Angle(0, -90, 0), size = Vector(0.522, 0.672, 0.754), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["electric_shit2+"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "BASE", pos = Vector(0, -0.872, 8.756), angle = Angle(0, 90, 0), size = Vector(0.072, 0.028, 0.224), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["energy_stuff"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "BASE", pos = Vector(-9.058, -1.675, 6.152), angle = Angle(125.438, 0.897, 89.919), size = Vector(0.075, 0.23, 0.35), color = Color(115, 155, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["bolt+"] = { type = "Model", model = "models/crossbow_bolt.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "bolt", pos = Vector(0, 0, 0), angle = Angle(0, 0, 79.724), size = Vector(1.016, 1.062, 1.062), color = Color(0, 255, 255, 255), surpresslightning = false, material = "models/props_combine/tpballglow", skin = 1, bodygroup = {} }, + ["element_name+"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.Bip01_R_Hand", rel = "BASE", pos = Vector(0, 2.153, -3.922), size = { x = 2.85, y = 2.85 }, color = Color(0, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["energy_stuff+"] = { type = "Model", model = "models/props_lab/teleportring.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "BASE", pos = Vector(9.121, -2.024, 6.177), angle = Angle(125.616, -180, -88.65), size = Vector(0.075, 0.23, 0.35), color = Color(115, 155, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["BASE"] = { type = "Model", model = "models/props_debris/wood_board06a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(13.421, -0.245, -2.487), angle = Angle(180, 99.782, 90), size = Vector(0.975, 0.093, 0.319), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/masterinterface_alert", skin = 0, bodygroup = {} } +} + +SWEP.ViewModelBoneMods = { + ["ValveBiped.bowr1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.pull"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.bowr2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.bowl1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, + ["ValveBiped.bowl2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) } +} + +SWEP.HUD3DBone = "ValveBiped.Crossbow_base" +SWEP.HUD3DPos = Vector(1.5, 0.5, 11) +SWEP.HUD3DScale = 0.025 + +SWEP.ViewModelFOV = 65 +SWEP.ViewModelFlip = false + +SWEP.Slot = 3 +SWEP.SlotPos = 0 + +function SWEP:GetViewModelPosition(pos, ang) + if GAMEMODE.DisableScopes then return end + + if self:IsScoped() then + return pos + ang:Up() * 256, ang + end + + return BaseClass.GetViewModelPosition(self, pos, ang) +end + + +function SWEP:DrawHUDBackground() + if GAMEMODE.DisableScopes then return end + if not self:IsScoped() then return end + + self:DrawFuturisticScope() +end + +local matBeam = Material("trails/electric") +function SWEP:PostDrawViewModel(vm, pl, wep) + if self:IsScoped() then return end + + if self.HUD3DPos and GAMEMODE:ShouldDraw3DWeaponHUD() then + local pos, ang = self:GetHUD3DPos(vm) + if pos then + self:Draw3DHUD(vm, pos, ang) + end + end + + local veles = self.VElements + local col1, col2 = Color(0, 0, 0, 0), Color(0, 155, 255, 255) + veles["bolt"].color = col1 + veles["bolt+"].color = col1 + + if self:Clip1() < 1 or self:GetNextPrimaryFire() > CurTime() then return end + + veles["bolt"].color = col2 + veles["bolt+"].color = col2 + + local attachposlocal = vm:WorldToLocal(vm:GetAttachment(1).Pos) + local attachpos = vm:LocalToWorld(attachposlocal + Vector(6, 1, 0)) + VectorRand() * 2 + + local offvec = Vector(40, 9, -13) + local vecrand = VectorRand() * 0.4 + local part = veles.energy_stuff + local partonepos = vm:LocalToWorld(part.pos + offvec) + vecrand + + offvec.y = -20 + local parttwopos = vm:LocalToWorld(part.pos + offvec) + vecrand + + render.SetMaterial(matBeam) + render.DrawBeam(attachpos, partonepos, 1, math.random(2, 3), 1 + math.random(5, 8), Color(110, 255, 195)) + render.DrawBeam(attachpos, parttwopos, 1, math.random(2, 3), 1 + math.random(5, 8), Color(110, 255, 195)) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/init.lua new file mode 100644 index 0000000..f012147 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/init.lua @@ -0,0 +1,4 @@ +INC_SERVER() + +SWEP.Primary.Projectile = "projectile_arrow_zea" +SWEP.Primary.ProjVelocity = 1300 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/shared.lua new file mode 100644 index 0000000..b2478a3 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zeus/shared.lua @@ -0,0 +1,63 @@ +SWEP.PrintName = "'Zeus' Voltaic Crossbow" +SWEP.Description = "An electrified crossbow which nullifies zombie buffs and prevents healing or reviving. Has a low flight arc but does not headshot, and shoots a bolt as it travels." + +SWEP.Base = "weapon_zs_baseproj" + +SWEP.HoldType = "crossbow" + +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" +SWEP.UseHands = true + +SWEP.CSMuzzleFlashes = false + +SWEP.Primary.Sound = Sound("ambient/levels/labs/electric_explosion5.wav") +SWEP.ReloadFinishSound = Sound("npc/vort/attack_shoot.wav") +SWEP.Primary.Delay = 1 +SWEP.Primary.Automatic = true +SWEP.Primary.Damage = 123 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Ammo = "XBowBolt" +SWEP.Primary.DefaultClip = 15 +SWEP.RequiredClip = 1 + +SWEP.SecondaryDelay = 0.25 + +SWEP.WalkSpeed = SPEED_SLOW + +SWEP.Tier = 4 +SWEP.MaxStock = 3 + +SWEP.ConeMax = 0 +SWEP.ConeMin = 0 + +SWEP.NextZoom = 0 + +SWEP.ReloadSpeed = 0.8 + +GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.065) + +function SWEP:EmitFireSound() + self:EmitSound(self.Primary.Sound, 75, math.random(215, 225), 0.75) + self:EmitSound("weapons/crossbow/bolt_skewer1.wav", 75, math.random(112, 128), 0.6, CHAN_WEAPON + 20) +end + +function SWEP:EmitReloadSound() + if IsFirstTimePredicted() then + self:EmitSound("weapons/crossbow/bolt_load"..math.random(2)..".wav", 50, 85, 1, CHAN_WEAPON + 21) + end +end + +function SWEP:EmitReloadFinishSound() + if IsFirstTimePredicted() then + self:EmitSound(self.ReloadFinishSound, 75, 235, 0.5, CHAN_WEAPON + 22) + end +end + +function SWEP:IsScoped() + return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime() +end + +util.PrecacheSound("weapons/crossbow/bolt_load1.wav") +util.PrecacheSound("weapons/crossbow/bolt_load2.wav") diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/cl_init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/cl_init.lua index 367f607..4463533 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/cl_init.lua @@ -1,6 +1,5 @@ -include("shared.lua") +INC_CLIENT() -SWEP.PrintName = "Zombie" SWEP.ViewModelFOV = 70 SWEP.DrawCrosshair = false @@ -12,10 +11,10 @@ end SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel function SWEP:DrawHUD() - if GetConVarNumber("crosshair") ~= 1 then return end + if GetConVar("crosshair"):GetInt() ~= 1 then return end self:DrawCrosshairDot() end -function SWEP:DrawWeaponSelection(...) - return self:BaseDrawWeaponSelection(...) +function SWEP:DrawWeaponSelection(x, y, w, h, alpha) + self:BaseDrawWeaponSelection(x, y, w, h, alpha) end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/init.lua index 7678ceb..f1cfd65 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/init.lua @@ -1,7 +1,4 @@ -AddCSLuaFile("cl_init.lua") -AddCSLuaFile("shared.lua") - -include("shared.lua") +INC_SERVER() SWEP.MoanDelay = 1 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/shared.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/shared.lua index 4ef5a4b..873d882 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/shared.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie/shared.lua @@ -1,13 +1,15 @@ SWEP.ZombieOnly = true SWEP.IsMelee = true +SWEP.PrintName = "Zombie" + SWEP.ViewModel = Model("models/Weapons/v_zombiearms.mdl") -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" +SWEP.WorldModel = "" SWEP.MeleeDelay = 0.74 SWEP.MeleeReach = 48 -SWEP.MeleeSize = 1.5 -SWEP.MeleeDamage = 30 +SWEP.MeleeSize = 4.5 --1.5 +SWEP.MeleeDamage = 35 SWEP.MeleeForceScale = 1 SWEP.MeleeDamageType = DMG_SLASH @@ -25,7 +27,7 @@ SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" function SWEP:StopMoaningSound() - local owner = self.Owner + local owner = self:GetOwner() owner:StopSound("NPC_BaseZombie.Moan1") owner:StopSound("NPC_BaseZombie.Moan2") owner:StopSound("NPC_BaseZombie.Moan3") @@ -33,19 +35,19 @@ function SWEP:StopMoaningSound() end function SWEP:StartMoaningSound() - self.Owner:EmitSound("NPC_BaseZombie.Moan"..math.random(4)) + self:GetOwner():EmitSound("NPC_BaseZombie.Moan"..math.random(4)) end function SWEP:PlayHitSound() - self.Owner:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav") + self:EmitSound("npc/zombie/claw_strike"..math.random(3)..".wav", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayMissSound() - self.Owner:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav") + self:EmitSound("npc/zombie/claw_miss"..math.random(2)..".wav", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/zombie/zo_attack"..math.random(2)..".wav") + self:EmitSound("npc/zombie/zo_attack"..math.random(2)..".wav") end function SWEP:Initialize() @@ -67,7 +69,7 @@ function SWEP:CheckAttackAnimation() end function SWEP:CheckMoaning() - if self:IsMoaning() and self.Owner:Health() < self:GetMoanHealth() then + if self:IsMoaning() and self:GetOwner():Health() < self:GetMoanHealth() then self:SetNextSecondaryFire(CurTime() + 1) self:StopMoaning() end @@ -78,17 +80,16 @@ function SWEP:CheckMeleeAttack() if swingend == 0 or CurTime() < swingend then return end self:StopSwinging(0) - if SERVER then - self:Swung() - end + self:Swung() end function SWEP:GetTracesNumPlayers(traces) local numplayers = 0 + local ent for _, trace in pairs(traces) do - local ent = trace.Entity - if ent and ent:IsValid() and ent:IsPlayer() then + ent = trace.Entity + if ent and ent:IsValidPlayer() then numplayers = numplayers + 1 end end @@ -100,54 +101,83 @@ function SWEP:GetDamage(numplayers, basedamage) basedamage = basedamage or self.MeleeDamage if numplayers then - return basedamage * math.Clamp(1.2 - numplayers * 0.2, 0.5, 1) + return basedamage * math.Clamp(1.1 - numplayers * 0.1, 0.666, 1) end return basedamage end function SWEP:Swung() - local owner = self.Owner + if not IsFirstTimePredicted() then return end - --owner:LagCompensation(true) + local owner = self:GetOwner() local hit = false - local traces = owner:PenetratingClipHullMeleeTrace(self.MeleeReach, self.MeleeSize, self.PreHit) - self.PreHit = nil + local traces = owner:CompensatedZombieMeleeTrace(self.MeleeReach, self.MeleeSize) + local prehit = self.PreHit + if prehit then + local ins = true + for _, tr in pairs(traces) do + if tr.HitNonWorld then + ins = false + break + end + end + if ins then + local eyepos = owner:EyePos() + if prehit.Entity:IsValid() and prehit.Entity:NearestPoint(eyepos):DistToSqr(eyepos) <= self.MeleeReach * self.MeleeReach then + table.insert(traces, prehit) + end + end + self.PreHit = nil + end local damage = self:GetDamage(self:GetTracesNumPlayers(traces)) + local effectdata = EffectData() + local ent for _, trace in ipairs(traces) do if not trace.Hit then continue end + ent = trace.Entity + hit = true if trace.HitWorld then self:MeleeHitWorld(trace) - else - local ent = trace.Entity - if ent and ent:IsValid() then - self:MeleeHit(ent, trace, damage) - end + elseif ent and ent:IsValid() then + self:MeleeHit(ent, trace, damage) end + + --if IsFirstTimePredicted() then + effectdata:SetOrigin(trace.HitPos) + effectdata:SetStart(trace.StartPos) + effectdata:SetNormal(trace.HitNormal) + util.Effect("RagdollImpact", effectdata) + if not trace.HitSky then + effectdata:SetSurfaceProp(trace.SurfaceProps) + effectdata:SetDamageType(self.MeleeDamageType) --effectdata:SetDamageType(DMG_BULLET) + effectdata:SetHitBox(trace.HitBox) + effectdata:SetEntity(ent) + util.Effect("Impact", effectdata) + end + --end end - if SERVER then + --if IsFirstTimePredicted() then if hit then self:PlayHitSound() else self:PlayMissSound() end - end - - --owner:LagCompensation(false) + --end if self.FrozenWhileSwinging then owner:ResetSpeed() end end -function SWEP:Think() +function SWEP:Think() self:CheckIdleAnimation() self:CheckAttackAnimation() self:CheckMoaning() @@ -171,47 +201,85 @@ function SWEP:MeleeHitEntity(ent, trace, damage, forcescale) local phys = ent:GetPhysicsObject() if phys:IsValid() and phys:IsMoveable() then if trace.IsPreHit then - phys:ApplyForceOffset(damage * 750 * (forcescale or self.MeleeForceScale) * self.Owner:GetAimVector(), (ent:NearestPoint(self.Owner:EyePos()) + ent:GetPos() * 5) / 6) + phys:ApplyForceOffset(damage * 750 * (forcescale or self.MeleeForceScale) * self:GetOwner():GetAimVector(), (ent:NearestPoint(self:GetOwner():EyePos()) + ent:GetPos() * 5) / 6) else phys:ApplyForceOffset(damage * 750 * (forcescale or self.MeleeForceScale) * trace.Normal, (ent:NearestPoint(trace.StartPos) + ent:GetPos() * 2) / 3) end - ent:SetPhysicsAttacker(self.Owner) + ent:SetPhysicsAttacker(self:GetOwner()) end end function SWEP:MeleeHitPlayer(ent, trace, damage, forcescale) - ent:ThrowFromPositionSetZ(self.Owner:GetPos(), damage * 2.5 * (forcescale or self.MeleeForceScale)) + ent:ThrowFromPositionSetZ(self:GetOwner():GetPos(), damage * 2.5 * (forcescale or self.MeleeForceScale)) ent:MeleeViewPunch(damage) local nearest = ent:NearestPoint(trace.StartPos) util.Blood(nearest, math.Rand(damage * 0.5, damage * 0.75), (nearest - trace.StartPos):GetNormalized(), math.Rand(damage * 5, damage * 10), true) end -function SWEP:ApplyMeleeDamage(ent, trace, damage) - if ent:IsPlayer() then - ent:TakeSpecialDamage(damage, self.MeleeDamageType, self.Owner, self, trace.HitPos) +function SWEP:ApplyMeleeDamage(hitent, tr, damage) + if not IsFirstTimePredicted() then return end + + local owner = self:GetOwner() + + local dmginfo = DamageInfo() + dmginfo:SetDamagePosition(tr.HitPos) + dmginfo:SetAttacker(owner) + dmginfo:SetInflictor(self) + dmginfo:SetDamageType(self.MeleeDamageType) + dmginfo:SetDamage(damage) + dmginfo:SetDamageForce(math.min(damage, 50) * 50 * owner:GetAimVector()) + + local vel + if hitent:IsPlayer() then + if SERVER then + hitent:SetLastHitGroup(tr.HitGroup) + if tr.HitGroup == HITGROUP_HEAD then + hitent:SetWasHitInHead() + end + + if hitent:WouldDieFrom(damage, tr.HitPos) then + dmginfo:SetDamageForce(math.min(damage, 50) * 400 * owner:GetAimVector()) + end + end + + vel = hitent:GetVelocity() + end + + hitent:DispatchTraceAttack(dmginfo, tr, owner:GetAimVector()) + + -- No knockback vs. players + if vel then + hitent:SetLocalVelocity(vel) + end + + --[[if hitent:IsPlayer() then + local vel = hitent:GetVelocity() + hitent:TakeSpecialDamage(damage, self.MeleeDamageType, self:GetOwner(), self, tr.HitPos) + hitent:SetLocalVelocity(vel) else - local dmgtype, owner, hitpos = self.MeleeDamageType, self.Owner, trace.HitPos + local dmgtype, owner, hitpos = self.MeleeDamageType, self:GetOwner(), tr.HitPos timer.Simple(0, function() -- Avoid prediction errors. - if ent:IsValid() then - ent:TakeSpecialDamage(damage, dmgtype, owner, self, hitpos) + if hitent:IsValid() and self:IsValid() and owner:IsValid() then + hitent:TakeSpecialDamage(damage, dmgtype, owner, self, hitpos) end end) - end + end]] end function SWEP:PrimaryAttack() - if CurTime() < self:GetNextPrimaryFire() or IsValid(self.Owner.FeignDeath) then return end + if CurTime() < self:GetNextPrimaryFire() or IsValid(self:GetOwner().FeignDeath) then return end - self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + + self:SetNextPrimaryFire(CurTime() + self.Primary.Delay * armdelay) self:SetNextSecondaryFire(self:GetNextPrimaryFire() + 0.5) self:StartSwinging() end function SWEP:SecondaryAttack() - if CLIENT then return end - if CurTime() < self:GetNextSecondaryFire() then return end self:SetNextSecondaryFire(CurTime() + self.AlertDelay) @@ -219,64 +287,80 @@ function SWEP:SecondaryAttack() end function SWEP:DoAlert() - self.Owner:LagCompensation(true) + self:GetOwner():DoReloadEvent() - local ent = self.Owner:MeleeTrace(4096, 24, self.Owner:GetMeleeFilter()).Entity - if ent:IsValid() and ent:IsPlayer() then - self:PlayAlertSound() - else - self:PlayIdleSound() + if SERVER then + local ent = self:GetOwner():CompensatedMeleeTrace(4096, 24).Entity + if ent:IsValidPlayer() then + self:PlayAlertSound() + else + self:PlayIdleSound() + end end - - self.Owner:LagCompensation(false) end function SWEP:PlayAlertSound() - self.Owner:EmitSound("npc/zombie/zombie_alert"..math.random(1, 3)..".wav") + self:GetOwner():EmitSound("npc/zombie/zombie_alert"..math.random(3)..".wav") end function SWEP:PlayIdleSound() - self.Owner:EmitSound("npc/zombie/zombie_voice_idle"..math.random(1, 14)..".wav") + self:GetOwner():EmitSound("npc/zombie/zombie_voice_idle"..math.random(14)..".wav") end function SWEP:SendAttackAnim() + local owner = self:GetOwner() + local armdelay = self.MeleeAnimationMul + if self.SwapAnims then self:SendWeaponAnim(ACT_VM_HITCENTER) else self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) end self.SwapAnims = not self.SwapAnims + if self.SwingAnimSpeed then + owner:GetViewModel():SetPlaybackRate(self.SwingAnimSpeed * armdelay) + else + owner:GetViewModel():SetPlaybackRate(1 * armdelay) + end +end + +function SWEP:DoSwingEvent() + self:GetOwner():DoZombieEvent() end function SWEP:StartSwinging() + if not IsFirstTimePredicted() then return end + + local owner = self:GetOwner() + local armdelay = owner:GetMeleeSpeedMul() + + self.MeleeAnimationMul = 1 / armdelay if self.MeleeAnimationDelay then - self.NextAttackAnim = CurTime() + self.MeleeAnimationDelay + self.NextAttackAnim = CurTime() + self.MeleeAnimationDelay * armdelay else self:SendAttackAnim() end - local owner = self.Owner - owner:DoAttackEvent() + self:DoSwingEvent() + + self:PlayAttackSound() - if SERVER then - self:PlayAttackSound() - end self:StopMoaning() if self.FrozenWhileSwinging then - owner:SetSpeed(1) + self:GetOwner():SetSpeed(1) end if self.MeleeDelay > 0 then - self:SetSwingEndTime(CurTime() + self.MeleeDelay) + self:SetSwingEndTime(CurTime() + self.MeleeDelay * armdelay) - local trace = self.Owner:MeleeTrace(self.MeleeReach, self.MeleeSize, player.GetAll()) - if trace.HitNonWorld then + local trace = owner:CompensatedMeleeTrace(self.MeleeReach, self.MeleeSize) + if trace.HitNonWorld and not trace.Entity:IsPlayer() then trace.IsPreHit = true self.PreHit = trace end - self.IdleAnimation = CurTime() + self:SequenceDuration() + self.IdleAnimation = CurTime() + (self:SequenceDuration() + (self.MeleeAnimationDelay or 0)) * armdelay else self:Swung() end @@ -298,10 +382,10 @@ function SWEP:StopMoaning() end function SWEP:StartMoaning() - if self:IsMoaning() or IsValid(self.Owner.Revive) or IsValid(self.Owner.FeignDeath) then return end + if self:IsMoaning() or IsValid(self:GetOwner().Revive) or IsValid(self:GetOwner().FeignDeath) then return end self:SetMoaning(true) - self:SetMoanHealth(self.Owner:Health()) + self:SetMoanHealth(self:GetOwner():Health()) self:StartMoaningSound() end @@ -318,7 +402,7 @@ function SWEP:Deploy() end function SWEP:OnRemove() - if IsValid(self.Owner) then + if IsValid(self:GetOwner()) then self:StopMoaning() end end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie_gore_blaster.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie_gore_blaster.lua new file mode 100644 index 0000000..d5239f8 --- /dev/null +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombie_gore_blaster.lua @@ -0,0 +1,57 @@ +AddCSLuaFile() + +SWEP.PrintName = "Gore Blaster Zombie" + +SWEP.Base = "weapon_zs_zombie" + +SWEP.MeleeDamage = 21 +SWEP.BleedDamageMul = 10 / SWEP.MeleeDamage +SWEP.MeleeDamageVsProps = 28 + +SWEP.AlertDelay = 2.75 + +function SWEP:Reload() + self:SecondaryAttack() +end + +function SWEP:PlayAttackSound() + self:EmitSound("npc/zombie/zo_attack"..math.random(2)..".wav", 70, math.random(87, 92)) +end + +function SWEP:PlayAlertSound() + self:GetOwner():EmitSound("npc/zombie/zombie_alert"..math.random(3)..".wav", 70, math.random(87, 92)) +end + +function SWEP:PlayIdleSound() + self:GetOwner():EmitSound("npc/zombie/zombie_voice_idle"..math.random(14)..".wav", 70, math.random(87, 92)) +end + +function SWEP:MeleeHit(ent, trace, damage, forcescale) + if not ent:IsPlayer() then + damage = self.MeleeDamageVsProps + end + + self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale) +end + +function SWEP:ApplyMeleeDamage(ent, trace, damage) + if SERVER and ent:IsPlayer() then + local bleed = ent:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(damage * self.BleedDamageMul) + bleed.Damager = self:GetOwner() + end + end + + self.BaseClass.ApplyMeleeDamage(self, ent, trace, damage) +end + +if not CLIENT then return end + +function SWEP:ViewModelDrawn() + render.ModelMaterialOverride(0) +end + +function SWEP:PreDrawViewModel(vm) + render.SetColorModulation(1, 0, 0) +end diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombielegs.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombielegs.lua index 99158a8..5566477 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombielegs.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombielegs.lua @@ -1,8 +1,6 @@ AddCSLuaFile() -if CLIENT then - SWEP.PrintName = "Zombie Kung Fu" -end +SWEP.PrintName = "Zombie Kung Fu" SWEP.Base = "weapon_zs_zombie" @@ -12,17 +10,17 @@ SWEP.MeleeDamage = 17 SWEP.DelayWhenDeployed = true -function SWEP:Move(mv) +--[[function SWEP:Move(mv) if self:IsSwinging() then mv:SetMaxSpeed(0) mv:SetMaxClientSpeed(0) end -end +end]] function SWEP:PrimaryAttack(fromsecondary) local n = self:GetNextPrimaryAttack() - if self.Owner:IsOnGround() or self.Owner:WaterLevel() >= 2 or self.Owner:GetMoveType() ~= MOVETYPE_WALK then + if self:GetOwner():IsOnGround() or self:GetOwner():WaterLevel() >= 2 or self:GetOwner():GetMoveType() ~= MOVETYPE_WALK then self.BaseClass.PrimaryAttack(self) end @@ -40,11 +38,11 @@ function SWEP:SecondaryAttack() end function SWEP:PlayHitSound() - self.Owner:EmitSound("npc/zombie/zombie_pound_door.wav") + self:EmitSound("npc/zombie/zombie_pound_door.wav", nil, nil, nil, CHAN_AUTO) end function SWEP:PlayAttackSound() - self.Owner:EmitSound("npc/zombie/foot_slide"..math.random(3)..".wav") + self:EmitSound("npc/zombie/foot_slide"..math.random(3)..".wav", nil, nil, nil, CHAN_AUTO) end function SWEP:Reload() diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombietorso.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombietorso.lua index 474f2de..045c0fe 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombietorso.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_zombietorso.lua @@ -2,9 +2,12 @@ AddCSLuaFile() SWEP.Base = "weapon_zs_zombie" +SWEP.PrintName = "Zombie Torso" + SWEP.MeleeDelay = 0.25 SWEP.MeleeReach = 40 SWEP.MeleeDamage = 25 +SWEP.SwingAnimSpeed = 2.96 SWEP.DelayWhenDeployed = true diff --git a/gamemodes/zombiesurvival/gamemode/ammoexpand/client/cl_expand.lua b/gamemodes/zombiesurvival/gamemode/ammoexpand/client/cl_expand.lua new file mode 100644 index 0000000..791318c --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/ammoexpand/client/cl_expand.lua @@ -0,0 +1,60 @@ +local M_Player = FindMetaTable("Player") + +local E_GetTable = FindMetaTable("Entity").GetTable + +local old_Player_SetAmmo = M_Player.SetAmmo +local old_Player_GetAmmoCount = M_Player.GetAmmoCount +local old_Player_RemoveAmmo = M_Player.RemoveAmmo + +local CUSTOM_AMMO_COUNT = {} + +local function GetIDFromNameOrID(id_or_name) + local ca = CUSTOM_AMMO[id_or_name] + if ca then + return ca.index + end +end + +function M_Player:GetAmmoCount(id_or_name) + if LocalPlayer() ~= self then return 0 end + + local id = GetIDFromNameOrID(id_or_name) + if id then + return CUSTOM_AMMO_COUNT[id] or 0 + end + + return old_Player_GetAmmoCount(self, id_or_name) +end + +function M_Player:SetAmmo(amount, id_or_name) + if LocalPlayer() ~= self then return end + + local id = GetIDFromNameOrID(id_or_name) + if id then + CUSTOM_AMMO_COUNT[id] = amount + else + old_Player_SetAmmo(self, amount, id_or_name) + end +end + +function M_Player:RemoveAmmo(amount, id_or_name) + if LocalPlayer() ~= self then return end + + local id = GetIDFromNameOrID(id_or_name) + if id then + CUSTOM_AMMO_COUNT[id] = math.max((CUSTOM_AMMO_COUNT[id] or 0) - amount, 0) + else + old_Player_RemoveAmmo(self, amount, id_or_name) + end +end + +net.Receive("cusammo", function(length) + local index = net.ReadUInt(6) + 128 + local amount = net.ReadUInt(10) + + CUSTOM_AMMO_COUNT[index] = amount +end) + +net.Receive("cusammo_removeall", function(length) + CUSTOM_AMMO_COUNT = {} +end) diff --git a/gamemodes/zombiesurvival/gamemode/ammoexpand/server/sv_expand.lua b/gamemodes/zombiesurvival/gamemode/ammoexpand/server/sv_expand.lua new file mode 100644 index 0000000..bae684c --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/ammoexpand/server/sv_expand.lua @@ -0,0 +1,101 @@ +util.AddNetworkString("cusammo") +util.AddNetworkString("cusammo_removeall") + +local M_Player = FindMetaTable("Player") +local E_GetTable = FindMetaTable("Entity").GetTable + +local old_Player_GiveAmmo = M_Player.GiveAmmo +local old_Player_GetAmmoCount = M_Player.GetAmmoCount +local old_Player_RemoveAmmo = M_Player.RemoveAmmo +local old_Player_SetAmmo = M_Player.SetAmmo +local old_Player_RemoveAllAmmo = M_Player.RemoveAllAmmo +local old_Player_StripAmmo = M_Player.StripAmmo + +local function GetIDFromNameOrID(id_or_name) + local ca = CUSTOM_AMMO[id_or_name] + if ca then + return ca.index + end +end + +function M_Player:GetAmmoCount(id_or_name) + local id = GetIDFromNameOrID(id_or_name) + if id then + local ca = E_GetTable(self).ca + if ca then + return ca[id] or 0 + end + + return 0 + end + + return old_Player_GetAmmoCount(self, id_or_name) +end + +function M_Player:GiveAmmo(amount, id_or_name, suppress_sound) + local id = GetIDFromNameOrID(id_or_name) + if id then + local et = E_GetTable(self) + if not et.ca then et.ca = {} end + et.ca[id] = (self.ca[id] or 0) + amount + + self:UpdateCustomAmmoCount(id) + + -- Just for the pickup sound to play. + if not suppress_sound then + old_Player_GiveAmmo(self, 1, "dummy") + end + else + old_Player_GiveAmmo(self, amount, id_or_name, suppress_sound) + end +end + +function M_Player:RemoveAmmo(amount, id_or_name) + local id = GetIDFromNameOrID(id_or_name) + if id then + local et = E_GetTable(self) + if not et.ca then et.ca = {} end + et.ca[id] = math.max((self.ca[id] or 0) - amount, 0) + + self:UpdateCustomAmmoCount(id) + else + old_Player_RemoveAmmo(self, amount, id_or_name) + end +end + +function M_Player:SetAmmo(amount, id_or_name) + local id = GetIDFromNameOrID(id_or_name) + if id then + local et = E_GetTable(self) + if not et.ca then et.ca = {} end + et.ca[id] = amount + + self:UpdateCustomAmmoCount(id) + else + old_Player_SetAmmo(self, amount, id_or_name) + end +end + +function M_Player:RemoveAllAmmo() + self.ca = nil + old_Player_RemoveAllAmmo(self) + + net.Start("cusammo_removeall") + net.Send(self) +end + +-- Not sure if there's a difference between RemoveAllAmmo and StripAmmo +function M_Player:StripAmmo() + self.ca = nil + old_Player_StripAmmo(self) + + net.Start("cusammo_removeall") + net.Send(self) +end + +function M_Player:UpdateCustomAmmoCount(index) + net.Start("cusammo") + net.WriteUInt(index - 128, 6) + net.WriteUInt(self.ca and self.ca[index] or 0, 10) + net.Send(self) +end diff --git a/gamemodes/zombiesurvival/gamemode/ammoexpand/shared/sh_expand.lua b/gamemodes/zombiesurvival/gamemode/ammoexpand/shared/sh_expand.lua new file mode 100644 index 0000000..000eeb0 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/ammoexpand/shared/sh_expand.lua @@ -0,0 +1,81 @@ +-- Weapons right now don't need this system. Only used for components. + +CUSTOM_AMMO = {} + +local CUSTOM_AMMO = CUSTOM_AMMO +local CUSTOM_AMMO_NUM = 128 + +local M_Weapon = FindMetaTable("Weapon") +local M_Player = FindMetaTable("Player") +local M_Entity = FindMetaTable("Entity") + +local E_GetTable = M_Entity.GetTable + +local old_game_AddAmmoType = game.AddAmmoType +local old_game_GetAmmoID = game.GetAmmoID +local old_game_GetAmmoMax = game.GetAmmoMax +local old_game_GetAmmoName = game.GetAmmoName + +local old_Weapon_GetPrimaryAmmoType = M_Weapon.GetPrimaryAmmoType +local old_Weapon_GetSecondaryAmmoType = M_Weapon.GetSecondaryAmmoType + +local old_Player_GetAmmoCount = M_Player.GetAmmoCount + +local added = 0 +function game.AddAmmoType(data) + added = added + 1 + if added < 35 then + --print('adding ' .. data.name .. ' via old') + old_game_AddAmmoType(data) + else + --print('adding ' .. data.name .. ' via new') + game.AddExpandedAmmoType(data) + end +end + +function game.AddExpandedAmmoType(data) + CUSTOM_AMMO_NUM = CUSTOM_AMMO_NUM + 1 + + data.index = CUSTOM_AMMO_NUM + data.maxcarry = data.maxcarry or 9999 + CUSTOM_AMMO[CUSTOM_AMMO_NUM] = data + CUSTOM_AMMO[data.name] = data +end + +function game.GetAmmoID(name) + return CUSTOM_AMMO[name] and CUSTOM_AMMO[name].index or old_game_GetAmmoID(name) +end + +function game.GetAmmoMax(name) + return CUSTOM_AMMO[name] and CUSTOM_AMMO[name].maxcarry or old_game_GetAmmoMax(name) +end + +function game.GetAmmoName(id) + return CUSTOM_AMMO[id] and CUSTOM_AMMO[id].name or old_game_GetAmmoName(id) +end + +function M_Weapon:GetPrimaryAmmoType() + local t = E_GetTable(self) + if t.Primary and t.Primary.Ammo and CUSTOM_AMMO[t.Primary.Ammo] then return CUSTOM_AMMO[t.Primary.Ammo].index end + + return old_Weapon_GetPrimaryAmmoType(self) +end + +function M_Weapon:GetSecondaryAmmoType() + local t = E_GetTable(self) + if t.Secondary and t.Secondary.Ammo and CUSTOM_AMMO[t.Secondary.Ammo] then return CUSTOM_AMMO[t.Secondary.Ammo].index end + + return old_Weapon_GetSecondaryAmmoType(self) +end + +--[[function M_Weapon:HasAmmo() + -- TODO +end + +function M_Weapon:Clip1() + -- TODO +end + +function M_Weapon:Clip2() + -- TODO +end]] diff --git a/gamemodes/zombiesurvival/gamemode/cl_deathnotice.lua b/gamemodes/zombiesurvival/gamemode/cl_deathnotice.lua index 60d79e5..8921f51 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_deathnotice.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_deathnotice.lua @@ -1,26 +1,27 @@ if not killicon.GetFont then - killicon.OldAddFont = killicon.AddFont - killicon.OldAddAlias = killicon.AddAlias - killicon.OldAdd = killicon.Add + local OldAddFont = killicon.AddFont + local OldAdd = killicon.Add local storedfonts = {} local storedicons = {} function killicon.AddFont(sClass, sFont, sLetter, cColor) + cColor = cColor or color_white storedfonts[sClass] = {sFont, sLetter, cColor} - return killicon.OldAddFont(sClass, sFont, sLetter, cColor) + return OldAddFont(sClass, sFont, sLetter, cColor) end function killicon.Add(sClass, sTexture, cColor) + cColor = cColor or color_white storedicons[sClass] = {sTexture, cColor} - return killicon.OldAdd(sClass, sTexture, cColor) + return OldAdd(sClass, sTexture, cColor) end function killicon.AddAlias(sClass, sBaseClass) - if storedfonts[sClass] then - return killicon.AddFont(sBaseClass, storedfonts[sClass][1], storedfonts[sClass][2], storedfonts[sClass][3]) - elseif storedicons[sClass] then - return killicon.Add(sBaseClass, storedicons[sClass][1], storedicons[sClass][2]) + if storedfonts[sBaseClass] then + return killicon.AddFont(sClass, storedfonts[sBaseClass][1], storedfonts[sBaseClass][2], storedfonts[sBaseClass][3]) + elseif storedicons[sBaseClass] then + return killicon.Add(sClass, storedicons[sBaseClass][1], storedicons[sBaseClass][2]) end end @@ -37,122 +38,364 @@ if not killicon.GetFont then end end -killicon.AddFont("default", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("suicide", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("player", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("worldspawn", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("func_move_linear", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("func_rotating", "zsdeathnoticecs", "C", color_white) -killicon.AddFont("trigger_hurt", "zsdeathnoticecs", "C", color_white) +killicon.AddFont("default", "zsdeathnoticecs", "C") +killicon.AddFont("suicide", "zsdeathnoticecs", "C") +killicon.AddFont("player", "zsdeathnoticecs", "C") +killicon.AddFont("worldspawn", "zsdeathnoticecs", "C") +killicon.AddFont("func_move_linear", "zsdeathnoticecs", "C") +killicon.AddFont("func_rotating", "zsdeathnoticecs", "C") +killicon.AddFont("trigger_hurt", "zsdeathnoticecs", "C") -killicon.AddFont("prop_physics", "zsdeathnotice", "9", color_white) -killicon.AddFont("prop_physics_multiplayer", "zsdeathnotice", "9", color_white) -killicon.AddFont("func_physbox", "zsdeathnotice", "9", color_white) -killicon.AddFont("weapon_smg1", "zsdeathnotice", "/", color_white) -killicon.AddFont("weapon_357", "zsdeathnotice", ".", color_white) -killicon.AddFont("weapon_ar2", "zsdeathnotice", "2", color_white) -killicon.AddFont("crossbow_bolt", "zsdeathnotice", "1", color_white) -killicon.AddFont("weapon_shotgun", "zsdeathnotice", "0", color_white) -killicon.AddFont("rpg_missile", "zsdeathnotice", "3", color_white) -killicon.AddFont("npc_grenade_frag", "zsdeathnotice", "4", color_white) -killicon.AddFont("weapon_pistol", "zsdeathnotice", "-", color_white) -killicon.AddFont("prop_combine_ball", "zsdeathnotice", "8", color_white) -killicon.AddFont("grenade_ar2", "zsdeathnotice", "7", color_white) -killicon.AddFont("weapon_stunstick", "zsdeathnotice", "!", color_white) -killicon.AddFont("weapon_slam", "zsdeathnotice", "*", color_white) -killicon.AddFont("weapon_crowbar", "zsdeathnotice", "6", color_white) +killicon.AddFont("prop_physics", "zsdeathnotice", "9") +killicon.AddFont("prop_physics_respawnable", "zsdeathnotice", "9") +killicon.AddFont("prop_physics_multiplayer", "zsdeathnotice", "9") +killicon.AddFont("func_physbox", "zsdeathnotice", "9") +killicon.AddFont("weapon_smg1", "zsdeathnotice", "/") +killicon.AddFont("weapon_357", "zsdeathnotice", ".") +killicon.AddFont("weapon_ar2", "zsdeathnotice", "2") +killicon.AddFont("crossbow_bolt", "zsdeathnotice", "1") +killicon.AddFont("weapon_shotgun", "zsdeathnotice", "0") +killicon.AddFont("rpg_missile", "zsdeathnotice", "3") +killicon.AddFont("npc_grenade_frag", "zsdeathnotice", "4") +killicon.AddFont("weapon_pistol", "zsdeathnotice", "-") +killicon.AddFont("prop_combine_ball", "zsdeathnotice", "8") +killicon.AddFont("grenade_ar2", "zsdeathnotice", "7") +killicon.AddFont("weapon_stunstick", "zsdeathnotice", "!") +killicon.AddFont("weapon_slam", "zsdeathnotice", "*") +killicon.AddFont("weapon_crowbar", "zsdeathnotice", "6") -killicon.AddFont("headshot", "zsdeathnoticecs", "D", color_white) -killicon.Add("redeem", "killicon/redeem_v2", color_white) +killicon.Add("headshot", "zombiesurvival/killicons/zs_headshot") +killicon.Add("redeem", "killicon/redeem_v2") -killicon.Add("weapon_zs_zombie", "zombiesurvival/killicons/zombie", color_white) -killicon.Add("weapon_zs_freshdead", "zombiesurvival/killicons/zombie", color_white) -killicon.Add("weapon_zs_classiczombie", "zombiesurvival/killicons/zombie", color_white) -killicon.Add("weapon_zs_superzombie", "zombiesurvival/killicons/zombie", color_white) -killicon.Add("weapon_zs_zombietorso", "zombiesurvival/killicons/torso", color_white) -killicon.Add("weapon_zs_zombielegs", "zombiesurvival/killicons/legs", color_white) -killicon.Add("weapon_zs_fastzombielegs", "zombiesurvival/killicons/legs", color_white) -killicon.Add("weapon_zs_nightmare", "zombiesurvival/killicons/nightmare", color_white) -killicon.Add("weapon_zs_pukepus", "zombiesurvival/killicons/pukepus", color_white) -killicon.Add("weapon_zs_ticklemonster", "zombiesurvival/killicons/tickle", color_white) -killicon.Add("weapon_zs_crow", "zombiesurvival/killicons/crow", color_white) -killicon.Add("weapon_zs_fastzombie", "zombiesurvival/killicons/fastzombie", color_white) -killicon.Add("weapon_zs_poisonzombie", "zombiesurvival/killicons/poisonzombie", color_white) -killicon.Add("weapon_zs_chemzombie", "zombiesurvival/killicons/chemzombie", color_white) -killicon.Add("weapon_zs_ghoul", "zombiesurvival/killicons/ghoul", color_white) -killicon.Add("dummy_chemzombie", "zombiesurvival/killicons/chemzombie", color_white) -killicon.Add("weapon_zs_wraith", "zombiesurvival/killicons/wraithv2", color_white) -killicon.Add("weapon_zs_headcrab", "zombiesurvival/killicons/headcrab", color_white) -killicon.Add("weapon_zs_fastheadcrab", "zombiesurvival/killicons/fastheadcrab", color_white) -killicon.Add("weapon_zs_poisonheadcrab", "zombiesurvival/killicons/poisonheadcrab", color_white) -killicon.Add("projectile_poisonspit", "zombiesurvival/killicons/projectile_poisonspit", color_white) -killicon.Add("projectile_poisonflesh", "zombiesurvival/killicons/projectile_poisonflesh", color_white) -killicon.Add("projectile_poisonpuke", "zombiesurvival/killicons/pukepus", color_white) -killicon.Add("weapon_zs_special_wow", "sprites/glow04_noz", color_white) +killicon.Add("weapon_zs_zombie", "zombiesurvival/killicons/zombie") +killicon.Add("weapon_zs_zombie_gore_blaster", "zombiesurvival/killicons/zombie", Color(255, 0, 0)) +killicon.Add("weapon_zs_skeleton", "zombiesurvival/killicons/skeletal_walker") +killicon.Add("weapon_zs_skeletallurker", "zombiesurvival/killicons/skeletal_lurker") +killicon.Add("weapon_zs_freshdead", "zombiesurvival/killicons/fresh_dead") +killicon.Add("weapon_zs_agiledead", "zombiesurvival/killicons/fresh_dead") +killicon.Add("weapon_zs_classiczombie", "zombiesurvival/killicons/fresh_dead") +killicon.Add("weapon_zs_superzombie", "zombiesurvival/killicons/fresh_dead") +killicon.Add("weapon_zs_zombietorso", "zombiesurvival/killicons/torso") +killicon.Add("weapon_zs_fastzombietorso", "zombiesurvival/killicons/fast_torso") +killicon.Add("weapon_zs_fastzombietorso_slingshot", "zombiesurvival/killicons/fast_torso", Color(163, 94, 99)) +killicon.Add("weapon_zs_shadowlurker", "zombiesurvival/killicons/skeletal_lurker", Color(20, 20, 20)) +killicon.Add("weapon_zs_shadowwalker", "zombiesurvival/killicons/skeletal_walker", Color(50, 50, 50)) +killicon.Add("weapon_zs_zombielegs", "zombiesurvival/killicons/legs") +killicon.Add("weapon_zs_fastzombielegs", "zombiesurvival/killicons/fast_legs") +killicon.Add("weapon_zs_asskicker", "zombiesurvival/killicons/legs") +killicon.Add("weapon_zs_shitslapper", "zombiesurvival/killicons/torso") +killicon.Add("weapon_zs_nightmare", "zombiesurvival/killicons/nightmare2") +killicon.Add("weapon_zs_anightmare", "zombiesurvival/killicons/ancient_nightmare") +killicon.Add("weapon_zs_pukepus", "zombiesurvival/killicons/pukepus") +killicon.Add("weapon_zs_ticklemonster", "zombiesurvival/killicons/tickle") +killicon.Add("weapon_zs_crow", "zombiesurvival/killicons/crow") +killicon.Add("weapon_zs_fastzombie", "zombiesurvival/killicons/fastzombie") +killicon.Add("weapon_zs_fastzombie_slingshot", "zombiesurvival/killicons/fastzombie", Color(163, 94, 99)) +killicon.Add("weapon_zs_poisonzombie", "zombiesurvival/killicons/poisonzombie") +killicon.Add("weapon_zs_wildpoisonzombie", "zombiesurvival/killicons/poisonzombie", Color(190, 240, 0)) +killicon.Add("weapon_zs_chemzombie", "zombiesurvival/killicons/chemzombie") +killicon.Add("weapon_zs_ghoul", "zombiesurvival/killicons/ghoul") +killicon.Add("weapon_zs_chilledghoul", "zombiesurvival/killicons/ghoul", Color(20, 20, 250)) +killicon.Add("weapon_zs_elderghoul", "zombiesurvival/killicons/ghoul", Color(170, 220, 0)) +killicon.Add("dummy_chemzombie", "zombiesurvival/killicons/chemzombie") +killicon.Add("weapon_zs_wraith", "zombiesurvival/killicons/wraithv2") +killicon.Add("weapon_zs_headcrab", "zombiesurvival/killicons/headcrab") +killicon.Add("weapon_zs_doomcrab", "zombiesurvival/killicons/headcrab", Color(25, 25, 25)) +killicon.Add("weapon_zs_fastheadcrab", "zombiesurvival/killicons/fastheadcrab") +killicon.Add("weapon_zs_bloodsucker_headcrab", "zombiesurvival/killicons/fastheadcrab", Color(175, 100, 100)) +killicon.Add("weapon_zs_poisonheadcrab", "zombiesurvival/killicons/poisonheadcrab") +killicon.Add("weapon_zs_barbedheadcrab", "zombiesurvival/killicons/poisonheadcrab", Color(236, 218, 0)) +killicon.Add("projectile_poisonspit", "zombiesurvival/killicons/projectile_poisonspit") +killicon.Add("projectile_poisonflesh", "zombiesurvival/killicons/projectile_poisonflesh") +killicon.Add("projectile_poisonpuke", "zombiesurvival/killicons/pukepus") +killicon.Add("weapon_zs_special_wow", "sprites/glow04_noz") +killicon.Add("weapon_zs_coolwisp", "sprites/glow04_noz", Color(0, 180, 255)) +killicon.Add("projectile_wispball", "sprites/glow04_noz") +killicon.Add("weapon_zs_fleshcreeper", "zombiesurvival/killicons/fleshcreeper") +killicon.Add("weapon_zs_bloatedzombie", "zombiesurvival/killicons/bloatedzombie") +killicon.Add("weapon_zs_vilebloatedzombie", "zombiesurvival/killicons/bloatedzombie", Color(10, 94, 0)) +killicon.Add("weapon_zs_gigagorechild", "zombiesurvival/killicons/gigagorechild") +killicon.Add("weapon_zs_gorechild", "zombiesurvival/killicons/gorechild") +killicon.Add("weapon_zs_gigashadowchild", "zombiesurvival/killicons/gigagorechild", Color(0, 0, 0)) +killicon.Add("weapon_zs_shadowgorechild", "zombiesurvival/killicons/gorechild", Color(0, 0, 0)) +killicon.Add("weapon_zs_shade", "zombiesurvival/killicons/shadev2", Color(0, 50, 255)) +killicon.Add("weapon_zs_bonemesh", "zombiesurvival/killicons/bonemesh") +killicon.Add("projectile_bonemesh", "zombiesurvival/killicons/projectile_bonemesh") +killicon.Add("projectile_doomcrab", "zombiesurvival/killicons/projectile_bonemesh", Color(30, 30, 30)) +killicon.Add("weapon_zs_redmarrow", "zombiesurvival/killicons/skeletal_walker", Color(255,0,0)) +killicon.Add("weapon_zs_lacerator", "zombiesurvival/killicons/lacerator") +killicon.Add("weapon_zs_lacerator_charging", "zombiesurvival/killicons/lacerator", Color(180, 45, 0)) +killicon.Add("weapon_zs_devourer", "zombiesurvival/killicons/devourer") +killicon.Add("projectile_devourer", "zombiesurvival/killicons/devourer") +killicon.Add("weapon_zs_frostshade", "zombiesurvival/killicons/shadev2", Color(0, 190, 255)) +killicon.Add("projectile_shadeice", "zombiesurvival/killicons/projectile_shadeice") +killicon.Add("status_frostshadeshield", "zombiesurvival/killicons/shadev2", Color(0, 190, 255)) +killicon.Add("weapon_zs_eradicator", "zombiesurvival/killicons/poisonzombie", Color(66, 0, 0)) +killicon.Add("weapon_zs_howler", "zombiesurvival/killicons/howler") +killicon.Add("weapon_zs_extinctioncrab", "zombiesurvival/killicons/fastheadcrab", Color(100, 20, 0)) +killicon.Add("projectile_extinctioncrab", "zombiesurvival/killicons/fastheadcrab", Color(100, 20, 0)) +killicon.Add("weapon_zs_frigidrevenant", "zombiesurvival/killicons/skeletal_walker", Color(50, 90, 135)) +killicon.Add("weapon_zs_skelesham", "zombiesurvival/killicons/skeletal_walker", Color(220, 200, 150)) +killicon.Add("weapon_zs_tormentedwraith", "zombiesurvival/killicons/wraithv2", Color(190, 255, 190)) +killicon.Add("weapon_zs_noxiousghoul", "zombiesurvival/killicons/ghoul", Color(230, 130, 190)) -killicon.Add("prop_gunturret", "zombiesurvival/killicons/prop_gunturret", color_white) -killicon.Add("weapon_zs_gunturret", "zombiesurvival/killicons/prop_gunturret", color_white) -killicon.Add("weapon_zs_gunturretremove", "zombiesurvival/killicons/prop_gunturret", color_white) -killicon.AddFont("projectile_zsgrenade", "zsdeathnotice", "4", color_white) -killicon.AddFont("weapon_zs_grenade", "zsdeathnotice", "4", color_white) -killicon.AddFont("prop_detpack", "zsdeathnotice", "*", color_white) -killicon.AddFont("weapon_zs_detpack", "zsdeathnotice", "*", color_white) -killicon.AddFont("weapon_zs_detpackremote", "zsdeathnotice", "*", color_white) -killicon.AddFont("weapon_zs_stubber", "zsdeathnoticecs", "n", color_white) -killicon.AddFont("weapon_zs_hunter", "zsdeathnoticecs", "r", color_white) -killicon.AddFont("weapon_zs_tosser", "zsdeathnotice", "/", color_white) -killicon.AddFont("weapon_zs_owens", "zsdeathnotice", "-", color_white) -killicon.AddFont("weapon_zs_battleaxe", "zsdeathnoticecs", "c", color_white) -killicon.AddFont("weapon_zs_boomstick", "zsdeathnotice", "0", color_white) -killicon.AddFont("weapon_zs_annabelle", "zsdeathnotice", "0", color_white) -killicon.AddFont("weapon_zs_silencer", "zsdeathnoticecs", "d", color_white) -killicon.AddFont("weapon_zs_blaster", "zsdeathnotice", "0", color_white) -killicon.AddFont("weapon_zs_eraser", "zsdeathnoticecs", "u", color_white) -killicon.AddFont("weapon_zs_sweepershotgun", "zsdeathnoticecs", "k", color_white) -killicon.AddFont("weapon_zs_zesweeper", "zsdeathnoticecs", "k", color_white) -killicon.AddFont("weapon_zs_barricadekit", "zsdeathnotice", "3", color_white) -killicon.AddFont("weapon_zs_bulletstorm", "zsdeathnoticecs", "m", color_white) -killicon.AddFont("weapon_zs_crossbow", "zsdeathnotice", "1", color_white) -killicon.AddFont("projectile_arrow", "zsdeathnotice", "1", color_white) -killicon.AddFont("weapon_zs_deagle", "zsdeathnoticecs", "f", color_white) -killicon.AddFont("weapon_zs_zedeagle", "zsdeathnoticecs", "f", color_white) -killicon.AddFont("weapon_zs_glock3", "zsdeathnoticecs", "c", color_white) -killicon.AddFont("weapon_zs_magnum", "zsdeathnotice", ".", color_white) -killicon.AddFont("weapon_zs_peashooter", "zsdeathnoticecs", "a", color_white) -killicon.AddFont("weapon_zs_slugrifle", "zsdeathnoticecs", "n", color_white) -killicon.AddFont("weapon_zs_smg", "zsdeathnoticecs", "x", color_white) -killicon.AddFont("weapon_zs_zesmg", "zsdeathnoticecs", "x", color_white) -killicon.AddFont("weapon_zs_swissarmyknife", "zsdeathnoticecs", "j", color_white) -killicon.AddFont("weapon_zs_zeknife", "zsdeathnoticecs", "j", color_white) -killicon.AddFont("weapon_zs_uzi", "zsdeathnoticecs", "l", color_white) -killicon.AddFont("weapon_zs_inferno", "zsdeathnoticecs", "e", color_white) -killicon.AddFont("weapon_zs_m4", "zsdeathnoticecs", "w", color_white) -killicon.AddFont("weapon_zs_reaper", "zsdeathnoticecs", "q", color_white) -killicon.AddFont("weapon_zs_crackler", "zsdeathnoticecs", "t", color_white) -killicon.AddFont("weapon_zs_pulserifle", "zsdeathnotice", "2", color_white) -killicon.AddFont("weapon_zs_akbar", "zsdeathnoticecs", "b", color_white) -killicon.AddFont("weapon_zs_zeakbar", "zsdeathnoticecs", "b", color_white) -killicon.AddFont("weapon_zs_ender", "zsdeathnoticecs", "v", color_white) -killicon.AddFont("weapon_zs_redeemers", "zsdeathnoticecs", "s", color_white) -killicon.Add("weapon_zs_axe", "killicon/zs_axe", color_white) -killicon.Add("weapon_zs_sawhack", "killicon/zs_axe", color_white) -killicon.Add("weapon_zs_keyboard", "killicon/zs_keyboard", color_white) -killicon.Add("weapon_zs_sledgehammer", "killicon/zs_sledgehammer", color_white) -killicon.Add("weapon_zs_megamasher", "killicon/zs_sledgehammer", color_white) -killicon.Add("weapon_zs_fryingpan", "killicon/zs_fryingpan", color_white) -killicon.Add("weapon_zs_pot", "killicon/zs_pot", color_white) -killicon.Add("weapon_zs_plank", "killicon/zs_plank", color_white) -killicon.Add("weapon_zs_hammer", "killicon/zs_hammer", color_white) -killicon.Add("weapon_zs_electrohammer", "killicon/zs_hammer", color_white) -killicon.Add("weapon_zs_shovel", "killicon/zs_shovel", color_white) -killicon.AddFont("weapon_zs_crowbar", "zsdeathnotice", "6", color_white) -killicon.AddFont("weapon_zs_stunbaton", "zsdeathnotice", "!", color_white) +killicon.Add("prop_gunturret", "zombiesurvival/killicons/weapon_zs_gunturret2") +killicon.Add("prop_gunturret_assault", "zombiesurvival/killicons/weapon_zs_assaultturret.png") +killicon.Add("prop_gunturret_buckshot", "zombiesurvival/killicons/weapon_zs_gunturret_buckshot") +killicon.Add("prop_gunturret_rocket", "zombiesurvival/killicons/weapon_zs_gunturret_rocket") +killicon.AddFont("weapon_zs_gunturretcontrol", "zsdeathnotice", "*") +killicon.Add("weapon_zs_gunturret", "zombiesurvival/killicons/weapon_zs_gunturret2") +killicon.Add("weapon_zs_gunturret_assault", "zombiesurvival/killicons/weapon_zs_assaultturret.png") +killicon.Add("weapon_zs_gunturret_buckshot", "zombiesurvival/killicons/weapon_zs_gunturret_buckshot") +killicon.Add("weapon_zs_gunturret_rocket", "zombiesurvival/killicons/weapon_zs_gunturret_rocket") +killicon.AddFont("projectile_zsgrenade", "zsdeathnotice", "4") +killicon.Add("projectile_proxymine", "zombiesurvival/killicons/weapon_zs_proxymine") +killicon.AddFont("weapon_zs_grenade", "zsdeathnotice", "4") +killicon.AddFont("weapon_zs_zegrenade", "zsdeathnotice", "4") +killicon.Add("weapon_zs_proxymine", "zombiesurvival/killicons/weapon_zs_proxymine") +killicon.Add("weapon_zs_detpack", "zombiesurvival/killicons/weapon_zs_detpack2") +killicon.Add("prop_detpack", "zombiesurvival/killicons/weapon_zs_detpack2") +killicon.Add("weapon_zs_detpackremote", "zombiesurvival/killicons/weapon_zs_detpack2") +killicon.AddFont("weapon_zs_stubber", "zsdeathnoticecs", "n") +killicon.AddFont("weapon_zs_zestubber", "zsdeathnoticecs", "n") +killicon.AddFont("weapon_zs_hunter", "zsdeathnoticecs", "r") +killicon.Add("weapon_zs_spinfusor", "zombiesurvival/killicons/weapon_zs_spinfusor2") +killicon.Add("projectile_disc", "zombiesurvival/killicons/weapon_zs_spinfusor") +killicon.AddFont("weapon_zs_tosser", "zsdeathnotice", "/") +killicon.Add("weapon_zs_hurricane", "zombiesurvival/killicons/weapon_zs_hurricane2") +killicon.AddFont("weapon_zs_owens", "zsdeathnotice", "-") +killicon.AddFont("weapon_zs_battleaxe", "zsdeathnoticecs", "y") +killicon.AddFont("weapon_zs_zebattleaxe", "zsdeathnoticecs", "y") +killicon.AddFont("weapon_zs_boomstick", "zsdeathnotice", "0") +killicon.Add("weapon_zs_annabelle", "zombiesurvival/killicons/weapon_zs_annabelle2") +killicon.AddFont("weapon_zs_silencer", "zsdeathnoticecs", "d") +killicon.AddFont("weapon_zs_zesilencer", "zsdeathnoticecs", "d") +killicon.Add("weapon_zs_blaster", "zombiesurvival/killicons/weapon_zs_blaster") +killicon.Add("weapon_zs_sawedoff", "zombiesurvival/killicons/weapon_zs_sawedoff2") +killicon.AddFont("weapon_zs_eraser", "zsdeathnoticecs", "u") +killicon.AddFont("weapon_zs_zeeraser", "zsdeathnoticecs", "u") +killicon.Add("weapon_zs_tempest", "zombiesurvival/killicons/weapon_zs_tempest") +killicon.Add("weapon_zs_zetempest", "zombiesurvival/killicons/weapon_zs_tempest") +killicon.AddFont("weapon_zs_sweepershotgun", "zsdeathnoticecs", "k") +killicon.Add("weapon_zs_oberon", "zombiesurvival/killicons/weapon_zs_oberon2") +killicon.AddFont("weapon_zs_zesweeper", "zsdeathnoticecs", "k") +killicon.AddFont("weapon_zs_barricadekit", "zsdeathnotice", "3") +killicon.AddFont("weapon_zs_bulletstorm", "zsdeathnoticecs", "m") +killicon.AddFont("weapon_zs_zebulletstorm", "zsdeathnoticecs", "m") +killicon.AddFont("weapon_zs_crossbow", "zsdeathnotice", "1") +killicon.AddFont("projectile_arrow", "zsdeathnotice", "1") +killicon.Add("projectile_arrow_mini", "zombiesurvival/killicons/weapon_zs_artemis3") +killicon.Add("weapon_zs_artemis", "zombiesurvival/killicons/weapon_zs_artemis3") +killicon.AddFont("weapon_zs_deagle", "zsdeathnoticecs", "f") +killicon.AddFont("weapon_zs_zedeagle", "zsdeathnoticecs", "f") +killicon.AddFont("weapon_zs_glock3", "zsdeathnoticecs", "c") +killicon.AddFont("weapon_zs_zeglock", "zsdeathnoticecs", "c") +killicon.AddFont("weapon_zs_magnum", "zsdeathnotice", ".") +killicon.Add("weapon_zs_novacolt", "zombiesurvival/killicons/weapon_zs_novacolt2") +killicon.AddFont("weapon_zs_peashooter", "zsdeathnoticecs", "a") +killicon.AddFont("weapon_zs_smg", "zsdeathnoticecs", "x") +killicon.AddFont("weapon_zs_zesmg", "zsdeathnoticecs", "x") +killicon.AddFont("weapon_zs_swissarmyknife", "zsdeathnoticecs", "j") +killicon.AddFont("weapon_zs_zeknife", "zsdeathnoticecs", "j") +killicon.AddFont("weapon_zs_uzi", "zsdeathnoticecs", "l") +killicon.AddFont("weapon_zs_inferno", "zsdeathnoticecs", "e") +killicon.AddFont("weapon_zs_zeinferno", "zsdeathnoticecs", "e") +killicon.AddFont("weapon_zs_m4", "zsdeathnoticecs", "w") +killicon.AddFont("weapon_zs_zem4", "zsdeathnoticecs", "w") +killicon.AddFont("weapon_zs_reaper", "zsdeathnoticecs", "q") +killicon.AddFont("weapon_zs_crackler", "zsdeathnoticecs", "t") +killicon.AddFont("weapon_zs_pulserifle", "zsdeathnotice", "2") +killicon.AddFont("weapon_zs_akbar", "zsdeathnoticecs", "b") +killicon.AddFont("weapon_zs_zeakbar", "zsdeathnoticecs", "b") +killicon.AddFont("weapon_zs_ender", "zsdeathnoticecs", "v") +killicon.AddFont("weapon_zs_redeemers", "zsdeathnoticecs", "s") +killicon.AddFont("weapon_zs_juggernaut", "zsdeathnoticecs", "z") +killicon.AddFont("weapon_zs_amigo", "zsdeathnoticecs", "A") +killicon.AddFont("weapon_zs_zeamigo", "zsdeathnoticecs", "A") +killicon.Add("weapon_zs_gluon", "zombiesurvival/killicons/weapon_zs_gluon2") +killicon.Add("weapon_zs_aspirant", "zombiesurvival/killicons/weapon_zs_aspirant2") +killicon.AddFont("weapon_zs_flashbomb", "zsdeathnoticecs", "P") +killicon.AddFont("projectile_flashbomb", "zsdeathnoticecs", "P") +killicon.Add("weapon_zs_slugrifle", "zombiesurvival/killicons/weapon_zs_slugrifle2") +killicon.Add("weapon_zs_z9000", "zombiesurvival/killicons/weapon_zs_z9000") +killicon.Add("weapon_zs_waraxe", "zombiesurvival/killicons/weapon_zs_waraxe2") +killicon.Add("weapon_zs_fracture", "zombiesurvival/killicons/weapon_zs_fracture2") +killicon.Add("weapon_zs_molotov", "zombiesurvival/killicons/weapon_zs_molotov2") +killicon.Add("projectile_zsmolotov", "zombiesurvival/killicons/weapon_zs_molotov2") +killicon.Add("env_molotovflame", "zombiesurvival/killicons/weapon_zs_molotov2") +killicon.Add("weapon_zs_scar", "zombiesurvival/killicons/weapon_zs_scar2") +killicon.Add("weapon_zs_quasar", "zombiesurvival/killicons/weapon_zs_quasar2") +killicon.Add("weapon_zs_inquisitor", "zombiesurvival/killicons/weapon_zs_inquisitor2") +killicon.Add("projectile_arrow_inq", "zombiesurvival/killicons/weapon_zs_inquisitor2") +killicon.Add("weapon_zs_longarm", "zombiesurvival/killicons/weapon_zs_longarm2") +killicon.AddFont("weapon_zs_minelayer", "zsdeathnotice", "3") +killicon.Add("projectile_impactmine", "zombiesurvival/killicons/impact_mine") +killicon.Add("projectile_impactmine_kin", "zombiesurvival/killicons/weapon_zs_enkindlermine.png") +killicon.Add("weapon_zs_jackhammer", "zombiesurvival/killicons/weapon_zs_jackhammer2") +killicon.AddFont("weapon_zs_quicksilver", "zsdeathnoticecs", "i") +killicon.AddFont("weapon_zs_zequicksilver", "zsdeathnoticecs", "i") +killicon.Add("weapon_zs_zeus", "zombiesurvival/killicons/weapon_zs_zeus") +killicon.Add("weapon_zs_charon", "zombiesurvival/killicons/weapon_zs_charon3") +killicon.Add("weapon_zs_slinger", "zombiesurvival/killicons/weapon_zs_slinger") +killicon.Add("weapon_zs_novablaster", "zombiesurvival/killicons/weapon_zs_novablaster2") +killicon.Add("weapon_zs_colossus", "zombiesurvival/killicons/weapon_zs_colossus3") +killicon.Add("weapon_zs_corgasgrenade", "zombiesurvival/killicons/weapon_zs_corgasgrenade2") +killicon.Add("projectile_corgasgrenade", "zombiesurvival/killicons/weapon_zs_corgasgrenade2") +killicon.Add("weapon_zs_crygasgrenade", "zombiesurvival/killicons/weapon_zs_corgasgrenade2", Color(0, 220, 220)) +killicon.Add("projectile_crygasgrenade", "zombiesurvival/killicons/weapon_zs_corgasgrenade2", Color(0, 220, 220)) +killicon.Add("weapon_zs_bloodshotbomb", "zombiesurvival/killicons/weapon_zs_corgasgrenade2", Color(220, 0, 0)) +killicon.Add("weapon_zs_broadside", "zombiesurvival/killicons/weapon_zs_broadside2") +killicon.Add("weapon_zs_tithonus", "zombiesurvival/killicons/weapon_zs_tithonus2") +killicon.Add("weapon_zs_seditionist", "zombiesurvival/killicons/weapon_zs_seditionist2") +killicon.Add("weapon_zs_hyena", "zombiesurvival/killicons/weapon_zs_hyena") +killicon.Add("weapon_zs_barrage", "zombiesurvival/killicons/weapon_zs_barrage") +killicon.Add("weapon_zs_hephaestus", "zombiesurvival/killicons/weapon_zs_heph") +killicon.Add("weapon_zs_innervator", "zombiesurvival/killicons/weapon_zs_innervator2") +killicon.Add("weapon_zs_cosmos", "zombiesurvival/killicons/weapon_zs_cosmos2") +killicon.Add("weapon_zs_blareduct", "zombiesurvival/killicons/weapon_zs_blareduct2") +killicon.Add("weapon_zs_cinderrod", "zombiesurvival/killicons/weapon_zs_blareduct2") +killicon.Add("weapon_zs_shroud", "zombiesurvival/killicons/weapon_zs_shroud2") +killicon.Add("weapon_zs_stabber", "zombiesurvival/killicons/weapon_zs_stabber") +killicon.Add("weapon_zs_bulwark", "zombiesurvival/killicons/weapon_zs_bulwark2") +killicon.Add("weapon_zs_deathdealers", "zombiesurvival/killicons/weapon_zs_deathdealers") +killicon.Add("weapon_zs_galestorm", "zombiesurvival/killicons/weapon_zs_galestorm") +killicon.Add("weapon_zs_battlerifle", "zombiesurvival/killicons/weapon_zs_battlerifle") +killicon.Add("weapon_zs_eminence", "zombiesurvival/killicons/weapon_zs_eminence") +killicon.Add("weapon_zs_gladiator", "zombiesurvival/killicons/weapon_zs_gladiator") +killicon.Add("weapon_zs_medicrifle", "zombiesurvival/killicons/weapon_zs_convalescence") +killicon.Add("weapon_zs_ripper", "zombiesurvival/killicons/weapon_zs_ripper") +killicon.Add("weapon_zs_smelter", "zombiesurvival/killicons/weapon_zs_flakcannon") +killicon.Add("weapon_zs_avelyn", "zombiesurvival/killicons/weapon_zs_avelyn") +killicon.Add("weapon_zs_asmd", "zombiesurvival/killicons/weapon_zs_asmd") +killicon.Add("weapon_zs_antidoteshot", "zombiesurvival/killicons/weapon_zs_purger.png") +killicon.Add("weapon_zs_onyx", "zombiesurvival/killicons/weapon_zs_onyx.png") +killicon.Add("weapon_zs_enkindler", "zombiesurvival/killicons/weapon_zs_enkindler.png") +killicon.Add("weapon_zs_renegade", "zombiesurvival/killicons/weapon_zs_renegade.png") +killicon.Add("weapon_zs_healingray", "zombiesurvival/killicons/weapon_zs_healingray.png") +killicon.Add("weapon_zs_proliferator", "zombiesurvival/killicons/weapon_zs_proliferator.png") +killicon.Add("weapon_zs_pollutor", "zombiesurvival/killicons/weapon_zs_proliferator.png") + +killicon.Add("weapon_zs_axe", "zombiesurvival/killicons/weapon_zs_axe") +killicon.Add("weapon_zs_sawhack", "zombiesurvival/killicons/weapon_zs_sawhack.png") +killicon.Add("weapon_zs_keyboard", "zombiesurvival/killicons/weapon_zs_keyboard") +killicon.Add("weapon_zs_sledgehammer", "zombiesurvival/killicons/weapon_zs_sledgehammer") +killicon.Add("weapon_zs_megamasher", "zombiesurvival/killicons/weapon_zs_megamasher2") +killicon.Add("weapon_zs_fryingpan", "zombiesurvival/killicons/weapon_zs_fryingpan") +killicon.Add("weapon_zs_pot", "zombiesurvival/killicons/weapon_zs_pot") +killicon.Add("weapon_zs_plank", "zombiesurvival/killicons/weapon_zs_plank") +killicon.Add("weapon_zs_hammer", "zombiesurvival/killicons/weapon_zs_hammer2") +killicon.Add("weapon_zs_shovel", "zombiesurvival/killicons/weapon_zs_shovel") +killicon.Add("weapon_zs_hook", "zombiesurvival/killicons/weapon_zs_hook2") +killicon.Add("weapon_zs_meattenderizer", "zombiesurvival/killicons/weapon_zs_meattenderizer2") +killicon.Add("weapon_zs_lamp", "zombiesurvival/killicons/weapon_zs_lamp") +killicon.Add("weapon_zs_pipe", "zombiesurvival/killicons/weapon_zs_pipe") +killicon.Add("weapon_zs_wrench", "zombiesurvival/killicons/weapon_zs_wrench") +killicon.AddFont("weapon_zs_crowbar", "zsdeathnotice", "6") +killicon.AddFont("weapon_zs_stunbaton", "zsdeathnotice", "!") +killicon.Add("weapon_zs_bust", "zombiesurvival/killicons/weapon_zs_bust2") +killicon.Add("weapon_zs_butcherknife", "zombiesurvival/killicons/weapon_zs_butcherknife2") +killicon.Add("weapon_zs_butcherknifez", "zombiesurvival/killicons/butcher") +killicon.Add("weapon_zs_electrohammer", "zombiesurvival/killicons/weapon_zs_electrohammer") +killicon.Add("prop_meathook", "zombiesurvival/killicons/weapon_zs_hook2") +killicon.Add("weapon_zs_kongolaxe", "zombiesurvival/killicons/weapon_zs_kongolaxe2") +killicon.Add("weapon_zs_fists", "zombiesurvival/killicons/weapon_zs_fists") +killicon.Add("weapon_zs_harpoon", "zombiesurvival/killicons/weapon_zs_harpoon2") +killicon.Add("weapon_zs_harpoon_te", "zombiesurvival/killicons/weapon_zs_harpoon2") +killicon.Add("prop_harpoon", "zombiesurvival/killicons/weapon_zs_harpoon2") +killicon.Add("projectile_harpoon", "zombiesurvival/killicons/weapon_zs_harpoon2") +killicon.Add("projectile_harpoon_te", "zombiesurvival/killicons/weapon_zs_harpoon2") +killicon.Add("weapon_zs_frotchet", "zombiesurvival/killicons/weapon_zs_frotchet") +killicon.Add("env_protrusionspike", "zombiesurvival/killicons/env_protrusionspike") +killicon.Add("weapon_zs_longsword", "zombiesurvival/killicons/weapon_zs_longsword2") +killicon.Add("weapon_zs_rebarmace", "zombiesurvival/killicons/weapon_zs_rebarmace2") +killicon.Add("weapon_zs_executioner", "zombiesurvival/killicons/weapon_zs_executioner2") +killicon.Add("weapon_zs_brassknuckles", "zombiesurvival/killicons/weapon_zs_brassknuckles") +killicon.Add("weapon_zs_powerfists", "zombiesurvival/killicons/weapon_zs_powerfist.png") +killicon.Add("weapon_zs_ladel", "zombiesurvival/killicons/weapon_zs_ladel") +killicon.Add("weapon_zs_glassbottle", "zombiesurvival/killicons/glass_bottle") +killicon.Add("weapon_zs_crackedbottle", "zombiesurvival/killicons/glass_bottle") +killicon.Add("weapon_zs_graveshovel", "zombiesurvival/killicons/weapon_zs_graveshovel") +killicon.Add("weapon_zs_graveshovelz", "zombiesurvival/killicons/butcher", Color(100, 0, 220)) -- temp killicon +killicon.Add("weapon_zs_pushbroom", "zombiesurvival/killicons/weapon_zs_broom") +killicon.Add("weapon_zs_scythe", "zombiesurvival/killicons/weapon_zs_scythe2") + +killicon.Add("weapon_zs_stone", "zombiesurvival/killicons/weapon_zs_stone") +killicon.Add("projectile_stone", "zombiesurvival/killicons/weapon_zs_stone") +killicon.Add("projectile_shaderock", "zombiesurvival/killicons/weapon_zs_stone") +killicon.Add("weapon_zs_medicalkit", "zombiesurvival/killicons/weapon_zs_medkit") +killicon.Add("weapon_zs_medicgun", "zombiesurvival/killicons/weapon_zs_medicgun2") +killicon.Add("weapon_zs_strengthshot", "zombiesurvival/killicons/weapon_zs_medicgun2", Color(255, 50, 50)) +killicon.Add("weapon_zs_arsenalcrate", "zombiesurvival/killicons/weapon_zs_arsenalcrate") +killicon.Add("weapon_zs_remantler", "zombiesurvival/killicons/weapon_zs_remantler2.png") +killicon.Add("weapon_zs_tv", "zombiesurvival/killicons/weapon_zs_tv.png") +killicon.Add("weapon_zs_barricadekit", "zombiesurvival/killicons/weapon_zs_barricadekit") +killicon.Add("weapon_zs_boardpack", "zombiesurvival/killicons/weapon_zs_boardpack") +killicon.Add("weapon_zs_manhack", "zombiesurvival/killicons/weapon_zs_manhack") +killicon.Add("prop_manhack", "zombiesurvival/killicons/weapon_zs_manhack") +killicon.AddFont("weapon_zs_manhackcontrol", "zsdeathnotice", "*") +killicon.Add("weapon_zs_manhack_saw", "zombiesurvival/killicons/weapon_zs_manhack_saw") +killicon.Add("prop_manhack_saw", "zombiesurvival/killicons/weapon_zs_manhack_saw") +killicon.AddFont("weapon_zs_manhackcontrol_saw", "zsdeathnotice", "*") +killicon.Add("weapon_zs_messagebeacon", "zombiesurvival/killicons/weapon_zs_messagebeacon") +killicon.Add("prop_messagebeacon", "zombiesurvival/killicons/weapon_zs_messagebeacon") +killicon.Add("weapon_zs_oxygentank", "zombiesurvival/killicons/weapon_zs_oxygentank") +killicon.Add("weapon_zs_resupplybox", "zombiesurvival/killicons/weapon_zs_resupplybox") +killicon.Add("weapon_zs_spotlamp", "zombiesurvival/killicons/weapon_zs_spotlamp") +killicon.Add("prop_spotlamp", "zombiesurvival/killicons/weapon_zs_spotlamp") +killicon.Add("prop_drone", "zombiesurvival/killicons/weapon_zs_drone3.png") +killicon.Add("weapon_zs_drone", "zombiesurvival/killicons/weapon_zs_drone3.png") +killicon.Add("prop_drone_hauler", "zombiesurvival/killicons/weapon_zs_haulerdrone.png") +killicon.Add("weapon_zs_drone_hauler", "zombiesurvival/killicons/weapon_zs_haulerdrone.png") +killicon.Add("prop_drone_pulse", "zombiesurvival/killicons/weapon_zs_drone_pulse.png") +killicon.Add("weapon_zs_drone_pulse", "zombiesurvival/killicons/weapon_zs_drone_pulse.png") +killicon.Add("prop_rollermine", "zombiesurvival/killicons/weapon_zs_rollermine.png") +killicon.Add("weapon_zs_rollermine", "zombiesurvival/killicons/weapon_zs_rollermine.png") +killicon.AddFont("weapon_zs_dronecontrol", "zsdeathnotice", "*") +killicon.AddFont("weapon_zs_rollerminecontrol", "zsdeathnotice", "*") +killicon.Add("weapon_zs_mediccloudbomb", "zombiesurvival/killicons/weapon_zs_mediccloudbomb") +killicon.Add("weapon_zs_nanitecloudbomb", "zombiesurvival/killicons/weapon_zs_mediccloudbomb", Color(255, 50, 255)) +killicon.Add("weapon_zs_repairfield", "zombiesurvival/killicons/weapon_zs_repairfield") +killicon.Add("weapon_zs_ffemitter", "zombiesurvival/killicons/weapon_zs_ffemitter") +killicon.Add("weapon_zs_zapper", "zombiesurvival/killicons/weapon_zs_zapper") +killicon.Add("prop_zapper", "zombiesurvival/killicons/weapon_zs_zapper") +killicon.Add("weapon_zs_zapper_arc", "zombiesurvival/killicons/weapon_zs_dynamo") +killicon.Add("prop_zapper_arc", "zombiesurvival/killicons/weapon_zs_dynamo") +killicon.Add("weapon_zs_f_banana", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_water", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_milk", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_orange", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_soda", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_watermelon", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_f_takeout", "zombiesurvival/killicons/food") +killicon.Add("weapon_zs_sigilfragment", "zombiesurvival/killicons/sigil_fragment") +killicon.Add("weapon_zs_corruptedfragment", "zombiesurvival/killicons/sigil_fragment", Color(50, 255, 50)) +killicon.Add("weapon_zs_trinket", "zombiesurvival/killicons/weapon_zs_trinket") +killicon.Add("weapon_zs_craftables", "zombiesurvival/killicons/weapon_zs_craftables") +killicon.Add("weapon_zs_craftingpack", "zombiesurvival/killicons/weapon_zs_craftables") +killicon.Add("weapon_zs_camera", "zombiesurvival/killicons/weapon_zs_camera") + +killicon.Add("status_bleed", "zombiesurvival/killicons/bleed", Color(255, 0, 0)) +killicon.Add("status_poison", "zombiesurvival/killicons/projectile_poisonflesh") +killicon.Add("env_fire", "zombiesurvival/killicons/burn") +killicon.Add("entityflame", "zombiesurvival/killicons/burn") + +killicon.Add("ammo_pistol", "zombiesurvival/killicons/pistol_ammo_icon", Color(255, 255, 200)) +killicon.Add("ammo_shotgun", "zombiesurvival/killicons/shotgun_ammo_icon", Color(255, 140, 120)) +killicon.Add("ammo_pulse", "zombiesurvival/killicons/pulse_ammo_icon", Color(150, 200, 255)) +killicon.Add("ammo_rifle", "zombiesurvival/killicons/rifle_ammo_icon_2", Color(200, 200, 155)) +killicon.Add("ammo_scrap", "zombiesurvival/killicons/scrap_ammo_icon", Color(150, 150, 150)) +killicon.Add("ammo_smg", "zombiesurvival/killicons/smg_ammo_icon_2", Color(180, 180, 255)) +killicon.Add("ammo_explosive", "zombiesurvival/killicons/explosive_ammo_icon_2", Color(250, 150, 50)) +killicon.Add("ammo_chemical", "zombiesurvival/killicons/chemical_ammo_icon", Color(170, 250, 90)) +killicon.Add("ammo_assault", "zombiesurvival/killicons/assault_rifle_ammo_icon", Color(200, 250, 200)) +killicon.Add("ammo_bolts", "zombiesurvival/killicons/bolts_ammo_icon_2", Color(230, 230, 100)) +killicon.Add("ammo_medpower", "zombiesurvival/killicons/medpower_ammo_icon") +killicon.Add("ammo_nail", "zombiesurvival/killicons/nail_ammo_icon_2") net.Receive("zs_crow_kill_crow", function(length) local victim = net.ReadString() local attacker = net.ReadString() - --gamemode.Call("AddDeathNotice", attacker, TEAM_UNDEAD, "weapon_zs_crow", victim, TEAM_UNDEAD) GAMEMODE:TopNotify(attacker, " ", {killicon = "weapon_zs_crow"}, " ", victim) end) @@ -162,8 +405,8 @@ net.Receive("zs_pl_kill_pl", function(length) local inflictor = net.ReadString() - local victimteam = net.ReadUInt(16) - local attackerteam = net.ReadUInt(16) + local victimteam = net.ReadUInt(8) + local attackerteam = net.ReadUInt(8) local headshot = net.ReadBit() == 1 @@ -181,11 +424,10 @@ net.Receive("zs_pl_kill_pl", function(length) end end - victim:CallZombieFunction("OnKilled", attacker, attacker, attacker == victim, headshot, DamageInfo()) + victim:CallZombieFunction5("OnKilled", attacker, attacker, attacker == victim, headshot, DamageInfo()) - print(attackername.." killed "..victimname.." with "..inflictor) + MsgC(team.GetColor(attackerteam), attackername, color_white, " killed ", team.GetColor(victimteam), victimname, color_white, " with ", COLOR_YELLOW, inflictor, "\n") - --gamemode.Call("AddDeathNotice", attackername, attackerteam, inflictor, victimname, victimteam, headshot) GAMEMODE:TopNotify(attacker, " ", {killicon = inflictor, headshot = headshot}, " ", victim) end end) @@ -197,8 +439,8 @@ net.Receive("zs_pls_kill_pl", function(length) local inflictor = net.ReadString() - local victimteam = net.ReadUInt(16) - local attackerteam = net.ReadUInt(16) + local victimteam = net.ReadUInt(8) + local attackerteam = net.ReadUInt(8) local headshot = net.ReadBit() == 1 @@ -211,46 +453,43 @@ net.Receive("zs_pls_kill_pl", function(length) gamemode.Call("LocalPlayerDied", attackername.." and "..assistername) end - victim:CallZombieFunction("OnKilled", attacker, attacker, attacker == victim, headshot, DamageInfo()) + victim:CallZombieFunction5("OnKilled", attacker, attacker, attacker == victim, headshot, DamageInfo()) - print(attackername.." and "..assistername.." killed "..victimname.." with "..inflictor) + MsgC(team.GetColor(attackerteam), attackername, " and ", team.GetColor(attackerteam), assistername, color_white, " killed ", team.GetColor(victimteam), victimname, color_white, " with ", COLOR_YELLOW, inflictor, "\n") - --gamemode.Call("AddDeathNotice", attackername.." and "..assistername, attackerteam, inflictor, victimname, victimteam, headshot) GAMEMODE:TopNotify(attacker, " and ", assister, " ", {killicon = inflictor, headshot = headshot}, " ", victim) end end) net.Receive("zs_pl_kill_self", function(length) local victim = net.ReadEntity() - local victimteam = net.ReadUInt(16) + local victimteam = net.ReadUInt(8) if victim:IsValid() then if victim == MySelf and victimteam == TEAM_HUMAN then gamemode.Call("LocalPlayerDied") end - victim:CallZombieFunction("OnKilled", victim, victim, true, false, DamageInfo()) + victim:CallZombieFunction5("OnKilled", victim, victim, true, false, DamageInfo()) local victimname = victim:Name() - print(victimname.." killed themself") + MsgC(team.GetColor(victimteam), victimname, color_white, " killed themself", "\n") - --gamemode.Call("AddDeathNotice", nil, 0, "suicide", victimname, victimteam) GAMEMODE:TopNotify({killicon = "suicide"}, " ", victim) end end) net.Receive("zs_playerredeemed", function(length) local pl = net.ReadEntity() - local name = net.ReadString() - - --gamemode.Call("AddDeathNotice", nil, 0, "redeem", name, TEAM_HUMAN) if pl:IsValid() then - GAMEMODE:TopNotify(pl, " has redeemed! ", {killicon = "redeem"}) + GAMEMODE:TopNotify(translate.Format("x_redeemed", pl:Name()), " ", {killicon = "redeem"}) if pl == MySelf then GAMEMODE:CenterNotify(COLOR_CYAN, translate.Get("you_redeemed")) + + util.WhiteOut(3) end end end) @@ -259,24 +498,19 @@ net.Receive("zs_death", function(length) local victim = net.ReadEntity() local inflictor = net.ReadString() local attacker = "#" .. net.ReadString() - local victimteam = net.ReadUInt(16) + local victimteam = net.ReadUInt(8) if victim:IsValid() then if victim == MySelf and victimteam == TEAM_HUMAN then gamemode.Call("LocalPlayerDied") end - victim:CallZombieFunction("OnKilled", attacker, NULL, attacker == victim, false, DamageInfo()) + victim:CallZombieFunction5("OnKilled", attacker, NULL, attacker == victim, false, DamageInfo()) local victimname = victim:Name() - print(victimname.." was killed by "..attacker.." with "..inflictor) + MsgC(team.GetColor(victimteam), victimname, color_white, " was killed by ", COLOR_YELLOW, attacker, color_white, " with ", COLOR_YELLOW, inflictor, "\n") - --gamemode.Call("AddDeathNotice", attacker, -1, inflictor, victimname, victimteam) GAMEMODE:TopNotify(COLOR_RED, attacker, " ", {deathicon = inflictor}, " ", victim) end end) - --- Handled above. -function GM:AddDeathNotice() -end diff --git a/gamemodes/zombiesurvival/gamemode/cl_dermaskin.lua b/gamemodes/zombiesurvival/gamemode/cl_dermaskin.lua index 92bd518..2f2560d 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_dermaskin.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_dermaskin.lua @@ -30,7 +30,7 @@ local color_frame_background = Color(0, 0, 0, 220) SKIN.color_frame_background = color_frame_background SKIN.color_frame_border = Color(0, 80, 0, 255) -SKIN.colTextEntryText = Color(10, 10, 10) +SKIN.colTextEntryText = Color(200, 200, 200) SKIN.colTextEntryTextHighlight = Color(30, 255, 0) SKIN.colTextEntryTextBorder = Color(70, 90, 70, 255) @@ -49,7 +49,6 @@ SKIN.colTextEntryTextCursor = Color( 0, 0, 100, 255 )]] function SKIN:PaintPropertySheet(panel, w, h) local ActiveTab = panel:GetActiveTab() - local Offset = 0 if ActiveTab then Offset = ActiveTab:GetTall() - 8 end draw.RoundedBox(8, 0, 0, w, h, self.colTab) @@ -76,7 +75,6 @@ local texDownEdge = surface.GetTextureID("gui/gradient_down") local texRightEdge = surface.GetTextureID("gui/gradient") function PaintGenericFrame(panel, x, y, wid, hei, edgesize) edgesize = edgesize or math.ceil(math.min(hei * 0.1, math.min(16, wid * 0.1))) - local dedgesize = edgesize * 2 local hedgesize = edgesize * 0.5 DisableClipping(true) surface.DrawRect(x, y, wid, hei) @@ -230,4 +228,22 @@ function SKIN:PaintButton(panel, w, h) surface.DrawTexturedRectRotated(math.ceil(edgesize * 0.5), math.ceil(h * 0.5), edgesize, h, 180) end +function SKIN:PaintComboDownArrowClassSel(panel, w, h) + local y = math.sin(UnPredictedCurTime() * 3) * 5 * (w/15) - 1 + + if panel.ComboBox:GetDisabled() then + return self.tex.Input.ComboBox.Button.Disabled(0, 0, w, h) + end + + if panel.ComboBox.Depressed or panel.ComboBox:IsMenuOpen() then + return self.tex.Input.Slider.H.Down(0, y, w, h) + end + + if panel.ComboBox.Hovered then + return self.tex.Input.Slider.H.Hover(0, y, w, h) + end + + self.tex.Input.Slider.H.Normal(0, y, w, h) +end + derma.DefineSkin("zombiesurvival", "The default Derma skin for Zombie Survival", SKIN, "Default") diff --git a/gamemodes/zombiesurvival/gamemode/cl_draw.lua b/gamemodes/zombiesurvival/gamemode/cl_draw.lua index 3ffa9b7..bc0e9d0 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_draw.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_draw.lua @@ -16,38 +16,46 @@ end) local color_blur1 = Color(60, 60, 60, 220) local color_blur2 = Color(40, 40, 40, 140) function draw.SimpleTextBlur(text, font, x, y, col, xalign, yalign) - color_blur1.a = col.a * 0.85 - color_blur2.a = col.a * 0.55 - draw_SimpleText(text, font, x + FontBlurX, y + FontBlurY, color_blur1, xalign, yalign) - draw_SimpleText(text, font, x + FontBlurX2, y + FontBlurY2, color_blur2, xalign, yalign) + if GAMEMODE.FontEffects then + color_blur1.a = col.a * 0.85 + color_blur2.a = col.a * 0.55 + draw_SimpleText(text, font, x + FontBlurX, y + FontBlurY, color_blur1, xalign, yalign) + draw_SimpleText(text, font, x + FontBlurX2, y + FontBlurY2, color_blur2, xalign, yalign) + end draw_SimpleText(text, font, x, y, col, xalign, yalign) end function draw.DrawTextBlur(text, font, x, y, col, xalign) - color_blur1.a = col.a * 0.85 - color_blur2.a = col.a * 0.55 - draw_DrawText(text, font, x + FontBlurX, y + FontBlurY, color_blur1, xalign) - draw_DrawText(text, font, x + FontBlurX2, y + FontBlurY2, color_blur2, xalign) + if GAMEMODE.FontEffects then + color_blur1.a = col.a * 0.85 + color_blur2.a = col.a * 0.55 + draw_DrawText(text, font, x + FontBlurX, y + FontBlurY, color_blur1, xalign) + draw_DrawText(text, font, x + FontBlurX2, y + FontBlurY2, color_blur2, xalign) + end draw_DrawText(text, font, x, y, col, xalign) end local colBlur = Color(0, 0, 0) function draw.SimpleTextBlurry(text, font, x, y, col, xalign, yalign) - colBlur.r = col.r - colBlur.g = col.g - colBlur.b = col.b - colBlur.a = col.a * math.Rand(0.35, 0.6) + if GAMEMODE.FontEffects then + colBlur.r = col.r + colBlur.g = col.g + colBlur.b = col.b + colBlur.a = col.a * math.Rand(0.35, 0.6) - draw_SimpleText(text, font.."Blur", x, y, colBlur, xalign, yalign) + draw_SimpleText(text, font.."Blur", x, y, colBlur, xalign, yalign) + end draw_SimpleText(text, font, x, y, col, xalign, yalign) end function draw.DrawTextBlurry(text, font, x, y, col, xalign) - colBlur.r = col.r - colBlur.g = col.g - colBlur.b = col.b - colBlur.a = col.a * math.Rand(0.35, 0.6) + if GAMEMODE.FontEffects then + colBlur.r = col.r + colBlur.g = col.g + colBlur.b = col.b + colBlur.a = col.a * math.Rand(0.35, 0.6) - draw_DrawText(text, font.."Blur", x, y, colBlur, xalign) + draw_DrawText(text, font.."Blur", x, y, colBlur, xalign) + end draw_DrawText(text, font, x, y, col, xalign) end diff --git a/gamemodes/zombiesurvival/gamemode/cl_floatingscore.lua b/gamemodes/zombiesurvival/gamemode/cl_floatingscore.lua index bbc3303..e69d478 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_floatingscore.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_floatingscore.lua @@ -1,25 +1,13 @@ -net.Receive("zs_healother", function(length) - gamemode.Call("HealedOtherPlayer", net.ReadEntity(), net.ReadUInt(16)) -end) - -net.Receive("zs_repairobject", function(length) - gamemode.Call("RepairedObject", net.ReadEntity(), net.ReadUInt(16)) -end) - -net.Receive("zs_commission", function(length) - gamemode.Call("ReceivedCommission", net.ReadEntity(), net.ReadEntity(), net.ReadUInt(16)) -end) - function GM:ReceivedCommission(crate, buyer, points) gamemode.Call("FloatingScore", crate, "floatingscore_com", points) end -function GM:HealedOtherPlayer(other, points) - gamemode.Call("FloatingScore", other, "floatingscore_heal", points, nil, true) +function GM:HealedOtherPlayer(other, health) + gamemode.Call("FloatingScore", other, "floatingscore_heal", health, nil, true) end -function GM:RepairedObject(other, points) - gamemode.Call("FloatingScore", other, "floatingscore", points) +function GM:RepairedObject(other, health) + gamemode.Call("FloatingScore", other, "floatingscore_rep", health, nil, true) end local cvarNoFloatingScore = CreateClientConVar("zs_nofloatingscore", 0, true, false) @@ -28,10 +16,8 @@ function GM:FloatingScore(victim, effectname, frags, flags, override_allow) local isvec = type(victim) == "Vector" - if not isvec then - if not victim:IsValid() or victim:IsPlayer() and victim:Team() == MySelf:Team() and not override_allow then - return - end + if not isvec and (not victim:IsValid() or victim:IsPlayer() and victim:Team() == MySelf:Team() and not override_allow) then + return end effectname = effectname or "floatingscore" @@ -42,9 +28,9 @@ function GM:FloatingScore(victim, effectname, frags, flags, override_allow) effectdata:SetOrigin(pos) effectdata:SetScale(flags or 0) if effectname == "floatingscore_und" then - effectdata:SetMagnitude(frags or GAMEMODE.ZombieClasses[victim:GetZombieClass()].Points or 1) + effectdata:SetMagnitude(math.Round(frags or GAMEMODE.ZombieClasses[victim:GetZombieClass()].Points or 1, 2)) else - effectdata:SetMagnitude(frags or 1) + effectdata:SetMagnitude(math.Round(frags or 1, 2)) end util.Effect(effectname, effectdata, true, true) end diff --git a/gamemodes/zombiesurvival/gamemode/cl_hint.lua b/gamemodes/zombiesurvival/gamemode/cl_hint.lua index bbf534e..f748c84 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_hint.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_hint.lua @@ -1,10 +1,10 @@ local Hints = {} function GM:DrawPointWorldHints() - for _, ent in pairs(ents.FindByClass("point_worldhint")) do ent:DrawHint() end + for _, ent in pairs(ents.FindByClass("point_worldhint")) do if ent:IsValid() and ent.DrawHint then ent:DrawHint() end end end -function GM:WorldHint(hint, pos, ent, lifetime) +function GM:WorldHint(text, pos, ent, lifetime) lifetime = lifetime or 8 if ent and ent:IsValid() then @@ -15,7 +15,7 @@ function GM:WorldHint(hint, pos, ent, lifetime) end end - local hint = {Hint = hint, Pos = pos, Entity = ent, StartTime = CurTime(), EndTime = CurTime() + lifetime} + local hint = {Hint = text, Pos = pos, Entity = ent, StartTime = CurTime(), EndTime = CurTime() + lifetime} table.insert(Hints, hint) return hint @@ -28,6 +28,8 @@ end) local matRing = Material("effects/select_ring") local colFG = Color(220, 220, 220, 255) function DrawWorldHint(hint, pos, delta, scale) + if not GAMEMODE.MessageBeaconShow then return end + local eyepos = EyePos() delta = delta or 1 @@ -55,9 +57,10 @@ function DrawWorldHint(hint, pos, delta, scale) cam.End3D2D() cam.IgnoreZ(false) end -local DrawWorldHint = DrawWorldHint function GM:DrawWorldHints() + local drawhint = DrawWorldHint + if #Hints > 0 then local curtime = CurTime() @@ -68,7 +71,7 @@ function GM:DrawWorldHints() if curtime < hint.EndTime and not (ent and not ent:IsValid()) then done = false - DrawWorldHint(hint.Hint, ent and ent:LocalToWorld(hint.Pos) or hint.Pos, math.Clamp(hint.EndTime - curtime, 0, 1)) + drawhint(hint.Hint, ent and ent:LocalToWorld(hint.Pos) or hint.Pos, math.Clamp(hint.EndTime - curtime, 0, 1)) end end diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 5be61c1..cf234e3 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -1,21 +1,29 @@ -- Sometimes persistent ones don't get created. --- Sometimes persistent ones don't get created. local dummy = CreateClientConVar("_zs_dummyconvar", 1, false, false) local oldCreateClientConVar = CreateClientConVar function CreateClientConVar(...) return oldCreateClientConVar(...) or dummy end +include("sh_globals.lua") + +include("obj_entity_extend_cl.lua") +include("obj_player_extend_cl.lua") +include("obj_weapon_extend_cl.lua") + +include("loader.lua") + include("shared.lua") include("cl_draw.lua") include("cl_util.lua") include("cl_options.lua") -include("obj_player_extend_cl.lua") include("cl_scoreboard.lua") include("cl_targetid.lua") include("cl_postprocess.lua") +include("cl_voicesets.lua") +include("cl_net.lua") +include("skillweb/cl_skillweb.lua") -include("vgui/dgamestate.lua") include("vgui/dteamcounter.lua") include("vgui/dmodelpanelex.lua") include("vgui/dammocounter.lua") @@ -36,15 +44,22 @@ include("vgui/pclassselect.lua") include("vgui/pweapons.lua") include("vgui/pendboard.lua") include("vgui/pworth.lua") -include("vgui/ppointshop.lua") +include("vgui/parsenal.lua") +include("vgui/premantle.lua") include("vgui/dpingmeter.lua") include("vgui/dsidemenu.lua") +include("vgui/dspawnmenu.lua") +include("vgui/zsgamestate.lua") include("vgui/zshealtharea.lua") +include("vgui/zsstatusarea.lua") include("cl_dermaskin.lua") include("cl_deathnotice.lua") include("cl_floatingscore.lua") include("cl_hint.lua") +include("cl_thirdperson.lua") + +include("itemstocks/cl_stock.lua") include("cl_zombieescape.lua") @@ -54,16 +69,19 @@ MySelf = MySelf or NULL hook.Add("InitPostEntity", "GetLocal", function() MySelf = LocalPlayer() - GAMEMODE.HookGetLocal = GAMEMODE.HookGetLocal or (function(g) end) + GAMEMODE.HookGetLocal = GAMEMODE.HookGetLocal or function(g) end gamemode.Call("HookGetLocal", MySelf) RunConsoleCommand("initpostentity") + + MySelf:ApplySkills() end) -- Remove when model decal crash is fixed. -function util.Decal() -end +--[[function util.Decal() +end]] -- Save on global lookup time. +local collectgarbage = collectgarbage local render = render local surface = surface local draw = draw @@ -95,11 +113,15 @@ local tonumber = tonumber local type = type local ScrW = ScrW local ScrH = ScrH +local Lerp = Lerp +local EF_DIMLIGHT = EF_DIMLIGHT local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER local TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT local TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT local TEXT_ALIGN_TOP = TEXT_ALIGN_TOP local TEXT_ALIGN_BOTTOM = TEXT_ALIGN_BOTTOM +local TEXT_ALIGN_TOP_REAL = TEXT_ALIGN_TOP_REAL +local TEXT_ALIGN_BOTTOM_REAL = TEXT_ALIGN_BOTTOM_REAL local TEAM_HUMAN = TEAM_HUMAN local TEAM_UNDEAD = TEAM_UNDEAD @@ -113,10 +135,14 @@ local COLOR_DARKGREEN = COLOR_DARKGREEN local COLOR_GREEN = COLOR_GREEN local COLOR_WHITE = COLOR_WHITE -local surface_SetFont = surface.SetFont -local surface_SetTexture = surface.SetTexture +local vector_up = Vector(0, 0, 1) +local vector_down = Vector(0, 0, 1) + +--local surface_SetFont = surface.SetFont +--local surface_SetTexture = surface.SetTexture local surface_SetMaterial = surface.SetMaterial local surface_SetDrawColor = surface.SetDrawColor +--local surface_DrawLine = surface.DrawLine local surface_DrawRect = surface.DrawRect local surface_DrawOutlinedRect = surface.DrawOutlinedRect local surface_DrawTexturedRect = surface.DrawTexturedRect @@ -124,12 +150,35 @@ local surface_DrawTexturedRectRotated = surface.DrawTexturedRectRotated local surface_DrawTexturedRectUV = surface.DrawTexturedRectUV local surface_PlaySound = surface.PlaySound +local render_SetBlend = render.SetBlend +local render_ModelMaterialOverride = render.ModelMaterialOverride +local render_SetColorModulation = render.SetColorModulation +local render_SuppressEngineLighting = render.SuppressEngineLighting +local cam_IgnoreZ = cam.IgnoreZ +local render_SetMaterial = render.SetMaterial +local render_DrawQuadEasy = render.DrawQuadEasy +local cam_Start3D = cam.Start3D +local cam_End3D = cam.End3D +local cam_Start3D2D = cam.Start3D2D +local cam_End3D2D = cam.End3D2D +local render_FogMode = render.FogMode +local render_FogStart = render.FogStart +local render_FogEnd = render.FogEnd +local render_FogColor = render.FogColor +local render_FogMaxDensity = render.FogMaxDensity +local render_GetFogDistances = render.GetFogDistances +local render_GetFogColor = render.GetFogColor +local render_GetFogMode = render.GetFogMode + local draw_SimpleText = draw.SimpleText local draw_SimpleTextBlurry = draw.SimpleTextBlurry local draw_SimpleTextBlur = draw.SimpleTextBlur local draw_GetFontHeight = draw.GetFontHeight -local MedicalAuraDistance = 300 +local MedicalAuraDistance = 800 ^ 2 + +local M_Player = FindMetaTable("Player") +local P_Team = M_Player.Team GM.LifeStatsBrainsEaten = 0 GM.LifeStatsHumanDamage = 0 @@ -145,6 +194,7 @@ GM.PrevHealth = 0 GM.SuppressArsenalTime = 0 GM.ZombieThirdPerson = false GM.Beats = {} +GM.CurrentRound = 1 GM.DeathFog = 0 GM.FogStart = 0 @@ -160,44 +210,39 @@ function GM:ClickedEndBoardPlayerButton(pl, button) end function GM:CenterNotify(...) - if self.CenterNotificationHUD and self.CenterNotificationHUD:Valid() then + if self.CenterNotificationHUD and self.CenterNotificationHUD:IsValid() then return self.CenterNotificationHUD:AddNotification(...) end end function GM:TopNotify(...) - if self.TopNotificationHUD and self.TopNotificationHUD:Valid() then + if self.TopNotificationHUD and self.TopNotificationHUD:IsValid() then return self.TopNotificationHUD:AddNotification(...) end end function GM:_InputMouseApply(cmd, x, y, ang) - self.InputMouseX = x - self.InputMouseY = y - if MySelf:KeyDown(IN_WALK) and MySelf:IsHolding() then - RunConsoleCommand("_zs_rotateang", self.InputMouseX, self.InputMouseY) + self.InputMouseX = math.NormalizeAngle(self.InputMouseX - x * 0.02 * GAMEMODE.PropRotationSensitivity) + self.InputMouseY = math.NormalizeAngle(self.InputMouseY - y * 0.02 * GAMEMODE.PropRotationSensitivity) + + local snap = GAMEMODE.PropRotationSnap + local snapanglex, snapangley = self.InputMouseX, self.InputMouseY + if snap > 0 then + snapanglex = Angle(self.InputMouseX, 0, 0):SnapTo("p", snap).p + snapangley = Angle(self.InputMouseY, 0, 0):SnapTo("p", snap).p + end + + RunConsoleCommand("_zs_rotateang", snapanglex, snapangley) return true end + + if self:UseOverTheShoulder() and P_Team(MySelf) == TEAM_HUMAN then + self:InputMouseApplyOTS(cmd, x, y, ang) + end end function GM:_GUIMousePressed(mc) - if self.HumanMenuPanel and self.HumanMenuPanel:Valid() and self.HumanMenuPanel:IsVisible() and MySelf:KeyDown(self.MenuKey) then - local dir = gui.ScreenToVector(gui.MousePos()) - local ent = util.TraceLine({start = MySelf:EyePos(), endpos = MySelf:EyePos() + dir * self.CraftingRange, filter = MySelf, mask = MASK_SOLID}).Entity - if ent:IsValid() and not ent:IsPlayer() and (ent:GetMoveType() == MOVETYPE_NONE or ent:GetMoveType() == MOVETYPE_VPHYSICS) and ent:GetSolid() == SOLID_VPHYSICS then - if mc == MOUSE_LEFT then - if ent == self.CraftingEntity then - self.CraftingEntity = nil - else - self.CraftingEntity = ent - end - elseif mc == MOUSE_RIGHT and self.CraftingEntity and self.CraftingEntity:IsValid() then - RunConsoleCommand("_zs_craftcombine", self.CraftingEntity:EntIndex(), ent:EntIndex()) - self.CraftingEntity = nil - end - end - end end function GM:TryHumanPickup(pl, entity) @@ -218,11 +263,8 @@ function GM:ContextMenuOpen() return false end -function GM:HUDWeaponPickedUp(wep) -end - function GM:_HUDWeaponPickedUp(wep) - if MySelf:Team() == TEAM_HUMAN and not wep.NoPickupNotification then + if P_Team(MySelf) == TEAM_HUMAN and not wep.NoPickupNotification then self:Rewarded(wep:GetClass()) end end @@ -234,58 +276,74 @@ function GM:HUDAmmoPickedUp(itemname, amount) end function GM:InitPostEntity() - if not self.HealthHUD then - self.HealthHUD = vgui.Create("ZSHealthArea") - end + self:CreateLateVGUI() + + self:AssignItemProperties() + self:FixWeaponBase() self:LocalPlayerFound() - self:EvaluateFilmMode() + gamemode.Call("EvaluateFilmMode") timer.Simple(2, function() GAMEMODE:GetFogData() end) + + RunConsoleCommand("pp_bloom", "0") end -function GM:SetupWorldFog() - if self.DeathFog == 0 then return end +local fogstart = 0 +local fogend = 0 +local fogr = 0 +local fogg = 0 +local fogb = 0 +function GM:SetupFog() local power = self.DeathFog local rpower = 1 - self.DeathFog - local fogstart = self.FogStart * rpower - local fogend = self.FogEnd * rpower + 150 * power - local fogr = self.FogRed * rpower - local fogg = self.FogGreen * rpower + 40 * power - local fogb = self.FogBlue * rpower + fogstart = self.FogStart * rpower + fogend = self.FogEnd * rpower + 150 * power + fogr = self.FogRed * rpower + fogg = self.FogGreen * rpower + 40 * power + fogb = self.FogBlue * rpower - render.FogMode(1) + local dimvision = MySelf.DimVision + if dimvision and dimvision:IsValid() then + power = dimvision:GetDim() - render.FogStart(fogstart) - render.FogEnd(fogend) - render.FogColor(fogr, fogg, fogb) - render.FogMaxDensity(1) + fogstart = Lerp(power, fogstart, 1) + fogend = Lerp(power, fogend, math.min(148 / math.max(0.01, MySelf.DimVisionEffMul), fogend)) + fogr = Lerp(power, fogr, 0) + fogg = Lerp(power, fogg, 0) + fogb = Lerp(power, fogb, 0) + end +end + +function GM:_SetupWorldFog() + if self.DeathFog == 0 and not MySelf.DimVision then return end + + self:SetupFog() + + render_FogMode(1) + + render_FogStart(fogstart) + render_FogEnd(fogend) + render_FogColor(fogr, fogg, fogb) + render_FogMaxDensity(1) return true end -function GM:SetupSkyboxFog(skyboxscale) - if self.DeathFog == 0 then return end +function GM:_SetupSkyboxFog(skyboxscale) + if self.DeathFog == 0 and not MySelf.DimVision then return end - local power = self.DeathFog - local rpower = 1 - self.DeathFog + self:SetupFog() - local fogstart = self.FogStart * rpower - local fogend = self.FogEnd * rpower + 150 * power - local fogr = self.FogRed * rpower - local fogg = self.FogGreen * rpower + 40 * power - local fogb = self.FogBlue * rpower - local fogdensity = 1 - power * 0.1 + render_FogMode(1) - render.FogMode(1) - - render.FogStart(fogstart * skyboxscale) - render.FogEnd(fogend * skyboxscale) - render.FogColor(fogr, fogg, fogb) - render.FogMaxDensity(1) + render_FogStart(fogstart * skyboxscale) + render_FogEnd(fogend * skyboxscale) + render_FogColor(fogr, fogg, fogb) + render_FogMaxDensity(1) return true end @@ -299,57 +357,68 @@ local colSky = Color(0, 30, 0) function GM:PostDrawSkyBox() self.DrawingInSky = false - if self.DeathFog == 0 then return end + local dimvision = MySelf.DimVision + dimvision = dimvision and dimvision:IsValid() and dimvision:GetDim() + if self.DeathFog > 0 or dimvision then + colSky.a = math.max(self.DeathFog, dimvision or 0) * 230 + colSky.g = self.DeathFog * 30 - colSky.a = self.DeathFog * 230 + cam_Start3D(EyePos(), EyeAngles()) + render_SuppressEngineLighting(true) - cam.Start3D(EyePos(), EyeAngles()) - render.SuppressEngineLighting(true) + render_SetMaterial(matSky) - render.SetMaterial(matSky) + render_DrawQuadEasy(Vector(0, 0, 10240), Vector(0, 0, -1), 20480, 20480, colSky, 0) + render_DrawQuadEasy(Vector(0, 10240, 0), Vector(0, -1, 0), 20480, 20480, colSky, 0) + render_DrawQuadEasy(Vector(0, -10240, 0), Vector(0, 1, 0), 20480, 20480, colSky, 0) + render_DrawQuadEasy(Vector(10240, 0, 0), Vector(-1, 0, 0), 20480, 20480, colSky, 0) + render_DrawQuadEasy(Vector(-10240, 0, 0), Vector(1, 0, 0), 20480, 20480, colSky, 0) - render.DrawQuadEasy(Vector(0, 0, 10240), Vector(0, 0, -1), 20480, 20480, colSky, 0) - render.DrawQuadEasy(Vector(0, 10240, 0), Vector(0, -1, 0), 20480, 20480, colSky, 0) - render.DrawQuadEasy(Vector(0, -10240, 0), Vector(0, 1, 0), 20480, 20480, colSky, 0) - render.DrawQuadEasy(Vector(10240, 0, 0), Vector(-1, 0, 0), 20480, 20480, colSky, 0) - render.DrawQuadEasy(Vector(-10240, 0, 0), Vector(1, 0, 0), 20480, 20480, colSky, 0) - - render.SuppressEngineLighting(false) - cam.End3D() + render_SuppressEngineLighting(false) + cam_End3D() + end end function GM:GetFogData() - local fogstart, fogend = render.GetFogDistances() - local fogr, fogg, fogb = render.GetFogColor() + local _fogstart, _fogend = render_GetFogDistances() + local _fogr, _fogg, _fogb = render_GetFogColor() - self.FogStart = fogstart - self.FogEnd = fogend - self.FogRed = fogr - self.FogGreen = fogg - self.FogBlue = fogb + self.FogStart = _fogstart + self.FogEnd = _fogend + self.FogRed = _fogr + self.FogGreen = _fogg + self.FogBlue = _fogb +end + +function GM:ShouldDraw3DWeaponHUD() + return GAMEMODE.WeaponHUDMode ~= 1 +end + +function GM:ShouldDraw2DWeaponHUD() + return GAMEMODE.WeaponHUDMode >= 1 or self:UseOverTheShoulder() end local matAura = Material("models/debug/debugwhite") local skip = false function GM.PostPlayerDrawMedical(pl) - if not skip and pl:Team() == TEAM_HUMAN and pl ~= LocalPlayer() then + if not skip and P_Team(pl) == TEAM_HUMAN and pl ~= MySelf then local eyepos = EyePos() - local dist = pl:NearestPoint(eyepos):Distance(eyepos) + local dist = pl:NearestPoint(eyepos):DistToSqr(eyepos) if dist < MedicalAuraDistance then local green = pl:Health() / pl:GetMaxHealth() pl.SkipDrawHooks = true skip = true - render.SuppressEngineLighting(true) - render.ModelMaterialOverride(matAura) - render.SetBlend((1 - (dist / MedicalAuraDistance)) * 0.1 * (1 + math.abs(math.sin((CurTime() + pl:EntIndex()) * 4)) * 0.05)) - render.SetColorModulation(1 - green, green, 0) + render_SuppressEngineLighting(true) + render_ModelMaterialOverride(matAura) + render_SetBlend((1 - dist / MedicalAuraDistance) * 0.1 * (1 + math.abs(math.sin((CurTime() + pl:EntIndex()) * 4)) * 0.05)) + render_SetColorModulation(1 - green, green, pl:GetDTBool(DT_PLAYER_BOOL_FRAIL) and 1 or 0) pl:DrawModel() - render.SetColorModulation(1, 1, 1) - render.SetBlend(1) - render.ModelMaterialOverride() - render.SuppressEngineLighting(false) + render_SetColorModulation(1, 1, 1) + render_SetBlend(1) + render_ModelMaterialOverride() + render_SuppressEngineLighting(false) skip = false pl.SkipDrawHooks = false @@ -364,13 +433,30 @@ function GM:OnReloaded() end -- The whole point of this is so we don't need to check if the local player is valid 1000 times a second. +-- Empty functions get filled when the local player is found. +function GM:Think() end +GM.HUDWeaponPickedUp = GM.Think +GM.Think = GM._Think +GM.HUDShouldDraw = GM.Think +GM.CachedFearPower = GM.Think +GM.CalcView = GM.Think +GM.ShouldDrawLocalPlayer = GM.Think +GM.PostDrawOpaqueRenderables = GM.Think +GM.PostDrawTranslucentRenderables = GM.Think +GM.HUDPaint = GM.Think +GM.HUDPaintBackground = GM.Think +GM.CreateMove = GM.Think +GM.PrePlayerDraw = GM.Think +GM.PostPlayerDraw = GM.Think +GM.InputMouseApply = GM.Think +GM.GUIMousePressed = GM.Think +GM.HUDWeaponPickedUp = GM.Think function GM:LocalPlayerFound() self.Think = self._Think self.HUDShouldDraw = self._HUDShouldDraw self.CachedFearPower = self._CachedFearPower self.CalcView = self._CalcView self.ShouldDrawLocalPlayer = self._ShouldDrawLocalPlayer - self.PostDrawOpaqueRenderables = self._PostDrawOpaqueRenderables self.PostDrawTranslucentRenderables = self._PostDrawTranslucentRenderables self.HUDPaint = self._HUDPaint self.HUDPaintBackground = self._HUDPaintBackground @@ -380,19 +466,58 @@ function GM:LocalPlayerFound() self.InputMouseApply = self._InputMouseApply self.GUIMousePressed = self._GUIMousePressed self.HUDWeaponPickedUp = self._HUDWeaponPickedUp + self.RenderScene = self._RenderScene + self.SetupSkyboxFog = self._SetupSkyboxFog + self.SetupWorldFog = self._SetupWorldFog LocalPlayer().LegDamage = 0 + LocalPlayer().ArmDamage = 0 if render.GetDXLevel() >= 80 then self.RenderScreenspaceEffects = self._RenderScreenspaceEffects end end +local LastSigilCorrupted = -math.huge +local LastSigilUncorrupted = -math.huge +local function DrawEyeFlash(x, y, size, islast) + local curtime = CurTime() + local bsize = size * (1 + curtime * 2 % 1) + surface_SetDrawColor(220, 0, 0, 240) + surface_DrawTexturedRectRotated(x, y, bsize, bsize, 0) + + if islast then + local dt = (curtime - LastSigilCorrupted) / 3 + if dt < 1 then + local idt = 1 - dt + surface_SetDrawColor(idt ^ 0.5 * 255, 0, 0, 255) + surface_DrawTexturedRectRotated(x, y, size * dt * 150, size, dt * 10) + surface_DrawTexturedRectRotated(x, y, size, size * dt * 150, dt * 10) + else + dt = (curtime - LastSigilUncorrupted) / 3 + if dt < 1 then + local idt = 1 - dt + surface_SetDrawColor(0, dt ^ 0.5 * 255, 0, 255) + surface_DrawTexturedRectRotated(x, y, size * idt * 150, size, idt * 10) + surface_DrawTexturedRectRotated(x, y, size, size * idt * 150, idt * 10) + end + end + end +end + local currentpower = 0 local spawngreen = 0 local matFearMeter = Material("zombiesurvival/fearometer") local matNeedle = Material("zombiesurvival/fearometerneedle") local matEyeGlow = Material("Sprites/light_glow02_add_noz") +local matSigil = Material("zombiesurvival/sigil.png") +local matArsenal = Material("zombiesurvival/arsenalcrate.png") +local matResupply = Material("zombiesurvival/resupply.png") +local matRemantler = Material("zombiesurvival/remantler.png") +local matCrossout = Material("zombiesurvival/crossout.png") +local matNest = Material("zombiesurvival/nest.png") +--local matGradientRight = Material("vgui/gradient-r") +--local matGradientLeft = CreateMaterial("gradient-l", "UnlitGeneric", {["$basetexture"] = "vgui/gradient-l", ["$vertexalpha"] = "1", ["$vertexcolor"] = "1", ["$ignorez"] = "1", ["$nomip"] = "1"}) function GM:DrawFearMeter(power, screenscale) if currentpower < power then currentpower = math.min(power, currentpower + FrameTime() * (math.tan(currentpower) * 2 + 0.05)) @@ -401,43 +526,111 @@ function GM:DrawFearMeter(power, screenscale) end local w, h = ScrW(), ScrH() - local wid, hei = 192 * screenscale, 192 * screenscale - local mx, my = w * 0.5 - wid * 0.5, h - hei + local size = 192 * screenscale + local half_size = size / 2 + local mx, my = w / 2 - half_size, h - size surface_SetMaterial(matFearMeter) surface_SetDrawColor(140, 140, 140, 240) - surface_DrawTexturedRect(mx, my, wid, hei) + surface_DrawTexturedRect(mx, my, size, size) if currentpower >= 0.75 then local pulse = CurTime() % 3 - 1 if pulse > 0 then pulse = pulse ^ 2 local pulsesize = pulse * screenscale * 28 surface_SetDrawColor(140, 140, 140, 120 - pulse * 120) - surface_DrawTexturedRect(mx - pulsesize, my - pulsesize, wid + pulsesize * 2, hei + pulsesize * 2) + surface_DrawTexturedRect(mx - pulsesize, my - pulsesize, size + pulsesize * 2, size + pulsesize * 2) end end surface_SetMaterial(matNeedle) surface_SetDrawColor(160, 160, 160, 225) local rot = math.Clamp((0.5 - currentpower) + math.sin(RealTime() * 10) * 0.01, -0.5, 0.5) * 300 - surface_DrawTexturedRectRotated(w * 0.5 - math.max(0, rot * wid * -0.0001), h - hei * 0.5 - math.abs(rot) * hei * 0.00015, wid, hei, rot) + surface_DrawTexturedRectRotated(w * 0.5 - math.max(0, rot * size * -0.0001), h - half_size - math.abs(rot) * size * 0.00015, size, size, rot) - if MySelf:Team() == TEAM_UNDEAD then + if P_Team(MySelf) == TEAM_UNDEAD then if self:GetDynamicSpawning() and self:ShouldUseAlternateDynamicSpawn() then local obs = MySelf:GetObserverTarget() spawngreen = math.Approach(spawngreen, self:DynamicSpawnIsValid(obs and obs:IsValid() and obs:IsPlayer() and obs:Team() == TEAM_UNDEAD and obs or MySelf) and 1 or 0, FrameTime() * 4) - local sy = my + hei * 0.6953 - local size = wid * 0.085 + local sy = my + size * 0.6953 + local gsize = size * 0.085 surface_SetMaterial(matEyeGlow) surface_SetDrawColor(220 * (1 - spawngreen), 220 * spawngreen, 0, 240) - surface_DrawTexturedRectRotated(mx + wid * 0.459, sy, size, size, 0) - surface_DrawTexturedRectRotated(mx + wid * 0.525, sy, size, size, 0) + surface_DrawTexturedRectRotated(mx + size * 0.459, sy, gsize, gsize, 0) + surface_DrawTexturedRectRotated(mx + size * 0.525, sy, gsize, gsize, 0) end if currentpower > 0 and not self.ZombieEscape then - draw_SimpleTextBlurry(translate.Format("resist_x", math.ceil(self:GetDamageResistance(currentpower) * 100)), "ZSDamageResistance", w * 0.5, my + hei * 0.75, Color(currentpower * 200, 200 - currentpower * 200, 0, 255), TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Format("resist_x", math.ceil(self:GetDamageResistance(currentpower) * 100)), "ZSDamageResistance", w * 0.5, my + size * 0.75, Color(currentpower * 200, 200 - currentpower * 200, 0, 255), TEXT_ALIGN_CENTER) + end + end + + if self:GetUseSigils() and self.MaxSigils > 0 then + local sigwid, sighei = screenscale * 18, screenscale * 36 + local extrude = size * 0.25 + sighei / 2 + local angle_current = -180 + local angle_step = 180 / (self.MaxSigils - 1) + local rad, sigil, health, maxhealth, corrupt, damageflash, sigx, sigy, healthfrac + + local sigils = GAMEMODE.CachedSigils + local corruptsigils = 0 + for i=1, self.MaxSigils do + sigil = sigils[i] + health = 0 + maxhealth = 0 + corrupt = false + if sigil and sigil:IsValid() then + health = sigil:GetSigilHealth() + maxhealth = sigil:GetSigilMaxHealth() + corrupt = sigil:GetSigilCorrupted() + corruptsigils = corruptsigils + (corrupt and 1 or 0) + end + + if health >= 0 then + rad = math.rad(angle_current) + sigx = mx + half_size + math.cos(rad) * extrude + sigy = my + half_size + math.sin(rad) * extrude + + if sigil and sigil:IsValid() then + damageflash = math.min((CurTime() - sigil:GetSigilLastDamaged()) * 2, 1) * 255 + else + damageflash = 255 + end + healthfrac = health / maxhealth + if corrupt then + surface_SetDrawColor((255 - damageflash) * healthfrac, damageflash * healthfrac, 0, 220) + else + surface_SetDrawColor((255 - damageflash) * healthfrac, damageflash * healthfrac, 220, 220) + end + + surface_SetMaterial(matSigil) + surface_DrawTexturedRectRotated(sigx, sigy, sigwid, sighei, angle_current + 90) + + if corrupt then + surface_SetMaterial(matCrossout) + surface_SetDrawColor(220, 0, 0, 220) + surface_DrawTexturedRect(sigx - sigwid / 2, sigy - sighei / 2, sigwid, sighei) + end + + angle_current = angle_current + angle_step + end + end + + local des = corruptsigils / self.MaxSigils --self:GetSigilsDestroyed() / self.MaxSigils + if des >= 0.3333 then + surface_SetMaterial(matEyeGlow) + + local eye_size = size * 0.125 + local sy = my + size * 0.6953 + + if des >= 0.6666 then + DrawEyeFlash(mx + size * 0.459, sy, eye_size) + DrawEyeFlash(mx + size * 0.525, sy, eye_size, true) + else + DrawEyeFlash(mx + size * 0.459, sy, eye_size, true) + end end end end @@ -463,45 +656,31 @@ function GM:IsBabyMode() end function GM:PostRender() - if self.m_ZombieVision and MySelf:IsValid() and MySelf:Team() == TEAM_UNDEAD then - local eyepos = EyePos() - local eyedir = EyeAngles():Forward() - --local tr = util.TraceLine({start = eyepos, endpos = eyepos + eyedir * 128, mask = MASK_SOLID_BRUSHONLY}) - - local dlight = DynamicLight(MySelf:EntIndex()) - if dlight then - dlight.Pos = MySelf:GetShootPos() - dlight.r = 10 - dlight.g = 255 - dlight.b = 80 - dlight.Brightness = 0.5 - dlight.Size = 2048 - dlight.Decay = 900 - dlight.DieTime = CurTime() + 2 - end - end end local lastwarntim = -1 -local NextGas = 0 +--local NextGas = 0 function GM:_Think() + local time = CurTime() + if self:GetEscapeStage() == ESCAPESTAGE_DEATH then self.DeathFog = math.min(self.DeathFog + FrameTime() / 5, 1) - if CurTime() >= NextGas then - NextGas = CurTime() + 0.01 + --[[if time >= NextGas then + NextGas = time + 0.01 + local randdir, emitpos, particle local eyepos = EyePos() local emitter = ParticleEmitter(eyepos) for i=1, 3 do - local randdir = VectorRand() + randdir = VectorRand() randdir.z = math.abs(randdir.z) randdir:Normalize() - local emitpos = eyepos + randdir * math.Rand(0, 1200) + emitpos = eyepos + randdir * math.Rand(0, 1200) - local particle = emitter:Add("particles/smokey", emitpos) + particle = emitter:Add("particles/smokey", emitpos) particle:SetVelocity(randdir * math.Rand(8, 256)) particle:SetAirResistance(16) particle:SetDieTime(math.Rand(2.2, 3.5)) @@ -514,8 +693,8 @@ function GM:_Think() particle:SetColor(0, math.Rand(20, 45), 0) end - emitter:Finish() - end + emitter:Finish() emitter = nil collectgarbage("step", 64) + end]] elseif self.DeathFog > 0 then self.DeathFog = math.max(self.DeathFog - FrameTime() / 5, 0) end @@ -532,23 +711,24 @@ function GM:_Think() local endtime = self:GetWaveActive() and self:GetWaveEnd() or self:GetWaveStart() if endtime ~= -1 then - local timleft = math.max(0, endtime - CurTime()) + local timleft = math.max(0, endtime - time) if timleft <= 10 and lastwarntim ~= math.ceil(timleft) then lastwarntim = math.ceil(timleft) if 0 < lastwarntim then - surface_PlaySound("buttons/lightswitch2.wav") + LocalPlayer():EmitSound("buttons/lightswitch2.wav", 100, 110 - lastwarntim * 2) end end end - local myteam = MySelf:Team() + local myteam = P_Team(MySelf) self:PlayBeats(myteam, self:CachedFearPower()) + local thirdperson if myteam == TEAM_HUMAN then local wep = MySelf:GetActiveWeapon() if wep:IsValid() and wep.GetIronsights and wep:GetIronsights() then - self.FOVLerp = math.Approach(self.FOVLerp, wep.IronsightsMultiplier or 0.6, FrameTime() * 4) + self.FOVLerp = math.Approach(self.FOVLerp, wep.IsScoped and not self.DisableScopes and wep.IronsightsMultiplier or not wep.IsScoped and wep.IronsightsMultiplier or 0.6, FrameTime() * 4) elseif self.FOVLerp ~= 1 then self.FOVLerp = math.Approach(self.FOVLerp, 1, FrameTime() * 5) end @@ -556,19 +736,27 @@ function GM:_Think() if MySelf:GetBarricadeGhosting() then MySelf:BarricadeGhostingThink() end + thirdperson = self.OverTheShoulder else self.HeartBeatTime = self.HeartBeatTime + (6 + self:CachedFearPower() * 5) * FrameTime() + thirdperson = self.ZombieThirdPerson - if not MySelf:Alive() then + --[[if not MySelf:Alive() then self:ToggleZombieVision(false) - end + end]] end + self.TransparencyRadius = thirdperson and self.TransparencyRadius3p or self.TransparencyRadius1p + + local tab for _, pl in pairs(player.GetAll()) do - if pl:Team() == TEAM_UNDEAD then - local tab = pl:GetZombieClassTable() + if P_Team(pl) == TEAM_UNDEAD then + tab = pl:GetZombieClassTable() if tab.BuildBonePositions then - pl.WasBuildingBonePositions = true + if not pl.WasBuildingBonePositions then + pl.BuildingBones = pl:GetBoneCount() - 1 + pl.WasBuildingBonePositions = true + end pl:ResetBones() tab.BuildBonePositions(tab, pl) elseif pl.WasBuildingBonePositions then @@ -592,9 +780,10 @@ local LastBeatLevel = 0 function GM:PlayBeats(teamid, fear) if RealTime() <= NextBeat or not gamemode.Call("ShouldPlayBeats", teamid, fear) then return end + --if (LASTHUMAN or self:GetAllSigilsDestroyed()) and cv_ShouldPlayMusic:GetBool() then if LASTHUMAN and cv_ShouldPlayMusic:GetBool() then MySelf:EmitSound(self.LastHumanSound, 0, 100, self.BeatsVolume) - NextBeat = RealTime() + (self.SoundDuration[snd] or SoundDuration(self.LastHumanSound)) - 0.025 + NextBeat = RealTime() + SoundDuration(self.LastHumanSound) - 0.025 return end @@ -631,33 +820,69 @@ function GM:DrawPackUpBar(x, y, fraction, notowner, screenscale) draw_SimpleText(notowner and CurTime() % 2 < 1 and translate.Format("requires_x_people", 4) or notowner and translate.Get("packing_others_object") or translate.Get("packing"), "ZSHUDFontSmall", x, y - draw_GetFontHeight("ZSHUDFontSmall") - 2, col, TEXT_ALIGN_CENTER) end +local colSigilTeleport = Color(125, 215, 255, 220) +function GM:DrawSigilTeleportBar(x, y, fraction, target, screenscale) + local maxbarwidth = 270 * screenscale + local barheight = 11 * screenscale + local barwidth = maxbarwidth * math.Clamp(fraction, 0, 1) + local startx = x - maxbarwidth * 0.5 + + local letter = "?" + for i, sigil in pairs(ents.FindByClass("prop_obj_sigil")) do + if target == sigil then + letter = string.char(64 + i) + break + end + end + + surface_SetDrawColor(0, 0, 0, 220) + surface_DrawRect(startx, y, maxbarwidth, barheight) + surface_SetDrawColor(colSigilTeleport) + surface_DrawRect(startx + 3, y + 3, barwidth - 6, barheight - 6) + surface_DrawOutlinedRect(startx, y, maxbarwidth, barheight) + + draw_SimpleText(translate.Format("teleporting_to_sigil", letter), "ZSHUDFontSmall", x, y - draw_GetFontHeight("ZSHUDFontSmall") - 2, colSigilTeleport, TEXT_ALIGN_CENTER) + draw_SimpleText(translate.Get("press_shift_to_cancel"), "ZSHUDFontSmaller", x, y + draw_GetFontHeight("ZSHUDFontSmaller") - 16, colSigilTeleport, TEXT_ALIGN_CENTER) + draw_SimpleText(translate.Get("point_at_a_sigil_to_choose_destination"), "ZSHUDFontSmaller", x, y + draw_GetFontHeight("ZSHUDFontSmaller") * 2 - 16, colSigilTeleport, TEXT_ALIGN_CENTER) +end + function GM:HumanHUD(screenscale) local curtime = CurTime() local w, h = ScrW(), ScrH() local packup = MySelf.PackUp + local sigiltp = MySelf.SigilTeleport if packup and packup:IsValid() then self:DrawPackUpBar(w * 0.5, h * 0.55, 1 - packup:GetTimeRemaining() / packup:GetMaxTime(), packup:GetNotOwner(), screenscale) + elseif sigiltp and sigiltp:IsValid() then + self:DrawSigilTeleportBar(w * 0.5, h * 0.55, 1 - sigiltp:GetTimeRemaining() / sigiltp:GetMaxTime(), sigiltp:GetTargetSigil(), screenscale) end if not self.RoundEnded then if self:GetWave() == 0 and not self:GetWaveActive() then local txth = draw_GetFontHeight("ZSHUDFontSmall") - draw_SimpleTextBlurry(translate.Get("waiting_for_players").." "..util.ToMinutesSeconds(math.max(0, self:GetWaveStart() - curtime)), "ZSHUDFontSmall", w * 0.5, h * 0.25, COLOR_GRAY, TEXT_ALIGN_CENTER) - draw_SimpleTextBlurry(translate.Get("humans_closest_to_spawns_are_zombies"), "ZSHUDFontSmall", w * 0.5, h * 0.25 + txth, COLOR_GRAY, TEXT_ALIGN_CENTER) - local desiredzombies = self:GetDesiredStartingZombies() - draw_SimpleTextBlurry(translate.Format("number_of_initial_zombies_this_game", self.WaveOneZombies * 100, desiredzombies), "ZSHUDFontSmall", w * 0.5, h * 0.75, COLOR_GRAY, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("waiting_for_players").." "..util.ToMinutesSecondsCD(math.max(0, self:GetWaveStart() - curtime)), "ZSHUDFontSmall", w * 0.5, h * 0.25, COLOR_GRAY, TEXT_ALIGN_CENTER) - draw_SimpleTextBlurry(translate.Get("zombie_volunteers"), "ZSHUDFontSmall", w * 0.5, h * 0.75 + txth, COLOR_GRAY, TEXT_ALIGN_CENTER) - local y = h * 0.75 + txth * 2 + if desiredzombies > 0 then + draw_SimpleTextBlurry(translate.Get(self:HasSigils() and "humans_furthest_from_sigils_are_zombies" or "humans_closest_to_spawns_are_zombies"), "ZSHUDFontSmall", w * 0.5, h * 0.25 + txth, COLOR_GRAY, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Format("number_of_initial_zombies_this_game", self.WaveOneZombies * 100, desiredzombies), "ZSHUDFontSmall", w * 0.5, h * 0.7, COLOR_GRAY, TEXT_ALIGN_CENTER) - txth = draw_GetFontHeight("ZSHUDFontTiny") - for i, pl in ipairs(self.ZombieVolunteers) do - if pl:IsValid() then - draw_SimpleTextBlurry(pl:Name(), "ZSHUDFontTiny", w * 0.5, y, pl == MySelf and COLOR_RED or COLOR_GRAY, TEXT_ALIGN_CENTER) - y = y + txth + for i, pl in ipairs(self.ZombieVolunteers) do + if pl:IsValid() then + draw_SimpleTextBlurry(translate.Get("zombie_volunteers"), "ZSHUDFontSmall", w * 0.5, h * 0.7 + txth, COLOR_GRAY, TEXT_ALIGN_CENTER) + break + end + end + + local y = h * 0.7 + txth * 1.9 + txth = draw_GetFontHeight("ZSHUDFontTiny") + for i, pl in ipairs(self.ZombieVolunteers) do + if pl:IsValid() then + draw_SimpleTextBlurry(pl:Name(), "ZSHUDFontTiny", w * 0.5, y, pl == MySelf and COLOR_SOFTRED or COLOR_GRAY, TEXT_ALIGN_CENTER) + y = y + txth * 0.8 + end end end end @@ -669,30 +894,26 @@ function GM:HumanHUD(screenscale) surface_SetDrawColor(30, 30, 230, 180) surface_DrawOutlinedRect(w * 0.4, h * 0.35, w * 0.2, 12) surface_DrawRect(w * 0.4, h * 0.35, w * 0.2 * (1 - drown:GetDrown()), 12) - draw_SimpleTextBlurry(translate.Get("breath").." ", "ZSHUDFontSmall", w * 0.4, h * 0.35 + 6, COLOR_BLUE, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("breath").." ", "ZSHUDFontSmall", w * 0.4, h * 0.35 + 6, COLOR_LBLUE, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) end end + local lockon = self.HumanMenuLockOn + if lockon and self:ValidMenuLockOnTarget(MySelf, lockon) then + local txth = draw_GetFontHeight("ZSHUDFontSmall") + draw_SimpleTextBlurry(translate.Format("giving_items_to", lockon:Name()), "ZSHUDFontSmall", w * 0.5, h * 0.55 + txth, COLOR_GRAY, TEXT_ALIGN_CENTER) + end + if gamemode.Call("PlayerCanPurchase", MySelf) then - if self:GetWaveActive() then - draw_SimpleTextBlurry(translate.Get("press_f2_for_the_points_shop"), "ZSHUDFontSmall", w * 0.5, 8, COLOR_GRAY, TEXT_ALIGN_CENTER) - else - local th = draw_GetFontHeight("ZSHUDFontSmall") - draw_SimpleTextBlurry(translate.Get("press_f2_for_the_points_shop"), "ZSHUDFontSmall", w * 0.5, 8, COLOR_GRAY, TEXT_ALIGN_CENTER) - draw_SimpleTextBlurry(translate.Format("x_discount_for_buying_between_waves", self.ArsenalCrateDiscountPercentage), "ZSHUDFontSmall", w * 0.5, 9 + th, COLOR_GRAY, TEXT_ALIGN_CENTER) - end + draw_SimpleTextBlurry(translate.Get("press_f2_for_the_points_shop"), "ZSHUDFontSmall", w * 0.5, screenscale * 135, COLOR_GRAY, TEXT_ALIGN_CENTER) end end -function GM:HUDPaint() -end - function GM:_HUDPaint() if self.FilmMode then return end local screenscale = BetterScreenScale() - - local myteam = MySelf:Team() + local myteam = P_Team(MySelf) self:HUDDrawTargetID(myteam, screenscale) @@ -707,7 +928,7 @@ function GM:_HUDPaint() end if GetGlobalBool("classicmode") then - draw_SimpleTextBlurry(translate.Get("classic_mode"), "ZSHUDFontSmaller", 4, ScrH() - 4, COLOR_GRAY, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) + draw_SimpleTextBlurry(translate.Get("classic_mode"), "ZSHUDFontSmaller", 4, ScrH() - 4, COLOR_GRAY, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM_REAL) end end @@ -715,39 +936,37 @@ function GM:ZombieObserverHUD(obsmode) local w, h = ScrW(), ScrH() local texh = draw_GetFontHeight("ZSHUDFontSmall") - local dyn - if obsmode == OBS_MODE_CHASE then local target = MySelf:GetObserverTarget() if target and target:IsValid() then - if target:IsPlayer() and target:Team() == TEAM_UNDEAD then + if target:IsPlayer() and P_Team(target) == TEAM_UNDEAD then draw_SimpleTextBlur(translate.Format("observing_x", target:Name(), math.max(0, target:Health())), "ZSHUDFontSmall", w * 0.5, h * 0.75 - texh - 32, COLOR_DARKRED, TEXT_ALIGN_CENTER) end + if target.IsCreeperNest or target.MinionSpawn then + local txt = target.IsCreeperNest and "Nest" or "Gore Child" + + draw_SimpleTextBlur(translate.Format("observing_x_simple", txt), "ZSHUDFontSmall", w * 0.5, h * 0.75 - texh - 32, COLOR_DARKRED, TEXT_ALIGN_CENTER) + end + dyn = self:GetDynamicSpawning() and self:DynamicSpawnIsValid(target) end end + local space = texh + 2 + local x, y = w / 2, h * 0.68 + if self:GetWaveActive() then - draw_SimpleTextBlur(dyn and translate.Get("press_lmb_to_spawn_on_them") or translate.Get("press_lmb_to_spawn"), "ZSHUDFontSmall", w * 0.5, h * 0.75, dyn and COLOR_DARKGREEN or COLOR_DARKRED, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("press_lmb_to_spawn"), "ZSHUDFontSmall", x, y, COLOR_GRAY, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("press_rmb_to_spawn_close"), "ZSHUDFontSmall", x, y + space, COLOR_GRAY, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("press_reload_to_spawn_far"), "ZSHUDFontSmall", x, y + space * 2, COLOR_GRAY, TEXT_ALIGN_CENTER) + draw_SimpleTextBlurry(translate.Get("press_alt_nest_menu"), "ZSHUDFontSmaller", x, y + space * 4, COLOR_GRAY, TEXT_ALIGN_CENTER) end - local space = texh + 8 - draw_SimpleTextBlur(translate.Get("press_rmb_to_cycle_targets"), "ZSHUDFontSmall", w * 0.5, h * 0.75 + space, COLOR_DARKRED, TEXT_ALIGN_CENTER) - draw_SimpleTextBlur(translate.Get("press_reload_to_spawn_at_normal_point"), "ZSHUDFontSmall", w * 0.5, h * 0.75 + space * 2, COLOR_DARKRED, TEXT_ALIGN_CENTER) - draw_SimpleTextBlur(translate.Get("press_jump_to_free_roam"), "ZSHUDFontSmall", w * 0.5, h * 0.75 + space * 3, COLOR_DARKRED, TEXT_ALIGN_CENTER) - - for _, ent in pairs(ents.FindByClass("prop_thrownbaby")) do - if ent:GetSettled() then - draw_SimpleTextBlur(translate.Format("press_walk_to_spawn_as_x", self.ZombieClasses["Gore Child"].Name), "ZSHUDFontSmall", w * 0.5, h * 0.75 + space * 3, COLOR_DARKRED, TEXT_ALIGN_CENTER) - break - end - end + draw_SimpleTextBlurry(translate.Get("press_jump_to_free_roam"), "ZSHUDFontSmall", x, y + space * 3, COLOR_GRAY, TEXT_ALIGN_CENTER) end -local matHumanHeadID = Material("zombiesurvival/humanhead") -local matZombieHeadID = Material("zombiesurvival/zombiehead") -local colLifeStats = Color(255, 0, 0, 255) +local colLifeStats = Color(255, 50, 50, 255) function GM:ZombieHUD() if self.LifeStatsEndTime and CurTime() < self.LifeStatsEndTime and (self.LifeStatsBarricadeDamage > 0 or self.LifeStatsHumanDamage > 0 or self.LifeStatsBrainsEaten > 0) then colLifeStats.a = math.Clamp((self.LifeStatsEndTime - CurTime()) / (self.LifeStatsLifeTime * 0.33), 0, 1) * 255 @@ -776,33 +995,30 @@ function GM:ZombieHUD() local obsmode = MySelf:GetObserverMode() if obsmode ~= OBS_MODE_NONE then self:ZombieObserverHUD(obsmode) - elseif not self:GetWaveActive() and not MySelf:Alive() then - local th = draw_GetFontHeight("ZSHUDFont") + elseif not MySelf:Alive() then local x = ScrW() * 0.5 local y = ScrH() * 0.3 - draw_SimpleTextBlur(translate.Get("waiting_for_next_wave"), "ZSHUDFont", x, y, COLOR_DARKRED, TEXT_ALIGN_CENTER) - local pl = GAMEMODE.NextBossZombie - local bossname = GAMEMODE.NextBossZombieClass - if pl and pl:IsValid() then - if pl == MySelf then - draw_SimpleTextBlur(translate.Format("you_will_be_x_soon", "'"..bossname.."'"), "ZSHUDFont", x, y+th, COLOR_RED, TEXT_ALIGN_CENTER) - else - draw_SimpleTextBlur(translate.Format("x_will_be_y_soon", pl:Name(), "'"..bossname.."'"), "ZSHUDFont", x, y+th, COLOR_GRAY, TEXT_ALIGN_CENTER) - end + + if not self:GetWaveActive() then + draw_SimpleTextBlur(translate.Get("waiting_for_next_wave"), "ZSHUDFont", x, y, COLOR_DARKRED, TEXT_ALIGN_CENTER) end - if MySelf:GetZombieClassTable().NeverAlive then - for _, ent in pairs(ents.FindByClass("prop_thrownbaby")) do - if ent:GetSettled() then - draw_SimpleTextBlur(translate.Format("press_walk_to_spawn_as_x", self.ZombieClasses["Gore Child"].Name), "ZSHUDFontSmall", w * 0.5, h * 0.75, COLOR_DARKRED, TEXT_ALIGN_CENTER) - break - end + end + + if not self:GetWaveActive() and self:GetWave() ~= 0 then + local pl = GAMEMODE.NextBossZombie + if pl and pl:IsValid() then + local x, y = ScrW() / 2, ScrH() * 0.3 + draw_GetFontHeight("ZSHUDFont") + if pl == MySelf then + draw_SimpleTextBlur(translate.Format("you_will_be_x_soon", GAMEMODE.NextBossZombieClass), "ZSHUDFont", x, y, Color(255, 50, 50), TEXT_ALIGN_CENTER) + else + draw_SimpleTextBlur(translate.Format("x_will_be_y_soon", pl:Name(), GAMEMODE.NextBossZombieClass), "ZSHUDFont", x, y, COLOR_GRAY, TEXT_ALIGN_CENTER) end end end end function GM:RequestedDefaultCart() - local defaultcart = GetConVarString("zs_defaultcart") + local defaultcart = GetConVar("zs_defaultcart"):GetString() if #defaultcart > 0 then defaultcart = string.lower(defaultcart) @@ -823,6 +1039,214 @@ function GM:_PostDrawTranslucentRenderables() if not self.DrawingInSky then self:DrawPointWorldHints() self:DrawWorldHints() + self:DrawSigilIndicators() + self:DrawCrateIndicators() + self:DrawResupplyIndicators() + self:DrawRemantlerIndicators() + self:DrawHumanIndicators() + self:DrawNestIndicators() + end +end + +function GM:DrawCrateIndicators() + if P_Team(MySelf) ~= TEAM_HUMAN or not MySelf:IsSkillActive(SKILL_INSIGHT) then return end + + local pos, distance, ang, deployable, alpha + local eyepos = EyePos() + + surface_SetMaterial(matArsenal) + + for i, arsenal in pairs(GAMEMODE.CachedArsenalEntities) do + if not arsenal:IsValid() then continue end + deployable = arsenal.GetObjectOwner + + pos = arsenal:GetPos() + pos.z = pos.z + (arsenal:IsPlayer() and 32 or (deployable and 12 or -8)) + distance = eyepos:DistToSqr(pos) + + if (distance >= 6400 and distance <= 1048576) and (not deployable or not WorldVisible(eyepos, pos)) then -- Limited to Scavenger's Eyes distance. + ang = (eyepos - pos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + alpha = math.min(220, math.sqrt(distance / 4)) + + cam_IgnoreZ(true) + cam_Start3D2D(pos, ang, math.max(250, math.sqrt(distance)) / 5000) + + surface_SetDrawColor(255, 255, 255, alpha) + surface_DrawTexturedRect(-123, -113, 248, 228) + + draw_SimpleTextBlurry("Arsenal Crate", "ZS3D2DFont2Big", 0, 128, COLOR_GRAY, TEXT_ALIGN_CENTER) + + cam_End3D2D() + cam_IgnoreZ(false) + end + end +end + +function GM:DrawResupplyIndicators() + if P_Team(MySelf) ~= TEAM_HUMAN or not MySelf:IsSkillActive(SKILL_ACUITY) then return end + + local pos, distance, ang, deployable, alpha + local eyepos = EyePos() + + surface_SetMaterial(matResupply) + + for i, resupply in pairs(GAMEMODE.CachedResupplyEntities) do + if not resupply:IsValid() then continue end + deployable = resupply.GetObjectOwner + + pos = resupply:GetPos() + pos.z = pos.z + (resupply:IsPlayer() and 32 or (deployable and 12 or -8)) + distance = eyepos:DistToSqr(pos) + + if (distance >= 6400 and distance <= 1048576) and (not deployable or not WorldVisible(eyepos, pos)) then -- Limited to Scavenger's Eyes distance. + ang = (eyepos - pos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + alpha = math.min(220, math.sqrt(distance / 4)) + + cam_IgnoreZ(true) + cam_Start3D2D(pos, ang, math.max(250, math.sqrt(distance)) / 5000) + + surface_SetDrawColor(255, 255, 255, alpha) + surface_DrawTexturedRect(-128, -128, 256, 256) + + local timeremain = math.ceil(math.max(0, (MySelf.NextUse or 0) - CurTime())) + local txt = not MySelf.NextUse and translate.Get("ready") or timeremain > 0 and timeremain or translate.Get("ready") + draw_SimpleTextBlurry(txt, "ZS3D2DFont2Big", 0, 128, COLOR_GRAY, TEXT_ALIGN_CENTER) + + cam_End3D2D() + cam_IgnoreZ(false) + end + end +end + +function GM:DrawRemantlerIndicators() + if P_Team(MySelf) ~= TEAM_HUMAN or not MySelf:IsSkillActive(SKILL_VISION) then return end + + local pos, distance, ang, deployable, alpha + local eyepos = EyePos() + + surface_SetMaterial(matRemantler) + + for i, remantler in pairs(GAMEMODE.CachedRemantlerEntities) do + if not remantler:IsValid() then continue end + deployable = remantler.GetObjectOwner + + pos = remantler:GetPos() + pos.z = pos.z + (remantler:IsPlayer() and 32 or (deployable and 12 or -8)) + distance = eyepos:DistToSqr(pos) + + if (distance >= 6400 and distance <= 1048576) and (not deployable or not WorldVisible(eyepos, pos)) then -- Limited to Scavenger's Eyes distance. + ang = (eyepos - pos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + alpha = math.min(220, math.sqrt(distance / 4)) + + cam_IgnoreZ(true) + cam_Start3D2D(pos, ang, math.max(250, math.sqrt(distance)) / 5000) + + surface_SetDrawColor(255, 255, 255, alpha) + surface_DrawTexturedRect(-128, -128, 256, 256) + + draw_SimpleTextBlurry("Weapon Remantler", "ZS3D2DFont2Big", 0, 128, COLOR_GRAY, TEXT_ALIGN_CENTER) + + cam_End3D2D() + cam_IgnoreZ(false) + end + end +end + +function GM:DrawNestIndicators() + if P_Team(MySelf) ~= TEAM_ZOMBIE then return end + + local pos, distance, ang, alpha + local eyepos = EyePos() + + surface_SetMaterial(matNest) + + for i, nest in pairs(GAMEMODE.CachedNests) do + if not nest:IsValid() then continue end + + pos = nest:GetPos() + pos.z = pos.z + 32 + distance = eyepos:DistToSqr(pos) + + ang = (eyepos - pos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + alpha = math.min(220, math.sqrt(distance / 4)) + + cam_IgnoreZ(true) + cam_Start3D2D(pos, ang, math.max(250, math.sqrt(distance)) / 5000) + + surface_SetDrawColor(255, 255, 255, alpha) + surface_DrawTexturedRect(-128, -128, 256, 256) + + draw_SimpleTextBlurry("Nest", "ZS3D2DFont2Big", 0, 128, COLOR_GRAY, TEXT_ALIGN_CENTER) + + if distance < 80000 then + local nown = nest:GetNestOwner() + local ownname = nown:IsValidZombie() and nown:ClippedName() or "" + + draw_SimpleTextBlurry(ownname, "ZS3D2DFont2", 0, 256, COLOR_GRAY, TEXT_ALIGN_CENTER) + end + + cam_End3D2D() + cam_IgnoreZ(false) + end +end + +function GM:DrawSigilIndicators() + if not self:GetUseSigils() then return end + + local health, pos, distance, maxhealth, corrupted, damageflash, missinghealthfrac, ang, alpha + local eyepos = EyePos() + + surface_SetMaterial(matSigil) + + for i, sigil in pairs(GAMEMODE.CachedSigils) do + if not sigil:IsValid() then continue end + + health = sigil:GetSigilHealth() + if health > 0 then + pos = sigil:GetPos() + pos.z = pos.z + 48 + distance = eyepos:DistToSqr(pos) + + maxhealth = sigil:GetSigilMaxHealth() + corrupted = sigil:GetSigilCorrupted() + damageflash = math.min((CurTime() - sigil:GetSigilLastDamaged()) * 2, 1) * 255 + missinghealthfrac = 1 - health / maxhealth + alpha = math.min(220, math.sqrt(distance / 4)) + + ang = (eyepos - pos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + + cam_IgnoreZ(true) + cam_Start3D2D(pos, ang, math.max(250, math.sqrt(distance)) / 5000) + local oldfogmode = render_GetFogMode() + render_FogMode(0) + + if corrupted then + surface_SetDrawColor(255 - damageflash, damageflash, 0, alpha) + else + surface_SetDrawColor(damageflash, 255, damageflash, alpha) + end + surface_DrawTexturedRect(-64, -128, 128, 256) + if missinghealthfrac > 0 then + surface_SetDrawColor(40, 40, 40, 255) + surface_DrawTexturedRectUV(-64, -128, 128, 256 * missinghealthfrac, 0, 0, 1, missinghealthfrac) + end + + draw_SimpleTextBlurry(string.char(64 + i), "ZS3D2DFont2Big", 0, 128, COLOR_GRAY, TEXT_ALIGN_CENTER) + + render_FogMode(oldfogmode) + cam_End3D2D() + cam_IgnoreZ(false) + end end end @@ -831,11 +1255,13 @@ function GM:RestartRound() self.RoundEnded = nil LASTHUMAN = nil - if pEndBoard and pEndBoard:Valid() then + if pEndBoard and pEndBoard:IsValid() then pEndBoard:Remove() pEndBoard = nil end + self:ClearItemStocks() + self:InitPostEntity() self:RevertZombieClasses() @@ -864,99 +1290,149 @@ function surface.CreateLegacyFont(font, size, weight, antialias, additive, name, surface.CreateFont(name, {font = font, size = size, weight = weight, antialias = antialias, additive = additive, shadow = shadow, outline = outline, blursize = blursize}) end -function GM:CreateFonts() - local fontfamily = "Typenoksidi" - local fontfamily3d = "hidden" - local fontweight = 0 +local fontfamily = "Ghoulish Fright AOE" +local fontfamilysm = "Remington Noiseless" +local fontfamily3d = "hidden" +local fontsizeadd = 8 +local fontweight = 0 + +function GM:Create3DFonts() + local fontsizeadd3D = 0 local fontweight3D = 0 - local fontaa = true - local fontshadow = false - local fontoutline = true - surface.CreateLegacyFont("csd", 42, 500, true, false, "healthsign", false, true) + surface.CreateLegacyFont(fontfamily3d, 28 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontSmaller", false, true) + surface.CreateLegacyFont(fontfamily3d, 48 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontSmall", false, true) + surface.CreateLegacyFont(fontfamily3d, 72 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont", false, true) + surface.CreateLegacyFont(fontfamily3d, 128 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontBig", false, true) + surface.CreateLegacyFont(fontfamily3d, 28 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontSmallerBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily3d, 48 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontSmallBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily3d, 72 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily3d, 128 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFontBigBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily, 40 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2Smaller", false, true) + surface.CreateLegacyFont(fontfamily, 48 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2Small", false, true) + surface.CreateLegacyFont(fontfamily, 72 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2", false, true) + surface.CreateLegacyFont(fontfamily, 128 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2Big", false, true) + surface.CreateLegacyFont(fontfamily, 40 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2SmallerBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily, 48 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2SmallBlur", false, false, 16) + surface.CreateLegacyFont(fontfamily, 72 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2Blur", false, false, 16) + surface.CreateLegacyFont(fontfamily, 128 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DFont2BigBlur", false, false, 16) + + surface.CreateLegacyFont(fontfamilysm, 14 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DUnstyleTiny", false, true) + surface.CreateLegacyFont(fontfamilysm, 24 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DUnstyleSmallest", false, true) + surface.CreateLegacyFont(fontfamilysm, 36 + fontsizeadd3D, fontweight3D, false, false, "ZS3D2DUnstyleSmaller", false, true) +end + +function GM:CreateNonScaleFonts() surface.CreateLegacyFont("tahoma", 96, 1000, true, false, "zshintfont", false, true) - surface.CreateLegacyFont(fontfamily3d, 48, fontweight3D, false, false, "ZS3D2DFontSmall", false, true) - surface.CreateLegacyFont(fontfamily3d, 72, fontweight3D, false, false, "ZS3D2DFont", false, true) - surface.CreateLegacyFont(fontfamily3d, 128, fontweight3D, false, false, "ZS3D2DFontBig", false, true) - surface.CreateLegacyFont(fontfamily3d, 48, fontweight3D, false, false, "ZS3D2DFontSmallBlur", false, false, 16) - surface.CreateLegacyFont(fontfamily3d, 72, fontweight3D, false, false, "ZS3D2DFontBlur", false, false, 16) - surface.CreateLegacyFont(fontfamily3d, 128, fontweight3D, false, false, "ZS3D2DFontBigBlur", false, false, 16) - surface.CreateLegacyFont(fontfamily, 40, fontweight3D, false, false, "ZS3D2DFont2Smaller", false, true) - surface.CreateLegacyFont(fontfamily, 48, fontweight3D, false, false, "ZS3D2DFont2Small", false, true) - surface.CreateLegacyFont(fontfamily, 72, fontweight3D, false, false, "ZS3D2DFont2", false, true) - surface.CreateLegacyFont(fontfamily, 128, fontweight3D, false, false, "ZS3D2DFont2Big", false, true) - surface.CreateLegacyFont(fontfamily, 40, fontweight3D, false, false, "ZS3D2DFont2SmallerBlur", false, false, 16) - surface.CreateLegacyFont(fontfamily, 48, fontweight3D, false, false, "ZS3D2DFont2SmallBlur", false, false, 16) - surface.CreateLegacyFont(fontfamily, 72, fontweight3D, false, false, "ZS3D2DFont2Blur", false, false, 16) - surface.CreateLegacyFont(fontfamily, 128, fontweight3D, false, false, "ZS3D2DFont2BigBlur", false, false, 16) - - local screenscale = BetterScreenScale() - - surface.CreateLegacyFont("csd", screenscale * 36, 100, true, false, "zsdeathnoticecs", false, true) - surface.CreateLegacyFont("HL2MP", screenscale * 36, 100, true, false, "zsdeathnotice", false, true) - - surface.CreateLegacyFont(fontfamily, screenscale * 16, fontweight, fontaa, false, "ZSHUDFontTiny", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 20, fontweight, fontaa, false, "ZSHUDFontSmallest", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 22, fontweight, fontaa, false, "ZSHUDFontSmaller", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 28, fontweight, fontaa, false, "ZSHUDFontSmall", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 42, fontweight, fontaa, false, "ZSHUDFont", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 72, fontweight, fontaa, false, "ZSHUDFontBig", fontshadow, fontoutline) - surface.CreateLegacyFont(fontfamily, screenscale * 16, fontweight, fontaa, false, "ZSHUDFontTinyBlur", false, false, 8) - surface.CreateLegacyFont(fontfamily, screenscale * 22, fontweight, fontaa, false, "ZSHUDFontSmallerBlur", false, false, 8) - surface.CreateLegacyFont(fontfamily, screenscale * 28, fontweight, fontaa, false, "ZSHUDFontSmallBlur", false, false, 8) - surface.CreateLegacyFont(fontfamily, screenscale * 42, fontweight, fontaa, false, "ZSHUDFontBlur", false, false, 8) - surface.CreateLegacyFont(fontfamily, screenscale * 72, fontweight, fontaa, false, "ZSHUDFontBigBlur", false, false, 8) - - surface.CreateLegacyFont(fontfamily, screenscale * 16, 0, fontaa, false, "ZSAmmoName", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 16, fontweight, fontaa, false, "ZSHUDFontTinyNS", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 20, fontweight, fontaa, false, "ZSHUDFontSmallestNS", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 22, fontweight, fontaa, false, "ZSHUDFontSmallerNS", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 28, fontweight, fontaa, false, "ZSHUDFontSmallNS", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 42, fontweight, fontaa, false, "ZSHUDFontNS", false, false) - surface.CreateLegacyFont(fontfamily, screenscale * 72, fontweight, fontaa, false, "ZSHUDFontBigNS", false, false) - - surface.CreateLegacyFont(fontfamily, screenscale * 16, 0, true, false, "ZSDamageResistance", false, true) - surface.CreateLegacyFont(fontfamily, screenscale * 16, 0, true, false, "ZSDamageResistanceBlur", false, true) - - surface.CreateLegacyFont(fontfamily, 32, fontweight, true, false, "ZSScoreBoardTitle", false, true) - surface.CreateLegacyFont(fontfamily, 22, fontweight, true, false, "ZSScoreBoardSubTitle", false, true) - surface.CreateLegacyFont(fontfamily, 16, fontweight, true, false, "ZSScoreBoardPlayer", false, true) - surface.CreateLegacyFont(fontfamily, 24, fontweight, true, false, "ZSScoreBoardHeading", false, false) - surface.CreateLegacyFont("arial", 20, 0, true, false, "ZSScoreBoardPlayerSmall", false, true) - -- Default, DefaultBold, DefaultSmall, etc. were changed when gmod13 hit. These are renamed fonts that have the old values. surface.CreateFont("DefaultFontVerySmall", {font = "tahoma", size = 10, weight = 0, antialias = false}) surface.CreateFont("DefaultFontSmall", {font = "tahoma", size = 11, weight = 0, antialias = false}) surface.CreateFont("DefaultFontSmallDropShadow", {font = "tahoma", size = 11, weight = 0, shadow = true, antialias = false}) surface.CreateFont("DefaultFont", {font = "tahoma", size = 13, weight = 500, antialias = false}) + surface.CreateFont("DefaultFontAA", {font = "tahoma", size = 13, weight = 500, antialias = true}) surface.CreateFont("DefaultFontBold", {font = "tahoma", size = 13, weight = 1000, antialias = false}) surface.CreateFont("DefaultFontLarge", {font = "tahoma", size = 16, weight = 0, antialias = false}) + surface.CreateFont("DefaultFontLargeAA", {font = "tahoma", size = 16, weight = 0, antialias = true}) + surface.CreateFont("DefaultFontLargest", {font = "tahoma", size = 22, weight = 0, antialias = false}) + surface.CreateFont("DefaultFontLargestAA", {font = "tahoma", size = 22, weight = 0, antialias = true}) +end + +function GM:CreateScalingFonts() + local fontaa = true + local fontshadow = false + local fontoutline = true + + local screenscale = BetterScreenScale() + + surface.CreateLegacyFont("csd", screenscale * 42, 100, true, false, "zsdeathnoticecs", false, false) + surface.CreateLegacyFont("HL2MP", screenscale * 42, 100, true, false, "zsdeathnotice", false, false) + + surface.CreateLegacyFont("csd", screenscale * 96, 100, true, false, "zsdeathnoticecsws", false, false) + surface.CreateLegacyFont("HL2MP", screenscale * 96, 100, true, false, "zsdeathnoticews", false, false) + + surface.CreateLegacyFont("csd", screenscale * 72, 100, true, false, "zsdeathnoticecspa", false, false) + surface.CreateLegacyFont("HL2MP", screenscale * 72, 100, true, false, "zsdeathnoticepa", false, false) + + surface.CreateLegacyFont(fontfamily, screenscale * (16 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontTiny", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (20 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallest", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (22 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmaller", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (28 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmall", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (42 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFont", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (72 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontBig", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamily, screenscale * (16 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontTinyBlur", false, false, 8) + surface.CreateLegacyFont(fontfamily, screenscale * (22 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallerBlur", false, false, 8) + surface.CreateLegacyFont(fontfamily, screenscale * (28 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallBlur", false, false, 8) + surface.CreateLegacyFont(fontfamily, screenscale * (42 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontBlur", false, false, 8) + surface.CreateLegacyFont(fontfamily, screenscale * (72 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontBigBlur", false, false, 8) + + surface.CreateLegacyFont(fontfamily, screenscale * (20 + fontsizeadd/2), 0, fontaa, false, "ZSAmmoName", false, false) + + local liscreenscale = math.max(0.95, BetterScreenScale()) + + surface.CreateLegacyFont(fontfamily, liscreenscale * (32 + fontsizeadd), fontweight, true, false, "ZSScoreBoardTitle", false, true) + surface.CreateLegacyFont(fontfamily, liscreenscale * (22 + fontsizeadd), fontweight, true, false, "ZSScoreBoardSubTitle", false, true) + surface.CreateLegacyFont(fontfamily, liscreenscale * (16 + fontsizeadd), fontweight, true, false, "ZSScoreBoardPlayer", false, true) + surface.CreateLegacyFont(fontfamily, liscreenscale * (24 + fontsizeadd), fontweight, true, false, "ZSScoreBoardHeading", false, false) + surface.CreateLegacyFont("arial", 18 * liscreenscale, 0, true, false, "ZSScoreBoardPlayerSmall", false, true) + surface.CreateLegacyFont("arial", 15 * liscreenscale, 0, true, false, "ZSScoreBoardPlayerSmaller", false, true) + surface.CreateLegacyFont("tahoma", 11 * liscreenscale, 0, true, false, "ZSScoreBoardPing") + + surface.CreateLegacyFont(fontfamily, screenscale * (16 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontTinyNS", false, false) + surface.CreateLegacyFont(fontfamily, screenscale * (20 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallestNS", false, false) + surface.CreateLegacyFont(fontfamily, screenscale * (22 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallerNS", false, false) + surface.CreateLegacyFont(fontfamily, screenscale * (28 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontSmallNS", false, false) + surface.CreateLegacyFont(fontfamily, screenscale * (42 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontNS", false, false) + surface.CreateLegacyFont(fontfamily, screenscale * (72 + fontsizeadd), fontweight, fontaa, false, "ZSHUDFontBigNS", false, false) + + surface.CreateLegacyFont(fontfamilysm, screenscale * 13, fontweight, fontaa, false, "ZSBodyTextFontSmall", fontshadow) + + surface.CreateLegacyFont(fontfamilysm, screenscale * 15, fontweight, fontaa, false, "ZSBodyTextFont", fontshadow, fontoutline) + surface.CreateLegacyFont(fontfamilysm, screenscale * 20, fontweight, fontaa, false, "ZSBodyTextFontBig", fontshadow, fontoutline) + + surface.CreateLegacyFont(fontfamily, screenscale * (20 + fontsizeadd), 0, true, false, "ZSDamageResistance", false, true) + surface.CreateLegacyFont(fontfamily, screenscale * (20 + fontsizeadd), 0, true, false, "ZSDamageResistanceBlur", false, true) + + surface.CreateFont("ZSXPBar", {font = "tahoma", size = screenscale * 14, weight = 500, antialias = false, shadow = true}) +end + +function GM:CreateFonts() + self:Create3DFonts() + self:CreateNonScaleFonts() + self:CreateScalingFonts() end function GM:EvaluateFilmMode() local visible = not self.FilmMode - if self.GameStatePanel and self.GameStatePanel:Valid() then + if self.GameStatePanel and self.GameStatePanel:IsValid() then self.GameStatePanel:SetVisible(visible) end - if self.TopNotificationHUD and self.TopNotificationHUD:Valid() then + if self.TopNotificationHUD and self.TopNotificationHUD:IsValid() then self.TopNotificationHUD:SetVisible(visible) end - if self.CenterNotificationHUD and self.CenterNotificationHUD:Valid() then + if self.CenterNotificationHUD and self.CenterNotificationHUD:IsValid() then self.CenterNotificationHUD:SetVisible(visible) end - if self.HealthHUD and self.HealthHUD:Valid() then + if self.XPHUD and self.XPHUD:IsValid() then + self.XPHUD:SetVisible(visible and self.DisplayXPHUD) + end + + if self.HealthHUD and self.HealthHUD:IsValid() then self.HealthHUD:SetVisible(visible) end + + if self.StatusHUD and self.StatusHUD:IsValid() then + self.StatusHUD:SetVisible(visible) + end end function GM:CreateVGUI() local screenscale = BetterScreenScale() - self.GameStatePanel = vgui.Create("DGameState") + self.GameStatePanel = vgui.Create("ZSGameState") self.GameStatePanel:SetTextFont("ZSHUDFontSmaller") self.GameStatePanel:SetAlpha(220) self.GameStatePanel:SetSize(screenscale * 420, screenscale * 80) @@ -965,9 +1441,8 @@ function GM:CreateVGUI() self.TopNotificationHUD = vgui.Create("DEXNotificationsList") self.TopNotificationHUD:SetAlign(RIGHT) self.TopNotificationHUD.PerformLayout = function(pan) - local screenscale = BetterScreenScale() pan:SetSize(ScrW() * 0.4, ScrH() * 0.6) - pan:AlignTop(16 * screenscale) + pan:AlignTop(16 * BetterScreenScale()) pan:AlignRight() end self.TopNotificationHUD:InvalidateLayout() @@ -977,26 +1452,68 @@ function GM:CreateVGUI() self.CenterNotificationHUD:SetAlign(CENTER) self.CenterNotificationHUD:SetMessageHeight(36) self.CenterNotificationHUD.PerformLayout = function(pan) - local screenscale = BetterScreenScale() - pan:SetSize(ScrW() * 0.5, ScrH() * 0.35) + pan:SetSize(ScrW() / 2, ScrH() * 0.35) pan:CenterHorizontal() - pan:AlignBottom(16 * screenscale) + pan:AlignBottom(16 * BetterScreenScale()) end self.CenterNotificationHUD:InvalidateLayout() self.CenterNotificationHUD:ParentToHUD() end +function GM:CreateLateVGUI() + if not self.HealthHUD then + self.HealthHUD = vgui.Create("ZSHealthArea") + end + + if not self.StatusHUD then + self.StatusHUD = vgui.Create("ZSStatusArea") + end + + if not self.XPHUD then + self.XPHUD = vgui.Create("ZSExperienceHUD") + self.XPHUD:ParentToHUD() + self.XPHUD:InvalidateLayout() + end +end + function GM:Initialize() + self:FixSkillConnections() self:CreateFonts() self:PrecacheResources() self:CreateVGUI() self:InitializeBeats() self:AddCustomAmmo() + self:RegisterFood() + self:CreateWeaponQualities() + self:CreateSpriteMaterials() + + -- Not sure if this still crashes, but whatever. + RunConsoleCommand("r_drawmodeldecals", "0") + -- Flashlight dynamic lights of other players. + RunConsoleCommand("r_dynamic", "0") + + self:RefreshMapIsObjective() +end + +-- These can be accessed without pointing to the IMaterial by using ! before the material string. +function GM:CreateSpriteMaterials() + local params = {["$translucent"] = "1", ["$vertexcolor"] = "1", ["$vertexalpha"] = "1"} + for i=1, 8 do + params["$basetexture"] = "Decals/blood"..i + CreateMaterial("sprite_bloodspray"..i, "UnlitGeneric", params) + end +end + +function GM:ShutDown() + RunConsoleCommand("r_drawmodeldecals", "1") + RunConsoleCommand("r_dynamic", "1") end local function FirstOfGoodType(a) + local ext + for _, v in pairs(a) do - local ext = string.sub(v, -4) + ext = string.sub(v, -4) if ext == ".ogg" or ext == ".wav" or ext == ".mp3" then return v end @@ -1033,6 +1550,9 @@ end function GM:PlayerDeath(pl, attacker) end +function GM:ScalePlayerDamage(pl, hitgroup, dmginfo) +end + function GM:LastHuman(pl) if not IsValid(pl) then pl = nil end @@ -1048,7 +1568,7 @@ function GM:LastHumanMessage() if self.RoundEnded or not MySelf:IsValid() then return end local icon = self.PantsMode and "weapon_zs_legs" or "default" - if MySelf:Team() == TEAM_UNDEAD or not MySelf:Alive() then + if P_Team(MySelf) == TEAM_UNDEAD or not MySelf:Alive() then self:CenterNotify({killicon = icon}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Get(self.PantsMode and "kick_the_last_human" or "kill_the_last_human"), {killicon = icon}) else self:CenterNotify({font = "ZSHUDFont"}, " ", COLOR_RED, translate.Get("you_are_the_last_human")) @@ -1057,33 +1577,23 @@ function GM:LastHumanMessage() end function GM:PlayerShouldTakeDamage(pl, attacker) - return pl == attacker or not attacker:IsPlayer() or pl:Team() ~= attacker:Team() or pl.AllowTeamDamage or attacker.AllowTeamDamage + return pl == attacker or not attacker:IsPlayer() or P_Team(pl) ~= P_Team(attacker) or pl.AllowTeamDamage or attacker.AllowTeamDamage end function GM:SetWave(wave) SetGlobalInt("wave", wave) end ---[[local texGradientUp = surface.GetTextureID("vgui/gradient_up") -local texGradientDown = surface.GetTextureID("vgui/gradient_down") -local texGradientRight = surface.GetTextureID("vgui/gradient-r")]] +local matRing = Material("effects/select_ring") +function GM:DrawCircle(x, y, radius, color) + surface.SetMaterial(matRing) + surface.SetDrawColor(color) + surface.DrawTexturedRect(x - radius, y - radius, radius * 2, radius * 2) +end + local matFilmGrain = Material("zombiesurvival/filmgrain/filmgrain") ---local color_black = color_black function GM:_HUDPaintBackground() - --[[local w, h = ScrW(), ScrH() - local bordersize = BetterScreenScale() * 32 - - surface_SetDrawColor(color_black) - - surface_SetTexture(texGradientDown) - surface_DrawTexturedRect(0, 0, w, bordersize) - surface_SetTexture(texGradientUp) - surface_DrawTexturedRect(0, h - bordersize, w, bordersize) - surface_SetTexture(texGradientRight) - surface_DrawTexturedRectRotated(bordersize / 2, h / 2, bordersize, h, 180) - surface_DrawTexturedRect(w - bordersize, 0, bordersize, h)]] - - if self.FilmGrainEnabled and MySelf:Team() ~= TEAM_UNDEAD then + if self.FilmGrainEnabled and P_Team(MySelf) ~= TEAM_UNDEAD then surface_SetMaterial(matFilmGrain) surface_SetDrawColor(0, 0, 0, (0.25 + 0.75 * self:CachedFearPower()) * self.FilmGrainOpacity) surface_DrawTexturedRectUV(0, 0, ScrW(), ScrH(), 2, 2, 0, 0) @@ -1096,30 +1606,57 @@ function GM:_HUDPaintBackground() end local function GiveWeapon() - RunConsoleCommand("zsgiveweapon") + if GAMEMODE.HumanMenuLockOn then + RunConsoleCommand("zsgiveweapon", GAMEMODE.HumanMenuLockOn:EntIndex(), GAMEMODE.InventoryMenu.SelInv) + end end local function GiveWeaponClip() - RunConsoleCommand("zsgiveweaponclip") + if GAMEMODE.HumanMenuLockOn then + RunConsoleCommand("zsgiveweaponclip", GAMEMODE.HumanMenuLockOn:EntIndex(), GAMEMODE.InventoryMenu.SelInv) + end end local function DropWeapon() - RunConsoleCommand("zsdropweapon") + RunConsoleCommand("zsdropweapon", GAMEMODE.InventoryMenu.SelInv) end local function EmptyClip() RunConsoleCommand("zsemptyclip") end +local function DismantleWeapon() + RunConsoleCommand("zs_dismantle", GAMEMODE.InventoryMenu.SelInv) +end + +local function AltSelItemUpd() + local activeweapon = MySelf:GetActiveWeapon() + if not activeweapon or not activeweapon:IsValid() then return end + + local actwclass = activeweapon:GetClass() + GAMEMODE.HumanMenuPanel.SelectedItemLabel:SetText(weapons.Get(actwclass).PrintName) +end + +function GM:DoAltSelectedItemUpdate() + if self.InventoryMenu.SelInv then + self.HumanMenuPanel.SelectedItemLabel:SetText(self.ZSInventoryItemData[self.InventoryMenu.SelInv].PrintName) + else + timer.Simple(0.25, AltSelItemUpd) + end +end + function GM:HumanMenu() if self.ZombieEscape then return end - local ent = MySelf:MeleeTrace(48, 2).Entity + local ent = MySelf:MeleeTrace(48, 2, nil, nil, true).Entity if self:ValidMenuLockOnTarget(MySelf, ent) then self.HumanMenuLockOn = ent else self.HumanMenuLockOn = nil end - if self.HumanMenuPanel and self.HumanMenuPanel:Valid() then + self:OpenInventory() + if self.HumanMenuPanel and self.HumanMenuPanel:IsValid() then self.HumanMenuPanel:SetVisible(true) self.HumanMenuPanel:OpenMenu() + + self:DoAltSelectedItemUpdate() return end @@ -1130,22 +1667,105 @@ function GM:HumanMenu() for k, v in pairs(self.AmmoNames) do local b = vgui.Create("DAmmoCounter", panel) b:SetAmmoType(k) - b:SetTall(screenscale * 36) + b:SetTall(math.max(32, screenscale * 36)) panel:AddItem(b) end - local b = EasyButton(panel, "Give Weapon", 8, 4) - b.DoClick = GiveWeapon - panel:AddItem(b) - b = EasyButton(panel, "Give Weapon and 5 clips", 8, 4) - b.DoClick = GiveWeaponClip - panel:AddItem(b) - b = EasyButton(panel, "Drop weapon", 8, 4) - b.DoClick = DropWeapon - panel:AddItem(b) - b = EasyButton(panel, "Empty clip", 8, 4) - b.DoClick = EmptyClip - panel:AddItem(b) + local hei = draw_GetFontHeight("ZSHUDFontSmall") + + local selecteditemtitle = EasyLabel(panel, "Selected Item", "ZSHUDFontSmall", color_white) + selecteditemtitle:SetContentAlignment(5) + panel:AddItem(selecteditemtitle) + + local selecteditemlabel = EasyLabel(panel, "Fists", "ZSHUDFontSmaller", color_white) + selecteditemlabel:SetContentAlignment(5) + panel:AddItem(selecteditemlabel) + panel.SelectedItemLabel = selecteditemlabel + + local gwbtn = vgui.Create("DButton") + gwbtn:SetFont("ZSHUDFontSmaller") + gwbtn:SetText("Give Item") + gwbtn:SetSize(panel:GetWide() - 8 * screenscale, hei - 4 * screenscale) + gwbtn:CenterHorizontal() + gwbtn.DoClick = GiveWeapon + panel:AddItem(gwbtn) + + gwbtn = vgui.Create("DButton") + gwbtn:SetFont("ZSHUDFontSmaller") + gwbtn:SetText("Give Item and 5 clips") + gwbtn:SetSize(panel:GetWide() - 8 * screenscale, hei - 4 * screenscale) + gwbtn:CenterHorizontal() + gwbtn.DoClick = GiveWeaponClip + panel:AddItem(gwbtn) + + gwbtn = vgui.Create("DButton") + gwbtn:SetFont("ZSHUDFontSmaller") + gwbtn:SetText("Drop Item") + gwbtn:SetSize(panel:GetWide() - 8 * screenscale, hei - 4 * screenscale) + gwbtn:CenterHorizontal() + gwbtn.DoClick = DropWeapon + panel:AddItem(gwbtn) + + gwbtn = vgui.Create("DButton") + gwbtn:SetFont("ZSHUDFontSmaller") + gwbtn:SetText("Empty Weapon Clip") + gwbtn:SetSize(panel:GetWide() - 8 * screenscale, hei - 4 * screenscale) + gwbtn:CenterHorizontal() + gwbtn.DoClick = EmptyClip + panel:AddItem(gwbtn) + + gwbtn = vgui.Create("DButton") + gwbtn:SetFont("ZSHUDFontSmaller") + gwbtn:SetText("Dismantle Item") + gwbtn:SetSize(panel:GetWide() - 8 * screenscale, hei - 4 * screenscale) + gwbtn:CenterHorizontal() + gwbtn.DoClick = DismantleWeapon + panel:AddItem(gwbtn) + + panel:AddItem(EasyLabel(panel, "Resupply Ammo Selection", "DefaultFont", color_white)) + local dropdown = vgui.Create("DComboBox", panel) + dropdown:SetMouseInputEnabled(true) + dropdown:AddChoice("Resupply Held Weapon") + for k,v in pairs(self.AmmoResupply) do + dropdown:AddChoice(self.AmmoNames[k]) + end + dropdown.OnSelect = function(me, index, value, data) + if value == "Resupply Held Weapon" then + MySelf.ResupplyChoice = nil + RunConsoleCommand("zs_resupplyammotype", "default") + return + end + + for k,v in pairs(self.AmmoNames) do + if value == v then + MySelf.ResupplyChoice = k + RunConsoleCommand("zs_resupplyammotype", k) + break + end + end + end + dropdown:SetText("Resupply Held Weapon") + dropdown:SetTextColor(color_black) + panel:AddItem(dropdown) + + self.HumanMenuSupplyChoice = dropdown + + panel:OpenMenu() +end + +function GM:ZombieSpawnMenu() + if self.ZombieEscape then return end + + if self.ZSpawnMenu and self.ZSpawnMenu:IsValid() then + self.ZSpawnMenu:SetVisible(true) + self.ZSpawnMenu:OpenMenu() + self.ZSpawnMenu:RefreshContents() + + return + end + + local panel = vgui.Create("DZombieSpawnMenu") + self.ZSpawnMenu = panel panel:OpenMenu() end @@ -1153,14 +1773,22 @@ end function GM:PlayerBindPress(pl, bind, wasin) if bind == "gmod_undo" or bind == "undo" then RunConsoleCommand("+zoom") - timer.CreateEx("ReleaseZoom", 1, 1, RunConsoleCommand, "-zoom") + timer.Create("ReleaseZoom", 1, 1, function() RunConsoleCommand("-zoom") end) elseif bind == "+menu_context" then - self.ZombieThirdPerson = not self.ZombieThirdPerson + if P_Team(pl) == TEAM_UNDEAD then + self.ZombieThirdPerson = not self.ZombieThirdPerson + elseif P_Team(pl) == TEAM_HUMAN then + self:ToggleOTSCamera() + end end end function GM:_ShouldDrawLocalPlayer(pl) - return pl:Team() == TEAM_UNDEAD and (self.ZombieThirdPerson or pl:CallZombieFunction("ShouldDrawLocalPlayer")) or pl:IsPlayingTaunt() + return FROM_CAMERA or P_Team(pl) == TEAM_UNDEAD and (self.ZombieThirdPerson or pl:CallZombieFunction0("ShouldDrawLocalPlayer")) + or P_Team(pl) == TEAM_HUMAN and self:UseOverTheShoulder() + or pl:IsPlayingTaunt() + or pl.Revive and pl.Revive:IsValid() + or pl.KnockedDown and pl.KnockedDown:IsValid() end local roll = 0 @@ -1170,19 +1798,31 @@ function GM:_CalcView(pl, origin, angles, fov, znear, zfar) end if pl.Revive and pl.Revive:IsValid() and pl.Revive.GetRagdollEyes then - local rpos, rang = pl.Revive:GetRagdollEyes(pl) - if rpos then - origin = rpos - angles = rang + if self.ThirdPersonKnockdown or self.ZombieThirdPerson then + origin = pl:GetThirdPersonCameraPos(origin, angles) + else + local rpos, rang = pl.Revive:GetRagdollEyes(pl) + if rpos then + origin = rpos + angles = rang + end end elseif pl.KnockedDown and pl.KnockedDown:IsValid() then - local rpos, rang = self:GetRagdollEyes(pl) - if rpos then - origin = rpos - angles = rang + if self.ThirdPersonKnockdown or self:UseOverTheShoulder() then + origin = pl:GetThirdPersonCameraPos(origin, angles) + else + local rpos, rang = self:GetRagdollEyes(pl) + if rpos then + origin = rpos + angles = rang + end + end + elseif pl:ShouldDrawLocalPlayer() and pl:OldAlive() and not pl:HasWon() then + if P_Team(pl) == TEAM_UNDEAD then + origin = pl:GetThirdPersonCameraPos(origin, angles) + elseif self:UseOverTheShoulder() then + self:CalcViewOTS(pl, origin, angles, fov, znear, zfar) end - elseif pl:ShouldDrawLocalPlayer() and pl:OldAlive() then - origin = pl:GetThirdPersonCameraPos(origin, angles) end local targetroll = 0 @@ -1202,7 +1842,7 @@ function GM:_CalcView(pl, origin, angles, fov, znear, zfar) angles.roll = angles.roll + roll if pl:IsPlayingTaunt() then - self:CalcViewTaunt(pl, origin, angles, fov, zclose, zfar) + self:CalcViewTaunt(pl, origin, angles, fov, znear, zfar) end local target = pl:GetObserverTarget() @@ -1226,97 +1866,20 @@ function GM:_CalcView(pl, origin, angles, fov, znear, zfar) end end - pl:CallZombieFunction("CalcView", origin, angles) + if pl:GetObserverMode() ~= OBS_MODE_NONE then + angles.roll = 0 --Fixes babies tilting the screen + end + + pl:CallZombieFunction2("CalcView", origin, angles) return self.BaseClass.CalcView(self, pl, origin, angles, fov, znear, zfar) end -function GM:CalcViewTaunt(pl, origin, angles, fov, zclose, zfar) +function GM:CalcViewTaunt(pl, origin, angles, fov, znear, zfar) local tr = util.TraceHull({start = origin, endpos = origin - angles:Forward() * 72, mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2), mask = MASK_OPAQUE, filter = pl}) origin:Set(tr.HitPos + tr.HitNormal * 2) end -local staggerdir = VectorRand():GetNormalized() -local BHopTime = 0 -local WasPressingJump = false - -local function PressingJump(cmd) - return bit.band(cmd:GetButtons(), IN_JUMP) ~= 0 -end - -local function DontPressJump(cmd) - cmd:SetButtons(cmd:GetButtons() - IN_JUMP) -end - -function GM:_CreateMove(cmd) - if MySelf:IsPlayingTaunt() and MySelf:Alive() then - self:CreateMoveTaunt(cmd) - return - end - - -- Disables bunny hopping to an extent. - if MySelf:GetLegDamage() >= 0.5 then - if PressingJump(cmd) then - DontPressJump(cmd) - end - elseif MySelf:OnGround() then - if CurTime() < BHopTime then - if PressingJump(cmd) then - DontPressJump(cmd) - WasPressingJump = true - end - elseif WasPressingJump then - if PressingJump(cmd) then - DontPressJump(cmd) - else - WasPressingJump = false - end - end - else - BHopTime = CurTime() + 0.065 - end - - local myteam = MySelf:Team() - if myteam == TEAM_HUMAN then - if MySelf:Alive() then - local lockon = self.HumanMenuLockOn - if lockon then - if self:ValidMenuLockOnTarget(MySelf, lockon) and self.HumanMenuPanel and self.HumanMenuPanel:Valid() and self.HumanMenuPanel:IsVisible() and MySelf:KeyDown(self.MenuKey) then - local oldang = cmd:GetViewAngles() - local newang = (lockon:EyePos() - EyePos()):Angle() - --oldang.pitch = math.ApproachAngle(oldang.pitch, newang.pitch, FrameTime() * math.max(45, math.abs(math.AngleDifference(oldang.pitch, newang.pitch)) ^ 1.3)) - oldang.yaw = math.ApproachAngle(oldang.yaw, newang.yaw, FrameTime() * math.max(45, math.abs(math.AngleDifference(oldang.yaw, newang.yaw)) ^ 1.3)) - cmd:SetViewAngles(oldang) - else - self.HumanMenuLockOn = nil - end - else - local maxhealth = MySelf:GetMaxHealth() - local threshold = MySelf:GetPalsy() and maxhealth - 1 or maxhealth * 0.25 - local health = MySelf:Health() - if health <= threshold then - local ft = FrameTime() - - staggerdir = (staggerdir + ft * 8 * VectorRand()):GetNormalized() - - local ang = cmd:GetViewAngles() - local rate = ft * ((threshold - health) / threshold) * 7 - ang.pitch = math.NormalizeAngle(ang.pitch + staggerdir.z * rate) - ang.yaw = math.NormalizeAngle(ang.yaw + staggerdir.x * rate) - cmd:SetViewAngles(ang) - end - end - end - elseif myteam == TEAM_UNDEAD then - local buttons = cmd:GetButtons() - if bit.band(buttons, IN_ZOOM) ~= 0 then - cmd:SetButtons(buttons - IN_ZOOM) - end - - MySelf:CallZombieFunction("CreateMove", cmd) - end -end - function GM:CreateMoveTaunt(cmd) cmd:ClearButtons(0) cmd:ClearMovement() @@ -1330,7 +1893,7 @@ function GM:HUDPaintEndRound() end function GM:PreDrawViewModel(vm, pl, wep) - if pl and pl:IsValid() and pl:IsHolding() then return true end + if pl and pl:IsValid() and (pl:IsHolding() or GAMEMODE.HideViewModels) then return true end if wep and wep:IsValid() and wep.PreDrawViewModel then return wep:PreDrawViewModel(vm) @@ -1352,136 +1915,139 @@ function GM:PostDrawViewModel(vm, pl, wep) end end -local undomodelblend = false -local undozombievision = false +local undo = false local matWhite = Material("models/debug/debugwhite") +local lowhealthcolor = GM.AuraColorEmpty +local fullhealthcolor = GM.AuraColorFull function GM:_PrePlayerDraw(pl) - if pl:CallZombieFunction("PrePlayerDraw") then return true end - local shadowman = false - if pl.status_overridemodel and pl.status_overridemodel:IsValid() and self:ShouldDrawLocalPlayer(MySelf) then -- We need to do this otherwise the player's real model shows up for some reason. - undomodelblend = true - render.SetBlend(0) - else - local myteam = MySelf:Team() - if myteam == pl:Team() and pl ~= MySelf and not self.MedicalAura then - local radius = self.TransparencyRadius - if radius > 0 then - local eyepos = EyePos() - local dist = pl:NearestPoint(eyepos):Distance(eyepos) - if dist < radius then - local blend = math.max((dist / radius) ^ 1.4, myteam == TEAM_HUMAN and 0.04 or 0.1) - render.SetBlend(blend) - if myteam == TEAM_HUMAN and blend < 0.4 then - render.ModelMaterialOverride(matWhite) - render.SetColorModulation(0.2, 0.2, 0.2) - shadowman = true - end - undomodelblend = true - end + if pl ~= MySelf and pl:IsEffectActive(EF_DIMLIGHT) then + pl:RemoveEffects(EF_DIMLIGHT) + end + + local myteam = P_Team(MySelf) + local theirteam = P_Team(pl) + + local radius = self.TransparencyRadius + if radius > 0 and myteam == theirteam and pl ~= MySelf and not (GAMEMODE.AlwaysDrawFriend and pl:IsFriend()) and not self.MedicalAura then + local dist = pl:GetPos():DistToSqr(EyePos()) + if dist < radius then + local blend = (dist / radius) ^ 1.4 + if blend <= 0.1 then + pl.ShadowMan = true return true end + render_SetBlend(blend) + if myteam == TEAM_HUMAN and blend < 0.5 then + render_ModelMaterialOverride(matWhite) + render_SetColorModulation(0.2, 0.2, 0.2) + shadowman = true + end + undo = true end end pl.ShadowMan = shadowman - if self.m_ZombieVision and MySelf:Team() == TEAM_UNDEAD and pl:Team() == TEAM_HUMAN and pl:GetPos():Distance(EyePos()) <= pl:GetAuraRange() then - undozombievision = true - local color = Color(255, 255, 255, 255) - local healthfrac = math.max(pl:Health(), 0) / pl:GetMaxHealth() - local lowhealthcolor = GAMEMODE.AuraColorEmpty - local fullhealthcolor = GAMEMODE.AuraColorFull - - color.r = math.Approach(lowhealthcolor.r, fullhealthcolor.r, math.abs(lowhealthcolor.r - fullhealthcolor.r) * healthfrac) - color.g = math.Approach(lowhealthcolor.g, fullhealthcolor.g, math.abs(lowhealthcolor.g - fullhealthcolor.g) * healthfrac) - color.b = math.Approach(lowhealthcolor.b, fullhealthcolor.b, math.abs(lowhealthcolor.b - fullhealthcolor.b) * healthfrac) + if pl:CallZombieFunction0("PrePlayerDraw") then return true end - render.ModelMaterialOverride(matWhite) - render.SetColorModulation(color.r/255, color.g/255, color.b/255) - render.SuppressEngineLighting(true) - cam.IgnoreZ(true) + if pl.SpawnProtection and (not (pl.status_overridemodel and pl.status_overridemodel:IsValid()) or pl:GetZombieClassTable().NoHideMainModel) then + undo = true + render_ModelMaterialOverride(matWhite) + render_SetBlend(0.02 + (CurTime() + pl:EntIndex() * 0.2) % 0.05) + render_SetColorModulation(0, 0.3, 0) + render_SuppressEngineLighting(true) + end + + if self.m_ZombieVision and myteam == TEAM_UNDEAD and theirteam == TEAM_HUMAN then + local dist = pl:GetPos():DistToSqr(EyePos()) + if dist <= pl:GetAuraRangeSqr() and (not pl:GetDTBool(DT_PLAYER_BOOL_NECRO) or dist >= 27500) then + undo = true + local healthfrac = pl:Health() / pl:GetMaxHealth() + + render_SetBlend(1) + render_ModelMaterialOverride(matWhite) + render_SetColorModulation( + Lerp(healthfrac, lowhealthcolor.r, fullhealthcolor.r) / 255, + Lerp(healthfrac, lowhealthcolor.g, fullhealthcolor.g) / 255, + Lerp(healthfrac, lowhealthcolor.b, fullhealthcolor.b) / 255 + ) + render_SuppressEngineLighting(true) + cam_IgnoreZ(true) + end end end local colFriend = Color(10, 255, 10, 60) local matFriendRing = Material("SGM/playercircle") +local matTargetTri = Material("gui/point.png") function GM:_PostPlayerDraw(pl) - pl:CallZombieFunction("PostPlayerDraw") + pl:CallZombieFunction0("PostPlayerDraw") - if undomodelblend then - render.SetBlend(1) - render.ModelMaterialOverride() - render.SetColorModulation(1, 1, 1) + if undo then + render_SetBlend(1) + render_ModelMaterialOverride() + render_SetColorModulation(1, 1, 1) + render_SuppressEngineLighting(false) + cam_IgnoreZ(false) - undomodelblend = false - end - if undozombievision then - render.ModelMaterialOverride() - render.SetColorModulation(1, 1, 1) - render.SuppressEngineLighting(false) - cam.IgnoreZ(false) - - undozombievision = false + undo = false end - if pl ~= MySelf and MySelf:Team() == pl:Team() and pl:IsFriend() then - local pos = pl:GetPos() + Vector(0, 0, 2) - render.SetMaterial(matFriendRing) - render.DrawQuadEasy(pos, Vector(0, 0, 1), 32, 32, colFriend) - render.DrawQuadEasy(pos, Vector(0, 0, -1), 32, 32, colFriend) + local eyepos, ang, tpos, distance, hpf + if MySelf.TargetLocus and self.TraceTargetTeam == pl and pl:IsValidLivingZombie() and not pl:GetZombieClassTable().IgnoreTargetAssist then + tpos = pl:GetPos() + tpos.z = tpos.z + 80 + + eyepos = MySelf:EyePos() + distance = eyepos:DistToSqr(tpos) + + ang = (eyepos - tpos):Angle() + ang:RotateAroundAxis(ang:Right(), 270) + ang:RotateAroundAxis(ang:Up(), 90) + + cam_IgnoreZ(true) + cam_Start3D2D(tpos, ang, math.max(750, math.sqrt(distance)) / 6500) + surface_SetMaterial(matTargetTri) + + hpf = pl:Health() / pl:GetMaxZombieHealth() + + surface_SetDrawColor(255 - (255 * hpf), 255 * hpf, 0, 230) + surface_DrawTexturedRect(-96, -96, 96, 96) + cam_End3D2D() + cam_IgnoreZ(false) end -end -function GM:DrawCraftingEntity() - local craftingentity = self.CraftingEntity - if craftingentity and craftingentity:IsValid() then - if self.HumanMenuPanel and self.HumanMenuPanel:Valid() and self.HumanMenuPanel:IsVisible() and MySelf:KeyDown(self.MenuKey) then - local scale = craftingentity:GetModelScale() - if not scale then return end - - render.ModelMaterialOverride(matWhite) - render.SuppressEngineLighting(true) - render.SetBlend(0.025) - local extrascale = 1.05 + math.abs(math.sin(RealTime() * 7)) * 0.1 - craftingentity:SetModelScale(scale * extrascale, 0) - - local oldpos = craftingentity:GetPos() - craftingentity:SetPos(oldpos - craftingentity:LocalToWorld(oldpos)) - craftingentity:DrawModel() - craftingentity:SetPos(oldpos) - - craftingentity:SetModelScale(scale, 0) - render.SetBlend(1) - render.SuppressEngineLighting(false) - render.ModelMaterialOverride(0) - else - self.CraftingEntity = nil - end + if pl ~= MySelf and P_Team(MySelf) == P_Team(pl) and pl:IsFriend() then + local pos = pl:GetPos() + pos.z = pos.z + 2 + render_SetMaterial(matFriendRing) + render_DrawQuadEasy(pos, vector_up, 32, 32, colFriend) + render_DrawQuadEasy(pos, vector_down, 32, 32, colFriend) end end function GM:HUDPaintBackgroundEndRound() - local w, h = ScrW(), ScrH() + local x, y = ScrW() / 2, ScrH() * 0.8 local timleft = math.max(0, self.EndTime + self.EndGameTime - CurTime()) if timleft <= 0 then - draw_SimpleTextBlur(translate.Get("loading"), "ZSHUDFont", w * 0.5, h * 0.8, COLOR_WHITE, TEXT_ALIGN_CENTER) + draw_SimpleTextBlur(translate.Get("loading"), "ZSHUDFont", x, y, COLOR_WHITE, TEXT_ALIGN_CENTER) else - draw_SimpleTextBlur(translate.Format("next_round_in_x", util.ToMinutesSeconds(timleft)), "ZSHUDFontSmall", w * 0.5, h * 0.8, COLOR_WHITE, TEXT_ALIGN_CENTER) + draw_SimpleTextBlur(translate.Format("next_round_in_x", util.ToMinutesSecondsCD(timleft)), "ZSHUDFontSmall", x, y, COLOR_WHITE, TEXT_ALIGN_CENTER) end end local function EndRoundCalcView(pl, origin, angles, fov, znear, zfar) if GAMEMODE.EndTime and CurTime() < GAMEMODE.EndTime + 5 then local endposition = GAMEMODE.LastHumanPosition - local override = GetGlobalVector("endcamerapos", 1) - if type(override) ~= "number" then + local override = GetGlobalVector("endcamerapos", vector_origin) + if override ~= vector_origin then endposition = override end if endposition then local delta = math.Clamp((CurTime() - GAMEMODE.EndTime) * 2, 0, 1) - + local start = endposition * delta + origin * (1 - delta) local tr = util.TraceHull({start = start, endpos = start + delta * 64 * Angle(0, CurTime() * 30, 0):Forward(), mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2), filter = player.GetAll(), mask = MASK_SOLID}) return {origin = tr.HitPos + tr.HitNormal, angles = (start - tr.HitPos):Angle()} @@ -1501,7 +2067,6 @@ local function EndRoundShouldDrawLocalPlayer(pl) hook.Remove("ShouldDrawLocalPlayer", "EndRoundShouldDrawLocalPlayer") end -local function EndRoundGetMeleeFilter(self) return {self} end function GM:EndRound(winner, nextmap) if self.RoundEnded then return end self.RoundEnded = true @@ -1512,8 +2077,6 @@ function GM:EndRound(winner, nextmap) RunConsoleCommand("stopsound") - FindMetaTable("Player").GetMeleeFilter = EndRoundGetMeleeFilter - self.HUDPaint = self.HUDPaintEndRound self.HUDPaintBackground = self.HUDPaintBackgroundEndRound @@ -1541,6 +2104,7 @@ function GM:EndRound(winner, nextmap) end function GM:WeaponDeployed(pl, wep) + self:DoChangeDeploySpeed(wep) end function GM:LocalPlayerDied(attackername) @@ -1557,22 +2121,53 @@ end function GM:KeyPress(pl, key) if key == self.MenuKey then - if pl:Team() == TEAM_HUMAN and pl:Alive() and not pl:IsHolding() then + local team = P_Team(pl) + if team == TEAM_HUMAN and pl:Alive() and not pl:IsHolding() then gamemode.Call("HumanMenu") + elseif team == TEAM_ZOMBIE and not pl:Alive() then + gamemode.Call("ZombieSpawnMenu") end elseif key == IN_SPEED then if pl:Alive() then - if pl:Team() == TEAM_HUMAN then + if P_Team(pl) == TEAM_HUMAN then pl:DispatchAltUse() - elseif pl:Team() == TEAM_UNDEAD then - pl:CallZombieFunction("AltUse") + elseif P_Team(pl) == TEAM_UNDEAD then + pl:CallZombieFunction0("AltUse") + end + end + end +end + +function GM:KeyRelease(pl, key) + if key == self.MenuKey then + if self.HumanMenuPanel and self.HumanMenuPanel:IsValid() then + if self.InventoryMenu and self.InventoryMenu:IsValid() then + self.InventoryMenu:SetVisible(false) + + if self.m_InvViewer and self.m_InvViewer:IsValid() then + self.m_InvViewer:SetVisible(false) + end + end + + if self.HumanMenuSupplyChoice then + self.HumanMenuSupplyChoice:CloseMenu() + end + + if self.InventoryMenu.SelInv then + self.InventoryMenu.SelInv = nil + self:DoAltSelectedItemUpdate() + + local grid = self.InventoryMenu.Grid + for k, v in pairs(grid:GetChildren()) do + v.On = false + end end end end end function GM:PlayerStepSoundTime(pl, iType, bWalking) - local time = pl:CallZombieFunction("PlayerStepSoundTime", iType, bWalking) + local time = pl:CallZombieFunction2("PlayerStepSoundTime", iType, bWalking) if time then return time end @@ -1593,11 +2188,11 @@ function GM:PlayerStepSoundTime(pl, iType, bWalking) end function GM:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume) - return pl:CallZombieFunction("PlayerFootstep", vFootPos, iFoot, strSoundName, fVolume) + return pl:CallZombieFunction4("PlayerFootstep", vFootPos, iFoot, strSoundName, fVolume) end function GM:PlayerCanCheckout(pl) - return pl:IsValid() and pl:Team() == TEAM_HUMAN and pl:Alive() and self:GetWave() <= 0 + return pl:IsValid() and P_Team(pl) == TEAM_HUMAN and pl:Alive() and self:GetWave() <= 0 end function GM:OpenWorth() @@ -1607,7 +2202,7 @@ function GM:OpenWorth() end function GM:CloseWorth() - if pWorth and pWorth:Valid() then + if pWorth and pWorth:IsValid() then pWorth:Remove() pWorth = nil end @@ -1624,8 +2219,8 @@ function GM:Rewarded(class, amount) local toptext = translate.Get("arsenal_upgraded") - local wep = weapons.GetStored(class) - if wep and wep.PrintName then + local wep = weapons.Get(class) + if wep and wep.PrintName and #wep.PrintName > 0 then if killicon.Get(class) == killicon.Get("default") then self:CenterNotify(COLOR_PURPLE, toptext..": ", color_white, wep.PrintName) else @@ -1639,233 +2234,9 @@ function GM:Rewarded(class, amount) end function PlayMenuOpenSound() - LocalPlayer():EmitSound("buttons/lightswitch2.wav", 100, 30) + MySelf:EmitSound("buttons/lightswitch2.wav", 100, 30) end function PlayMenuCloseSound() - LocalPlayer():EmitSound("buttons/lightswitch2.wav", 100, 20) -end - -local DamageFloaters = CreateClientConVar("zs_damagefloaters", "1", true, false):GetBool() -cvars.AddChangeCallback("zs_damagefloaters", function(cvar, oldvalue, newvalue) - DamageFloaters = newvalue ~= "0" -end) - -net.Receive("zs_legdamage", function(length) - LocalPlayer().LegDamage = net.ReadFloat() -end) - -net.Receive("zs_nextboss", function(length) - GAMEMODE.NextBossZombie = net.ReadEntity() - GAMEMODE.NextBossZombieClass = net.ReadString() -end) - -net.Receive("zs_zvols", function(length) - local volunteers = {} - local count = net.ReadUInt(8) - for i=1, count do - volunteers[i] = net.ReadEntity() - end - - GAMEMODE.ZombieVolunteers = volunteers -end) - -net.Receive("zs_dmg", function(length) - local damage = net.ReadUInt(16) - local pos = net.ReadVector() - - if DamageFloaters then - local effectdata = EffectData() - effectdata:SetOrigin(pos) - effectdata:SetMagnitude(damage) - effectdata:SetScale(0) - util.Effect("damagenumber", effectdata) - end -end) - -net.Receive("zs_dmg_prop", function(length) - local damage = net.ReadUInt(16) - local pos = net.ReadVector() - - if DamageFloaters then - local effectdata = EffectData() - effectdata:SetOrigin(pos) - effectdata:SetMagnitude(damage) - effectdata:SetScale(1) - util.Effect("damagenumber", effectdata) - end -end) - -net.Receive("zs_lifestats", function(length) - local barricadedamage = net.ReadUInt(24) - local humandamage = net.ReadUInt(24) - local brainseaten = net.ReadUInt(16) - - GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime - GAMEMODE.LifeStatsBarricadeDamage = barricadedamage - GAMEMODE.LifeStatsHumanDamage = humandamage - GAMEMODE.LifeStatsBrainsEaten = brainseaten -end) - -net.Receive("zs_lifestatsbd", function(length) - local barricadedamage = net.ReadUInt(24) - - GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime - GAMEMODE.LifeStatsBarricadeDamage = barricadedamage -end) - -net.Receive("zs_lifestatshd", function(length) - local humandamage = net.ReadUInt(24) - - GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime - GAMEMODE.LifeStatsHumanDamage = humandamage -end) - -net.Receive("zs_lifestatsbe", function(length) - local brainseaten = net.ReadUInt(16) - - GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime - GAMEMODE.LifeStatsBrainsEaten = brainseaten -end) - -net.Receive("zs_honmention", function(length) - local pl = net.ReadEntity() - local mentionid = net.ReadUInt(8) - local etc = net.ReadInt(32) - - if pl:IsValid() then - gamemode.Call("AddHonorableMention", pl, mentionid, etc) - end -end) - -net.Receive("zs_wavestart", function(length) - local wave = net.ReadInt(16) - local time = net.ReadFloat() - - gamemode.Call("SetWave", wave) - gamemode.Call("SetWaveEnd", time) - - if GAMEMODE.ZombieEscape then - GAMEMODE:CenterNotify(COLOR_RED, {font = "ZSHUDFont"}, translate.Get("escape_from_the_zombies")) - elseif wave == GAMEMODE:GetNumberOfWaves() then - GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Get("final_wave"), {killicon = "default"}) - GAMEMODE:CenterNotify(translate.Get("final_wave_sub")) - else - GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Format("wave_x_has_begun", wave), {killicon = "default"}) - end - - surface_PlaySound("ambient/creatures/town_zombie_call1.wav") -end) - -net.Receive("zs_classunlock", function(length) - GAMEMODE:CenterNotify(COLOR_GREEN, net.ReadString()) -end) - -net.Receive("zs_waveend", function(length) - local wave = net.ReadInt(16) - local time = net.ReadFloat() - - gamemode.Call("SetWaveStart", time) - - if wave < GAMEMODE:GetNumberOfWaves() and wave > 0 then - GAMEMODE:CenterNotify(COLOR_RED, {font = "ZSHUDFont"}, translate.Format("wave_x_is_over", wave)) - GAMEMODE:CenterNotify(translate.Format("wave_x_is_over_sub", GAMEMODE.ArsenalCrateDiscountPercentage)) - - surface_PlaySound("ambient/atmosphere/cave_hit"..math.random(6)..".wav") - end -end) - -net.Receive("zs_gamestate", function(length) - local wave = net.ReadInt(16) - local wavestart = net.ReadFloat() - local waveend = net.ReadFloat() - - gamemode.Call("SetWave", wave) - gamemode.Call("SetWaveStart", wavestart) - gamemode.Call("SetWaveEnd", waveend) -end) - -local matSkull = Material("zombiesurvival/horderally") -local bossspawnedend -local function BossSpawnedPaint() - if CurTime() > bossspawnedend then - hook.Remove("HUDPaint", "BossSpawnedPaint") - return - end - - local delta = math.Clamp(bossspawnedend - CurTime(), 0, 1) - local size = (1 - delta) * math.max(ScrW(), ScrH()) - - surface_SetMaterial(matSkull) - surface_SetDrawColor(160, 0, 0, math.min(delta * 400, 180)) - surface_DrawTexturedRectRotated(ScrW() / 2, ScrH() / 2, size, size, delta * 25) -end -net.Receive("zs_boss_spawned", function(length) - local ent = net.ReadEntity() - local classindex = net.ReadUInt(8) - - if ent == MySelf and ent:IsValid() then - GAMEMODE:CenterNotify({killicon = "default"}, " ", COLOR_RED, translate.Format("you_are_x", translate.Get(GAMEMODE.ZombieClasses[classindex].TranslationName)), {killicon = "default"}) - elseif ent:IsValid() then - GAMEMODE:CenterNotify({killicon = "default"}, " ", COLOR_RED, (translate.Format("x_has_risen_as_y", ent:Name(), translate.Get(GAMEMODE.ZombieClasses[classindex].TranslationName))), {killicon = "default"}) - else - GAMEMODE:CenterNotify({killicon = "default"}, " ", COLOR_RED, translate.Format("x_has_risen", translate.Get(GAMEMODE.ZombieClasses[classindex].TranslationName)), {killicon = "default"}) - end - - if MySelf:IsValid() then - MySelf:EmitSound("npc/zombie_poison/pz_alert1.wav", 0) - end - - bossspawnedend = CurTime() + 1 - hook.Add("HUDPaint", "BossSpawnedPaint", BossSpawnedPaint) -end) - -net.Receive("zs_centernotify", function(length) - local tab = net.ReadTable() - - GAMEMODE:CenterNotify(unpack(tab)) -end) - -net.Receive("zs_topnotify", function(length) - local tab = net.ReadTable() - - GAMEMODE:TopNotify(unpack(tab)) -end) - -net.Receive("zs_lasthuman", function(length) - local pl = net.ReadEntity() - - gamemode.Call("LastHuman", pl) -end) - -net.Receive("zs_gamemodecall", function(length) - gamemode.Call(net.ReadString()) -end) - -net.Receive("zs_lasthumanpos", function(length) - GAMEMODE.LastHumanPosition = net.ReadVector() -end) - -net.Receive("zs_endround", function(length) - local winner = net.ReadUInt(8) - local nextmap = net.ReadString() - - gamemode.Call("EndRound", winner, nextmap) -end) - --- Temporary fix -function render.DrawQuadEasy(pos, dir, xsize, ysize, color, rotation) - xsize = xsize / 2 - ysize = ysize / 2 - - local ang = dir:Angle() - - if rotation then - ang:RotateAroundAxis(ang:Forward(), rotation) - end - - local upoffset = ang:Up() * ysize - local rightoffset = ang:Right() * xsize - - render.DrawQuad(pos - upoffset - rightoffset, pos - upoffset + rightoffset, pos + upoffset + rightoffset, pos + upoffset - rightoffset, color) + MySelf:EmitSound("buttons/lightswitch2.wav", 100, 20) end diff --git a/gamemodes/zombiesurvival/gamemode/cl_net.lua b/gamemodes/zombiesurvival/gamemode/cl_net.lua new file mode 100644 index 0000000..861264b --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/cl_net.lua @@ -0,0 +1,468 @@ +local surface_PlaySound = surface.PlaySound + +local DamageFloaters = CreateClientConVar("zs_damagefloaters", "1", true, false):GetBool() +cvars.AddChangeCallback("zs_damagefloaters", function(cvar, oldvalue, newvalue) + DamageFloaters = newvalue ~= "0" +end) + +local M_Player = FindMetaTable("Player") +local P_Team = M_Player.Team + +local function AltSelItemUpd() + local activeweapon = MySelf:GetActiveWeapon() + if not activeweapon or not activeweapon:IsValid() then return end + + local actwclass = activeweapon:GetClass() + GAMEMODE.HumanMenuPanel.SelectedItemLabel:SetText(weapons.Get(actwclass).PrintName) +end + +net.Receive("zs_legdamage", function(length) + MySelf.LegDamage = net.ReadFloat() +end) + +net.Receive("zs_armdamage", function(length) + MySelf.ArmDamage = net.ReadFloat() +end) + +net.Receive("zs_nextboss", function(length) + GAMEMODE.NextBossZombie = net.ReadEntity() + GAMEMODE.NextBossZombieClass = GAMEMODE.ZombieClasses[net.ReadUInt(8)].Name +end) + +net.Receive("zs_zvols", function(length) + local volunteers = {} + local count = net.ReadUInt(8) + for i=1, count do + volunteers[i] = net.ReadEntity() + end + + GAMEMODE.ZombieVolunteers = volunteers +end) + +net.Receive("zs_dmg", function(length) + local damage = net.ReadUInt(16) + local pos = net.ReadVector() + + if DamageFloaters then + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetMagnitude(damage) + effectdata:SetScale(0) + util.Effect("damagenumber", effectdata) + end +end) + +net.Receive("zs_dmg_prop", function(length) + local damage = net.ReadUInt(16) + local pos = net.ReadVector() + + if DamageFloaters then + local effectdata = EffectData() + effectdata:SetOrigin(pos) + effectdata:SetMagnitude(damage) + effectdata:SetScale(1) + util.Effect("damagenumber", effectdata) + end +end) + +net.Receive("zs_lifestats", function(length) + local barricadedamage = net.ReadUInt(16) + local humandamage = net.ReadUInt(16) + local brainseaten = net.ReadUInt(8) + + GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime + + GAMEMODE.LifeStatsBarricadeDamage = barricadedamage + GAMEMODE.LifeStatsHumanDamage = humandamage + GAMEMODE.LifeStatsBrainsEaten = brainseaten +end) + +net.Receive("zs_lifestatsbd", function(length) + local barricadedamage = net.ReadUInt(16) + + GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime + + GAMEMODE.LifeStatsBarricadeDamage = barricadedamage +end) + +net.Receive("zs_lifestatshd", function(length) + local humandamage = net.ReadUInt(16) + + GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime + + GAMEMODE.LifeStatsHumanDamage = humandamage +end) + +net.Receive("zs_lifestatsbe", function(length) + local brainseaten = net.ReadUInt(8) + + GAMEMODE.LifeStatsEndTime = CurTime() + GAMEMODE.LifeStatsLifeTime + + GAMEMODE.LifeStatsBrainsEaten = brainseaten +end) + +net.Receive("zs_honmention", function(length) + local pl = net.ReadEntity() + local mentionid = net.ReadUInt(8) + local etc = net.ReadInt(32) + + if pl:IsValid() then + gamemode.Call("AddHonorableMention", pl, mentionid, etc) + end +end) + +net.Receive("zs_wavestart", function(length) + local wave = net.ReadInt(16) + local time = net.ReadFloat() + + gamemode.Call("SetWave", wave) + gamemode.Call("SetWaveEnd", time) + + if GAMEMODE.ZombieEscape then + GAMEMODE:CenterNotify(COLOR_RED, {font = "ZSHUDFont"}, translate.Get("escape_from_the_zombies")) + elseif wave == GAMEMODE:GetNumberOfWaves() then + GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Get("final_wave"), {killicon = "default"}) + GAMEMODE:CenterNotify(translate.Get("final_wave_sub")) + else + GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Format("wave_x_has_begun", wave), {killicon = "default"}) + + if wave == 1 and GAMEMODE:GetUseSigils() then + GAMEMODE:CenterNotify(translate.Format("x_sigils_appeared", GAMEMODE.MaxSigils)) + end + end + + surface_PlaySound("ambient/creatures/town_zombie_call1.wav") +end) + +net.Receive("zs_classunlock", function(length) + GAMEMODE:CenterNotify(COLOR_GREEN, translate.Format("x_unlocked", net.ReadString())) +end) + +net.Receive("zs_waveend", function(length) + local wave = net.ReadInt(16) + local time = net.ReadFloat() + + gamemode.Call("SetWaveStart", time) + + if wave < GAMEMODE:GetNumberOfWaves() and wave > 0 then + GAMEMODE:CenterNotify(COLOR_RED, {font = "ZSHUDFont"}, translate.Format("wave_x_is_over", wave)) + GAMEMODE:CenterNotify(translate.Get("wave_x_is_over_sub")) + + if MySelf:IsValid() and P_Team(MySelf) == TEAM_HUMAN then + if MySelf:GetZSSPRemaining() > 0 then + GAMEMODE:CenterNotify(translate.Format("unspent_skill_points_press_x", input.LookupBinding("gm_showspare1") or "F3")) + end + + if GAMEMODE.EndWavePointsBonus > 0 then + local pointsbonus = GAMEMODE.EndWavePointsBonus + (GAMEMODE:GetWave() - 1) * GAMEMODE.EndWavePointsBonusPerWave + (MySelf.EndWavePointsExtra or 0) + + if not MySelf.Scourer then + GAMEMODE:CenterNotify(COLOR_CYAN, translate.Format("points_for_surviving", pointsbonus)) + else + GAMEMODE:CenterNotify(COLOR_ORANGE, translate.Format("scrap_for_surviving", pointsbonus)) + end + end + end + + surface_PlaySound("ambient/atmosphere/cave_hit"..math.random(6)..".wav") + end +end) + +net.Receive("zs_gamestate", function(length) + local wave = net.ReadInt(16) + local wavestart = net.ReadFloat() + local waveend = net.ReadFloat() + + gamemode.Call("SetWave", wave) + gamemode.Call("SetWaveStart", wavestart) + gamemode.Call("SetWaveEnd", waveend) +end) + +net.Receive("zs_boss_spawned", function(length) + local ent = net.ReadEntity() + local classindex = net.ReadUInt(8) + local classtbl = GAMEMODE.ZombieClasses[classindex] + local ki = {killicon = classtbl.SWEP} + local kid = {killicon = "default"} + + if ent == MySelf and ent:IsValid() then + GAMEMODE:CenterNotify(ki, " ", COLOR_RED, translate.Format("you_are_x", translate.Get(classtbl.TranslationName)), ki) + elseif ent:IsValid() and P_Team(MySelf) == TEAM_UNDEAD then + GAMEMODE:CenterNotify(ki, " ", COLOR_RED, translate.Format("x_has_risen_as_y", ent:Name(), translate.Get(classtbl.TranslationName)), ki) + else + GAMEMODE:CenterNotify(kid, " ", COLOR_RED, translate.Get("x_has_risen"), kid) + end + + if MySelf:IsValid() then + MySelf:EmitSound(string.format("npc/zombie_poison/pz_alert%d.wav", math.random(1, 2)), 0, math.random(95, 105)) + end +end) +net.Receive("zs_boss_slain", function(length) + local ent = net.ReadEntity() + local classindex = net.ReadUInt(8) + local classtbl = GAMEMODE.ZombieClasses[classindex] + local ki = {killicon = classtbl.SWEP} + + if ent:IsValid() then + GAMEMODE:CenterNotify(ki, " ", COLOR_YELLOW, translate.Format("x_has_been_slain_as_y", ent:Name(), translate.Get(classtbl.TranslationName)), ki) + end + + if MySelf:IsValid() then + MySelf:EmitSound("ambient/atmosphere/cave_hit4.wav", 0, 150) + end +end) + +net.Receive("zs_classunlockstate", function(length) + local clstr = net.ReadInt(8) + local class = GAMEMODE.ZombieClasses[clstr] + local unlocked = net.ReadBool() + + class.Locked = not unlocked + class.Unlocked = unlocked +end) + +net.Receive("zs_centernotify", function(length) + local tab = net.ReadTable() + + GAMEMODE:CenterNotify(unpack(tab)) +end) + +net.Receive("zs_topnotify", function(length) + local tab = net.ReadTable() + + GAMEMODE:TopNotify(unpack(tab)) +end) + +net.Receive("zs_survivor", function(length) + local ent = net.ReadEntity() + + if ent:IsValidPlayer() then + GAMEMODE:TopNotify(ent, " ", translate.Get("has_survived")) + + if ent == MySelf then + util.WhiteOut(3) + end + end +end) + +net.Receive("zs_lasthuman", function(length) + local pl = net.ReadEntity() + + gamemode.Call("LastHuman", pl) +end) + +net.Receive("zs_gamemodecall", function(length) + gamemode.Call(net.ReadString()) +end) + +net.Receive("zs_lasthumanpos", function(length) + GAMEMODE.LastHumanPosition = net.ReadVector() +end) + +net.Receive("zs_endround", function(length) + local winner = net.ReadUInt(8) + local nextmap = net.ReadString() + + gamemode.Call("EndRound", winner, nextmap) +end) + +net.Receive("zs_healother", function(length) + if net.ReadBool() then + gamemode.Call("HealedOtherPlayer", net.ReadEntity(), net.ReadFloat()) + else + GAMEMODE:CenterNotify({killicon = "weapon_zs_medicalkit"}, " ", COLOR_GREEN, translate.Format("healed_x_for_y", net.ReadEntity():Name(), net.ReadFloat())) + end +end) + +net.Receive("zs_repairobject", function(length) + gamemode.Call("RepairedObject", net.ReadEntity(), net.ReadFloat()) +end) + +net.Receive("zs_commission", function(length) + gamemode.Call("ReceivedCommission", net.ReadEntity(), net.ReadEntity(), net.ReadFloat()) +end) + +net.Receive("zs_sigilcorrupted", function(length) + local corrupted = net.ReadUInt(8) + + LastSigilCorrupted = CurTime() + + if MySelf:IsValid() then + local maxsigils = GAMEMODE:NumSigils() + local winddown = CreateSound(MySelf, "ambient/levels/labs/teleport_winddown1.wav") + winddown:PlayEx(1, 120) + + timer.Simple(1.25, function() + MySelf:EmitSound("ambient/levels/labs/machine_stop1.wav", 75, 80) + MySelf:EmitSound("ambient/atmosphere/hole_hit5.wav", 75, 70) + end) + + timer.Simple(1.5, function() + winddown:Stop() + MySelf:EmitSound("zombiesurvival/eyeflash.ogg", 75, 100) + end) + + if corrupted == maxsigils then + GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFontSmall"}, COLOR_RED, translate.Get("sigil_corrupted_last"), {killicon = "default"}) + else + GAMEMODE:CenterNotify(COLOR_RED, {font = "ZSHUDFontSmall"}, translate.Get("sigil_corrupted")) + --GAMEMODE:CenterNotify(COLOR_RED, translate.Format("sigil_corrupted_x_remain", maxsigils - corrupted)) + end + end +end) + +net.Receive("zs_sigiluncorrupted", function(length) + --local corrupted = net.ReadUInt(8) + + LastSigilUncorrupted = CurTime() + + if MySelf:IsValid() then + MySelf:EmitSound("ambient/levels/labs/teleport_preblast_suckin1.wav", 75, 180) + + timer.Simple(1.25, function() + MySelf:EmitSound("ambient/machines/teleport1.wav", 75, 60, 0.3) + end) + GAMEMODE:CenterNotify(COLOR_GREEN, {font = "ZSHUDFontSmall"}, translate.Get("sigil_uncorrupted")) + end +end) + +net.Receive("zs_ammopickup", function(length) + local amount = net.ReadUInt(16) + local ammotype = net.ReadString() + local ico = GAMEMODE.AmmoIcons[ammotype] or "weapon_zs_resupplybox" + + ammotype = GAMEMODE.AmmoNames[ammotype] or ammotype + + GAMEMODE:CenterNotify({killicon = ico}, " ", COLOR_GREEN, translate.Format("obtained_x_y_ammo", amount, ammotype)) +end) + +net.Receive("zs_ammogive", function(length) + local amount = net.ReadUInt(16) + local ammotype = net.ReadString() + local ent = net.ReadEntity() + + if not ent:IsValidPlayer() then return end + local ico = GAMEMODE.AmmoIcons[ammotype] or "weapon_zs_resupplybox" + + ammotype = GAMEMODE.AmmoNames[ammotype] or ammotype + + GAMEMODE:CenterNotify({killicon = ico}, " ", COLOR_GREEN, translate.Format("gave_x_y_ammo_to_z", amount, ammotype, ent:Name())) +end) + +net.Receive("zs_ammogiven", function(length) + local amount = net.ReadUInt(16) + local ammotype = net.ReadString() + local ent = net.ReadEntity() + + if not ent:IsValidPlayer() then return end + local ico = GAMEMODE.AmmoIcons[ammotype] or "weapon_zs_resupplybox" + + ammotype = GAMEMODE.AmmoNames[ammotype] or ammotype + + GAMEMODE:CenterNotify({killicon = ico}, " ", COLOR_GREEN, translate.Format("obtained_x_y_ammo_from_z", amount, ammotype, ent:Name())) +end) + +net.Receive("zs_deployablelost", function(length) + local deploy = net.ReadString() + local class = net.ReadString() + + GAMEMODE:CenterNotify({killicon = class}, " ", COLOR_RED, translate.Format("deployable_lost", deploy)) +end) + +net.Receive("zs_deployableclaim", function(length) + local deploy = net.ReadString() + local class = net.ReadString() + + GAMEMODE:CenterNotify({killicon = class}, " ", COLOR_LBLUE, translate.Format("deployable_claimed", deploy)) +end) + +net.Receive("zs_deployableout", function(length) + local deploy = net.ReadString() + local class = net.ReadString() + + GAMEMODE:CenterNotify({killicon = class}, " ", COLOR_RED, translate.Format("ran_out_of_ammo", deploy)) +end) + +net.Receive("zs_trinketrecharged", function(length) + local trinket = net.ReadString() + MySelf:EmitSound("buttons/button3.wav", 75, 50) + + GAMEMODE:CenterNotify({killicon = "weapon_zs_trinket"}, " ", COLOR_RORANGE, translate.Format("trinket_recharged", trinket)) +end) + +net.Receive("zs_trinketconsumed", function(length) + local trinket = net.ReadString() + MySelf:EmitSound("buttons/button3.wav", 75, 50) + + GAMEMODE:CenterNotify({killicon = "weapon_zs_trinket"}, " ", COLOR_RORANGE, translate.Format("trinket_consumed", trinket)) +end) + +net.Receive("zs_invitem", function(length) + local invitemt = net.ReadString() + local inviname = GAMEMODE.ZSInventoryItemData[invitemt].PrintName + local category = GAMEMODE:GetInventoryItemType(invitemt) + + surface.PlaySound("items/ammo_pickup.wav") + GAMEMODE:CenterNotify({killicon = category == INVCAT_TRINKETS and "weapon_zs_trinket" or "weapon_zs_craftables"}, " ", COLOR_RORANGE, translate.Format("obtained_a_inv", inviname)) +end) + +net.Receive("zs_invgiven", function(length) + local invitemt = net.ReadString() + local inviname = GAMEMODE.ZSInventoryItemData[invitemt].PrintName + local category = GAMEMODE:GetInventoryItemType(invitemt) + local ent = net.ReadEntity() + + if not ent:IsValidPlayer() then return end + + GAMEMODE:CenterNotify({killicon = category == INVCAT_TRINKETS and "weapon_zs_trinket" or "weapon_zs_craftables"}, " ", COLOR_RORANGE, translate.Format("obtained_inv_item_from_z", inviname, ent:Name())) +end) + +net.Receive("zs_healby", function(length) + local amount = net.ReadFloat() + local ent = net.ReadEntity() + + if not ent:IsValidPlayer() then return end + + GAMEMODE:CenterNotify({killicon = "weapon_zs_medicalkit"}, " ", COLOR_GREEN, translate.Format("healed_x_by_y", ent:Name(), amount)) +end) + +net.Receive("zs_buffby", function(length) + local ent = net.ReadEntity() + local buff = net.ReadString() + + if not ent:IsValidPlayer() then return end + + GAMEMODE:CenterNotify({killicon = "weapon_zs_medicgun"}, " ", COLOR_GREEN, translate.Format("buffed_x_with_y", ent:Name(), buff)) +end) + +net.Receive("zs_buffwith", function(length) + local ent = net.ReadEntity() + local buff = net.ReadString() + + if not ent:IsValidPlayer() then return end + + GAMEMODE:CenterNotify({killicon = "weapon_zs_medicgun"}, " ", COLOR_GREEN, translate.Format("buffed_x_with_a_y", ent:Name(), buff)) +end) + +net.Receive("zs_nailremoved", function(length) + local ent = net.ReadEntity() + if not ent:IsValidPlayer() then return end + + GAMEMODE:CenterNotify({killicon = "weapon_zs_hammer"}, " ", COLOR_RED, translate.Format("removed_your_nail", ent:Name())) +end) + +net.Receive("zs_currentround", function(length) + GAMEMODE.CurrentRound = net.ReadUInt(6) +end) + +net.Receive("zs_updatealtselwep", function(length) + if MySelf:Alive() and P_Team(MySelf) == TEAM_HUMAN and GAMEMODE.HumanMenuPanel and GAMEMODE.HumanMenuPanel:IsValid() and not GAMEMODE.InventoryMenu.SelInv then + timer.Simple(0.25, AltSelItemUpd) + end +end) + +net.Receive("zs_nestbuilt", function(length) + if GAMEMODE.ZSpawnMenu and GAMEMODE.ZSpawnMenu:IsValid() then + GAMEMODE.ZSpawnMenu:RefreshContents() + end +end) diff --git a/gamemodes/zombiesurvival/gamemode/cl_options.lua b/gamemodes/zombiesurvival/gamemode/cl_options.lua index b00070e..8a73918 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_options.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_options.lua @@ -6,8 +6,59 @@ GM.ItemCategoryIcons = { [ITEMCAT_AMMO] = "icon16/box.png", [ITEMCAT_MELEE] = "icon16/cog.png", [ITEMCAT_TOOLS] = "icon16/wrench.png", + [ITEMCAT_DEPLOYABLES] = "icon16/package.png", [ITEMCAT_OTHER] = "icon16/world.png", - [ITEMCAT_RETURNS] = "icon16/user_delete.png" + [ITEMCAT_TRINKETS] = "icon16/ruby.png" --[[, + [ITEMCAT_RETURNS] = "icon16/user_delete.png"]] +} + +GM.RemortColors = { + [9] = COLOR_TAN, + [8] = COLOR_BROWN, + [7] = COLOR_RPINK, + [6] = COLOR_RPURPLE, + [5] = COLOR_CYAN, + [4] = COLOR_GREEN, + [3] = COLOR_YELLOW, + [2] = COLOR_RORANGE, + [1] = COLOR_RED +} + +GM.SpeedToText = { + [SPEED_NORMAL] = "Normal", + [SPEED_SLOWEST] = "Very Slow", + [SPEED_SLOWER] = "Quite Slow", + [SPEED_SLOW] = "Slow", + [SPEED_FAST] = "Fast", + [SPEED_FASTER] = "Quite Fast", + [SPEED_FASTEST] = "Very Fast", + [-1] = "Ultra Slow", +} + +GM.AmmoToPurchaseNames = { + ["pistol"] = "pistolammo", + ["buckshot"] = "shotgunammo", + ["smg1"] = "smgammo", + ["ar2"] = "assaultrifleammo", + ["357"] = "rifleammo", + ["pulse"] = "pulseammo", + ["XBowBolt"] = "crossbowammo", + ["impactmine"] = "impactmine", + ["chemical"] = "chemical" +} + +GM.WeaponStatBarVals = { + {"MeleeDamage", "Damage", 2, 140, false}, + {"MeleeRange", "Range", 30, 100, false}, + {"MeleeSize", "Size", 0.2, 3, false}, + + {"Damage", "Damage", 1, 105, false, "Primary"}, + {"Delay", "Attack Delay", 0.05, 2, true, "Primary"}, + {"ClipSize", "Clip Size", 1, 35, false, "Primary"}, + + {"ConeMin", "Min Spread", 0, 5, true}, + {"ConeMax", "Max Spread", 1.5, 7, true}, + {"WalkSpeed", "Move Speed", 200, 250, false} } GM.LifeStatsLifeTime = 5 @@ -15,25 +66,44 @@ GM.LifeStatsLifeTime = 5 GM.RewardIcons = {} GM.RewardIcons["weapon_zs_barricadekit"] = "models/props_debris/wood_board05a.mdl" -GM.CrosshairColor = Color(CreateClientConVar("zs_crosshair_colr", "255", true, false):GetInt(), CreateClientConVar("zs_crosshair_colg", "255", true, false):GetInt(), CreateClientConVar("zs_crosshair_colb", "255", true, false):GetInt(), 220) -GM.CrosshairColor2 = Color(CreateClientConVar("zs_crosshair_colr2", "220", true, false):GetInt(), CreateClientConVar("zs_crosshair_colg2", "0", true, false):GetInt(), CreateClientConVar("zs_crosshair_colb2", "0", true, false):GetInt(), 220) +GM.CrosshairColor = Color(CreateClientConVar("zs_crosshair_colr", "255", true, false):GetInt(), CreateClientConVar("zs_crosshair_colg", "255", true, false):GetInt(), CreateClientConVar("zs_crosshair_colb", "255", true, false):GetInt(), CreateClientConVar("zs_crosshair_cola", "220", true, false):GetInt()) +GM.CrosshairColor2 = Color(CreateClientConVar("zs_crosshair_colr2", "220", true, false):GetInt(), CreateClientConVar("zs_crosshair_colg2", "0", true, false):GetInt(), CreateClientConVar("zs_crosshair_colb2", "0", true, false):GetInt(), CreateClientConVar("zs_crosshair_cola2", "220", true, false):GetInt()) cvars.AddChangeCallback("zs_crosshair_colr", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor.r = tonumber(newvalue) or 255 end) cvars.AddChangeCallback("zs_crosshair_colg", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor.g = tonumber(newvalue) or 255 end) cvars.AddChangeCallback("zs_crosshair_colb", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor.b = tonumber(newvalue) or 255 end) +cvars.AddChangeCallback("zs_crosshair_cola", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor.a = tonumber(newvalue) or 255 end) cvars.AddChangeCallback("zs_crosshair_colr2", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor2.r = tonumber(newvalue) or 255 end) cvars.AddChangeCallback("zs_crosshair_colg2", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor2.g = tonumber(newvalue) or 255 end) cvars.AddChangeCallback("zs_crosshair_colb2", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor2.b = tonumber(newvalue) or 255 end) +cvars.AddChangeCallback("zs_crosshair_cola2", function(cvar, oldvalue, newvalue) GAMEMODE.CrosshairColor2.a = tonumber(newvalue) or 255 end) GM.FilmMode = CreateClientConVar("zs_filmmode", "0", true, false):GetBool() cvars.AddChangeCallback("zs_filmmode", function(cvar, oldvalue, newvalue) GAMEMODE.FilmMode = tonumber(newvalue) == 1 - GAMEMODE:EvaluateFilmMode() + gamemode.Call("EvaluateFilmMode") end) CreateClientConVar("zs_noredeem", "0", true, true) CreateClientConVar("zs_alwaysvolunteer", "0", true, true) CreateClientConVar("zs_nobosspick", "0", true, true) +CreateClientConVar("zs_nousetodeposit", "0", true, true) +CreateClientConVar("zs_nopickupprops", "0", true, true) + +GM.DisableScopes = CreateClientConVar("zs_disablescopes", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_disablescopes", function(cvar, oldvalue, newvalue) + GAMEMODE.DisableScopes = tonumber(newvalue) == 1 +end) + +GM.IronsightZoomScale = math.Clamp(CreateClientConVar("zs_ironsightzoom", 1, true, false):GetFloat(), 0, 1) +cvars.AddChangeCallback("zs_ironsightzoom", function(cvar, oldvalue, newvalue) + GAMEMODE.IronsightZoomScale = math.Clamp(tonumber(newvalue) or 1, 0, 1) +end) + +GM.ThirdPersonKnockdown = CreateClientConVar("zs_thirdpersonknockdown", "1", true, false):GetBool() +cvars.AddChangeCallback("zs_thirdpersonknockdown", function(cvar, oldvalue, newvalue) + GAMEMODE.ThirdPersonKnockdown = tonumber(newvalue) == 1 +end) GM.SuicideOnChangeClass = CreateClientConVar("zs_suicideonchange", "1", true, false):GetBool() cvars.AddChangeCallback("zs_suicideonchange", function(cvar, oldvalue, newvalue) @@ -45,41 +115,166 @@ cvars.AddChangeCallback("zs_beats", function(cvar, oldvalue, newvalue) GAMEMODE.BeatsEnabled = tonumber(newvalue) == 1 end) +GM.DamageNumberThroughWalls = CreateClientConVar("zs_damagefloaterswalls", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_damagefloaterswalls", function(cvar, oldvalue, newvalue) + GAMEMODE.DamageNumberThroughWalls = tonumber(newvalue) == 1 +end) + GM.BeatsVolume = math.Clamp(CreateClientConVar("zs_beatsvolume", 80, true, false):GetInt(), 0, 100) / 100 cvars.AddChangeCallback("zs_beatsvolume", function(cvar, oldvalue, newvalue) GAMEMODE.BeatsVolume = math.Clamp(tonumber(newvalue) or 0, 0, 100) / 100 end) +GM.CrosshairLines = math.Clamp(CreateClientConVar("zs_crosshairlines", 4, true, false):GetInt(), 2, 8) +cvars.AddChangeCallback("zs_crosshairlines", function(cvar, oldvalue, newvalue) + GAMEMODE.CrosshairLines = math.Clamp(tonumber(newvalue) or 4, 2, 8) +end) + +GM.CrosshairOffset = math.Clamp(CreateClientConVar("zs_crosshairoffset", 0, true, false):GetInt(), 0, 90) +cvars.AddChangeCallback("zs_crosshairoffset", function(cvar, oldvalue, newvalue) + GAMEMODE.CrosshairOffset = math.Clamp(tonumber(newvalue) or 0, 0, 90) +end) + +GM.CrosshairThickness = math.Clamp(CreateClientConVar("zs_crosshairthickness", 1, true, false):GetFloat(), 0.5, 2) +cvars.AddChangeCallback("zs_crosshairthickness", function(cvar, oldvalue, newvalue) + GAMEMODE.CrosshairThickness = math.Clamp(tonumber(newvalue) or 1, 0.5, 2) +end) + +GM.PropRotationSensitivity = math.Clamp(CreateClientConVar("zs_proprotationsens", 1, true, false):GetFloat(), 0.1, 4) +cvars.AddChangeCallback("zs_proprotationsens", function(cvar, oldvalue, newvalue) + GAMEMODE.PropRotationSensitivity = math.Clamp(tonumber(newvalue) or 1, 0.1, 4) +end) + +GM.PropRotationSnap = math.Clamp(CreateClientConVar("zs_proprotationsnap", 0, true, false):GetInt(), 0, 45) +cvars.AddChangeCallback("zs_proprotationsnap", function(cvar, oldvalue, newvalue) + GAMEMODE.PropRotationSnap = math.Clamp(tonumber(newvalue) or 0, 0, 45) +end) + +GM.DamageNumberScale = math.Clamp(CreateClientConVar("zs_dmgnumberscale", 1, true, false):GetFloat(), 0.5, 2) +cvars.AddChangeCallback("zs_dmgnumberscale", function(cvar, oldvalue, newvalue) + GAMEMODE.DamageNumberScale = math.Clamp(tonumber(newvalue) or 1, 0.5, 2) +end) + +GM.DamageNumberSpeed = math.Clamp(CreateClientConVar("zs_dmgnumberspeed", 1, true, false):GetFloat(), 0, 1) +cvars.AddChangeCallback("zs_dmgnumberspeed", function(cvar, oldvalue, newvalue) + GAMEMODE.DamageNumberSpeed = math.Clamp(tonumber(newvalue) or 1, 0, 1) +end) + +GM.DamageNumberLifetime = math.Clamp(CreateClientConVar("zs_dmgnumberlife", 1, true, false):GetFloat(), 0.2, 1.5) +cvars.AddChangeCallback("zs_dmgnumberlife", function(cvar, oldvalue, newvalue) + GAMEMODE.DamageNumberLifetime = math.Clamp(tonumber(newvalue) or 1, 0.2, 1.5) +end) + +GM.InterfaceSize = math.Clamp(CreateClientConVar("zs_interfacesize", 1, true, false):GetFloat(), 0.7, 1.5) +cvars.AddChangeCallback("zs_interfacesize", function(cvar, oldvalue, newvalue) + if not GAMEMODE.EmptyCachedFontHeights then return end --??? + + GAMEMODE.InterfaceSize = math.Clamp(tonumber(newvalue) or 1, 0.7, 1.5) + + GAMEMODE:CreateScalingFonts() + GAMEMODE:EmptyCachedFontHeights() + + local screenscale = BetterScreenScale() + + GAMEMODE.HealthHUD:InvalidateLayout() + + GAMEMODE.GameStatePanel:InvalidateLayout() + GAMEMODE.GameStatePanel:SetSize(screenscale * 420, screenscale * 80) + + GAMEMODE.TopNotificationHUD:InvalidateLayout() + GAMEMODE.CenterNotificationHUD:InvalidateLayout() + GAMEMODE.XPHUD:InvalidateLayout() + GAMEMODE.StatusHUD:InvalidateLayout() + + GAMEMODE.ArsenalInterface = nil + + GAMEMODE:ScoreboardRebuild() +end) + GM.AlwaysShowNails = CreateClientConVar("zs_alwaysshownails", "0", true, false):GetBool() cvars.AddChangeCallback("zs_alwaysshownails", function(cvar, oldvalue, newvalue) GAMEMODE.AlwaysShowNails = tonumber(newvalue) == 1 end) -GM.NoCrosshairRotate = CreateClientConVar("zs_nocrosshairrotate", "0", true, false):GetBool() +GM.AlwaysQuickBuy = CreateClientConVar("zs_alwaysquickbuy", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_alwaysquickbuy", function(cvar, oldvalue, newvalue) + GAMEMODE.AlwaysQuickBuy = tonumber(newvalue) == 1 +end) + +GM.NoIronsights = CreateClientConVar("zs_noironsights", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_noironsights", function(cvar, oldvalue, newvalue) + GAMEMODE.NoIronsights = tonumber(newvalue) == 1 +end) + +GM.NoCrosshairRotate = CreateClientConVar("zs_nocrosshairrotate", "1", true, false):GetBool() cvars.AddChangeCallback("zs_nocrosshairrotate", function(cvar, oldvalue, newvalue) GAMEMODE.NoCrosshairRotate = tonumber(newvalue) == 1 end) -GM.TransparencyRadius = math.Clamp(CreateClientConVar("zs_transparencyradius", 140, true, false):GetInt(), 0, 512) -cvars.AddChangeCallback("zs_transparencyradius", function(cvar, oldvalue, newvalue) - GAMEMODE.TransparencyRadius = math.Clamp(tonumber(newvalue) or 0, 0, 512) +GM.HideViewModels = CreateClientConVar("zs_hideviewmodels", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_hideviewmodels", function(cvar, oldvalue, newvalue) + GAMEMODE.HideViewModels = tonumber(newvalue) == 1 end) -GM.MovementViewRoll = CreateClientConVar("zs_movementviewroll", "1", true, false):GetBool() +GM.TransparencyRadiusMax = 2048 +GM.TransparencyRadius = 0 + +GM.TransparencyRadius1p = math.Clamp(CreateClientConVar("zs_transparencyradius", 140, true, false):GetInt(), 0, GM.TransparencyRadiusMax) ^ 2 +cvars.AddChangeCallback("zs_transparencyradius", function(cvar, oldvalue, newvalue) + GAMEMODE.TransparencyRadius1p = math.Clamp(tonumber(newvalue) or 0, 0, GAMEMODE.TransparencyRadiusMax) ^ 2 +end) + +GM.TransparencyRadius3p = math.Clamp(CreateClientConVar("zs_transparencyradius3p", 140, true, false):GetInt(), 0, GM.TransparencyRadiusMax) ^ 2 +cvars.AddChangeCallback("zs_transparencyradius3p", function(cvar, oldvalue, newvalue) + GAMEMODE.TransparencyRadius3p = math.Clamp(tonumber(newvalue) or 0, 0, GAMEMODE.TransparencyRadiusMax) ^ 2 +end) + +GM.MovementViewRoll = CreateClientConVar("zs_movementviewroll", "0", true, false):GetBool() cvars.AddChangeCallback("zs_movementviewroll", function(cvar, oldvalue, newvalue) GAMEMODE.MovementViewRoll = tonumber(newvalue) == 1 end) +GM.MessageBeaconShow = CreateClientConVar("zs_messagebeaconshow", "1", true, false):GetBool() +cvars.AddChangeCallback("zs_messagebeaconshow", function(cvar, oldvalue, newvalue) + GAMEMODE.MessageBeaconShow = tonumber(newvalue) == 1 +end) + GM.WeaponHUDMode = CreateClientConVar("zs_weaponhudmode", "0", true, false):GetInt() cvars.AddChangeCallback("zs_weaponhudmode", function(cvar, oldvalue, newvalue) GAMEMODE.WeaponHUDMode = tonumber(newvalue) or 0 end) +GM.HealthTargetDisplay = CreateClientConVar("zs_healthtargetdisplay", "0", true, false):GetInt() +cvars.AddChangeCallback("zs_healthtargetdisplay", function(cvar, oldvalue, newvalue) + GAMEMODE.HealthTargetDisplay = tonumber(newvalue) or 0 +end) + GM.DrawPainFlash = CreateClientConVar("zs_drawpainflash", "1", true, false):GetBool() cvars.AddChangeCallback("zs_drawpainflash", function(cvar, oldvalue, newvalue) GAMEMODE.DrawPainFlash = tonumber(newvalue) == 1 end) +GM.DisplayXPHUD = CreateClientConVar("zs_drawxp", "1", true, false):GetBool() +cvars.AddChangeCallback("zs_drawxp", function(cvar, oldvalue, newvalue) + GAMEMODE.DisplayXPHUD = tonumber(newvalue) == 1 + gamemode.Call("EvaluateFilmMode") +end) + +GM.FontEffects = CreateClientConVar("zs_fonteffects", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_fonteffects", function(cvar, oldvalue, newvalue) + GAMEMODE.FontEffects = tonumber(newvalue) == 1 +end) + +GM.HidePacks = CreateClientConVar("zs_hidepacks", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_hidepacks", function(cvar, oldvalue, newvalue) + GAMEMODE.HidePacks = tonumber(newvalue) == 1 +end) + +GM.AlwaysDrawFriend = CreateClientConVar("zs_showfriends", "0", true, false):GetBool() +cvars.AddChangeCallback("zs_showfriends", function(cvar, oldvalue, newvalue) + GAMEMODE.AlwaysDrawFriend = tonumber(newvalue) == 1 +end) + CreateConVar( "cl_playercolor", "0.24 0.34 0.41", { FCVAR_ARCHIVE, FCVAR_USERINFO }, "The value is a Vector - so between 0-1 - not between 0-255" ) CreateConVar( "cl_weaponcolor", "0.30 1.80 2.10", { FCVAR_ARCHIVE, FCVAR_USERINFO }, "The value is a Vector - so between 0-1 - not between 0-255" ) diff --git a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua index 7e1bc39..e5efad4 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_postprocess.lua @@ -59,12 +59,9 @@ local DrawSharpen = DrawSharpen local EyePos = EyePos local TEAM_HUMAN = TEAM_HUMAN local TEAM_UNDEAD = TEAM_UNDEAD -local render_UpdateScreenEffectTexture = render.UpdateScreenEffectTexture local render_SetMaterial = render.SetMaterial -local render_DrawScreenQuad = render.DrawScreenQuad local render_DrawSprite = render.DrawSprite -local render_DrawBeam = render.DrawBeam -local render_GetLightRGB = render.GetLightRGB +local render_SetLightingMode = render.SetLightingMode local math_Approach = math.Approach local FrameTime = FrameTime local CurTime = CurTime @@ -74,6 +71,8 @@ local math_max = math.max local math_abs = math.abs local team_GetPlayers = team.GetPlayers +local FullBright = false + local tColorModDead = { ["$pp_colour_contrast"] = 1.25, ["$pp_colour_colour"] = 0, @@ -111,20 +110,31 @@ local tColorModZombie = { } local tColorModZombieVision = { - ["$pp_colour_colour"] = 0.75, - ["$pp_colour_brightness"] = -0.15, - ["$pp_colour_contrast"] = 1.5, + ["$pp_colour_colour"] = 3, + ["$pp_colour_brightness"] = -0.1, + ["$pp_colour_contrast"] = 1, ["$pp_colour_mulr"] = 0, ["$pp_colour_mulg"] = 0, ["$pp_colour_mulb"] = 0, ["$pp_colour_addr"] = 0, - ["$pp_colour_addg"] = 0, + ["$pp_colour_addg"] = 0.1, + ["$pp_colour_addb"] = 0 +} + +local tColorModNightVision = { + ["$pp_colour_colour"] = 0.99, + ["$pp_colour_brightness"] = -0.34, + ["$pp_colour_contrast"] = 1.46, + ["$pp_colour_mulr"] = 0, + ["$pp_colour_mulg"] = 1, + ["$pp_colour_mulb"] = 0, + ["$pp_colour_addr"] = 0, + ["$pp_colour_addg"] = 0.2, ["$pp_colour_addb"] = 0 } local redview = 0 local fear = 0 -local matTankGlass = Material("models/props_lab/Tank_Glass001") function GM:_RenderScreenspaceEffects() if MySelf.Confusion and MySelf.Confusion:IsValid() then MySelf.Confusion:RenderScreenSpaceEffects() @@ -138,16 +148,6 @@ function GM:_RenderScreenspaceEffects() DrawSharpen(1, math_min(6, self.HurtEffect * 3)) end - --[[if MySelf:Team() == TEAM_UNDEAD and self.m_ZombieVision and not matTankGlass:IsError() then - render_UpdateScreenEffectTexture() - matTankGlass:SetFloat("$envmap", 0) - matTankGlass:SetFloat("$envmaptint", 0) - matTankGlass:SetFloat("$refractamount", 0.035) - matTankGlass:SetInt("$ignorez", 1) - render_SetMaterial(matTankGlass) - render_DrawScreenQuad() - end]] - if self.ColorModEnabled then if not MySelf:Alive() and MySelf:GetObserverMode() ~= OBS_MODE_CHASE then if not MySelf:HasWon() then @@ -163,72 +163,82 @@ function GM:_RenderScreenspaceEffects() DrawColorModify(tColorModZombie) end else - local curr = tColorModHuman["$pp_colour_addr"] - local health = MySelf:Health() - if health <= 50 then - --tColorModHuman["$pp_colour_addr"] = math_min(0.3 - health * 0.006, curr + FrameTime() * 0.055) - redview = math_Approach(redview, 1 - health / 50, FrameTime() * 0.2) - elseif 0 < curr then - --tColorModHuman["$pp_colour_addr"] = math_max(0, curr - FrameTime() * 0.1) - redview = math_Approach(redview, 0, FrameTime() * 0.2) + if self.m_NightVision then + DrawColorModify(tColorModNightVision) + else + local curr = tColorModHuman["$pp_colour_addr"] + local health = MySelf:Health() + local maxhealth = MySelf:GetMaxHealth() / 3 + if health <= maxhealth then + redview = math_Approach(redview, 1 - health / maxhealth, FrameTime() * 0.2) + elseif 0 < curr then + redview = math_Approach(redview, 0, FrameTime() * 0.2) + end + + tColorModHuman["$pp_colour_addr"] = redview * (0.035 + math_abs(math_sin(CurTime() * 2)) * 0.14) + tColorModHuman["$pp_colour_brightness"] = fear * -0.045 + tColorModHuman["$pp_colour_contrast"] = 1 + fear * 0.15 + tColorModHuman["$pp_colour_colour"] = 1 - fear * 0.725 --0.85 + + DrawColorModify(tColorModHuman) end - - tColorModHuman["$pp_colour_addr"] = redview * (0.035 + math_abs(math.sin(CurTime() * 2)) * 0.14) - tColorModHuman["$pp_colour_brightness"] = fear * -0.045 - tColorModHuman["$pp_colour_contrast"] = 1 + fear * 0.15 - tColorModHuman["$pp_colour_colour"] = 1 - fear * 0.725 --0.85 - - DrawColorModify(tColorModHuman) end end end +function GM:_RenderScene() + if (self.m_ZombieVision and MySelf:Team() == TEAM_UNDEAD) or (self.m_NightVision and MySelf:Team() == TEAM_HUMAN and not MySelf:GetStatus("dimvision")) then + render_SetLightingMode(1) + FullBright = true + else + FullBright = false + end +end + +function GM:FullBrightOn() + if FullBright then + render_SetLightingMode(1) + end +end + +function GM:FullBrightOff() + if FullBright then + render_SetLightingMode(0) + end +end + +hook.Add("PreDrawOpaqueRenderables", "ZFullBright", GM.FullBrightOff) +hook.Add("PreDrawTranslucentRenderables", "ZFullBright", GM.FullBrightOff) +hook.Add("PostDrawTranslucentRenderables", "ZFullBright", GM.FullBrightOn) +hook.Add("PreDrawViewModel", "ZFullBright", GM.FullBrightOff) +hook.Add("RenderScreenspaceEffects", "ZFullBright", GM.FullBrightOff) + local matGlow = Material("Sprites/light_glow02_add_noz") local colHealthEmpty = GM.AuraColorEmpty local colHealthFull = GM.AuraColorFull -local colHealth = Color(255, 255, 255, 255) -local matPullBeam = Material("cable/rope") -local colPullBeam = Color(255, 255, 255, 255) -function GM:_PostDrawOpaqueRenderables() - if MySelf:Team() == TEAM_UNDEAD then - if self.Auras then - local eyepos = EyePos() - for _, pl in pairs(team_GetPlayers(TEAM_HUMAN)) do - if pl:Alive() and pl:GetPos():Distance(eyepos) <= pl:GetAuraRange() then - local healthfrac = math_max(pl:Health(), 0) / pl:GetMaxHealth() - colHealth.r = math_Approach(colHealthEmpty.r, colHealthFull.r, math_abs(colHealthEmpty.r - colHealthFull.r) * healthfrac) - colHealth.g = math_Approach(colHealthEmpty.g, colHealthFull.g, math_abs(colHealthEmpty.g - colHealthFull.g) * healthfrac) - colHealth.b = math_Approach(colHealthEmpty.b, colHealthFull.b, math_abs(colHealthEmpty.b - colHealthFull.b) * healthfrac) +local colHealth = Color(255, 255, 255) +function GM:DrawHumanIndicators() + if MySelf:Team() ~= TEAM_UNDEAD or not self.Auras or self.m_ZombieVision then return end - --local attach = pl:GetAttachment(pl:LookupAttachment("chest")) -- This probably lagged so much. - --local pos = attach and attach.Pos or pl:WorldSpaceCenter() - local pos = pl:WorldSpaceCenter() + local eyepos = EyePos() + local range, dist, healthfrac, pos, size + for _, pl in pairs(team_GetPlayers(TEAM_HUMAN)) do + range = pl:GetAuraRangeSqr() + dist = pl:GetPos():DistToSqr(eyepos) + if pl:Alive() and dist <= range and (not pl:GetDTBool(DT_PLAYER_BOOL_NECRO) or dist >= 27500) then + healthfrac = math_max(pl:Health(), 0) / pl:GetMaxHealth() + colHealth.r = math_Approach(colHealthEmpty.r, colHealthFull.r, math_abs(colHealthEmpty.r - colHealthFull.r) * healthfrac) + colHealth.g = math_Approach(colHealthEmpty.g, colHealthFull.g, math_abs(colHealthEmpty.g - colHealthFull.g) * healthfrac) + colHealth.b = math_Approach(colHealthEmpty.b, colHealthFull.b, math_abs(colHealthEmpty.b - colHealthFull.b) * healthfrac) - render_SetMaterial(matGlow) - render_DrawSprite(pos, 13, 13, colHealth) - local size = math_sin(self.HeartBeatTime + pl:EntIndex()) * 50 - 21 - if size > 0 then - render_DrawSprite(pos, size * 1.5, size, colHealth) - render_DrawSprite(pos, size, size * 1.5, colHealth) - end - end - end - end - elseif MySelf:Team() == TEAM_HUMAN then - self:DrawCraftingEntity() + pos = pl:WorldSpaceCenter() - local holding = MySelf.status_human_holding - if holding and holding:IsValid() and holding:GetIsHeavy() then - local object = holding:GetObject() - if object:IsValid() then - local pullpos = holding:GetPullPos() - local hingepos = holding:GetHingePos() - local r, g, b = render_GetLightRGB(hingepos) - colPullBeam.r = r * 255 - colPullBeam.g = g * 255 - colPullBeam.b = b * 255 - render_SetMaterial(matPullBeam) - render_DrawBeam(hingepos, pullpos, 0.5, 0, pullpos:Distance(hingepos) / 128, colPullBeam) + render_SetMaterial(matGlow) + render_DrawSprite(pos, 13, 13, colHealth) + size = math_sin(self.HeartBeatTime + pl:EntIndex()) * 50 - 21 + if size > 0 then + render_DrawSprite(pos, size * 1.5, size, colHealth) + render_DrawSprite(pos, size, size * 1.5, colHealth) end end end @@ -243,11 +253,49 @@ function GM:ToggleZombieVision(onoff) if not self.m_ZombieVision then self.m_ZombieVision = true MySelf:EmitSound("npc/stalker/breathing3.wav", 0, 230) - MySelf:SetDSP(30) end elseif self.m_ZombieVision then self.m_ZombieVision = nil MySelf:EmitSound("npc/zombie/zombie_pain6.wav", 0, 110) - MySelf:SetDSP(0) end end + +net.Receive("zs_togglezvision", function(length) + gamemode.Call("ToggleZombieVision") +end) + +local CModWhiteOut = { + ["$pp_colour_addr"] = 0, + ["$pp_colour_addg"] = 0, + ["$pp_colour_addb"] = 0, + ["$pp_colour_brightness"] = 0, + ["$pp_colour_contrast"] = 1, + ["$pp_colour_colour"] = 1, + ["$pp_colour_mulr"] = 0, + ["$pp_colour_mulg"] = 0, + ["$pp_colour_mulb"] = 0 +} +local WhiteOutEnd +local WhiteOutFadeTime +local function RenderWhiteOut() + local dt = math_max(WhiteOutEnd - CurTime(), 0) / WhiteOutFadeTime + if dt <= 0 then + WhiteOutEnd = nil + WhiteOutFadeTime = nil + hook.Remove("RenderScreenspaceEffects", "WhiteOut") + else + local size = 5 + dt * 10 + CModWhiteOut["$pp_colour_brightness"] = dt ^ 2 + DrawBloom(1 - dt, dt * 3, size, size, 1, 1, 1, 1, 1) + DrawColorModify(CModWhiteOut) + end +end + +function util.WhiteOut(time, fadeouttime) + time = time or 1 + + WhiteOutEnd = math_max(CurTime() + time, WhiteOutEnd or 0) + WhiteOutFadeTime = math_max(fadeouttime or time, WhiteOutFadeTime or 0) + + hook.Add("RenderScreenspaceEffects", "WhiteOut", RenderWhiteOut) +end diff --git a/gamemodes/zombiesurvival/gamemode/cl_scoreboard.lua b/gamemodes/zombiesurvival/gamemode/cl_scoreboard.lua index 01198bd..4659332 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_scoreboard.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_scoreboard.lua @@ -7,14 +7,21 @@ function GM:ScoreboardShow() ScoreBoard = vgui.Create("ZSScoreBoard") end - ScoreBoard:SetSize(math.min(ScrW(), ScrH()) * 0.8, ScrH() * 0.85) + local screenscale = BetterScreenScale() + + ScoreBoard:SetSize(math.min(974, ScrW() * 0.65) * math.max(1, screenscale), ScrH() * 0.85) ScoreBoard:AlignTop(ScrH() * 0.05) ScoreBoard:CenterHorizontal() ScoreBoard:SetAlpha(0) - ScoreBoard:AlphaTo(255, 0.5, 0) + ScoreBoard:AlphaTo(255, 0.15, 0) ScoreBoard:SetVisible(true) end +function GM:ScoreboardRebuild() + self:ScoreboardHide() + ScoreBoard = nil +end + function GM:ScoreboardHide() gui.EnableScreenClicker(false) @@ -35,9 +42,6 @@ local function BlurPaint(self) return true end -local function emptypaint(self) - return true -end function PANEL:Init() self.NextRefresh = RealTime() + 0.1 @@ -60,8 +64,8 @@ function PANEL:Init() self.m_ServerNameLabel:NoClipping(true) self.m_ServerNameLabel.Paint = BlurPaint - self.m_AuthorLabel = EasyLabel(self, "by "..GAMEMODE.Author.." ("..GAMEMODE.Email..")", "DefaultFontSmall", COLOR_GRAY) - self.m_ContactLabel = EasyLabel(self, GAMEMODE.Website, "DefaultFontSmall", COLOR_GRAY) + self.m_AuthorLabel = EasyLabel(self, "by "..GAMEMODE.Author.." ("..GAMEMODE.Email..")", "ZSScoreBoardPing", COLOR_GRAY) + self.m_ContactLabel = EasyLabel(self, GAMEMODE.Website, "ZSScoreBoardPing", COLOR_GRAY) self.m_HumanHeading = vgui.Create("DTeamHeading", self) self.m_HumanHeading:SetTeam(TEAM_HUMAN) @@ -69,6 +73,12 @@ function PANEL:Init() self.m_ZombieHeading = vgui.Create("DTeamHeading", self) self.m_ZombieHeading:SetTeam(TEAM_UNDEAD) + self.m_PointsLabel = EasyLabel(self, "Score", "ZSScoreBoardPlayer", COLOR_GRAY) + self.m_RemortCLabel = EasyLabel(self, "R.LVL", "ZSScoreBoardPlayer", COLOR_GRAY) + + self.m_BrainsLabel = EasyLabel(self, "Brains", "ZSScoreBoardPlayer", COLOR_GRAY) + self.m_RemortCZLabel = EasyLabel(self, "R.LVL", "ZSScoreBoardPlayer", COLOR_GRAY) + self.ZombieList = vgui.Create("DScrollPanel", self) self.ZombieList.Team = TEAM_UNDEAD @@ -79,30 +89,48 @@ function PANEL:Init() end function PANEL:PerformLayout() + local screenscale = math.max(0.95, BetterScreenScale()) + self.m_AuthorLabel:MoveBelow(self.m_TitleLabel) self.m_ContactLabel:MoveBelow(self.m_AuthorLabel) self.m_ServerNameLabel:SetPos(math.min(self:GetWide() - self.m_ServerNameLabel:GetWide(), self:GetWide() * 0.75 - self.m_ServerNameLabel:GetWide() * 0.5), 32 - self.m_ServerNameLabel:GetTall() / 2) - self.m_HumanHeading:SetSize(self:GetWide() / 2 - 32, 28) - self.m_HumanHeading:SetPos(self:GetWide() * 0.25 - self.m_HumanHeading:GetWide() * 0.5, 110 - self.m_HumanHeading:GetTall()) + self.m_HumanHeading:SetSize(self:GetWide() / 2 - 32, 28 * screenscale) + self.m_HumanHeading:SetPos(self:GetWide() * 0.25 - self.m_HumanHeading:GetWide() * 0.5, 110 * screenscale - self.m_HumanHeading:GetTall()) - self.m_ZombieHeading:SetSize(self:GetWide() / 2 - 32, 28) - self.m_ZombieHeading:SetPos(self:GetWide() * 0.75 - self.m_ZombieHeading:GetWide() * 0.5, 110 - self.m_ZombieHeading:GetTall()) + self.m_ZombieHeading:SetSize(self:GetWide() / 2 - 32, 28 * screenscale) + self.m_ZombieHeading:SetPos(self:GetWide() * 0.75 - self.m_ZombieHeading:GetWide() * 0.5, 110 * screenscale - self.m_ZombieHeading:GetTall()) - self.HumanList:SetSize(self:GetWide() / 2 - 24, self:GetTall() - 150) - self.HumanList:AlignBottom(16) - self.HumanList:AlignLeft(8) + self.m_PointsLabel:SizeToContents() + self.m_PointsLabel:SetPos((self:GetWide() / 2 - 24) * 0.6 - self.m_PointsLabel:GetWide() * 0.35, 110 * screenscale - self.m_HumanHeading:GetTall()) + self.m_PointsLabel:MoveBelow(self.m_HumanHeading, 1 * screenscale) - self.ZombieList:SetSize(self:GetWide() / 2 - 24, self:GetTall() - 150) - self.ZombieList:AlignBottom(16) - self.ZombieList:AlignRight(8) + self.m_RemortCLabel:SizeToContents() + self.m_RemortCLabel:SetPos((self:GetWide() / 2 - 24) * 0.71 - self.m_RemortCLabel:GetWide() * 0.5, 110 * screenscale - self.m_HumanHeading:GetTall()) + self.m_RemortCLabel:MoveBelow(self.m_HumanHeading, 1 * screenscale) + + self.m_BrainsLabel:SizeToContents() + self.m_BrainsLabel:SetPos(self:GetWide() / 2 + 3 * screenscale + (self:GetWide() / 2 - 24) * 0.61 - self.m_BrainsLabel:GetWide() * 0.35, 110 * screenscale - self.m_HumanHeading:GetTall()) + self.m_BrainsLabel:MoveBelow(self.m_ZombieHeading, 1 * screenscale) + + self.m_RemortCZLabel:SizeToContents() + self.m_RemortCZLabel:SetPos(self:GetWide() / 2 + 3 * screenscale + (self:GetWide() / 2 - 24) * 0.71 - self.m_RemortCZLabel:GetWide() * 0.5, 110 * screenscale - self.m_HumanHeading:GetTall()) + self.m_RemortCZLabel:MoveBelow(self.m_ZombieHeading, 1 * screenscale) + + self.HumanList:SetSize(self:GetWide() / 2 - 24, self:GetTall() - 150 * screenscale) + self.HumanList:AlignBottom(16 * screenscale) + self.HumanList:AlignLeft(8 * screenscale) + + self.ZombieList:SetSize(self:GetWide() / 2 - 24, self:GetTall() - 150 * screenscale) + self.ZombieList:AlignBottom(16 * screenscale) + self.ZombieList:AlignRight(8 * screenscale) end function PANEL:Think() if RealTime() >= self.NextRefresh then self.NextRefresh = RealTime() + self.RefreshTime - self:Refresh() + self:RefreshScoreboard() end end @@ -135,7 +163,7 @@ end function PANEL:GetPlayerPanel(pl) for _, panel in pairs(self.PlayerPanels) do - if panel:Valid() and panel:GetPlayer() == pl then + if panel:IsValid() and panel:GetPlayer() == pl then return panel end end @@ -143,7 +171,7 @@ end function PANEL:CreatePlayerPanel(pl) local curpan = self:GetPlayerPanel(pl) - if curpan and curpan:Valid() then return curpan end + if curpan and curpan:IsValid() then return curpan end if pl:Team() == TEAM_SPECTATOR then return end @@ -157,7 +185,7 @@ function PANEL:CreatePlayerPanel(pl) return panel end -function PANEL:Refresh() +function PANEL:RefreshScoreboard() self.m_ServerNameLabel:SetText(GetHostName()) self.m_ServerNameLabel:SizeToContents() self.m_ServerNameLabel:SetPos(math.min(self:GetWide() - self.m_ServerNameLabel:GetWide(), self:GetWide() * 0.75 - self.m_ServerNameLabel:GetWide() * 0.5), 32 - self.m_ServerNameLabel:GetTall() / 2) @@ -165,7 +193,7 @@ function PANEL:Refresh() if self.PlayerPanels == nil then self.PlayerPanels = {} end for pl, panel in pairs(self.PlayerPanels) do - if not panel:Valid() or pl:IsValid() and pl:IsSpectator() then + if not panel:IsValid() or pl:IsValid() and pl:IsSpectator() then self:RemovePlayerPanel(panel) end end @@ -176,7 +204,7 @@ function PANEL:Refresh() end function PANEL:RemovePlayerPanel(panel) - if panel:Valid() then + if panel:IsValid() then self.PlayerPanels[panel:GetPlayer()] = nil panel:Remove() end @@ -184,7 +212,7 @@ end vgui.Register("ZSScoreBoard", PANEL, "Panel") -local PANEL = {} +PANEL = {} PANEL.RefreshTime = 1 @@ -199,9 +227,44 @@ local function MuteDoClick(self) end end +GM.ZSFriends = {} +--[[hook.Add("Initialize", "LoadZSFriends", function() + if file.Exists(GAMEMODE.FriendsFile, "DATA") then + GAMEMODE.ZSFriends = Deserialize(file.Read(GAMEMODE.FriendsFile)) or {} + end +end)]] + +local function ToggleZSFriend(self) + if MySelf.LastFriendAdd and MySelf.LastFriendAdd + 2 > CurTime() then return end + + local pl = self:GetParent():GetPlayer() + if pl:IsValid() then + if GAMEMODE.ZSFriends[pl:SteamID()] then + GAMEMODE.ZSFriends[pl:SteamID()] = nil + else + GAMEMODE.ZSFriends[pl:SteamID()] = true + end + + self:GetParent().NextRefresh = RealTime() + + net.Start("zs_zsfriend") + net.WriteString(pl:SteamID()) + net.WriteBool(GAMEMODE.ZSFriends[pl:SteamID()]) + net.SendToServer() + + MySelf.LastFriendAdd = CurTime() + --file.Write(GAMEMODE.FriendsFile, Serialize(GAMEMODE.ZSFriends)) + end +end + +net.Receive("zs_zsfriendadded", function() + local pl = net:ReadEntity() + pl.ZSFriendAdded = net:ReadBool() +end) + local function AvatarDoClick(self) local pl = self.PlayerPanel:GetPlayer() - if pl:IsValid() and pl:IsPlayer() then + if pl:IsValidPlayer() then pl:ShowProfile() end end @@ -209,18 +272,19 @@ end local function empty() end function PANEL:Init() - self:SetTall(32) + local screenscale = math.max(0.95, BetterScreenScale()) + self:SetTall(32 * screenscale) self.m_AvatarButton = self:Add("DButton", self) self.m_AvatarButton:SetText(" ") - self.m_AvatarButton:SetSize(32, 32) + self.m_AvatarButton:SetSize(32 * screenscale, 32 * screenscale) self.m_AvatarButton:Center() self.m_AvatarButton.DoClick = AvatarDoClick self.m_AvatarButton.Paint = empty self.m_AvatarButton.PlayerPanel = self self.m_Avatar = vgui.Create("AvatarImage", self.m_AvatarButton) - self.m_Avatar:SetSize(32, 32) + self.m_Avatar:SetSize(32 * screenscale, 32 * screenscale) self.m_Avatar:SetVisible(false) self.m_Avatar:SetMouseInputEnabled(false) @@ -230,21 +294,25 @@ function PANEL:Init() self.m_SpecialImage:SetVisible(false) self.m_ClassImage = vgui.Create("DImage", self) - self.m_ClassImage:SetSize(22, 22) + self.m_ClassImage:SetSize(22 * screenscale, 22 * screenscale) self.m_ClassImage:SetMouseInputEnabled(false) self.m_ClassImage:SetVisible(false) self.m_PlayerLabel = EasyLabel(self, " ", "ZSScoreBoardPlayer", COLOR_WHITE) self.m_ScoreLabel = EasyLabel(self, " ", "ZSScoreBoardPlayerSmall", COLOR_WHITE) + self.m_RemortLabel = EasyLabel(self, " ", "ZSScoreBoardPlayerSmaller", COLOR_WHITE) self.m_PingMeter = vgui.Create("DPingMeter", self) self.m_PingMeter.PingBars = 5 self.m_Mute = vgui.Create("DImageButton", self) self.m_Mute.DoClick = MuteDoClick + + self.m_Friend = vgui.Create("DImageButton", self) + self.m_Friend.DoClick = ToggleZSFriend end -local colTemp = Color(255, 255, 255, 220) +local colTemp = Color(255, 255, 255, 200) function PANEL:Paint() local col = color_black_alpha220 local mul = 0.5 @@ -266,7 +334,7 @@ function PANEL:Paint() colTemp.r = col.r * mul colTemp.g = col.g * mul colTemp.b = col.b * mul - draw.RoundedBox(8, 0, 0, self:GetWide(), self:GetTall(), colTemp) + draw.RoundedBox(4, 0, 0, self:GetWide(), self:GetTall(), colTemp) return true end @@ -287,7 +355,7 @@ function PANEL:PerformLayout() self.m_PlayerLabel:CenterVertical() self.m_ScoreLabel:SizeToContents() - self.m_ScoreLabel:SetPos(self:GetWide() * 0.666 - self.m_ScoreLabel:GetWide() / 2, 0) + self.m_ScoreLabel:SetPos(self:GetWide() * 0.6 - self.m_ScoreLabel:GetWide() / 2, 0) self.m_ScoreLabel:CenterVertical() self.m_SpecialImage:CenterVertical() @@ -305,9 +373,17 @@ function PANEL:PerformLayout() self.m_Mute:SetSize(16, 16) self.m_Mute:MoveLeftOf(self.m_PingMeter, 8) self.m_Mute:CenterVertical() + + self.m_Friend:SetSize(16, 16) + self.m_Friend:MoveLeftOf(self.m_Mute, 8) + self.m_Friend:CenterVertical() + + self.m_RemortLabel:SizeToContents() + self.m_RemortLabel:MoveLeftOf(self.m_ClassImage, 2) + self.m_RemortLabel:CenterVertical() end -function PANEL:Refresh() +function PANEL:RefreshPlayer() local pl = self:GetPlayer() if not pl:IsValid() then self:Remove() @@ -315,27 +391,49 @@ function PANEL:Refresh() end local name = pl:Name() - if #name > 26 then - name = string.sub(name, 1, 24)..".." + if #name > 23 then + name = string.sub(name, 1, 21)..".." end self.m_PlayerLabel:SetText(name) - self.m_ScoreLabel:SetText(pl:Frags()) + self.m_PlayerLabel:SetAlpha(240) - if pl:Team() == TEAM_UNDEAD and pl:GetZombieClassTable().Icon then + self.m_ScoreLabel:SetText(pl:Frags()) + self.m_ScoreLabel:SetAlpha(240) + + local rlvl = pl:GetZSRemortLevel() + self.m_RemortLabel:SetText(rlvl > 0 and rlvl or "") + + local rlvlmod = math.floor((rlvl % 40) / 4) + local hcolor, hlvl = COLOR_GRAY, 0 + for rlvlr, rcolor in pairs(GAMEMODE.RemortColors) do + if rlvlmod >= rlvlr and rlvlr >= hlvl then + hlvl = rlvlr + hcolor = rcolor + end + end + self.m_RemortLabel:SetColor(hcolor) + self.m_RemortLabel:SetAlpha(240) + + if MySelf:Team() == TEAM_UNDEAD and pl:Team() == TEAM_UNDEAD and pl:GetZombieClassTable().Icon then self.m_ClassImage:SetVisible(true) self.m_ClassImage:SetImage(pl:GetZombieClassTable().Icon) + self.m_ClassImage:SetImageColor(pl:GetZombieClassTable().IconColor or color_white) else self.m_ClassImage:SetVisible(false) end - if pl == LocalPlayer() then + if pl == MySelf then self.m_Mute:SetVisible(false) + self.m_Friend:SetVisible(false) else if pl:IsMuted() then self.m_Mute:SetImage("icon16/sound_mute.png") else self.m_Mute:SetImage("icon16/sound.png") end + + self.m_Friend:SetColor(pl.ZSFriendAdded and COLOR_LIMEGREEN or COLOR_GRAY) + self.m_Friend:SetImage(GAMEMODE.ZSFriends[pl:SteamID()] and "icon16/heart_delete.png" or "icon16/heart.png") end self:SetZPos(-pl:Frags()) @@ -351,14 +449,14 @@ end function PANEL:Think() if RealTime() >= self.NextRefresh then self.NextRefresh = RealTime() + self.RefreshTime - self:Refresh() + self:RefreshPlayer() end end function PANEL:SetPlayer(pl) self.m_Player = pl or NULL - if pl:IsValid() and pl:IsPlayer() then + if pl:IsValidPlayer() then self.m_Avatar:SetPlayer(pl) self.m_Avatar:SetVisible(true) @@ -377,7 +475,7 @@ function PANEL:SetPlayer(pl) self.m_PingMeter:SetPlayer(pl) - self:Refresh() + self:RefreshPlayer() end function PANEL:GetPlayer() diff --git a/gamemodes/zombiesurvival/gamemode/cl_targetid.lua b/gamemodes/zombiesurvival/gamemode/cl_targetid.lua index 108573b..3d468c1 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_targetid.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_targetid.lua @@ -1,10 +1,24 @@ -local trace = {mask = MASK_SHOT, mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2), filter = {}} +local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER +local EyePos = EyePos +local EyeVector = EyeVector +local CurTime = CurTime +local string_format = string.format +local string_match = string.match +local math_max = math.max +local math_ceil = math.ceil +local draw = draw +local util = util + +local trace = {mask = MASK_SHOT, mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2)} +local filter = {} local entitylist = {} local colTemp = Color(255, 255, 255) function GM:DrawTargetID(ent, fade) fade = fade or 1 - local ts = ent:GetPos():ToScreen() + local pos = ent:GetPos() + pos.z = pos.z + 16 + local ts = pos:ToScreen() local x, y = ts.x, math.Clamp(ts.y, 0, ScrH() * 0.95) colTemp.a = fade * 255 @@ -12,15 +26,43 @@ function GM:DrawTargetID(ent, fade) local name = ent:Name() draw.SimpleTextBlur(name, "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) - y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 4 + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 3 - local healthfraction = math.max(ent:Health() / (ent:Team() == TEAM_UNDEAD and ent:GetMaxZombieHealth() or ent:GetMaxHealth()), 0) + local healthfraction = math_max(ent:Health() / (ent:Team() == TEAM_UNDEAD and ent:GetMaxZombieHealth() or ent:GetMaxHealth()), 0) if healthfraction ~= 1 then util.ColorCopy(0.75 <= healthfraction and COLOR_HEALTHY or 0.5 <= healthfraction and COLOR_SCRATCHED or 0.25 <= healthfraction and COLOR_HURT or COLOR_CRITICAL, colTemp) - local healthdisplay = math.ceil(healthfraction * 100).."%" - draw.SimpleTextBlur(healthdisplay, "ZSHUDFont", x, y, colTemp, TEXT_ALIGN_CENTER) - y = y + draw.GetFontHeight("ZSHUDFont") + 4 + local hptxt = self.HealthTargetDisplay == 1 and math_ceil(ent:Health()).." HP" or math_ceil(healthfraction * 100).."%" + + draw.SimpleTextBlur(hptxt, "ZSHUDFont", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFont") + 3 + + if self.MedicalAura then + if ent:GetDTBool(DT_PLAYER_BOOL_FRAIL) then + util.ColorCopy(COLOR_LBLUE, colTemp) + draw.SimpleTextBlur("(FRAIL)", "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 2 + end + + local poison = ent:GetPoisonDamage() + local bleed = ent:GetBleedDamage() + local phant = ent:GetPhantomHealth() + if poison >= 1 then + util.ColorCopy(COLOR_LIMEGREEN, colTemp) + draw.SimpleTextBlur("(POISON - " .. math.floor(poison) ..")", "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 2 + end + if bleed >= 1 then + util.ColorCopy(COLOR_SOFTRED, colTemp) + draw.SimpleTextBlur("(BLEED - " .. math.floor(bleed) ..")", "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 2 + end + if phant >= 1 then + util.ColorCopy(COLOR_MIDGRAY, colTemp) + draw.SimpleTextBlur("(BLOODLUST)", "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 2 + end + end end util.ColorCopy(color_white, colTemp) @@ -34,35 +76,78 @@ function GM:DrawTargetID(ent, fade) else local holding = ent:GetHolding() if holding:IsValid() then - local mdl = holding:GetModel() - local name = string.match(mdl, ".*/(.+)%.mdl") or "object" - draw.SimpleTextBlur("Carrying ["..name.."]", "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) + draw.SimpleTextBlur(string_format("Carrying [%s]", string_match(holding:GetModel(), ".*/(.+)%.mdl") or "object"), "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) else local wep = ent:GetActiveWeapon() if wep:IsValid() then draw.SimpleTextBlur(wep:GetPrintName(), "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) end end + + local level = ent:GetZSLevel() + local remortlevel = ent:GetZSRemortLevel() + y = y + draw.GetFontHeight("ZSHUDFontTiny") + 4 + if remortlevel >= 1 then + draw.SimpleTextBlur(string_format("LVL %d R.LVL %d", level, remortlevel), "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) + else + draw.SimpleTextBlur("LVL "..level, "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) + end end end +function GM:DrawSigilTargetHint(ent, fade) + fade = fade or 1 + local pos = ent:GetPos() + pos.z = pos.z + 16 + local ts = pos:ToScreen() + local x, y = ts.x, math.Clamp(ts.y, 0, ScrH() * 0.95) + + colTemp.a = fade * 128 + util.ColorCopy(color_white, colTemp) + + draw.SimpleTextBlur("Sigil", "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) + y = y + draw.GetFontHeight("ZSHUDFontSmaller") + 0 + + draw.SimpleTextBlur("Press E to teleport", "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) +end + +GM.TraceTarget = NULL + +local function FuncFilterPlayers(ent) + return not ent:IsPlayer() +end +local function FuncFilterTeam(ent) + return not (ent:IsPlayer() and ent:Team() == MySelf:Team()) +end function GM:HUDDrawTargetID(teamid) local start = EyePos() trace.start = start - trace.endpos = start + EyeAngles():Forward() * 2048 - trace.filter[1] = MySelf - trace.filter[2] = MySelf:GetObserverTarget() + trace.endpos = start + EyeVector() * 2048 + filter[1] = MySelf.TargetIDFilter or MySelf + filter[2] = MySelf:GetObserverTarget() + trace.filter = filter local isspectator = MySelf:IsSpectator() local entity = util.TraceHull(trace).Entity - if entity:IsValid() and entity:IsPlayer() and (entity:Team() == teamid or isspectator) then + self.TraceTarget = entity + trace.filter = FuncFilterPlayers + self.TraceTargetNoPlayers = util.TraceLine(trace).Entity + + if MySelf.TargetLocus then + trace.filter = FuncFilterTeam + self.TraceTargetTeam = util.TraceLine(trace).Entity + end + + if entity:IsValid() and (entity:IsPlayer() and (entity:Team() == teamid or isspectator) or entity.Sigil) then entitylist[entity] = CurTime() end for ent, time in pairs(entitylist) do - if ent:IsValid() and ent:IsPlayer() and (ent:Team() == teamid or isspectator) and CurTime() < time + 2 then - self:DrawTargetID(ent, 1 - math.Clamp((CurTime() - time) / 2, 0, 1)) + if ent:IsValidPlayer() and (ent:Team() == teamid or isspectator) and CurTime() < time + 1.5 then + self:DrawTargetID(ent, 1 - math.Clamp((CurTime() - time) / 1.5, 0, 1)) + elseif teamid == TEAM_HUMAN and ent.Sigil and CurTime() < time + 0.5 then + self:DrawSigilTargetHint(ent, 1 - math.Clamp((CurTime() - time) / 0.5, 0, 1)) else entitylist[ent] = nil end diff --git a/gamemodes/zombiesurvival/gamemode/cl_thirdperson.lua b/gamemodes/zombiesurvival/gamemode/cl_thirdperson.lua new file mode 100644 index 0000000..92d046d --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/cl_thirdperson.lua @@ -0,0 +1,104 @@ +GM.OverTheShoulder = false + +local otscameraangles = Angle() +local otsdesiredright = 0 +local staggerdir = VectorRand():GetNormalized() + +function GM:UseOverTheShoulder() + return self.OverTheShoulder and not engine.IsPlayingDemo() +end + +function GM:ToggleOTSCamera() + if self.OverTheShoulder then + if otsdesiredright == -1 then + otsdesiredright = 0 + self.OverTheShoulder = false + otscameraangles.roll = 0 + MySelf:SetEyeAngles(otscameraangles) + else + otsdesiredright = -1 + end + else + self.OverTheShoulder = true + otsdesiredright = 1 + otscameraangles = MySelf:EyeAngles() + end +end + +function GM:InputMouseApplyOTS(cmd, x, y, ang) + otscameraangles.pitch = math.Clamp(math.NormalizeAngle(otscameraangles.pitch + y / 50), -89, 89) + otscameraangles.yaw = math.NormalizeAngle(otscameraangles.yaw - x / 50) + otscameraangles.roll = ang.roll +end + +function GM:CreateMoveOTS(cmd) + local maxhealth = MySelf:GetMaxHealth() + local threshold = MySelf.HasPalsy and maxhealth - 1 or maxhealth * 0.25 + local health = MySelf:Health() + local frightened = MySelf:GetStatus("frightened") + local gunsway = MySelf.GunSway + + if (health <= threshold or frightened or gunsway) and not GAMEMODE.ZombieEscape then + local ft = FrameTime() + + staggerdir = (staggerdir + ft * 8 * VectorRand()):GetNormalized() + + local ang = otscameraangles + local rate = MySelf:GetRateOfPalsy(ft, frightened, health, threshold, gunsway) + + ang.pitch = math.NormalizeAngle(ang.pitch + staggerdir.z * rate) + ang.yaw = math.NormalizeAngle(ang.yaw + staggerdir.x * rate) + otscameraangles = ang + end + + local offsetyaw = otscameraangles.yaw - cmd:GetViewAngles().yaw --ply:EyeAngles( ).y + + local corrected = Vector(cmd:GetForwardMove(), cmd:GetSideMove(), 0) + local sign = cmd:GetForwardMove() < 0 + local length = corrected:Length() + + corrected = Angle(0, corrected:Angle().y - offsetyaw, 0):Forward() + + -- Not possible to get a perfect solution, but this is better. + cmd:SetForwardMove(math.Clamp(corrected.x * length, sign and -length or 0, length)) + cmd:SetSideMove(corrected.y * length) +end + +local trace_wall = {mask = MASK_SOLID_BRUSHONLY, mins = Vector(-3, -3, -3), maxs = Vector(3, 3, 3)} +local trace_crosshair = {mask = MASK_SHOT--[[, mins = Vector(-1, -1, -1), maxs = Vector(1, 1, 1)]]} +local maxdiff = 70 + +local myteam = 0 +local function IgnoreTeam(ent) + return not (ent:IsPlayer() and ent:Team() == myteam) +end +function GM:CalcViewOTS(pl, origin, angles, fov, znear, zfar) + local camPos = origin - otscameraangles:Forward() * 28 + otsdesiredright * 12 * otscameraangles:Right() -- - otscameraangles:Up() * 2 + local eyepos = pl:EyePos() + + trace_wall.start = eyepos + trace_wall.endpos = camPos + trace_wall.filter = pl + camPos = util.TraceHull(trace_wall).HitPos + + myteam = pl:Team() + trace_crosshair.start = camPos + trace_crosshair.endpos = camPos + otscameraangles:Forward() * 32768 + trace_crosshair.filter = IgnoreTeam + local crosshair_tr = util.TraceLine(trace_crosshair) + local crosshair_pos = crosshair_tr.HitPos + local desired_angles = (crosshair_pos - eyepos):Angle() + + -- Don't face away more than a certain amount of degrees + desired_angles.yaw = math.ApproachAngle(otscameraangles.yaw, desired_angles.yaw, maxdiff) + + pl:SetEyeAngles(desired_angles) + + origin:Set(camPos) + angles:Set(otscameraangles) + + -- Let gamemode know if our LOS to crosshair target is blocked. + trace_wall.start = eyepos + trace_wall.endpos = crosshair_tr.HitPos + GAMEMODE.LastOTSBlocked = util.TraceLine(trace_wall).Fraction <= 0.5 +end diff --git a/gamemodes/zombiesurvival/gamemode/cl_util.lua b/gamemodes/zombiesurvival/gamemode/cl_util.lua index f0ceec8..02e51b6 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_util.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_util.lua @@ -6,6 +6,26 @@ concommand.Add("printdxinfo", function() print("Supports Vertex Shaders 2.0: "..tostring(render.SupportsVertexShaders_2_0())) end) +local ammonames = { + ["pistol"] = "pistolammo", + ["buckshot"] = "shotgunammo", + ["smg1"] = "smgammo", + ["ar2"] = "assaultrifleammo", + ["357"] = "rifleammo", + ["pulse"] = "pulseammo", + ["battery"] = "50mkit", + ["xbowbolt"] = "crossbowammo", + ["impactmine"] = "impactmine", + ["chemical"] = "chemical", + ["gaussenergy"] = "nail" +} + +concommand.Add("zs_quickbuyammo", function() + if ammonames[GAMEMODE.CachedResupplyAmmoType] then + RunConsoleCommand("zs_pointsshopbuy", "ps_"..ammonames[GAMEMODE.CachedResupplyAmmoType]) + end +end) + local function GetViewModelPosition(self, pos, ang) return pos + ang:Forward() * -256, ang end @@ -18,7 +38,7 @@ end -- Scales the screen based around 1080p but doesn't make things TOO tiny on low resolutions. function BetterScreenScale() - return math.Clamp(ScrH() / 1080, 0.6, 1) + return math.max(ScrH() / 1080, 0.851) * GAMEMODE.InterfaceSize end function render.GetLightRGB(pos) diff --git a/gamemodes/zombiesurvival/gamemode/cl_voicesets.lua b/gamemodes/zombiesurvival/gamemode/cl_voicesets.lua new file mode 100644 index 0000000..75b75ef --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/cl_voicesets.lua @@ -0,0 +1,301 @@ +local VoiceSets = {} + +VoiceSets[VOICESET_MALE] = { + [VOICELINE_GIVEAMMO] = { + Sound("vo/npc/male01/ammo03.wav"), + Sound("vo/npc/male01/ammo04.wav"), + Sound("vo/npc/male01/ammo05.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("vo/npc/male01/ow01.wav"), + Sound("vo/npc/male01/ow02.wav"), + Sound("vo/npc/male01/pain01.wav"), + Sound("vo/npc/male01/pain02.wav"), + Sound("vo/npc/male01/pain03.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("vo/npc/male01/pain04.wav"), + Sound("vo/npc/male01/pain05.wav"), + Sound("vo/npc/male01/pain06.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("vo/npc/male01/pain07.wav"), + Sound("vo/npc/male01/pain08.wav"), + Sound("vo/npc/male01/pain09.wav") + }, + [VOICELINE_DEATH] = { + Sound("vo/npc/male01/no02.wav"), + Sound("ambient/voices/citizen_beaten1.wav"), + Sound("ambient/voices/citizen_beaten3.wav"), + Sound("ambient/voices/citizen_beaten4.wav"), + Sound("ambient/voices/citizen_beaten5.wav"), + Sound("vo/npc/male01/pain07.wav"), + Sound("vo/npc/male01/pain08.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("ambient/voices/m_scream1.wav") + } +} + +VoiceSets[VOICESET_BARNEY] = { + [VOICELINE_GIVEAMMO] = { + Sound("items/ammo_pickup.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("vo/npc/Barney/ba_pain02.wav"), + Sound("vo/npc/Barney/ba_pain07.wav"), + Sound("vo/npc/Barney/ba_pain04.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("vo/npc/Barney/ba_pain01.wav"), + Sound("vo/npc/Barney/ba_pain08.wav"), + Sound("vo/npc/Barney/ba_pain10.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("vo/npc/Barney/ba_pain05.wav"), + Sound("vo/npc/Barney/ba_pain06.wav"), + Sound("vo/npc/Barney/ba_pain09.wav") + }, + [VOICELINE_DEATH] = { + Sound("vo/npc/Barney/ba_ohshit03.wav"), + Sound("vo/npc/Barney/ba_no01.wav"), + Sound("vo/npc/Barney/ba_no02.wav"), + Sound("vo/npc/Barney/ba_pain03.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("vo/k_lab/ba_thingaway02.wav") + } +} + +VoiceSets[VOICESET_FEMALE] = { + [VOICELINE_GIVEAMMO] = { + Sound("vo/npc/female01/ammo03.wav"), + Sound("vo/npc/female01/ammo04.wav"), + Sound("vo/npc/female01/ammo05.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("vo/npc/female01/pain01.wav"), + Sound("vo/npc/female01/pain02.wav"), + Sound("vo/npc/female01/pain03.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("vo/npc/female01/pain04.wav"), + Sound("vo/npc/female01/pain05.wav"), + Sound("vo/npc/female01/pain06.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("vo/npc/female01/pain07.wav"), + Sound("vo/npc/female01/pain08.wav"), + Sound("vo/npc/female01/pain09.wav") + }, + [VOICELINE_DEATH] = { + Sound("vo/npc/female01/no01.wav"), + Sound("vo/npc/female01/ow01.wav"), + Sound("vo/npc/female01/ow02.wav"), + Sound("vo/npc/female01/goodgod.wav"), + Sound("ambient/voices/citizen_beaten2.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("ambient/voices/f_scream1.wav") + } +} + +VoiceSets[VOICESET_ALYX] = { + [VOICELINE_GIVEAMMO] = { + Sound("vo/npc/female01/ammo03.wav"), + Sound("vo/npc/female01/ammo04.wav"), + Sound("vo/npc/female01/ammo05.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("vo/npc/Alyx/gasp03.wav"), + Sound("vo/npc/Alyx/hurt08.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("vo/npc/Alyx/hurt04.wav"), + Sound("vo/npc/Alyx/hurt06.wav"), + Sound("vo/Citadel/al_struggle07.wav"), + Sound("vo/Citadel/al_struggle08.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("vo/npc/Alyx/hurt05.wav"), + Sound("vo/npc/Alyx/hurt06.wav") + }, + [VOICELINE_DEATH] = { + Sound("vo/npc/Alyx/no01.wav"), + Sound("vo/npc/Alyx/no02.wav"), + Sound("vo/npc/Alyx/no03.wav"), + Sound("vo/Citadel/al_dadgordonno_c.wav"), + Sound("vo/Streetwar/Alyx_gate/al_no.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("vo/npc/Alyx/uggh01.wav"), + Sound("vo/npc/Alyx/uggh02.wav") + } +} + +VoiceSets[VOICESET_COMBINE] = { + [VOICELINE_GIVEAMMO] = { + Sound("npc/combine_soldier/vo/hardenthatposition.wav"), + Sound("npc/combine_soldier/vo/readyweapons.wav"), + Sound("npc/combine_soldier/vo/weareinaninfestationzone.wav"), + Sound("npc/metropolice/vo/dismountinghardpoint.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("npc/combine_soldier/pain1.wav"), + Sound("npc/combine_soldier/pain2.wav"), + Sound("npc/combine_soldier/pain3.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("npc/metropolice/pain1.wav"), + Sound("npc/metropolice/pain2.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("npc/metropolice/pain3.wav"), + Sound("npc/metropolice/pain4.wav") + }, + [VOICELINE_DEATH] = { + Sound("npc/combine_soldier/die1.wav"), + Sound("npc/combine_soldier/die2.wav"), + Sound("npc/combine_soldier/die3.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("npc/combine_soldier/die1.wav"), + Sound("npc/combine_soldier/die2.wav"), + Sound("npc/metropolice/vo/shit.wav") + } +} + +VoiceSets[VOICESET_MONK] = { + [VOICELINE_GIVEAMMO] = { + Sound("vo/ravenholm/monk_giveammo01.wav") + }, + [VOICELINE_PAIN_LIGHT] = { + Sound("vo/ravenholm/monk_pain01.wav"), + Sound("vo/ravenholm/monk_pain02.wav"), + Sound("vo/ravenholm/monk_pain03.wav"), + Sound("vo/ravenholm/monk_pain05.wav") + }, + [VOICELINE_PAIN_MED] = { + Sound("vo/ravenholm/monk_pain04.wav"), + Sound("vo/ravenholm/monk_pain06.wav"), + Sound("vo/ravenholm/monk_pain07.wav"), + Sound("vo/ravenholm/monk_pain08.wav") + }, + [VOICELINE_PAIN_HEAVY] = { + Sound("vo/ravenholm/monk_pain09.wav"), + Sound("vo/ravenholm/monk_pain10.wav"), + Sound("vo/ravenholm/monk_pain12.wav") + }, + [VOICELINE_DEATH] = { + Sound("vo/ravenholm/monk_death07.wav") + }, + [VOICELINE_EYEPAIN] = { + Sound("vo/ravenholm/monk_death07.wav") + } +} + +local meta = FindMetaTable("Player") +if not meta then return end + +function meta:GetVoiceLines(line_type) + return VoiceSets[self:GetDTInt(DT_PLAYER_INT_VOICESET)][line_type] +end + +function meta:PlayEyePainSound() + local snds = self:GetVoiceLines(VOICELINE_EYEPAIN) + if snds then + self:EmitSound(snds[math.random(1, #snds)]) + end +end + +function meta:PlayGiveAmmoSound() + local snds = self:GetVoiceLines(VOICELINE_GIVEAMMO) + if snds then + self:EmitSound(snds[math.random(1, #snds)]) + end +end + +function meta:PlayDeathSound() + local snds = self:GetVoiceLines(VOICELINE_DEATH) + if snds then + self:EmitSound(snds[math.random(1, #snds)]) + end +end + +function meta:PlayZombieDeathSound() + if not self:CallZombieFunction0("PlayDeathSound") then + local snds = self:GetZombieClassTable().DeathSounds + if snds then + self:EmitSound(snds[math.random(#snds)]) + end + end +end + +function meta:PlayPainSound(health) + local snds + + if health >= 70 then + snds = self:GetVoiceLines(VOICELINE_PAIN_LIGHT) + elseif health >= 35 then + snds = self:GetVoiceLines(VOICELINE_PAIN_MED) + else + snds = self:GetVoiceLines(VOICELINE_PAIN_HEAVY) + end + + if snds then + local snd = snds[math.random(#snds)] + if snd then + self:EmitSound(snd) + end + end +end + +function meta:PlayZombiePainSound() + if self:CallZombieFunction0("PlayPainSound") then return end + + local snds = self:GetZombieClassTable().PainSounds + if snds then + local snd = snds[math.random(#snds)] + if snd then + self:EmitSound(snd) + end + end +end + +net.Receive("voice_eyepain", function(len) + local ent = net.ReadEntity() + if ent:IsValid() then + ent:PlayEyePainSound() + end +end) +net.Receive("voice_giveammo", function(len) + local ent = net.ReadEntity() + if ent:IsValid() then + ent:PlayGiveAmmoSound() + end +end) +net.Receive("voice_death", function(len) + local ent = net.ReadEntity() + if ent:IsValid() then + ent:PlayDeathSound() + end +end) +net.Receive("voice_zombiedeath", function(len) + local ent = net.ReadEntity() + if ent:IsValid() then + ent:PlayZombieDeathSound() + end +end) +net.Receive("voice_pain", function(len) + local ent = net.ReadEntity() + local health = net.ReadUInt(4) * 25 + if ent:IsValid() then + ent:PlayPainSound(health) + end +end) +net.Receive("voice_zombiepain", function(len) + local ent = net.ReadEntity() + if ent:IsValid() then + ent:PlayZombiePainSound() + end +end) diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/client.lua b/gamemodes/zombiesurvival/gamemode/gmapex/client.lua new file mode 100644 index 0000000..e69de29 diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/config.lua b/gamemodes/zombiesurvival/gamemode/gmapex/config.lua new file mode 100644 index 0000000..bdf889a --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/gmapex/config.lua @@ -0,0 +1,3 @@ +function GMAPEX:CanUse(pl) + return pl:IsSuperAdmin() +end diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/gmapex.lua b/gamemodes/zombiesurvival/gamemode/gmapex/gmapex.lua new file mode 100644 index 0000000..ae1e603 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/gmapex/gmapex.lua @@ -0,0 +1,20 @@ +if GMAPEX then return end + +GMAPEX = {} + +if SERVER then + AddCSLuaFile("config.lua") + AddCSLuaFile("sh_serialization.lua") + AddCSLuaFile("client.lua") +end + +include("config.lua") +include("sh_serialization.lua") + +if SERVER then + include("server.lua") +end + +if CLIENT then + include("client.lua") +end diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/point_gmapexentity.lua b/gamemodes/zombiesurvival/gamemode/gmapex/point_gmapexentity.lua new file mode 100644 index 0000000..9f5b471 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/gmapex/point_gmapexentity.lua @@ -0,0 +1,91 @@ +AddCSLuaFile() + +ENT.Type = "anim" + +AccessorFuncDT(ENT, "EntityClass", "String", 0) + +function ENT:Initialize() + self:DrawShadow(false) + + if SERVER then + self:SetModel("models/editor/axis_helper.mdl") + self:SetMoveType(MOVETYPE_NONE) + self:SetSolid(SOLID_NONE) + end +end + +local function SearchForModelIn(filename) + if file.Exists(filename, "LUA") then + local contents = file.Read(filename, "LUA") + return string.match(contents, "self%:SetModel%([\"'](.+)[\"']%)") + end +end + +local function ExtractModel(classname, isweapon, isentity) + local basedir = isweapon and "weapons/" or "entities/" + basedir = basedir..classname + + return SearchForModelIn(basedir..".lua") + or SearchForModelIn(basedir.."/init.lua") + or SearchForModelIn(basedir.."/shared.lua") + or SearchForModelIn(basedir.."/cl_init.lua") +end + +function ENT:EntityClassChanged() + local mdl, tex + local isweapon = false + local isentity = false + local classname = self:GetEntityClass() + local stored = weapons.Get(classname) + if stored then + isweapon = true + else + stored = scripted_ents.Get(classname) + if stored then + isentity = true + end + end + + if isentity or isweapon then + mdl = stored.Model or ExtractModel(classname, isweapon, isentity) -- Try to see if a model can be extracted from the files themselves? + end + + self:SetModelAndSprite(mdl, tex) +end + +function ENT:SetModelAndSprite(mdl, tex) + mdl = mdl or "models/editor/axis_helper.mdl" + + if SERVER then + self:SetModel(mdl) + end + + if CLIENT then + if tex then + self.SpriteMaterial = Material(tex) + else + self.SpriteMaterial = nil + end + end +end + +function ENT:Think() + local entityclass = self:GetEntityClass() + if self._PrevEntityClass ~= entityclass then + self._PrevEntityClass = entityclass + self:EntityClassChanged() + end +end + +if not CLIENT then return end + +ENT.RenderGroup = RENDERGROUP_TRANSLUCENT + +function ENT:DrawTranslucent() + if self.SpriteMaterial then + render.SetMaterial(self.SpriteMaterial) + render.DrawSprite(self:GetPos(), 24, 24) + else + self:DrawModel() + end +end diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/server.lua b/gamemodes/zombiesurvival/gamemode/gmapex/server.lua new file mode 100644 index 0000000..e69de29 diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/sh_serialization.lua b/gamemodes/zombiesurvival/gamemode/gmapex/sh_serialization.lua new file mode 100644 index 0000000..3c922cd --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/gmapex/sh_serialization.lua @@ -0,0 +1,102 @@ +if SRL_VER and SRL_VER > 3 then return end +SRL_VER = 3 + +local sandbox_env = {Vector = Vector, Angle = Angle} + +function Deserialize(sIn) + local out = {} + + if #sIn == 0 or string.sub(sIn, -1) ~= "}" then return out end + + if string.sub(sIn, 1, 4) ~= "SRL=" then sIn = "SRL="..sIn end + + if string.sub(sIn, 5, 5) ~= "{" then return out end + + sIn = sIn.." return SRL" + local func = CompileString(sIn, "deserialize", false) + if type(func) == "string" then + print("Deserialization error: "..func) + else + setfenv(func, sandbox_env) + out = func() or out + end + + return out +end + +local allowedtypes = {} +allowedtypes["string"] = true +allowedtypes["number"] = true +allowedtypes["table"] = true +allowedtypes["Vector"] = true +allowedtypes["Angle"] = true +allowedtypes["boolean"] = true +local function MakeTable(tab, done) + local str = "" + done = done or {} + + local sequential = table.IsSequential(tab) + + for key, value in pairs(tab) do + local keytype = type(key) + local valuetype = type(value) + + if allowedtypes[keytype] and allowedtypes[valuetype] then + if sequential then + key = "" + else + if keytype == "number" or keytype == "boolean" then + key ="["..tostring(key).."]=" + else + key = "["..string.format("%q", tostring(key)).."]=" + end + end + + if valuetype == "table" and not done[value] then + done[value] = true + if type(value._serialize) == "function" then + str = str..key..value:_serialize().."," + else + str = str..key.."{"..MakeTable(value, done).."}," + end + else + if valuetype == "string" then + value = string.format("%q", value) + elseif valuetype == "Vector" then + value = "Vector("..value.x..","..value.y..","..value.z..")" + elseif valuetype == "Angle" then + value = "Angle("..value.pitch..","..value.yaw..","..value.roll..")" + else + value = tostring(value) + end + + str = str .. key .. value .. "," + end + end + end + + if string.sub(str, -1) == "," then + return string.sub(str, 1, #str - 1) + else + return str + end +end + +function Serialize(tIn, bRaw) + if #tIn == 0 then + local empty = true + for k in pairs(tIn) do + empty = false + break + end + if empty then + return "" + end + end + + if bRaw then + return "{"..MakeTable(tIn).."}" + end + + return "SRL={"..MakeTable(tIn).."}" +end \ No newline at end of file diff --git a/gamemodes/zombiesurvival/gamemode/gmapex/shared.lua b/gamemodes/zombiesurvival/gamemode/gmapex/shared.lua new file mode 100644 index 0000000..11c63f2 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/gmapex/shared.lua @@ -0,0 +1,25 @@ +function GMAPEX:Initialize() + scripted_ents.RegisterFromFile("point_lentmanentity.lua") +end + +function scripted_ents.RegisterFromFile(filename) + ENT = {} + include(filename) + scripted_ents.Register(filename:sub(1, -5):lower(), filename) +end + +function AccessorFuncDT(tab, membername, type, id) + local emeta = FindMetaTable("Entity") + local setter = emeta["SetDT"..type] + local getter = emeta["GetDT"..type] + + tab["Set"..membername] = function(me, val) + setter(me, id, val) + end + + tab["Get"..membername] = function(me) + return getter(me, id) + end +end + +hook.Add("Initialize", "gmapex", function() GMAPEX:Initialize() end) diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index 68bd714..e034c7f 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -10,8 +10,6 @@ This was my first ever gamemode. A lot of stuff is from years ago and some stuff ]] --- TODO: player introduced to a "main menu" sort of thing. auto joins as spectator. Requires recoding of a lot of logic because right now we assume only two possible teams and no spectator for humans. - AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") @@ -19,15 +17,18 @@ AddCSLuaFile("sh_translate.lua") AddCSLuaFile("sh_colors.lua") AddCSLuaFile("sh_serialization.lua") AddCSLuaFile("sh_globals.lua") -AddCSLuaFile("sh_crafts.lua") AddCSLuaFile("sh_util.lua") AddCSLuaFile("sh_options.lua") AddCSLuaFile("sh_zombieclasses.lua") AddCSLuaFile("sh_animations.lua") AddCSLuaFile("sh_sigils.lua") AddCSLuaFile("sh_channel.lua") +AddCSLuaFile("sh_weaponquality.lua") + +AddCSLuaFile("vault/shared.lua") AddCSLuaFile("cl_draw.lua") +AddCSLuaFile("cl_net.lua") AddCSLuaFile("cl_util.lua") AddCSLuaFile("cl_options.lua") AddCSLuaFile("cl_scoreboard.lua") @@ -37,20 +38,28 @@ AddCSLuaFile("cl_deathnotice.lua") AddCSLuaFile("cl_floatingscore.lua") AddCSLuaFile("cl_dermaskin.lua") AddCSLuaFile("cl_hint.lua") +AddCSLuaFile("cl_thirdperson.lua") +AddCSLuaFile("cl_voicesets.lua") + +AddCSLuaFile("skillweb/sh_skillweb.lua") +AddCSLuaFile("skillweb/cl_skillweb.lua") +AddCSLuaFile("skillweb/registry.lua") AddCSLuaFile("obj_vector_extend.lua") +AddCSLuaFile("obj_entity_extend.lua") +AddCSLuaFile("obj_entity_extend_cl.lua") AddCSLuaFile("obj_player_extend.lua") AddCSLuaFile("obj_player_extend_cl.lua") AddCSLuaFile("obj_weapon_extend.lua") -AddCSLuaFile("obj_entity_extend.lua") +AddCSLuaFile("obj_weapon_extend_cl.lua") -AddCSLuaFile("vgui/dgamestate.lua") AddCSLuaFile("vgui/dteamcounter.lua") AddCSLuaFile("vgui/dmodelpanelex.lua") AddCSLuaFile("vgui/dammocounter.lua") AddCSLuaFile("vgui/dpingmeter.lua") AddCSLuaFile("vgui/dteamheading.lua") AddCSLuaFile("vgui/dsidemenu.lua") +AddCSLuaFile("vgui/dspawnmenu.lua") AddCSLuaFile("vgui/dmodelkillicon.lua") AddCSLuaFile("vgui/dexroundedpanel.lua") @@ -67,36 +76,70 @@ AddCSLuaFile("vgui/pclassselect.lua") AddCSLuaFile("vgui/pweapons.lua") AddCSLuaFile("vgui/pendboard.lua") AddCSLuaFile("vgui/pworth.lua") -AddCSLuaFile("vgui/ppointshop.lua") +AddCSLuaFile("vgui/parsenal.lua") +AddCSLuaFile("vgui/premantle.lua") AddCSLuaFile("vgui/zshealtharea.lua") +AddCSLuaFile("vgui/zsstatusarea.lua") +AddCSLuaFile("vgui/zsgamestate.lua") + +include("sh_globals.lua") + +include("obj_entity_extend_sv.lua") +include("obj_player_extend_sv.lua") +include("obj_weapon_extend_sv.lua") + +AddCSLuaFile("loader.lua") +include("loader.lua") include("shared.lua") include("sv_options.lua") -include("sv_crafts.lua") -include("obj_entity_extend_sv.lua") -include("obj_player_extend_sv.lua") include("mapeditor.lua") include("sv_playerspawnentities.lua") include("sv_profiling.lua") include("sv_sigils.lua") +include("sv_concommands.lua") + +include("itemstocks/sv_stock.lua") + +include("vault/server.lua") + +include("skillweb/sv_registry.lua") +include("skillweb/sv_skillweb.lua") include("sv_zombieescape.lua") -if file.Exists(GM.FolderName.."/gamemode/maps/"..game.GetMap()..".lua", "LUA") then - include("maps/"..game.GetMap()..".lua") -end +include("zsbots/init.lua") -function BroadcastLua(code) - for _, pl in pairs(player.GetAll()) do - pl:SendLua(code) - end -end +include_library("statistics") -player.GetByUniqueID = player.GetByUniqueID or function(uid) - for _, pl in pairs(player.GetAll()) do - if pl:UniqueID() == uid then return pl end - end -end +local pairs = pairs +local ipairs = ipairs +local IN_WALK = IN_WALK +local IN_USE = IN_USE +local IN_RELOAD = IN_RELOAD +local IN_MOVERIGHT = IN_MOVERIGHT +local IN_MOVELEFT = IN_MOVELEFT +local IN_ATTACK = IN_ATTACK +local IN_ATTACK2 = IN_ATTACK2 +local IN_ZOOM = IN_ZOOM +local IN_SPEED = IN_SPEED +local CurTime = CurTime +local Vector = Vector +local Angle = Angle +local vector_origin = vector_origin +local HITGROUP_HEAD = HITGROUP_HEAD +local HITGROUP_LEFTLEG = HITGROUP_LEFTLEG +local HITGROUP_RIGHTLEG = HITGROUP_RIGHTLEG +local math_max = math.max + +local M_Player = FindMetaTable("Player") + +local P_GetBarricadeGhosting = M_Player.GetBarricadeGhosting +local P_BarricadeGhostingThink = M_Player.BarricadeGhostingThink +local P_Team = M_Player.Team +local P_Alive = M_Player.Alive +local player_GetAll = player.GetAll +local P_GetPhantomHealth = M_Player.GetPhantomHealth function GM:WorldHint(hint, pos, ent, lifetime, filter) net.Start("zs_worldhint") @@ -118,17 +161,17 @@ function GM:CreateGibs(pos, headoffset) for i = 1, 2 do local ent = ents.CreateLimited("prop_playergib") if ent:IsValid() then - ent:SetPos(headpos + VectorRand() * 5) + ent:SetPos(headpos + VectorRand():GetNormalized() * math.Rand(1, 5)) ent:SetAngles(VectorRand():Angle()) ent:SetGibType(i) ent:Spawn() end end - for i=1, 4 do + for i = 1, 4 do local ent = ents.CreateLimited("prop_playergib") if ent:IsValid() then - ent:SetPos(pos + VectorRand() * 12) + ent:SetPos(pos + VectorRand():GetNormalized() * math.Rand(1, 12)) ent:SetAngles(VectorRand():Angle()) ent:SetGibType(math.random(3, #GAMEMODE.HumanGibs)) ent:Spawn() @@ -136,15 +179,25 @@ function GM:CreateGibs(pos, headoffset) end end +function GM:DisallowHumanPickup(pl, entity) +end + function GM:TryHumanPickup(pl, entity) - if self.ZombieEscape or pl.NoObjectPickup or not pl:Alive() or pl:Team() ~= TEAM_HUMAN then return end + if self.ZombieEscape or pl.NoObjectPickup or not pl:Alive() or pl:Team() ~= TEAM_HUMAN or (entity.NoPickupsTime and CurTime() < entity.NoPickupsTime and entity.NoPickupsOwner ~= pl) then return end + + if gamemode.Call("DisallowHumanPickup", pl, entity) or pl:GetInfo("zs_nopickupprops") == "1" then return end if entity:IsValid() and not entity.m_NoPickup then + local phys = entity:GetPhysicsObject() + if phys:IsValid() and phys:HasGameFlag(FVPHYSICS_PLAYER_HELD) then return end + local entclass = string.sub(entity:GetClass(), 1, 12) - if (entclass == "prop_physics" or entclass == "func_physbox" or entity.HumanHoldable and entity:HumanHoldable(pl)) and not entity:IsNailed() and entity:GetMoveType() == MOVETYPE_VPHYSICS and entity:GetPhysicsObject():IsValid() and entity:GetPhysicsObject():GetMass() <= CARRY_MAXIMUM_MASS and entity:GetPhysicsObject():IsMoveable() and entity:OBBMins():Length() + entity:OBBMaxs():Length() <= CARRY_MAXIMUM_VOLUME then - local holder, status = entity:GetHolder() + local carrymaxmass = CARRY_MAXIMUM_MASS * (pl.PropCarryCapacityMul or 1) + local carrymaxvol = CARRY_MAXIMUM_VOLUME * (pl.PropCarryCapacityMul or 1) + if (entclass == "prop_physics" or entclass == "func_physbox" or entity.HumanHoldable and entity:HumanHoldable(pl)) and not entity:IsNailed() and entity:GetMoveType() == MOVETYPE_VPHYSICS and entity:GetPhysicsObject():IsValid() and entity:GetPhysicsObject():GetMass() <= carrymaxmass and entity:GetPhysicsObject():IsMoveable() and entity:OBBMins():Length() + entity:OBBMaxs():Length() <= carrymaxvol then + local holder = entity:GetHolder() if not holder and not pl:IsHolding() and CurTime() >= (pl.NextHold or 0) - and pl:GetShootPos():Distance(entity:NearestPoint(pl:GetShootPos())) <= 64 and pl:GetGroundEntity() ~= entity then + and pl:GetShootPos():DistToSqr(entity:NearestPoint(pl:GetShootPos())) <= 4096 and pl:GetGroundEntity() ~= entity then --64^2 local newstatus = ents.Create("status_human_holding") if newstatus:IsValid() then pl.NextHold = CurTime() + 0.25 @@ -163,21 +216,36 @@ end function GM:AddResources() resource.AddFile("resource/fonts/typenoksidi.ttf") resource.AddFile("resource/fonts/hidden.ttf") + resource.AddFile("resource/fonts/ghoulfriaoe.ttf") + resource.AddFile("resource/fonts/remingtonnoiseless.ttf") + + resource.AddFile("particles/vman_explosion.pcf") for _, filename in pairs(file.Find("materials/zombiesurvival/*.vmt", "GAME")) do resource.AddFile("materials/zombiesurvival/"..filename) end + for _, filename in pairs(file.Find("materials/zombiesurvival/*.png", "GAME")) do + resource.AddFile("materials/zombiesurvival/"..filename) + end + for _, filename in pairs(file.Find("materials/zombiesurvival/killicons/*.vmt", "GAME")) do resource.AddFile("materials/zombiesurvival/killicons/"..filename) end + for _, filename in pairs(file.Find("materials/zombiesurvival/killicons/*.png", "GAME")) do + resource.AddFile("materials/zombiesurvival/killicons/"..filename) + end + resource.AddFile("materials/zombiesurvival/filmgrain/filmgrain.vmt") resource.AddFile("materials/zombiesurvival/filmgrain/filmgrain.vtf") for _, filename in pairs(file.Find("sound/zombiesurvival/*.ogg", "GAME")) do resource.AddFile("sound/zombiesurvival/"..filename) end + for _, filename in pairs(file.Find("sound/zombiesurvival/ui/*.ogg", "GAME")) do + resource.AddFile("sound/zombiesurvival/ui/"..filename) + end for _, filename in pairs(file.Find("sound/zombiesurvival/*.wav", "GAME")) do resource.AddFile("sound/zombiesurvival/"..filename) end @@ -201,22 +269,6 @@ function GM:AddResources() resource.AddFile("materials/refract_ring.vmt") resource.AddFile("materials/killicon/redeem_v2.vtf") resource.AddFile("materials/killicon/redeem_v2.vmt") - resource.AddFile("materials/killicon/zs_axe.vtf") - resource.AddFile("materials/killicon/zs_keyboard.vtf") - resource.AddFile("materials/killicon/zs_sledgehammer.vtf") - resource.AddFile("materials/killicon/zs_fryingpan.vtf") - resource.AddFile("materials/killicon/zs_pot.vtf") - resource.AddFile("materials/killicon/zs_plank.vtf") - resource.AddFile("materials/killicon/zs_hammer.vtf") - resource.AddFile("materials/killicon/zs_shovel.vtf") - resource.AddFile("materials/killicon/zs_axe.vmt") - resource.AddFile("materials/killicon/zs_keyboard.vmt") - resource.AddFile("materials/killicon/zs_sledgehammer.vmt") - resource.AddFile("materials/killicon/zs_fryingpan.vmt") - resource.AddFile("materials/killicon/zs_pot.vmt") - resource.AddFile("materials/killicon/zs_plank.vmt") - resource.AddFile("materials/killicon/zs_hammer.vmt") - resource.AddFile("materials/killicon/zs_shovel.vmt") resource.AddFile("models/weapons/v_zombiearms.mdl") resource.AddFile("materials/models/weapons/v_zombiearms/zombie_classic_sheet.vmt") resource.AddFile("materials/models/weapons/v_zombiearms/zombie_classic_sheet.vtf") @@ -228,7 +280,7 @@ function GM:AddResources() resource.AddFile("materials/models/weapons/v_fza/fast_zombie_sheet.vmt") resource.AddFile("materials/models/weapons/v_fza/fast_zombie_sheet.vtf") resource.AddFile("materials/models/weapons/v_fza/fast_zombie_sheet_normal.vtf") - resource.AddFile("models/weapons/v_annabelle.mdl") + resource.AddFile("models/weapons/c_annabelle.mdl") resource.AddFile("materials/models/weapons/w_annabelle/gun.vtf") resource.AddFile("materials/models/weapons/sledge.vtf") resource.AddFile("materials/models/weapons/sledge.vmt") @@ -239,22 +291,14 @@ function GM:AddResources() resource.AddFile("materials/models/weapons/hammer.vtf") resource.AddFile("materials/models/weapons/hammer.vmt") resource.AddFile("models/weapons/w_sledgehammer.mdl") - resource.AddFile("models/weapons/v_sledgehammer/v_sledgehammer.mdl") + resource.AddFile("models/weapons/v_sledgehammer/c_sledgehammer.mdl") resource.AddFile("models/weapons/w_hammer.mdl") - resource.AddFile("models/weapons/v_hammer/v_hammer.mdl") + resource.AddFile("models/weapons/v_hammer/c_hammer.mdl") - resource.AddFile("models/weapons/v_aegiskit.mdl") + resource.AddFile("models/weapons/c_aegiskit.mdl") resource.AddFile("materials/models/weapons/v_hand/armtexture.vmt") - resource.AddFile("models/wraith_zsv1.mdl") - for _, filename in pairs(file.Find("materials/models/wraith1/*.vmt", "GAME")) do - resource.AddFile("materials/models/wraith1/"..filename) - end - for _, filename in pairs(file.Find("materials/models/wraith1/*.vtf", "GAME")) do - resource.AddFile("materials/models/wraith1/"..filename) - end - resource.AddFile("models/weapons/v_supershorty/v_supershorty.mdl") resource.AddFile("models/weapons/w_supershorty.mdl") for _, filename in pairs(file.Find("materials/weapons/v_supershorty/*.vmt", "GAME")) do @@ -285,8 +329,13 @@ function GM:AddResources() resource.AddFile("materials/models/player/elis/fty/001.vtf") resource.AddFile("materials/models/player/elis/fty/001_normal.vtf") + resource.AddFile("models/player/zelpa/stalker.mdl") + resource.AddFile("models/vinrax/player/doll_player.mdl") + resource.AddFile("models/player/zombie_classic_hbfix.mdl") + resource.AddFile("models/player/zombie_lacerator2.mdl") + resource.AddFile("sound/weapons/melee/golf club/golf_hit-01.ogg") resource.AddFile("sound/weapons/melee/golf club/golf_hit-02.ogg") resource.AddFile("sound/weapons/melee/golf club/golf_hit-03.ogg") @@ -308,14 +357,41 @@ function GM:AddResources() resource.AddFile("sound/weapons/melee/keyboard/keyboard_hit-03.ogg") resource.AddFile("sound/weapons/melee/keyboard/keyboard_hit-04.ogg") - resource.AddFile("materials/noxctf/sprite_bloodspray1.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray2.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray3.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray4.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray5.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray6.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray7.vmt") - resource.AddFile("materials/noxctf/sprite_bloodspray8.vmt") + resource.AddFile("sound/weapons/zs_sawnoff/sawnoff_fire1.ogg") + resource.AddFile("sound/weapons/zs_sawnoff/barrelup.ogg") + resource.AddFile("sound/weapons/zs_sawnoff/barreldown.ogg") + + resource.AddFile("sound/weapons/zs_longarm/longarm_fire.ogg") + + resource.AddFile("sound/weapons/zs_scar/scar_fire1.ogg") + + resource.AddFile("sound/nox/sword_hit.ogg") + resource.AddFile("sound/nox/sword_miss.ogg") + resource.AddFile("sound/nox/frotchet_test1.ogg") + resource.AddFile("sound/nox/scatterfrost.ogg") + + resource.AddFile("sound/weapons/zs_gluon/egon_off1.wav") + + resource.AddFile("sound/weapons/zs_heph/electro4.wav") + resource.AddFile("sound/weapons/zs_heph/electro5.wav") + resource.AddFile("sound/weapons/zs_heph/electro6.wav") + + resource.AddFile("sound/weapons/zs_inner/innershot.ogg") + + resource.AddFile("sound/weapons/zs_glad/gladshot4.wav") + + resource.AddFile("sound/weapons/zs_flak/load1.wav") + resource.AddFile("sound/weapons/zs_flak/shot1.wav") + + resource.AddFile("sound/weapons/zs_rail/rail.wav") + + resource.AddFile("sound/weapons/zs_asmd/secondary2.wav") + resource.AddFile("sound/weapons/zs_asmd/main3.wav") + + resource.AddFile("sound/weapons/zs_power/power1.ogg") + resource.AddFile("sound/weapons/zs_power/power4.wav") + + resource.AddFile("materials/zombiesurvival/arsenalcrate.png") resource.AddFile("sound/"..tostring(self.LastHumanSound)) resource.AddFile("sound/"..tostring(self.AllLoseSound)) @@ -324,11 +400,14 @@ function GM:AddResources() end function GM:Initialize() + self:FixSkillConnections() self:RegisterPlayerSpawnEntities() self:AddResources() self:PrecacheResources() self:AddCustomAmmo() + self:CreateWeaponQualities() self:AddNetworkStrings() + self:RegisterFood() self:LoadProfiler() self:SetPantsMode(self.PantsMode, true) @@ -336,14 +415,7 @@ function GM:Initialize() self:SetBabyMode(self:IsBabyMode(), true) self:SetRedeemBrains(self.DefaultRedeem) - local mapname = string.lower(game.GetMap()) - if string.find(mapname, "_obj_", 1, true) or string.find(mapname, "objective", 1, true) then - self.ObjectiveMap = true - end - - --[[if string.sub(mapname, 1, 3) == "zm_" then - NOZOMBIEGASSES = true - end]] + self:RefreshMapIsObjective() game.ConsoleCommand("fire_dmgscale 1\n") game.ConsoleCommand("mp_flashlight 1\n") @@ -363,18 +435,26 @@ function GM:AddNetworkStrings() util.AddNetworkString("zs_zvols") util.AddNetworkString("zs_nextboss") util.AddNetworkString("zs_classunlock") - + util.AddNetworkString("zs_sigilcorrupted") + util.AddNetworkString("zs_sigiluncorrupted") + util.AddNetworkString("zs_survivor") + util.AddNetworkString("zs_itemstock") util.AddNetworkString("zs_playerredeemed") util.AddNetworkString("zs_dohulls") util.AddNetworkString("zs_penalty") util.AddNetworkString("zs_nextresupplyuse") + util.AddNetworkString("zs_stowagecaches") util.AddNetworkString("zs_lifestats") util.AddNetworkString("zs_lifestatsbd") util.AddNetworkString("zs_lifestatshd") util.AddNetworkString("zs_lifestatsbe") util.AddNetworkString("zs_boss_spawned") + util.AddNetworkString("zs_boss_slain") util.AddNetworkString("zs_commission") util.AddNetworkString("zs_healother") + util.AddNetworkString("zs_healby") + util.AddNetworkString("zs_buffby") + util.AddNetworkString("zs_buffwith") util.AddNetworkString("zs_repairobject") util.AddNetworkString("zs_worldhint") util.AddNetworkString("zs_honmention") @@ -384,12 +464,61 @@ function GM:AddNetworkStrings() util.AddNetworkString("zs_dmg") util.AddNetworkString("zs_dmg_prop") util.AddNetworkString("zs_legdamage") + util.AddNetworkString("zs_armdamage") + util.AddNetworkString("zs_extrastartingworth") + util.AddNetworkString("zs_ammopickup") + util.AddNetworkString("zs_ammogive") + util.AddNetworkString("zs_ammogiven") + util.AddNetworkString("zs_deployablelost") + util.AddNetworkString("zs_deployableclaim") + util.AddNetworkString("zs_deployableout") + util.AddNetworkString("zs_trinketconsumed") + util.AddNetworkString("zs_nailremoved") + util.AddNetworkString("zs_togglezvision") + util.AddNetworkString("zs_remantlercontent") + util.AddNetworkString("zs_classunlockstate") + util.AddNetworkString("zs_changeclass") + util.AddNetworkString("zs_currentround") + util.AddNetworkString("zs_zsfriend") + util.AddNetworkString("zs_zsfriendadded") + util.AddNetworkString("zs_remantleconf") + util.AddNetworkString("zs_nestbuilt") + util.AddNetworkString("zs_nestspec") + util.AddNetworkString("zs_tvcamera") + + util.AddNetworkString("zs_inventoryitem") + util.AddNetworkString("zs_trycraft") + util.AddNetworkString("zs_updatealtselwep") + util.AddNetworkString("zs_invitem") + util.AddNetworkString("zs_invgiven") + util.AddNetworkString("zs_wipeinventory") + + util.AddNetworkString("zs_skills_active") + util.AddNetworkString("zs_skills_unlocked") + util.AddNetworkString("zs_skills_desired") + util.AddNetworkString("zs_skill_is_desired") + util.AddNetworkString("zs_skill_is_unlocked") + util.AddNetworkString("zs_skills_all_desired") + util.AddNetworkString("zs_skill_set_desired") + util.AddNetworkString("zs_skills_init") + util.AddNetworkString("zs_skills_reset") + util.AddNetworkString("zs_skills_remort") + util.AddNetworkString("zs_skills_nextreset") + util.AddNetworkString("zs_skills_notify") + util.AddNetworkString("zs_skills_refunded") util.AddNetworkString("zs_crow_kill_crow") util.AddNetworkString("zs_pl_kill_pl") util.AddNetworkString("zs_pls_kill_pl") util.AddNetworkString("zs_pl_kill_self") util.AddNetworkString("zs_death") + + util.AddNetworkString("voice_eyepain") + util.AddNetworkString("voice_giveammo") + util.AddNetworkString("voice_death") + util.AddNetworkString("voice_zombiedeath") + util.AddNetworkString("voice_pain") + util.AddNetworkString("voice_zombiepain") end function GM:IsClassicMode() @@ -420,7 +549,7 @@ end function GM:ShowTeam(pl) if pl:Team() == TEAM_HUMAN and not self.ZombieEscape then - pl:SendLua(self:GetWave() > 0 and "GAMEMODE:OpenPointsShop()" or "MakepWorth()") + pl:SendLua(self:GetWave() > 0 and "GAMEMODE:OpenArsenalMenu()" or "MakepWorth()") end end @@ -432,7 +561,7 @@ function GM:ShowSpare1(pl) pl:SendLua("GAMEMODE:OpenClassSelect()") end elseif pl:Team() == TEAM_HUMAN then - pl:SendLua("MakepWeapons()") + pl:SendLua("GAMEMODE:ToggleSkillWeb()") end end @@ -443,19 +572,32 @@ end function GM:SetupSpawnPoints() local ztab = ents.FindByClass("info_player_undead") ztab = table.Add(ztab, ents.FindByClass("info_player_zombie")) - ztab = table.Add(ztab, ents.FindByClass("info_player_rebel")) local htab = ents.FindByClass("info_player_human") - htab = table.Add(htab, ents.FindByClass("info_player_combine")) - local mapname = string.lower(game.GetMap()) -- Terrorist spawns are usually in some kind of house or a main base in CS_ in order to guard the hosties. Put the humans there. - if string.sub(mapname, 1, 3) == "cs_" or string.sub(mapname, 1, 3) == "zs_" then - ztab = table.Add(ztab, ents.FindByClass("info_player_counterterrorist")) - htab = table.Add(htab, ents.FindByClass("info_player_terrorist")) - else -- Otherwise, this is probably a DE_, ZM_, or ZH_ map. In DE_ maps, the T's spawn away from the main part of the map and are zombies in zombie plugins so let's do the same. - ztab = table.Add(ztab, ents.FindByClass("info_player_terrorist")) - htab = table.Add(htab, ents.FindByClass("info_player_counterterrorist")) + -- Otherwise, this is probably a DE_, ZM_, or ZH_ map. In DE_ maps, the T's spawn away from the main part of the map and are zombies in zombie plugins so let's do the same. + local mapname = string.lower(game.GetMap()) + local stockspawnbehavior = string.sub(mapname, 1, 3) == "cs_" or string.sub(mapname, 1, 3) == "zs_" + + -- Only add CS:S and HL2:DM spawn points if no ZS specific spawn points exist. + if #ztab == 0 then + if stockspawnbehavior then + ztab = table.Add(ztab, ents.FindByClass("info_player_counterterrorist")) + else + ztab = table.Add(ztab, ents.FindByClass("info_player_terrorist")) + end + + ztab = table.Add(ztab, ents.FindByClass("info_player_rebel")) + end + if #htab == 0 then + if stockspawnbehavior then + htab = table.Add(htab, ents.FindByClass("info_player_terrorist")) + else + htab = table.Add(htab, ents.FindByClass("info_player_counterterrorist")) + end + + htab = table.Add(htab, ents.FindByClass("info_player_combine")) end -- Add all the old ZS spawns from GMod9. @@ -503,15 +645,31 @@ weaponmodelstoweapon["models/weapons/w_crowbar.mdl"] = "weapon_zs_crowbar" weaponmodelstoweapon["models/weapons/w_stunbaton.mdl"] = "weapon_zs_stunbaton" weaponmodelstoweapon["models/props_interiors/furniture_lamp01a.mdl"] = "weapon_zs_lamp" weaponmodelstoweapon["models/props_junk/rock001a.mdl"] = "weapon_zs_stone" -weaponmodelstoweapon["models/props_c17/canister01a.mdl"] = "weapon_zs_oxygentank" +--weaponmodelstoweapon["models/props_c17/canister01a.mdl"] = "weapon_zs_oxygentank" weaponmodelstoweapon["models/props_canal/mattpipe.mdl"] = "weapon_zs_pipe" weaponmodelstoweapon["models/props_junk/meathook001a.mdl"] = "weapon_zs_hook" +weaponmodelstoweapon["models/props_junk/glassbottle01a.mdl"] = "weapon_zs_glassbottle" +weaponmodelstoweapon["models/props_lab/ladel.mdl"] = "weapon_zs_ladel" +weaponmodelstoweapon["models/props_junk/watermelon01.mdl"] = "weapon_zs_f_watermelon" +weaponmodelstoweapon["models/props/cs_italy/bananna_bunch.mdl"] = "weapon_zs_f_banana" +weaponmodelstoweapon["models/props/cs_italy/bananna.mdl"] = "weapon_zs_f_banana" +weaponmodelstoweapon["models/props/cs_italy/orange.mdl"] = "weapon_zs_f_orange" +weaponmodelstoweapon["models/props_junk/popcan01a.mdl"] = "weapon_zs_f_soda" +weaponmodelstoweapon["models/props_junk/garbage_milkcarton002a.mdl"] = "weapon_zs_f_milk" +weaponmodelstoweapon["models/props/cs_office/water_bottle.mdl"] = "weapon_zs_f_water" +weaponmodelstoweapon["models/props_junk/garbage_takeoutcarton001a.mdl"] = "weapon_zs_f_takeout" +weaponmodelstoweapon["models/props_c17/pushbroom.mdl"] = "weapon_zs_pushbroom" function GM:InitPostEntity() + self.DidInitPostEntity = true + + self:AssignItemProperties() + self:FixWeaponBase() + gamemode.Call("InitPostEntityMap") RunConsoleCommand("mapcyclefile", "mapcycle_zombiesurvival.txt") - if string.find(string.lower(GetConVarString("hostname")), "hellsgamers", 1, true) then + if string.find(string.lower(GetConVar("hostname"):GetString()), "hellsgamers", 1, true) then self.Think = function() end self.DoPlayerDeath = self.Think self.SetWave = self.Think @@ -526,6 +684,12 @@ function GM:SetupProps() local mdl = ent:GetModel() if mdl then mdl = string.lower(mdl) + if mdl == "models/props_c17/furniturestove001a.mdl" then + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:SetMass(500) + end + end if table.HasValue(self.BannedProps, mdl) then ent:Remove() elseif weaponmodelstoweapon[mdl] then @@ -537,6 +701,16 @@ function GM:SetupProps() wep:SetShouldRemoveAmmo(false) wep:Spawn() + ent:Remove() + end + elseif ent:GetName() == "" and self.WorldConversions[mdl] then + local wep = ents.Create("prop_invitem") + if wep:IsValid() then + wep:SetPos(ent:GetPos()) + wep:SetAngles(ent:GetAngles()) + wep:SetInventoryItemType(self.WorldConversions[mdl].Result) + wep:Spawn() + ent:Remove() end elseif ent:GetMaxHealth() == 1 and ent:Health() == 0 and ent:GetKeyValues().damagefilter ~= "invul" and ent:GetName() == "" then @@ -575,10 +749,17 @@ function GM:RemoveUnusedEntities() util.RemoveAll("item_ammo_crate") -- Shouldn't exist. - util.RemoveAll("item_suitcharger") + util.RemoveAll("item_suit*") + util.RemoveAll("func_recharge") end function GM:ReplaceMapWeapons() + local prefix = game.GetMap():lower():sub(1, 3) + if prefix == "dm_" or prefix == "pb_" then + util.RemoveAll("weapon_*") + return + end + for _, ent in pairs(ents.FindByClass("weapon_*")) do local wepclass = ent:GetClass() if wepclass ~= "weapon_map_base" then @@ -613,6 +794,22 @@ local ammoreplacements = { ["item_box_buckshot"] = "buckshot" } function GM:ReplaceMapAmmo() + local prefix = game.GetMap():lower():sub(1, 3) + if prefix == "dm_" or prefix == "pb_" then + util.RemoveAll("item_ammo_*") + util.RemoveAll("item_health*") + util.RemoveAll("item_rpg_round") + util.RemoveAll("item_box_buckshot") + + for _, e in pairs(ents.FindByModel("models/props_c17/oildrum001_explosive.mdl")) do + if e:IsValid() and e:GetClass():sub(1, 12) == "prop_physics" then + e:Remove() + end + end + + return + end + for classname, ammotype in pairs(ammoreplacements) do for _, ent in pairs(ents.FindByClass(classname)) do local newent = ents.Create("prop_ammo") @@ -657,7 +854,7 @@ function GM:CreateZombieGas() if not self.ZombieEscape then for __, human_spawn in pairs(humanspawns) do - if human_spawn:IsValid() and human_spawn:GetPos():Distance(spawnpos) < 500 then + if human_spawn:IsValid() and human_spawn:GetPos():DistToSqr(spawnpos) < 90000 then near = true break end @@ -666,7 +863,7 @@ function GM:CreateZombieGas() if not near then for __, gas in pairs(gasses) do - if gas:GetPos():Distance(spawnpos) < 350 then + if gas:GetPos():DistToSqr(spawnpos) < 122500 then --350^2 near = true break end @@ -683,10 +880,25 @@ function GM:CreateZombieGas() end end -function GM:CheckDynamicSpawnHR(ent) - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_UNDEAD then - ent.DynamicSpawnedOn = ent.DynamicSpawnedOn + 1 +function GM:PlayerShouldTakeNailRemovalPenalty(pl, nail, nailowner, prop) + if gamemode.Call("PlayerIsAdmin", pl) then return false end + if nailowner.ZSFriends[pl] then return false end + + if not gamemode.Call("CanPlaceNail", nailowner) then return false end + + if pl:BarricadeExpertPrecedence(nailowner) == 1 then -- If I'm better than they are. + return false end + + local firstnail = prop:GetFirstNail() + if firstnail and pl == firstnail:GetOwner() then + return false + end + + -- just gonna consider this obsolete + --if nailowner:Frags() >= 75 or owner:Frags() < 75 then return true end + + return true end local playermins = Vector(-17, -17, 0) @@ -698,16 +910,17 @@ function GM:PlayerSelectSpawn(pl) local teamid = pl:Team() local tab local epicenter + if pl.m_PreRedeem and teamid == TEAM_HUMAN and #self.RedeemSpawnPoints >= 1 then tab = self.RedeemSpawnPoints elseif teamid == TEAM_UNDEAD then if pl:GetZombieClassTable().Boss and (not pl.DeathClass or self.ZombieClasses[pl.DeathClass].Boss) and #self.BossSpawnPoints >= 1 then tab = self.BossSpawnPoints elseif self.DynamicSpawning --[[and CurTime() >= self:GetWaveStart() + 1]] then -- If we're a bit in the wave then we can spawn on top of heavily dense groups with no humans looking at us. - if self:ShouldUseAlternateDynamicSpawn() then + if self:ShouldUseAlternateDynamicSpawn() then -- This system is used for zombie escape, classic mode, baby mode, etc. -- If they're near a human, use position where they died. for _, h in pairs(team.GetPlayers(TEAM_HUMAN)) do - if h:GetPos():Distance(epicenter or pl:GetPos()) < 1024 then + if h:GetPos():DistToSqr(epicenter or pl:GetPos()) < 1048576 then --1024^2 epicenter = pl.KilledPos break end @@ -727,13 +940,11 @@ function GM:PlayerSelectSpawn(pl) end else local dyn = pl.ForceDynamicSpawn - if dyn then + if dyn then -- We were spectating an entity. pl.ForceDynamicSpawn = nil if self:DynamicSpawnIsValid(dyn) then - self:CheckDynamicSpawnHR(dyn) - - if dyn:GetClass() == "prop_creepernest" then - local owner = dyn.Owner + if dyn:GetClass() == "prop_creepernest" then -- For honorable mentions + local owner = dyn:GetOwner() if owner and owner:IsValid() and owner:Team() == TEAM_UNDEAD then owner.NestSpawns = owner.NestSpawns + 1 end @@ -741,21 +952,14 @@ function GM:PlayerSelectSpawn(pl) return dyn end + end - epicenter = dyn:GetPos() -- Ok, at least skew our epicenter to what they tried to spawn at. - tab = table.Copy(team.GetValidSpawnPoint(TEAM_UNDEAD)) - local dynamicspawns = self:GetDynamicSpawns(pl) - if #dynamicspawns > 0 then - spawninplayer = true - table.Add(tab, dynamicspawns) - end - else - tab = table.Copy(team.GetValidSpawnPoint(TEAM_UNDEAD)) - local dynamicspawns = self:GetDynamicSpawns(pl) - if #dynamicspawns > 0 then - spawninplayer = true - table.Add(tab, dynamicspawns) - end + -- Otherwise we just use whatever we can (creeper nests too) + tab = table.Copy(team.GetValidSpawnPoint(TEAM_UNDEAD)) + local dynamicspawns = self:GetDynamicSpawns(pl) + if #dynamicspawns > 0 then + spawninplayer = true + table.Add(tab, dynamicspawns) end end end @@ -766,64 +970,92 @@ function GM:PlayerSelectSpawn(pl) -- Now we have a table of our potential spawn points, including dynamic spawns (other players). -- We validate if the spawn is blocked, disabled, or otherwise not suitable below. - local count = #tab - if count > 0 then + if #tab > 0 then local potential = {} + -- Filter out spawns that are disabled or blocked. for _, spawn in pairs(tab) do if spawn:IsValid() and not spawn.Disabled and (spawn:IsPlayer() or spawn ~= LastSpawnPoints[teamid] or #tab == 1) and spawn:IsInWorld() then local blocked - local spawnpos = spawn:GetPos() - for _, ent in pairs(ents.FindInBox(spawnpos + playermins, spawnpos + playermaxs)) do - if IsValid(ent) and ent:IsPlayer() and not spawninplayer or string.sub(ent:GetClass(), 1, 5) == "prop_" then - blocked = true - break + + if not self.ObjectiveMap or teamid == TEAM_UNDEAD then + local spawnpos = spawn:GetPos() + for _, ent in pairs(ents.FindInBox(spawnpos + playermins, spawnpos + playermaxs)) do + if not spawninplayer and IsValid(ent) and ent:IsPlayer() or string.sub(ent:GetClass(), 1, 5) == "prop_" then + blocked = true + break + end end end + if not blocked then potential[#potential + 1] = spawn end end end - -- Now our final spawn list. Pick the one that's closest to the humans if we're a zombie. Otherwise use a random spawn. + -- Now our final spawn list is ready. if #potential > 0 then - local spawn = teamid == TEAM_UNDEAD and self:GetClosestSpawnPoint(potential, epicenter or self:GetTeamEpicentre(TEAM_HUMAN)) or table.Random(potential) + local spawn + if teamid == TEAM_UNDEAD then + if pl:KeyDown(IN_ATTACK2) then + spawn = self:GetClosestSpawnPoint(potential, epicenter or self:GetTeamEpicentre(TEAM_HUMAN)) + elseif pl:KeyDown(IN_RELOAD) then + spawn = self:GetFurthestSpawnPoint(potential, epicenter or self:GetTeamEpicentre(TEAM_HUMAN)) + elseif math.random(2) == 2 then + -- Let every other left click masher spawn randomly instead of closest so we have wandering zombies. + spawn = table.Random(potential) + else + spawn = self:GetClosestSpawnPoint(potential, epicenter or self:GetTeamEpicentre(TEAM_HUMAN)) + end + else + spawn = table.Random(potential) + end + if spawn then LastSpawnPoints[teamid] = spawn - self:CheckDynamicSpawnHR(spawn) - pl.SpawnedOnSpawnPoint = true + pl.SpawnedOnSpawnPoint = spawn:GetClass():sub(1, 11) == "info_player" + pl.DidntSpawnOnSpawnPoint = pl.DidntSpawnOnSpawnPoint or not pl.SpawnedOnSpawnPoint return spawn end end end - pl.SpawnedOnSpawnPoint = true + pl.SpawnedOnSpawnPoint = false + pl.DidntSpawnOnSpawnPoint = true -- Fallback. return LastSpawnPoints[teamid] or #tab > 0 and table.Random(tab) or pl end -local function BossZombieSort(a, b) - local ascore = a.BarricadeDamage * 0.2 + a.DamageDealt[TEAM_UNDEAD] - local bscore = b.BarricadeDamage * 0.2 + b.DamageDealt[TEAM_UNDEAD] +local function BossZombieSort(za, zb) + local ascore = za.WaveBarricadeDamage * 0.05 + za.WaveHumanDamage + local bscore = zb.WaveBarricadeDamage * 0.05 + zb.WaveHumanDamage if ascore == bscore then - return a:Deaths() < b:Deaths() + return za:Deaths() < zb:Deaths() end return ascore > bscore end -function GM:SpawnBossZombie(bossplayer, silent) +function GM:SpawnBossZombie(bossplayer, silent, bossindex, triggerboss) if not bossplayer then bossplayer = self:CalculateNextBoss() end if not bossplayer then return end - local bossindex = bossplayer:GetBossZombieIndex() + if not bossindex then + bossindex = bossplayer:GetBossZombieIndex() + end + if bossindex == -1 then return end + if not triggerboss then + bossplayer.BossDeathNotification = true + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_ZOMBIECLASS, GAMEMODE.ZombieClasses[bossindex].Name, "BossSpawn", 1) + end + self.LastBossZombieSpawned = self:GetWave() local curclass = bossplayer.DeathClass or bossplayer:GetZombieClass() @@ -833,6 +1065,7 @@ function GM:SpawnBossZombie(bossplayer, silent) bossplayer.DeathClass = nil bossplayer:UnSpectateAndSpawn() bossplayer.DeathClass = curclass + bossplayer.BossHealRemaining = 750 if not silent then net.Start("zs_boss_spawned") @@ -857,6 +1090,70 @@ function GM:SendZombieVolunteers(pl, nonemptyonly) end end +function GM:ZombieSpawnDistanceSort(other) + return self._ZombieSpawnDistance < other._ZombieSpawnDistance +end + +function GM:ZombieSpawnDistanceSortSigils(other) + return self._ZombieSpawnDistance > other._ZombieSpawnDistance +end + +function GM:SortZombieSpawnDistances(allplayers) + local plpos, dist + + -- If using sigils then we sort by inverse distance from sigils instead of this. + local zspawns = self:GetSigils() + local sortbysigils = #zspawns > 0 + if not sortbysigils then + zspawns = ents.FindByClass("zombiegasses") + if #zspawns == 0 then + zspawns = team.GetValidSpawnPoint(TEAM_UNDEAD) + end + end + + local maxdist = 1280000000--12800000 + for _, pl in pairs(allplayers) do + if pl:Team() == TEAM_UNDEAD then + pl._ZombieSpawnDistance = sortbysigils and maxdist + 2 or -2 + elseif pl:GetInfo("zs_alwaysvolunteer") == "1" then + pl._ZombieSpawnDistance = sortbysigils and maxdist + 1 or -1 + elseif CLIENT or pl.LastNotAFK and CurTime() <= pl.LastNotAFK + 60 then + plpos = pl:GetPos() + dist = maxdist + for __, ent in pairs(zspawns) do + dist = math.min(dist, ent:NearestPoint(plpos):DistToSqr(plpos)) + end + pl._ZombieSpawnDistance = dist + else + pl._ZombieSpawnDistance = sortbysigils and 128 or maxdist -- AFK people should NOT be considered volunteers but also people ACTIVELY next to sigils should be picked AFTER AFK people. + end + end + + table.sort(allplayers, sortbysigils and self.ZombieSpawnDistanceSortSigils or self.ZombieSpawnDistanceSort) +end + +function GM:ShouldRestartRound() + if self.TimeLimit == -1 or self.RoundLimit == -1 then return true end + + local roundlimit = self.RoundLimit + --[[if self.ZombieEscape and roundlimit > 0 then + roundlimit = math.ceil(roundlimit * 1.5) + end]] + + local timelimit = self.TimeLimit + if self.ZombieEscape and timelimit > 0 then + timelimit = timelimit * 1.5 + end + + if timelimit > 0 and CurTime() >= timelimit + or roundlimit > 0 and self.CurrentRound >= roundlimit + or not self.ZombieEscape and ROUNDWINNER == TEAM_HUMAN then + return false + end + + return true +end + local NextTick = 0 function GM:Think() local time = CurTime() @@ -873,7 +1170,7 @@ function GM:Think() elseif self.BossZombies and not self.PantsMode and not self:IsClassicMode() and not self.ZombieEscape and self.LastBossZombieSpawned ~= wave and wave > 0 and not self.RoundEnded and (self.BossZombiePlayersRequired <= 0 or #player.GetAll() >= self.BossZombiePlayersRequired) then - if self:GetWaveStart() - 10 <= time then + if self:GetWaveStart() - 5 <= time then self:SpawnBossZombie() else self:CalculateNextBoss() @@ -882,14 +1179,26 @@ function GM:Think() end end - local humans = team.GetPlayers(TEAM_HUMAN) - for _, pl in pairs(humans) do - if pl:GetBarricadeGhosting() then - pl:BarricadeGhostingThink() + local allplayers = player_GetAll() + + for _, pl in pairs(allplayers) do + if pl.ShouldFlinch then + pl.ShouldFlinch = nil + --pl:Flinch() end - if pl.m_PointQueue >= 1 and time >= pl.m_LastDamageDealt + 3 then - pl:PointCashOut((pl.m_LastDamageDealtPosition or pl:GetPos()) + Vector(0, 0, 32), FM_NONE) + if P_Team(pl) == TEAM_HUMAN then + if P_GetBarricadeGhosting(pl) then + P_BarricadeGhostingThink(pl) + end + + if pl.PointQueue >= 1 and time >= pl.LastDamageDealtTime + 2 then + pl:PointCashOut(pl.LastDamageDealtPos or pl:GetPos(), FM_NONE) + end + + if P_GetPhantomHealth(pl) > 0 and P_Alive(pl) and pl:IsSkillActive(SKILL_BLOODLUST) then + pl:SetPhantomHealth(math_max(0, P_GetPhantomHealth(pl) - 5 * FrameTime())) + end end end @@ -900,48 +1209,137 @@ function GM:Think() if NextTick <= time then NextTick = time + 1 - local doafk = not self:GetWaveActive() and wave == 0 - local dopoison = self:GetEscapeStage() == ESCAPESTAGE_DEATH + local plpos - for _, pl in pairs(humans) do - if pl:Alive() then - if doafk then - local plpos = pl:GetPos() + if wave == 0 and not self:GetWaveActive() then + for _, pl in pairs(allplayers) do + if P_Team(pl) == TEAM_HUMAN then + plpos = pl:GetPos() if pl.LastAFKPosition and (pl.LastAFKPosition.x ~= plpos.x or pl.LastAFKPosition.y ~= plpos.y) then - pl.LastNotAFK = CurTime() + pl.LastNotAFK = time + end + pl.LastAFKPosition = plpos + end + end + end + + for _, pl in pairs(allplayers) do + if P_Team(pl) == TEAM_HUMAN and P_Alive(pl) then + plpos = pl:GetPos() + if doafk then + if pl.LastAFKPosition and (pl.LastAFKPosition.x ~= plpos.x or pl.LastAFKPosition.y ~= plpos.y) then + pl.LastNotAFK = time end pl.LastAFKPosition = plpos end if pl:WaterLevel() >= 3 and not (pl.status_drown and pl.status_drown:IsValid()) then pl:GiveStatus("drown") - else - pl:PreventSkyCade() end - if self:GetWave() >= 1 and time >= pl.BonusDamageCheck + 60 then - pl.BonusDamageCheck = time - pl:AddPoints(2) - pl:PrintTranslatedMessage(HUD_PRINTCONSOLE, "minute_points_added", 2) + local healmax = pl:IsSkillActive(SKILL_D_FRAIL) and math.floor(pl:GetMaxHealth() * 0.25) or pl:GetMaxHealth() + + if pl:IsSkillActive(SKILL_REGENERATOR) and time >= pl.NextRegenerate and pl:Health() < math.min(healmax, pl:GetMaxHealth() * 0.6) then + pl.NextRegenerate = time + 6 + pl:SetHealth(math.min(healmax, pl:Health() + 1)) end - if pl.BuffRegenerative and time >= pl.NextRegenerate and pl:Health() < pl:GetMaxHealth() / 2 then - pl.NextRegenerate = time + 5 - pl:SetHealth(pl:Health() + 1) + if pl:HasTrinket("regenimplant") and time >= pl.NextRegenTrinket and pl:Health() < healmax then + pl.NextRegenTrinket = time + 12 + pl:SetHealth(math.min(healmax, pl:Health() + 1)) end - if dopoison then - pl:TakeSpecialDamage(5, DMG_POISON) + if pl:IsSkillActive(SKILL_BLOODARMOR) and pl.MaxBloodArmor > 0 and time >= pl.NextBloodArmorRegen and pl:GetBloodArmor() < pl.MaxBloodArmor then + pl.NextBloodArmorRegen = time + 8 + pl:SetBloodArmor(math.min(pl.MaxBloodArmor, pl:GetBloodArmor() + (1 * pl.BloodarmorGainMul))) + end + + if pl:KeyDown(IN_SPEED) and pl:GetVelocity() ~= vector_origin and pl:IsSkillActive(SKILL_CARDIOTONIC) then + if pl:GetBloodArmor() > 0 then + pl:SetBloodArmor(pl:GetBloodArmor() - 1) + if pl:GetBloodArmor() == 0 and pl:IsSkillActive(SKILL_BLOODLETTER) then + local bleed = pl:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(5) + bleed.Damager = pl + end + end + else + pl:ResetSpeed() + end + end + + if pl:IsSkillActive(SKILL_D_LATEBUYER) and not pl.LateBuyerMessage then + local midwave = self:GetWave() < self:GetNumberOfWaves() / 2 or self:GetWave() == self:GetNumberOfWaves() / 2 and self:GetWaveActive() and time < self:GetWaveEnd() - (self:GetWaveEnd() - self:GetWaveStart()) / 2 + if not midwave then + pl:CenterNotify(COLOR_CYAN, translate.ClientGet(pl, "late_buyer_finished")) + pl:SendLua("surface.PlaySound(\"buttons/button5.wav\")") + pl.LateBuyerMessage = true + end + end + + pl:CheckTrinketRecharges() + + if pl:HasTrinket("autoreload") and pl.OldWeaponToReload and time > (pl.NextAutomatedReload or 0) then + local mywep = pl.OldWeaponToReload + if mywep and mywep:IsValid() and mywep.FinishReload then + local max1 = mywep:GetPrimaryClipSize() + + if max1 > 0 then + local ammotype = mywep:GetPrimaryAmmoType() + local spare = pl:GetAmmoCount(ammotype) + local current = mywep:Clip1() + local needed = max1 - current + + needed = math.min(spare, needed) + + mywep:SetClip1(current + needed) + pl:RemoveAmmo(needed, ammotype) + end + end + + pl.NextAutomatedReload = math.huge + pl.OldWeaponToReload = nil + end + + if pl:IsSkillActive(SKILL_STOWAGE) and self:GetWave() > 0 and time > (pl.NextResupplyUse or 0) then + local stockpiling = pl:IsSkillActive(SKILL_STOCKPILE) + + pl.NextResupplyUse = time + self.ResupplyBoxCooldown * (pl.ResupplyDelayMul or 1) * (stockpiling and 2.12 or 1) + pl.StowageCaches = (pl.StowageCaches or 0) + (stockpiling and 2 or 1) + + net.Start("zs_nextresupplyuse") + net.WriteFloat(pl.NextResupplyUse) + net.Send(pl) + + net.Start("zs_stowagecaches") + net.WriteInt(pl.StowageCaches, 8) + net.Send(pl) + end + end + end + + if self:GetEscapeStage() == ESCAPESTAGE_DEATH then + for _, pl in pairs(allplayers) do + if P_Team(pl) == TEAM_HUMAN then + pl:TakeSpecialDamage(15, DMG_ACID) end end end end end +function GM:PlayerSwitchWeapon(pl, old, new) + if pl:HasTrinket("autoreload") then + pl.NextAutomatedReload = CurTime() + 3.95 + pl.OldWeaponToReload = old + end +end + -- We calculate the volunteers. If the list changed then broadcast the new list. function GM:CalculateZombieVolunteers() local volunteers = {} - local allplayers = player.GetAll() + local allplayers = player_GetAll() self:SortZombieSpawnDistances(allplayers) for i = 1, self:GetDesiredStartingZombies() do volunteers[i] = allplayers[i] @@ -964,29 +1362,32 @@ function GM:CalculateZombieVolunteers() end end +GM.LastCalculatedBossTime = 0 function GM:CalculateNextBoss() - local livingbosses = 0 local zombies = {} for _, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do - if ent:GetZombieClassTable().Boss and ent:Alive() then - livingbosses = livingbosses + 1 - if livingbosses >= 3 then return end - else - if ent:GetInfo("zs_nobosspick") == "0" then - table.insert(zombies, ent) - end + if ent:GetInfo("zs_nobosspick") == "0" and not ent:GetZombieClassTable().Boss then + table.insert(zombies, ent) end end table.sort(zombies, BossZombieSort) local newboss = zombies[1] - local newbossclass = "" - - if newboss and newboss:IsValid() then newbossclass = GAMEMODE.ZombieClasses[newboss:GetBossZombieIndex()].Name end - net.Start("zs_nextboss") - net.WriteEntity(newboss) - net.WriteString(newbossclass) - net.Broadcast() - + + if newboss ~= self.LastCalculatedBoss or CurTime() >= self.LastCalculatedBossTime + 2 then + self.LastCalculatedBoss = newboss + self.LastCalculatedBossTime = CurTime() + + net.Start("zs_nextboss") + if newboss and newboss:IsValid() then + net.WriteEntity(newboss) + net.WriteUInt(newboss:GetBossZombieIndex(), 8) + else + net.WriteEntity(NULL) + net.WriteUInt(1, 8) + end + net.Broadcast() + end + return newboss end @@ -1017,7 +1418,7 @@ function GM:CalculateInfliction(victim, attacker) players = humans + zombies - if players == 0 then return self.CappedInfliction end + if players == 0 and wonhumans == 0 then return self.CappedInfliction end local infliction = math.max(zombies / players, self.CappedInfliction) self.CappedInfliction = infliction @@ -1043,12 +1444,22 @@ function GM:CalculateInfliction(victim, attacker) if v.Infliction and infliction >= v.Infliction and not self:IsClassUnlocked(v.Name) then v.Unlocked = true - if not self.PantsMode and not self:IsClassicMode() and not self:IsBabyMode() and not self.ZombieEscape then - if not v.Locked then - for _, pl in pairs(player.GetAll()) do - pl:CenterNotify(COLOR_RED, translate.ClientFormat(pl, "infliction_reached", v.Infliction * 100)) - pl:CenterNotify(translate.ClientFormat(pl, "x_unlocked", translate.ClientGet(pl, v.TranslationName))) - end + for _, ent in pairs(ents.FindByClass("logic_classunlock")) do + local classname = v.Name + if ent.Class == string.lower(classname) then + ent:Input("onclassunlocked", ent, ent, classname) + end + end + + if not self.PantsMode and not self:IsClassicMode() and not self:IsBabyMode() and not self.ZombieEscape and not v.Locked then + net.Start("zs_classunlockstate") + net.WriteInt(k, 8) + net.WriteBool(v.Unlocked) + net.Broadcast() + + for _, pl in pairs(player.GetAll()) do + pl:CenterNotify(COLOR_RED, translate.ClientFormat(pl, "infliction_reached", v.Infliction * 100)) + pl:CenterNotify(translate.ClientFormat(pl, "x_unlocked", translate.ClientGet(pl, v.TranslationName))) end end end @@ -1084,26 +1495,32 @@ function GM:LastHuman(pl) self.TheLastHuman = pl end -function GM:PlayerHealedTeamMember(pl, other, health, wep) - if self:GetWave() == 0 then return end +function GM:PlayerHealedTeamMember(pl, other, health, wep, pointmul, nobymsg, floater) + health = health - other:RemoveUselessDamage(health) + if self:GetWave() == 0 or health <= 0 or pl == other then return end pl.HealedThisRound = pl.HealedThisRound + health - pl.CarryOverHealth = (pl.CarryOverHealth or 0) + health - local hpperpoint = self.MedkitPointsPerHealth - if hpperpoint <= 0 then return end + if pointmul ~= 0 then + local hpperpoint = self.MedkitPointsPerHealth + if hpperpoint <= 0 then return end - local points = math.floor(pl.CarryOverHealth / hpperpoint) + local points = health / hpperpoint * pointmul - if 1 <= points then pl:AddPoints(points) + end - pl.CarryOverHealth = pl.CarryOverHealth - points * hpperpoint + net.Start("zs_healother") + net.WriteBool(not floater) + net.WriteEntity(other) + net.WriteFloat(health) + net.Send(pl) - net.Start("zs_healother") - net.WriteEntity(other) - net.WriteUInt(points, 16) - net.Send(pl) + if not nobymsg then + net.Start("zs_healby") + net.WriteFloat(health) + net.WriteEntity(pl) + net.Send(other) end end @@ -1111,26 +1528,22 @@ function GM:ObjectPackedUp(pack, packer, owner) end function GM:PlayerRepairedObject(pl, other, health, wep) - if self:GetWave() == 0 then return end + health = health - other:RemoveUselessDamage(health) + if self:GetWave() == 0 or health <= 0 then return end pl.RepairedThisRound = pl.RepairedThisRound + health - pl.CarryOverRepair = (pl.CarryOverRepair or 0) + health local hpperpoint = self.RepairPointsPerHealth if hpperpoint <= 0 then return end - local points = math.floor(pl.CarryOverRepair / hpperpoint) + local points = health / hpperpoint - if 1 <= points then - pl:AddPoints(points) + pl:AddPoints(points) - pl.CarryOverRepair = pl.CarryOverRepair - points * hpperpoint - - net.Start("zs_repairobject") - net.WriteEntity(other) - net.WriteUInt(points, 16) - net.Send(pl) - end + net.Start("zs_repairobject") + net.WriteEntity(other) + net.WriteFloat(health) + net.Send(pl) end function GM:CacheHonorableMentions() @@ -1170,6 +1583,7 @@ function GM:PostDoHonorableMentions() end function GM:PostEndRound(winner) + self:SaveAllVaults() end -- You can override or hook and return false in case you have your own map change system. @@ -1181,7 +1595,7 @@ function GM:LoadNextMap() timer.Simple(10, game.LoadNextMap) timer.Simple(15, function() RunConsoleCommand("changelevel", game.GetMap()) end) - if file.Exists(GetConVarString("mapcyclefile"), "GAME") then + if file.Exists(GetConVar("mapcyclefile"):GetString(), "GAME") then game.LoadNextMap() else local maps = file.Find("maps/zs_*.bsp", "GAME") @@ -1225,6 +1639,10 @@ GM.CurrentRound = 1 function GM:RestartRound() self.CurrentRound = self.CurrentRound + 1 + net.Start("zs_currentround") + net.WriteUInt(self.CurrentRound, 6) + net.Broadcast() + self:RestartLua() self:RestartGame() @@ -1235,6 +1653,7 @@ end GM.DynamicSpawning = true GM.CappedInfliction = 0 +GM.PeakPopulation = 0 GM.StartingZombie = {} GM.CheckedOut = {} GM.PreviouslyDied = {} @@ -1245,6 +1664,7 @@ function GM:RestartLua() self.TheLastHuman = nil self.LastBossZombieSpawned = nil self.UseSigils = nil + --self:SetAllSigilsDestroyed(false) -- logic_pickups self.MaxWeaponPickups = nil @@ -1271,6 +1691,7 @@ function GM:RestartLua() end self.CappedInfliction = 0 + self.PeakPopulation = 0 self.StartingZombie = {} self.CheckedOut = {} @@ -1285,6 +1706,7 @@ function GM:RestartLua() hook.Remove("PlayerCanHearPlayersVoice", "EndRoundCanHearPlayersVoice") self:RevertZombieClasses() + self:ClearItemStocks(true) end -- I don't know. @@ -1308,17 +1730,21 @@ function GM:DoRestartGame() ent:Remove() end + for _, ent in pairs(ents.FindByClass("prop_invitem")) do + ent:Remove() + end + self:SetUseSigils(false) self:SetEscapeStage(ESCAPESTAGE_NONE) self:SetWave(0) - if GAMEMODE.ZombieEscape then + self:SetWaveActive(false) + if self.ZombieEscape then self:SetWaveStart(CurTime() + 30) else self:SetWaveStart(CurTime() + self.WaveZeroLength) end self:SetWaveEnd(self:GetWaveStart() + self:GetWaveOneLength()) - self:SetWaveActive(false) SetGlobalInt("numwaves", -2) @@ -1332,6 +1758,10 @@ function GM:DoRestartGame() pl:GodDisable() gamemode.Call("PlayerInitialSpawnRound", pl) gamemode.Call("PlayerReadyRound", pl) + + if pl:Team() == TEAM_UNDEAD then -- bots? + pl:KillSilent() + end end end @@ -1342,14 +1772,20 @@ function GM:RestartGame() pl:SetFrags(0) pl:SetDeaths(0) pl:SetPoints(0) - pl:ChangeTeam(TEAM_HUMAN) + if not pl.IsZSBot then + pl:ChangeTeam(TEAM_HUMAN) + end pl:DoHulls() pl:SetZombieClass(self.DefaultZombieClass) pl.DeathClass = nil end + for _, ent in pairs(ents.FindByClass("prop_obj_sigil")) do + ent:Remove() + end + self:SetWave(0) - if GAMEMODE.ZombieEscape then + if self.ZombieEscape then self:SetWaveStart(CurTime() + 30) else self:SetWaveStart(CurTime() + self.WaveZeroLength) @@ -1383,15 +1819,39 @@ function GM:InitPostEntityMap(fromze) for _, ent in pairs(ents.FindByClass("prop_ammo")) do ent.PlacedInMap = true end for _, ent in pairs(ents.FindByClass("prop_weapon")) do ent.PlacedInMap = true end + for _, ent in pairs(ents.FindByClass("func_door_rotating")) do ent.NoTraceAttack = true end + for _, ent in pairs(ents.FindByClass("func_physbox")) do ent.IsPhysbox = true end + for _, ent in pairs(ents.FindByClass("func_physbox_multiplayer")) do + ent.IsPhysbox = true + ent.IgnoreZEProtect = true + end + + for _, ent in pairs(ents.FindByClass("item_*")) do ent.NoNails = true end if self.ObjectiveMap then self:SetDynamicSpawning(false) self.BossZombies = false end - --[[if not game.IsDedicated() then - gamemode.Call("CreateSigils") - end]] + if game.MaxPlayers() > 16 then + local e = ents.FindByClass("shadow_control")[1] + if not e then + e = ents.Create("shadow_control") + e:Spawn() + end + if e:IsValid() then + e:SetKeyValue("disableallshadows", "1") + end + + util.RemoveAll("func_precipitation") + end + + gamemode.Call("CreateSigils") +end + +function GM:SetDynamicSpawning(onoff) + SetGlobalBool("DynamicSpawningDisabled", not onoff) + self.DynamicSpawning = onoff end local function EndRoundPlayerShouldTakeDamage(pl, attacker) return pl:Team() == TEAM_UNDEAD or not attacker:IsPlayer() end @@ -1405,6 +1865,17 @@ local function EndRoundSetupPlayerVisibility(pl) end end +function GM:OnPlayerWin(pl) + local xp = math.Clamp(#player.GetAll() * 6, 20, 200) * (GAMEMODE.WinXPMulti or 1) + if self.ZombieEscape then + xp = xp / 4 + end + pl:AddZSXP(xp) +end + +function GM:OnPlayerLose(pl) +end + function GM:EndRound(winner) if self.RoundEnded then return end self.RoundEnded = true @@ -1416,7 +1887,7 @@ function GM:EndRound(winner) timer.Simple(2, function() game.SetTimeScale(1) end) end - hook.Add("PlayerCanHearPlayersVoice", "EndRoundCanHearPlayersVoice", function() return true end) + hook.Add("PlayerCanHearPlayersVoice", "EndRoundCanHearPlayersVoice", function() return true, false end) if self.OverrideEndCamera == nil or self.OverrideEndCamera then hook.Add("SetupPlayerVisibility", "EndRoundSetupPlayerVisibility", EndRoundSetupPlayerVisibility) @@ -1432,15 +1903,30 @@ function GM:EndRound(winner) -- Get rid of some lag. util.RemoveAll("prop_ammo") util.RemoveAll("prop_weapon") + util.RemoveAll("prop_invitem") timer.Simple(5, function() gamemode.Call("DoHonorableMentions") end) if winner == TEAM_HUMAN then self.LastHumanPosition = nil + for _, pl in pairs(player.GetAll()) do + if pl:Team() == TEAM_HUMAN then + if not self:GetUseSigils() then + gamemode.Call("OnPlayerWin", pl) + end + elseif pl:Team() == TEAM_UNDEAD then + gamemode.Call("OnPlayerLose", pl) + end + end + hook.Add("PlayerShouldTakeDamage", "EndRoundShouldTakeDamage", EndRoundPlayerShouldTakeDamage) elseif winner == TEAM_UNDEAD then hook.Add("PlayerShouldTakeDamage", "EndRoundShouldTakeDamage", EndRoundPlayerCanSuicide) + + for _, pl in pairs(team.GetPlayers(TEAM_UNDEAD)) do + gamemode.Call("OnPlayerLose", pl) + end end net.Start("zs_endround") @@ -1448,6 +1934,9 @@ function GM:EndRound(winner) net.WriteString(game.GetMapNext()) net.Broadcast() + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_ROUND, + winner == TEAM_HUMAN and "Wins" or ("LossWave"..self:GetWave()), game.GetMap(), 1) + if winner == TEAM_HUMAN then for _, ent in pairs(ents.FindByClass("logic_winlose")) do ent:Input("onwin") @@ -1463,8 +1952,47 @@ function GM:EndRound(winner) self:SetWaveStart(CurTime() + 9999) end +function GM:ScalePlayerDamage(pl, hitgroup, dmginfo) + local attacker = dmginfo:GetAttacker() + local inflictor = dmginfo:GetInflictor() + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, inflictor:GetClass(), "Hits", 1) + if hitgroup == HITGROUP_HEAD then + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, inflictor:GetClass(), "Headshots", 1) + end + + if not dmginfo:IsBulletDamage() then return end + + if hitgroup == HITGROUP_HEAD and dmginfo:IsBulletDamage() then + pl.m_LastHeadShot = CurTime() + end + + --local crouchpunish = pl:ShouldCrouchJumpPunish() + + if not pl:CallZombieFunction2("ScalePlayerDamage", hitgroup, dmginfo) then + if hitgroup == HITGROUP_HEAD then + dmginfo:SetDamage(dmginfo:GetDamage() * (inflictor.HeadshotMulti or 2) * (attacker:IsPlayer() and attacker:GetStatus("renegade") and 1.1 or 1)) + elseif hitgroup == HITGROUP_LEFTLEG or hitgroup == HITGROUP_RIGHTLEG then + --if not crouchpunish then + if not pl:ShouldCrouchJumpPunish() then + dmginfo:SetDamage(dmginfo:GetDamage() / 4) + end + end + end + + if (hitgroup == HITGROUP_LEFTLEG or hitgroup == HITGROUP_RIGHTLEG) and self:PlayerShouldTakeDamage(pl, dmginfo:GetAttacker()) and not pl:CallZombieFunction1("IgnoreLegDamage", dmginfo) then + pl:AddLegDamage( + pl:ShouldCrouchJumpPunish() and not (pl.LastBarricadeHit and pl.LastBarricadeHit + 2 > CurTime()) and dmginfo:GetDamage()/4 + or dmginfo:GetDamage() + ) + end +end + function GM:PlayerReady(pl) gamemode.Call("PlayerReadyRound", pl) + + self:PlayerReadyVault(pl) + + pl.PlayerReady = true end function GM:PlayerReadyRound(pl) @@ -1475,7 +2003,7 @@ function GM:PlayerReadyRound(pl) local classid = pl:GetZombieClass() pl:SetZombieClass(classid, true, pl) - + if self.OverrideStartingWorth then pl:SendLua("GAMEMODE.StartingWorth="..tostring(self.StartingWorth)) end @@ -1485,12 +2013,16 @@ function GM:PlayerReadyRound(pl) pl:DoHulls(classid, TEAM_UNDEAD) elseif pl:Team() == TEAM_HUMAN then if self:GetWave() <= 0 and self.StartingWorth > 0 and not self.StartingLoadout and not self.ZombieEscape then - pl:SendLua("MakepWorth()") + pl:SendLua("InitialWorthMenu()") else gamemode.Call("GiveDefaultOrRandomEquipment", pl) end end + net.Start("zs_currentround") + net.WriteUInt(self.CurrentRound, 6) + net.Send(pl) + if self.RoundEnded then pl:SendLua("gamemode.Call(\"EndRound\", "..tostring(ROUNDWINNER)..", \""..game.GetMapNext().."\")") gamemode.Call("DoHonorableMentions", pl) @@ -1509,6 +2041,9 @@ function GM:PlayerReadyRound(pl) elseif self:IsBabyMode() then pl:SendLua("SetGlobalBool(\"babymode\", true)") end + + self:RefreshItemStocks(pl) + self:ClassUnlocksUpdate(pl) end function GM:FullGameUpdate(pl) @@ -1532,35 +2067,45 @@ concommand.Add("initpostentity", function(sender, command, arguments) end) local playerheight = Vector(0, 0, 72) -local playermins = Vector(-17, -17, 0) -local playermaxs = Vector(17, 17, 4) -local function groupsort(a, b) - return #a > #b +local function groupsort(ga, gb) + return #ga > #gb end function GM:AttemptHumanDynamicSpawn(pl) - if pl:IsValid() and pl:IsPlayer() and pl:Alive() and pl:Team() == TEAM_HUMAN and self.DynamicSpawning then - local groups = self:GetTeamRallyGroups(TEAM_HUMAN) - table.sort(groups, groupsort) - for i=1, #groups do - local group = groups[i] + if not self.DynamicSpawning or not pl:IsValidLivingHuman() then return false end - local allplayers = team.GetPlayers(TEAM_HUMAN) - for _, otherpl in pairs(group) do - if otherpl ~= pl then - local pos = otherpl:GetPos() + Vector(0, 0, 1) - if otherpl:Alive() and otherpl:GetMoveType() == MOVETYPE_WALK and not util.TraceHull({start = pos, endpos = pos + playerheight, mins = playermins, maxs = playermaxs, mask = MASK_SOLID, filter = allplayers}).Hit then - local nearzombie = false - for __, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do - if ent:Alive() and ent:GetPos():Distance(pos) <= 256 then - nearzombie = true - end - end + local sigils = self:GetSigils() + local randsigil = sigils[math.random(#sigils)] + if randsigil and randsigil:IsValid() and not randsigil:GetSigilCorrupted() then + pl:SetBarricadeGhosting(true) + pl:SetPos(randsigil:GetPos()) + return true + end - if not nearzombie then - pl:SetPos(otherpl:GetPos()) - return true + local group, pos, nearzombie + + local allplayers = team.GetPlayers(TEAM_HUMAN) + + local groups = self:GetTeamRallyGroups(TEAM_HUMAN) + table.sort(groups, groupsort) + + for i=1, #groups do + group = groups[i] + + for _, otherpl in pairs(group) do + if otherpl ~= pl then + pos = otherpl:GetPos() + Vector(0, 0, 1) + if otherpl:Alive() and otherpl:GetMoveType() == MOVETYPE_WALK and not util.TraceHull({start = pos, endpos = pos + playerheight, mins = playermins, maxs = playermaxs, mask = MASK_SOLID, filter = allplayers}).Hit then + nearzombie = false + for __, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do + if ent:Alive() and ent:GetPos():DistToSqr(pos) <= 65536 then --256^2 + nearzombie = true end end + + if not nearzombie then + pl:SetPos(otherpl:GetPos()) + return true + end end end end @@ -1570,7 +2115,19 @@ function GM:AttemptHumanDynamicSpawn(pl) end function GM:PlayerInitialSpawn(pl) + pl.MaxBloodArmor = GAMEMODE.ZombieEscape and 0 or 10 + pl.NextFlashlightSwitch = 0 + pl.NextPainSound = 0 + pl.NextFlinch = 0 + pl.LastSentESW = 0 + pl.m_LastWaveStartSpawn = 0 + pl.m_LastGasHeal = 0 + + self:InitializeVault(pl) + gamemode.Call("PlayerInitialSpawnRound", pl) + + self.PeakPopulation = math.max(self.PeakPopulation, #player.GetAll()) end function GM:PlayerInitialSpawnRound(pl) @@ -1581,11 +2138,14 @@ function GM:PlayerInitialSpawnRound(pl) pl:SetCanWalk(false) pl:SetCanZoom(false) - pl:SetNoCollideWithTeammates(true) + + -- This is the culprit for shitty player to player collisions when standing on an enemy's head. No idea why. + pl:SetNoCollideWithTeammates(false) --pl:SetNoCollideWithTeammates(true) pl:SetCustomCollisionCheck(true) pl.ZombiesKilled = 0 pl.ZombiesKilledAssists = 0 + pl.Headshots = 0 pl.BrainsEaten = 0 pl.ResupplyBoxUsedByOthers = 0 @@ -1593,57 +2153,51 @@ function GM:PlayerInitialSpawnRound(pl) pl.WaveJoined = self:GetWave() pl.CrowKills = 0 - pl.CrowVsCrowKills = 0 - pl.CrowBarricadeDamage = 0 + pl.DefenceDamage = 0 + pl.StrengthBoostDamage = 0 pl.BarricadeDamage = 0 - pl.DynamicSpawnedOn = 0 - pl.NextPainSound = 0 + pl.PointsRemainder = 0 - pl.BonusDamageCheck = 0 + pl.XPRemainder = 0 pl.LegDamage = 0 + pl.ArmDamage = 0 pl.DamageDealt = {} pl.DamageDealt[TEAM_UNDEAD] = 0 pl.DamageDealt[TEAM_HUMAN] = 0 + pl.ZSFriends = {} + pl.LifeBarricadeDamage = 0 pl.LifeHumanDamage = 0 pl.LifeBrainsEaten = 0 - pl.m_PointQueue = 0 - pl.m_LastDamageDealt = 0 + pl.WaveBarricadeDamage = 0 + pl.WaveHumanDamage = 0 + + pl.PointQueue = 0 + pl.LastDamageDealtTime = 0 pl.HealedThisRound = 0 - pl.CarryOverHealth = 0 pl.RepairedThisRound = 0 - pl.CarryOverRepair = 0 - pl.PointsCommission = 0 - pl.CarryOverCommision = 0 pl.NextRegenerate = 0 + pl.NextBloodArmorRegen = 0 + pl.NextRegenTrinket = 0 + pl.LateBuyerMessage = nil pl.NestsDestroyed = 0 pl.NestSpawns = 0 + pl.LastRevive = 0 - local nosend = not pl.DidInitPostEntity - pl.HumanSpeedAdder = nil - pl.HumanSpeedAdder = nil - pl.HumanRepairMultiplier = nil - pl.HumanHealMultiplier = nil - pl.BuffResistant = nil - pl.BuffRegenerative = nil - pl.BuffMuscular = nil - pl.IsWeak = nil - pl.HumanSpeedAdder = nil - pl:SetPalsy(false, nosend) - pl:SetHemophilia(false, nosend) - pl:SetUnlucky(false) - pl.Clumsy = nil - pl.NoGhosting = nil - pl.NoObjectPickup = nil + pl.ZSInventory = {} + + --local nosend = not pl.DidInitPostEntity pl.DamageVulnerability = nil + self:LoadVault(pl) + local uniqueid = pl:UniqueID() if table.HasValue(self.FanList, uniqueid) then @@ -1651,34 +2205,37 @@ function GM:PlayerInitialSpawnRound(pl) pl:PrintTranslatedMessage(HUD_PRINTTALK, "thanks_for_being_a_fan_of_zs") end - if self.PreviouslyDied[uniqueid] then + if self.PreviouslyDied[uniqueid] or ZSBOT then -- They already died and reconnected. pl:ChangeTeam(TEAM_UNDEAD) - --[[else - pl:ChangeTeam(TEAM_SPECTATOR) - pl:Spectate(OBS_MODE_ROAMING)]] elseif LASTHUMAN then ---- - -- Joined during last human. pl.SpawnedTime = CurTime() pl:ChangeTeam(TEAM_UNDEAD) elseif self:GetWave() <= 0 then - -- Joined during ready phase. pl.SpawnedTime = CurTime() pl:ChangeTeam(TEAM_HUMAN) + if self.DynamicSpawning then + timer.Simple(1, function() + GAMEMODE:AttemptHumanDynamicSpawn(pl) + pl:SetBarricadeGhosting(true, true) + end) + end elseif self:GetNumberOfWaves() == -1 or self.NoNewHumansWave <= self:GetWave() or team.NumPlayers(TEAM_UNDEAD) == 0 and 1 <= team.NumPlayers(TEAM_HUMAN) then -- Joined during game, no zombies, some humans or joined past the deadline. pl:ChangeTeam(TEAM_UNDEAD) self.PreviouslyDied[uniqueid] = CurTime() else - -- Joined past the ready phase but before the deadline. pl.SpawnedTime = CurTime() pl:ChangeTeam(TEAM_HUMAN) if self.DynamicSpawning then - timer.Simple(0, function() GAMEMODE:AttemptHumanDynamicSpawn(pl) end) - end ---- + timer.Simple(0, function() + GAMEMODE:AttemptHumanDynamicSpawn(pl) + pl:SetBarricadeGhosting(true, true) + end) + end end - if pl:Team() == TEAM_UNDEAD and not self:GetWaveActive() and self.ZombieClasses["Crow"] then - pl:SetZombieClass(self.ZombieClasses["Crow"].Index) + if pl:Team() == TEAM_UNDEAD and not self:GetWaveActive() then + pl:SetZombieClassName("Crow") pl.DeathClass = self.DefaultZombieClass else pl:SetZombieClass(self.DefaultZombieClass) @@ -1694,34 +2251,10 @@ function GM:GetDynamicSpawning() return self.DynamicSpawning end -function GM:PlayerRedeemed(pl, silent, noequip) - pl:RemoveStatus("overridemodel", false, true) +function GM:PrePlayerRedeemed(pl, silent, noequip) +end - pl:ChangeTeam(TEAM_HUMAN) - if not noequip then pl.m_PreRedeem = true end - pl:UnSpectateAndSpawn() - pl.m_PreRedeem = nil - pl:DoHulls() - - local frags = pl:Frags() - if frags < 0 then - pl:SetFrags(frags * 5) - else - pl:SetFrags(0) - end - pl:SetDeaths(0) - - pl.DeathClass = nil - pl:SetZombieClass(self.DefaultZombieClass) - - pl.SpawnedTime = CurTime() - - if not silent then - net.Start("zs_playerredeemed") - net.WriteEntity(pl) - net.WriteString(pl:Name()) - net.Broadcast() - end +function GM:PostPlayerRedeemed(pl, silent, noequip) end function GM:PlayerDisconnected(pl) @@ -1746,9 +2279,48 @@ function GM:PlayerDisconnected(pl) end end + self:SaveVault(pl) + gamemode.Call("CalculateInfliction") end +function GM:CanDamageNail(ent, attacker, inflictor, damage, dmginfo) + return not attacker:IsPlayer() or attacker:Team() == TEAM_UNDEAD +end + +function GM:CanPlaceNail(pl, tr) + if tr and not pl:HasBarricadeExpert() and tr.Entity.ExpertProtection and tr.Entity.ExpertProtection > CurTime() then + return false + end + + return true +end + +function GM:CanRemoveNail(pl, nail) + return not nail.m_NailUnremovable +end + +function GM:CanRemoveOthersNail(pl, nailowner, ent) + -- obsolete + --[[local plpoints = pl:Frags() + local ownerpoints = nailowner:Frags() + if plpoints >= 75 or ownerpoints < 75 then return true end]] + + if gamemode.Call("PlayerIsAdmin", pl) then return true end + if nailowner.ZSFriends[pl] then return true end + + if pl:BarricadeExpertPrecedence(nailowner) == -1 then + pl:PrintTranslatedMessage(HUD_PRINTCENTER, "cant_remove_nails_of_superior_player") + return false + end + + return true +end + +function GM:SetRedeemBrains(amount) + SetGlobalInt("redeembrains", amount) +end + -- Reevaluates a prop and its constraint system (or all props if no arguments) to determine if they should be frozen or not from nails. function GM:EvaluatePropFreeze(ent, neighbors) if not ent then @@ -1770,10 +2342,12 @@ function GM:EvaluatePropFreeze(ent, neighbors) neighbors = neighbors or {} table.insert(neighbors, ent) + local baseent, attachent + for _, nail in pairs(ent:GetNails()) do if nail:IsValid() then - local baseent = nail:GetBaseEntity() - local attachent = nail:GetAttachEntity() + baseent = nail:GetBaseEntity() + attachent = nail:GetAttachEntity() if baseent:IsValid() and not baseent:IsWorld() and not table.HasValue(neighbors, baseent) then self:EvaluatePropFreeze(baseent, neighbors) end @@ -1806,8 +2380,22 @@ function GM:OnNailRemoved(nail, ent1, ent2, remover) if remover and remover:IsValid() and remover:IsPlayer() then local deployer = nail:GetDeployer() - if deployer:IsValid() and deployer ~= remover and deployer:Team() == TEAM_HUMAN then - PrintTranslatedMessage(HUD_PRINTCONSOLE, "nail_removed_by", remover:Name(), deployer:Name()) + local deployername = "[unconnected]" + if deployer:IsValid() and deployer:Team() == TEAM_HUMAN then + deployername = deployer:Name() + + if deployer ~= remover then + net.Start("zs_nailremoved") + net.WriteEntity(remover) + net.Send(deployer) + end + end + + PrintTranslatedMessage(HUD_PRINTCONSOLE, "nail_removed_by", remover:Name(), deployername) + + if remover:HasBarricadeExpert() then + if ent1 and ent1:IsValid() and not ent1:IsWorld() then ent1.ExpertProtection = CurTime() + 5 end + if ent2 and ent2:IsValid() and not ent2:IsWorld() then ent2.ExpertProtection = CurTime() + 5 end end end end @@ -1825,6 +2413,7 @@ end function GM:RemoveDuplicateAmmo(pl) local AmmoCounts = {} local WepAmmos = {} + for _, wep in pairs(pl:GetWeapons()) do if wep.Primary then local ammotype = wep:ValidPrimaryAmmo() @@ -1839,6 +2428,7 @@ function GM:RemoveDuplicateAmmo(pl) end end end + for ammotype, count in pairs(AmmoCounts) do if count > 1 then local highest = 0 @@ -1880,9 +2470,14 @@ function GM:GiveDefaultOrRandomEquipment(pl) end function GM:GiveStartingLoadout(pl) + if self.CheckedOut[pl:UniqueID()] then return end + self.CheckedOut[pl:UniqueID()] = true + for item, amount in pairs(self.StartingLoadout) do for i=1, amount do pl:Give(item) + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, item, "StartingLoadout", 1) end end end @@ -1902,8 +2497,12 @@ function GM:GiveRandomEquipment(pl) if tab.Callback then tab.Callback(pl) elseif tab.SWEP then - pl:StripWeapon(tab.SWEP) - pl:Give(tab.SWEP) + if not pl:AddInventoryItem(tab.SWEP) then + pl:StripWeapon(tab.SWEP) + pl:Give(tab.SWEP) + end + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, tab.SWEP, "RandomCheckouts", 1) end end end @@ -1914,200 +2513,6 @@ function GM:PlayerCanCheckout(pl) return pl:IsValid() and pl:Team() == TEAM_HUMAN and pl:Alive() and not self.CheckedOut[pl:UniqueID()] and not self.StartingLoadout and not self.ZombieEscape and self.StartingWorth > 0 and self:GetWave() < 2 end -concommand.Add("zs_pointsshopbuy", function(sender, command, arguments) - if not (sender:IsValid() and sender:IsConnected()) or #arguments == 0 then return end - - if sender:GetUnlucky() then - sender:CenterNotify(COLOR_RED, translate.ClientGet(sender, "banned_for_life_warning")) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - if not sender:NearArsenalCrate() then - sender:CenterNotify(COLOR_RED, translate.ClientGet(sender, "need_to_be_near_arsenal_crate")) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - if not gamemode.Call("PlayerCanPurchase", sender) then - sender:CenterNotify(COLOR_RED, translate.ClientGet(sender, "cant_purchase_right_now")) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - local itemtab - local id = arguments[1] - local num = tonumber(id) - if num then - itemtab = GAMEMODE.Items[num] - else - for i, tab in pairs(GAMEMODE.Items) do - if tab.Signature == id then - itemtab = tab - break - end - end - end - - if not itemtab or not itemtab.PointShop then return end - - local points = sender:GetPoints() - local cost = itemtab.Worth - if not GAMEMODE:GetWaveActive() then - cost = cost * GAMEMODE.ArsenalCrateMultiplier - end - - if GAMEMODE:IsClassicMode() and itemtab.NoClassicMode then - sender:CenterNotify(COLOR_RED, translate.ClientFormat(sender, "cant_use_x_in_classic", itemtab.Name)) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - if GAMEMODE.ZombieEscape and itemtab.NoZombieEscape then - sender:CenterNotify(COLOR_RED, translate.ClientFormat(sender, "cant_use_x_in_zombie_escape", itemtab.Name)) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - cost = math.ceil(cost) - - if points < cost then - sender:CenterNotify(COLOR_RED, translate.ClientGet(sender, "dont_have_enough_points")) - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - return - end - - if itemtab.Callback then - itemtab.Callback(sender) - elseif itemtab.SWEP then - if sender:HasWeapon(itemtab.SWEP) then - local stored = weapons.GetStored(itemtab.SWEP) - if stored and stored.AmmoIfHas then - sender:GiveAmmo(stored.Primary.DefaultClip, stored.Primary.Ammo) - else - local wep = ents.Create("prop_weapon") - if wep:IsValid() then - wep:SetPos(sender:GetShootPos()) - wep:SetAngles(sender:GetAngles()) - wep:SetWeaponType(itemtab.SWEP) - wep:SetShouldRemoveAmmo(true) - wep:Spawn() - end - end - else - local wep = sender:Give(itemtab.SWEP) - if wep and wep:IsValid() and wep.EmptyWhenPurchased and wep:GetOwner():IsValid() then - if wep.Primary then - local primary = wep:ValidPrimaryAmmo() - if primary then - sender:RemoveAmmo(math.max(0, wep.Primary.DefaultClip - wep.Primary.ClipSize), primary) - end - end - if wep.Secondary then - local secondary = wep:ValidSecondaryAmmo() - if secondary then - sender:RemoveAmmo(math.max(0, wep.Secondary.DefaultClip - wep.Secondary.ClipSize), secondary) - end - end - end - end - else - return - end - - sender:TakePoints(cost) - sender:PrintTranslatedMessage(HUD_PRINTTALK, "purchased_x_for_y_points", itemtab.Name, cost) - sender:SendLua("surface.PlaySound(\"ambient/levels/labs/coinslot1.wav\")") - - local nearest = sender:NearestArsenalCrateOwnedByOther() - if nearest then - local owner = nearest:GetObjectOwner() - if owner:IsValid() then - local nonfloorcommission = cost * 0.07 - local commission = math.floor(nonfloorcommission) - if commission > 0 then - owner.PointsCommission = owner.PointsCommission + cost - - owner:AddPoints(commission) - - net.Start("zs_commission") - net.WriteEntity(nearest) - net.WriteEntity(sender) - net.WriteUInt(commission, 16) - net.Send(owner) - end - - local leftover = nonfloorcommission - commission - if leftover > 0 then - owner.CarryOverCommision = owner.CarryOverCommision + leftover - if owner.CarryOverCommision >= 1 then - local carried = math.floor(owner.CarryOverCommision) - owner.CarryOverCommision = owner.CarryOverCommision - carried - owner:AddPoints(carried) - - net.Start("zs_commission") - net.WriteEntity(nearest) - net.WriteEntity(sender) - net.WriteUInt(carried, 16) - net.Send(owner) - end - end - end - end -end) - -concommand.Add("worthrandom", function(sender, command, arguments) - if sender:IsValid() and sender:IsConnected() and gamemode.Call("PlayerCanCheckout", sender) then - gamemode.Call("GiveRandomEquipment", sender) - end -end) - -concommand.Add("worthcheckout", function(sender, command, arguments) - if not (sender:IsValid() and sender:IsConnected()) or #arguments == 0 then return end - - if not gamemode.Call("PlayerCanCheckout", sender) then - sender:CenterNotify(COLOR_RED, translate.ClientGet(sender, "cant_use_worth_anymore")) - return - end - - local cost = 0 - local hasalready = {} - - for _, id in pairs(arguments) do - local tab = FindStartingItem(id) - if tab and not hasalready[id] then - cost = cost + tab.Worth - hasalready[id] = true - end - end - - if cost > GAMEMODE.StartingWorth then return end - - local hasalready = {} - - for _, id in pairs(arguments) do - local tab = FindStartingItem(id) - if tab and not hasalready[id] then - if tab.NoClassicMode and GAMEMODE:IsClassicMode() then - sender:PrintMessage(HUD_PRINTTALK, translate.ClientFormat(sender, "cant_use_x_in_classic_mode", tab.Name)) - elseif tab.Callback then - tab.Callback(sender) - hasalready[id] = true - elseif tab.SWEP then - sender:StripWeapon(tab.SWEP) -- "Fixes" players giving each other empty weapons to make it so they get no ammo from the Worth menu purchase. - sender:Give(tab.SWEP) - hasalready[id] = true - end - end - end - - if table.Count(hasalready) > 0 then - GAMEMODE.CheckedOut[sender:UniqueID()] = true - end - - gamemode.Call("RemoveDuplicateAmmo", sender) -end) - function GM:PlayerDeathThink(pl) if self.RoundEnded or pl.Revive or self:GetWave() == 0 then return end @@ -2150,7 +2555,20 @@ function GM:PlayerDeathThink(pl) pl:ChangeToCrow() end else -- In spectator. - if pl:KeyDown(IN_RELOAD) then + if pl:KeyDown(IN_ATTACK) or pl:KeyDown(IN_ATTACK2) or pl:IsBot() then + pl:RefreshDynamicSpawnPoint() + + local forcespawn = pl.ForceDynamicSpawn + if forcespawn and forcespawn.MinionSpawn then + pl:TrySpawnAsGoreChild(forcespawn) + else + if self:GetWaveActive() then + pl:UnSpectateAndSpawn() + else + pl:ChangeToCrow() + end + end + elseif pl:KeyDown(IN_RELOAD) then if self:GetWaveActive() then pl.ForceDynamicSpawn = nil local prev = self.DynamicSpawning @@ -2160,44 +2578,12 @@ function GM:PlayerDeathThink(pl) else pl:ChangeToCrow() end - elseif pl:KeyDown(IN_WALK) then - pl:TrySpawnAsGoreChild() - elseif pl:KeyDown(IN_ATTACK) then - if self:GetWaveActive() then - pl:RefreshDynamicSpawnPoint() - pl:UnSpectateAndSpawn() - else - pl:ChangeToCrow() - end - elseif pl:KeyPressed(IN_ATTACK2) then - pl.SpectatedPlayerKey = (pl.SpectatedPlayerKey or 0) + 1 - - local livingzombies = {} - for _, v in pairs(ents.FindByClass("prop_creepernest")) do - if v:GetNestBuilt() then table.insert(livingzombies, v) end - end - for _, v in pairs(team.GetPlayers(TEAM_ZOMBIE)) do - if v:Alive() then table.insert(livingzombies, v) end - end - --[[for _, v in pairs(team.GetSpawnPointGrouped(TEAM_UNDEAD)) do - table.insert(livingzombies, v) - end]] - - pl:StripWeapons() - - if pl.SpectatedPlayerKey > #livingzombies then - pl.SpectatedPlayerKey = 1 - end - - local specplayer = livingzombies[pl.SpectatedPlayerKey] - if specplayer then - pl:Spectate(OBS_MODE_CHASE) - pl:SpectateEntity(specplayer) - end elseif pl:KeyPressed(IN_JUMP) then - pl:Spectate(OBS_MODE_ROAMING) - pl:SpectateEntity(NULL) - pl.SpectatedPlayerKey = nil + if pl:GetObserverMode() ~= OBS_MODE_ROAMING then + pl:Spectate(OBS_MODE_ROAMING) + pl:SpectateEntity(NULL) + pl.SpectatedPlayerKey = nil + end end end end @@ -2211,9 +2597,19 @@ function GM:PropBreak(attacker, ent) end function GM:PropBroken(ent, attacker) + if IsValid(ent) and IsValid(attacker) and not ent._PROPBROKEN and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then + ent._PROPBROKEN = true + + if attacker.LogID then --failsafe for local dev + PrintMessage(HUD_PRINTCONSOLE, attacker:LogID().." broke "..ent:GetModel()) + end + end end function GM:NestDestroyed(ent, attacker) + if IsValid(ent) and IsValid(attacker) and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then + PrintMessage(HUD_PRINTCONSOLE, attacker:LogID().." team killed a nest at "..tostring(ent:GetPos()).." (builder: "..(ent:GetOwner() and ent:GetOwner():IsValid() and ent:GetOwner():IsPlayer() and ent:GetOwner():LogID() or "unknown")..")") + end end function GM:EntityTakeDamage(ent, dmginfo) @@ -2225,6 +2621,15 @@ function GM:EntityTakeDamage(ent, dmginfo) return end + if ent.LastHeld and CurTime() < ent.LastHeld + 0.1 and attacker:IsPlayer() and P_Team(attacker) == TEAM_HUMAN then + dmginfo:SetDamage(0) + dmginfo:SetDamageType(0) + dmginfo:ScaleDamage(0) + dmginfo:SetDamageForce(vector_origin) + return + end + + -- Props about to be broken props take 3x damage from anything except zombies if ent._BARRICADEBROKEN and not (attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD) then dmginfo:SetDamage(dmginfo:GetDamage() * 3) end @@ -2239,38 +2644,29 @@ function GM:EntityTakeDamage(ent, dmginfo) -- Don't allow blowing up props during wave 0. if self:GetWave() <= 0 and string.sub(ent:GetClass(), 1, 12) == "prop_physics" and inflictor.NoPropDamageDuringWave0 then dmginfo:SetDamage(0) - dmginfo:SetDamageType(DMG_BULLET) + dmginfo:SetDamageType(DMG_ALWAYSGIB) return end -- We need to stop explosive chains team killing. if inflictor:IsValid() then local dmgtype = dmginfo:GetDamageType() - if dmgtype == DMG_BLAST or dmgtype == DMG_BURN or dmgtype == DMG_SLOWBURN then - if ent:IsPlayer() then - if inflictor.LastExplosionTeam == ent:Team() and inflictor.LastExplosionAttacker ~= ent and inflictor.LastExplosionTime and CurTime() < inflictor.LastExplosionTime + 10 then -- Player damaged by physics object explosion / fire. - dmginfo:SetDamage(0) - dmginfo:ScaleDamage(0) - return - end - elseif inflictor ~= ent and string.sub(ent:GetClass(), 1, 12) == "prop_physics" and string.sub(inflictor:GetClass(), 1, 12) == "prop_physics" then -- Physics object damaged by physics object explosion / fire. - ent.LastExplosionAttacker = inflictor.LastExplosionAttacker - ent.LastExplosionTeam = inflictor.LastExplosionTeam - ent.LastExplosionTime = CurTime() + if ent:IsPlayer() and (dmgtype == DMG_ALWAYSGIB or dmgtype == DMG_BURN or dmgtype == DMG_SLOWBURN) and string.sub(inflictor:GetClass(), 1, 12) == "prop_physics" then -- We'll assume a barrel did this damage to a player + if inflictor.LastDamagedByTeam == ent:Team() and inflictor.LastDamagedBy ~= ent then -- A team member is trying to screw with us + dmginfo:SetDamage(0) + dmginfo:ScaleDamage(0) + return end - elseif inflictor:IsPlayer() and string.sub(ent:GetClass(), 1, 12) == "prop_physics" then -- Physics object damaged by player. - if inflictor:Team() == TEAM_HUMAN then - local phys = ent:GetPhysicsObject() - if phys:IsValid() and phys:HasGameFlag(FVPHYSICS_PLAYER_HELD) and inflictor:GetCarry() ~= ent or ent._LastDropped and CurTime() < ent._LastDropped + 3 and ent._LastDroppedBy ~= inflictor then -- Human player damaged a physics object while it was being carried or recently carried. They weren't the carrier. - dmginfo:SetDamage(0) - dmginfo:ScaleDamage(0) - return + elseif string.sub(ent:GetClass(), 1, 12) == "prop_physics" then -- Physics object damaged by... + if inflictor:IsPlayer() then + ent.LastDamagedByTeam = inflictor:Team() + ent.LastDamagedBy = inflictor + elseif (dmgtype == DMG_ALWAYSGIB or dmgtype == DMG_BURN or dmgtype == DMG_SLOWBURN) and string.sub(inflictor:GetClass(), 1, 12) == "prop_physics" then -- A barrel damaging a barrel. Probably. + if inflictor.LastDamagedByTeam then + ent.LastDamagedByTeam = inflictor.LastDamagedByTeam + ent.LastDamagedBy = inflictor.LastDamagedBy end end - - ent.LastExplosionAttacker = inflictor - ent.LastExplosionTeam = inflictor:Team() - ent.LastExplosionTime = CurTime() end end @@ -2278,13 +2674,63 @@ function GM:EntityTakeDamage(ent, dmginfo) if ent:DamageNails(attacker, inflictor, dmginfo:GetDamage(), dmginfo) then return end local dispatchdamagedisplay = false - local entclass = ent:GetClass() if ent:IsPlayer() then dispatchdamagedisplay = true + + if attacker.PBAttacker and attacker.PBAttacker:IsValid() then + attacker = attacker.PBAttacker + end + + if attacker:IsValid() then + if attacker:IsPlayer() then + ent:SetLastAttacker(attacker) + + local myteam = attacker:Team() + local otherteam = ent:Team() + + if myteam ~= otherteam then + local damage = math.min(dmginfo:GetDamage(), ent:Health()) + if damage > 0 then + local time = CurTime() + + attacker.DamageDealt[myteam] = attacker.DamageDealt[myteam] + damage + + if myteam == TEAM_UNDEAD then + if otherteam == TEAM_HUMAN then + attacker:AddLifeHumanDamage(damage) + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_ZOMBIECLASS, attacker:GetZombieClassTable().Name, "HumanDamage", damage) + end + elseif myteam == TEAM_HUMAN and otherteam == TEAM_UNDEAD then + ent.DamagedBy[attacker] = (ent.DamagedBy[attacker] or 0) + damage + if time >= ent.m_LastWaveStartSpawn + 3 and time >= ent.m_LastGasHeal + 2 then + local points = damage / ent:GetMaxHealth() * ent:GetZombieClassTable().Points + if POINTSMULTIPLIER then + points = points * POINTSMULTIPLIER + end + if ent.PointsMultiplier then + points = points * ent.PointsMultiplier + end + attacker.PointQueue = attacker.PointQueue + points + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, inflictor:GetClass(), "PointsEarned", points) + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, inflictor:GetClass(), "Damage", damage) + end + + local pos = ent:GetPos() + pos.z = pos.z + 32 + attacker.LastDamageDealtPos = pos + attacker.LastDamageDealtTime = time + end + end + end + elseif attacker:GetClass() == "trigger_hurt" then + ent.LastHitWithTriggerHurt = CurTime() + end + end elseif ent.PropHealth then -- A prop that was invulnerable and converted to vulnerable. - if self.NoPropDamageFromHumanMelee and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN and inflictor.IsMelee then + if ent._PROPBROKEN or self.NoPropDamageFromHumanMelee and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN and inflictor.IsMelee then dmginfo:SetDamage(0) return end @@ -2316,6 +2762,10 @@ function GM:EntityTakeDamage(ent, dmginfo) elseif entclass == "func_door_rotating" then if ent:GetKeyValues().damagefilter == "invul" or ent.Broken then return end + if self.ZombieEscape then + return + end + if not ent.Heal then local br = ent:BoundingRadius() if br > 80 then return end -- Don't break these kinds of doors that are bigger than this. @@ -2354,20 +2804,26 @@ function GM:EntityTakeDamage(ent, dmginfo) ent:Fire("kill", "", 0.15) end elseif entclass == "prop_door_rotating" then - if ent:GetKeyValues().damagefilter == "invul" or ent:HasSpawnFlags(2048) or ent.Broken then return end + if ent:GetKeyValues().damagefilter == "invul" or ent:HasSpawnFlags(2048) and ent:IsDoorLocked() or ent.Broken then return end - ent.Heal = ent.Heal or ent:BoundingRadius() * 35 - ent.TotalHeal = ent.TotalHeal or ent.Heal - - if gamemode.Call("ShouldAntiGrief", ent, attacker, dmginfo, ent.TotalHeal) then - attacker:AntiGrief(dmginfo) - if dmginfo:GetDamage() <= 0 then return end + if not ent.Heal then + ent.Heal = ent:BoundingRadius() * 35 + ent.TotalHeal = ent.Heal end if dmginfo:GetDamage() >= 20 and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then ent:EmitSound(math.random(2) == 1 and "npc/zombie/zombie_pound_door.wav" or "ambient/materials/door_hit1.wav") end + if self.ZombieEscape then + return + end + + if gamemode.Call("ShouldAntiGrief", ent, attacker, dmginfo, ent.TotalHeal) then + attacker:AntiGrief(dmginfo) + if dmginfo:GetDamage() <= 0 then return end + end + ent.Heal = ent.Heal - dmginfo:GetDamage() local brit = math.Clamp(ent.Heal / ent.TotalHeal, 0, 1) local col = ent:GetColor() @@ -2411,12 +2867,40 @@ function GM:EntityTakeDamage(ent, dmginfo) end end end + elseif entclass == "func_breakable" then + if ent:GetKeyValues().damagefilter == "invul" then return end + + if self.ZombieEscape then + dispatchdamagedisplay = true + return + end + + if gamemode.Call("ShouldAntiGrief", ent, attacker, dmginfo, ent:GetMaxHealth()) then + attacker:AntiGrief(dmginfo, true) + if dmginfo:GetDamage() <= 0 then return end + end + + if ent:Health() == 0 and ent:GetMaxHealth() == 1 then return end + + local brit = math.Clamp(ent:Health() / ent:GetMaxHealth(), 0, 1) + local col = ent:GetColor() + col.r = 255 + col.g = 255 * brit + col.b = 255 * brit + ent:SetColor(col) + + dispatchdamagedisplay = true elseif string.sub(entclass, 1, 12) == "func_physbox" then local holder, status = ent:GetHolder() if holder then status:Remove() end if ent:GetKeyValues().damagefilter == "invul" then return end + if not ent.IgnoreZEProtect and self.ZombieEscape then + dispatchdamagedisplay = true + return + end + ent.Heal = ent.Heal or ent:BoundingRadius() * 35 ent.TotalHeal = ent.TotalHeal or ent.Heal @@ -2452,48 +2936,36 @@ function GM:EntityTakeDamage(ent, dmginfo) ent:Fire("break", "", 0) end end - elseif entclass == "func_breakable" then - if ent:GetKeyValues().damagefilter == "invul" then return end - - if gamemode.Call("ShouldAntiGrief", ent, attacker, dmginfo, ent:GetMaxHealth()) then - attacker:AntiGrief(dmginfo, true) - if dmginfo:GetDamage() <= 0 then return end - end - - if ent:Health() == 0 and ent:GetMaxHealth() == 1 then return end - - local brit = math.Clamp(ent:Health() / ent:GetMaxHealth(), 0, 1) - local col = ent:GetColor() - col.r = 255 - col.g = 255 * brit - col.b = 255 * brit - ent:SetColor(col) - - dispatchdamagedisplay = true - elseif ent:IsBarricadeProp() and attacker:IsPlayer() and attacker:Team() == TEAM_UNDEAD then + elseif ent:IsBarricadeProp() and attacker:IsValidLivingZombie() or ent.ZombieConstruction and attacker:IsValidLivingHuman() then dispatchdamagedisplay = true end - if dmginfo:GetDamage() > 0 or ent:IsPlayer() and ent:GetZombieClassTable().Name == "Shade" then + local dmg = dmginfo:GetDamage() + if dmg > 0 then local holder, status = ent:GetHolder() - if holder then status:Remove() end + if holder and not holder.BuffTaut then status:Remove() end - if attacker:IsPlayer() and dispatchdamagedisplay then - self:DamageFloater(attacker, ent, dmginfo) + local dmgpos = dmginfo:GetDamagePosition() + local hasdmgsess = attacker:IsPlayer() and attacker:HasDamageNumberSession() + + if attacker:IsPlayer() and dispatchdamagedisplay and not hasdmgsess then + self:DamageFloater(attacker, ent, dmgpos, dmg) + elseif hasdmgsess and dispatchdamagedisplay then + attacker:CollectDamageNumberSession(dmg, dmgpos, ent:IsPlayer()) end end end -function GM:DamageFloater(attacker, victim, dmginfo) - local dmgpos = dmginfo:GetDamagePosition() +function GM:DamageFloater(attacker, victim, dmgpos, dmg, definiteply) + if attacker == victim then return end if dmgpos == vector_origin then dmgpos = victim:NearestPoint(attacker:EyePos()) end - net.Start(victim:IsPlayer() and "zs_dmg" or "zs_dmg_prop") + net.Start((definiteply or victim:IsPlayer()) and "zs_dmg" or "zs_dmg_prop") if INFDAMAGEFLOATER then INFDAMAGEFLOATER = nil net.WriteUInt(9999, 16) else - net.WriteUInt(math.ceil(dmginfo:GetDamage()), 16) + net.WriteUInt(math.ceil(dmg), 16) end net.WriteVector(dmgpos) net.Send(attacker) @@ -2516,14 +2988,36 @@ function GM:SetRandomToZombie() return pl end +function GM:PreOnPlayerChangedTeam(pl, oldteam, newteam) + --[[if oldteam == TEAM_HUMAN then + self:SaveVault(pl) + end]] +end + function GM:OnPlayerChangedTeam(pl, oldteam, newteam) if newteam == TEAM_UNDEAD then pl:SetPoints(0) + + --pl.WaveBarricadeDamage = 0 + --pl.WaveHumanDamage = 0 pl.DamagedBy = {} + pl:SetBarricadeGhosting(false) self.CheckedOut[pl:UniqueID()] = true elseif newteam == TEAM_HUMAN then self.PreviouslyDied[pl:UniqueID()] = nil + + if self.PointSaving > 0 and pl.PointsVault ~= nil and not self.ZombieEscape and not self:IsClassicMode() then + pl:SetPoints(math.floor(pl.PointsVault)) + else + pl:SetPoints(0) + end + + self:RefreshItemStocks(pl) + end + + if newteam ~= TEAM_HUMAN then + pl:RemoveSkills() end pl:SetLastAttacker(nil) @@ -2533,11 +3027,21 @@ function GM:OnPlayerChangedTeam(pl, oldteam, newteam) end end - pl.m_PointQueue = 0 + pl.PointQueue = 0 timer.Simple(0, function() gamemode.Call("CalculateInfliction") end) end +function GM:SetToDefaultZombieClass(pl) + if pl:Team() == TEAM_UNDEAD then + pl:KillSilent() + pl:SetZombieClass(self.DefaultZombieClass or 1) + pl:UnSpectateAndSpawn() + else + pl:SetZombieClass(self.DefaultZombieClass or 1) + end +end + function GM:SetPantsMode(mode) if self.ZombieEscape then return end @@ -2567,13 +3071,7 @@ function GM:SetPantsMode(mode) for _, pl in pairs(player.GetAll()) do if pl:GetZombieClassTable().Name == "Zombie Legs" then - if pl:Team() == TEAM_UNDEAD then - pl:KillSilent() - pl:SetZombieClass(self.DefaultZombieClass or 1) - pl:UnSpectateAndSpawn() - else - pl:SetZombieClass(self.DefaultZombieClass or 1) - end + self:SetToDefaultZombieClass(pl) end end end @@ -2612,13 +3110,7 @@ function GM:SetClassicMode(mode) for _, pl in pairs(player.GetAll()) do if pl:GetZombieClassTable().Name == "Classic Zombie" then - if pl:Team() == TEAM_UNDEAD then - pl:KillSilent() - pl:SetZombieClass(self.DefaultZombieClass or 1) - pl:UnSpectateAndSpawn() - else - pl:SetZombieClass(self.DefaultZombieClass or 1) - end + self:SetToDefaultZombieClass(pl) end end end @@ -2655,18 +3147,13 @@ function GM:SetBabyMode(mode) for _, pl in pairs(player.GetAll()) do if pl:GetZombieClassTable().Name == "Gore Child" then - if pl:Team() == TEAM_UNDEAD then - pl:KillSilent() - pl:SetZombieClass(self.DefaultZombieClass or 1) - pl:UnSpectateAndSpawn() - else - pl:SetZombieClass(self.DefaultZombieClass or 1) - end + self:SetToDefaultZombieClass(pl) end end end end +GM.InitialVolunteers = {} function GM:SetClosestsToZombie() local allplayers = player.GetAllActive() local numplayers = #allplayers @@ -2687,8 +3174,8 @@ function GM:SetClosestsToZombie() if #zombies > desiredzombies then local toswap = #zombies - desiredzombies for _, pl in pairs(zombies) do - if pl.DiedDuringWave0 and pl:GetInfo("zs_alwaysvolunteer") ~= "1" then - pl:SetTeam(TEAM_HUMAN) + if pl.DiedDuringWave0 and pl:GetInfo("zs_alwaysvolunteer") ~= "1" and not pl.IsZSBot then + pl:ChangeTeam(TEAM_HUMAN) pl:UnSpectateAndSpawn() toswap = toswap - 1 if toswap <= 0 then @@ -2703,18 +3190,22 @@ function GM:SetClosestsToZombie() if pl:Team() ~= TEAM_UNDEAD then pl:ChangeTeam(TEAM_UNDEAD) self.PreviouslyDied[pl:UniqueID()] = CurTime() + self.InitialVolunteers[pl:UniqueID()] = true end pl:SetFrags(0) pl:SetDeaths(0) + + local unlocked = {} + for _, v in ipairs(self.ZombieClasses) do + if v.Unlocked and not v.Hidden and v.NotRandomStart then + unlocked[#unlocked + 1] = v.Index + end + end + pl:SetZombieClass(unlocked[math.random(#unlocked)]) + self.StartingZombie[pl:UniqueID()] = true pl:UnSpectateAndSpawn() end - - for _, pl in pairs(allplayers) do - if pl:Team() == TEAM_HUMAN and pl._ZombieSpawnDistance <= 128 then - pl:SetPos(self:PlayerSelectSpawn(pl):GetPos()) - end - end end function GM:AllowPlayerPickup(pl, ent) @@ -2732,60 +3223,42 @@ function GM:PlayerShouldTakeDamage(pl, attacker) end function GM:PlayerHurt(victim, attacker, healthremaining, damage) - if 0 < healthremaining then - victim:PlayPainSound() - end + if healthremaining < 1 then return end if victim:Team() == TEAM_HUMAN then - victim.BonusDamageCheck = CurTime() + victim:PlayPainSound() - if healthremaining < 75 and 1 <= healthremaining then + if healthremaining < 75 then victim:ResetSpeed(nil, healthremaining) end - end - if attacker:IsValid() then - if attacker:IsPlayer() then - victim:SetLastAttacker(attacker) + if healthremaining < victim:GetMaxHealth() * 0.5 and victim:GetBloodArmor() < victim.MaxBloodArmor + 10 and victim:HasTrinket("bloodpack") then + victim:SetBloodArmor(math.min(victim:GetBloodArmor() + (20 * victim.BloodarmorGainMul), victim.MaxBloodArmor + (20 * victim.MaxBloodArmorMul))) + victim:TakeInventoryItem("trinket_bloodpack") - local myteam = attacker:Team() - local otherteam = victim:Team() - if myteam ~= otherteam then - damage = math.min(damage, victim.m_PreHurtHealth) - victim.m_PreHurtHealth = healthremaining - - attacker.DamageDealt[myteam] = attacker.DamageDealt[myteam] + damage - - if myteam == TEAM_UNDEAD then - if otherteam == TEAM_HUMAN then - attacker:AddLifeHumanDamage(damage) - end - elseif myteam == TEAM_HUMAN and otherteam == TEAM_UNDEAD then - victim.DamagedBy[attacker] = (victim.DamagedBy[attacker] or 0) + damage - if (not victim.m_LastWaveStartSpawn or CurTime() >= victim.m_LastWaveStartSpawn + 3) - and (healthremaining <= 0 or not victim.m_LastGasHeal or CurTime() >= victim.m_LastGasHeal + 2) then - attacker.m_PointQueue = attacker.m_PointQueue + damage / victim:GetMaxHealth() * (victim:GetZombieClassTable().Points or 0) - end - attacker.m_LastDamageDealtPosition = victim:GetPos() - attacker.m_LastDamageDealt = CurTime() - end - end - elseif attacker:GetClass() == "trigger_hurt" then - victim.LastHitWithTriggerHurt = CurTime() + net.Start("zs_trinketconsumed") + net.WriteString("Blood Transfusion Pack") + net.Send(victim) end + else + victim:PlayZombiePainSound() end end --- Don't change speed instantly to stop people from shooting and then running away with a faster weapon. function GM:WeaponDeployed(pl, wep) + self:DoChangeDeploySpeed(wep) + + -- Don't change speed instantly to stop people from shooting and then running away with a faster weapon. local timername = tostring(pl).."speedchange" - timer.Destroy(timername) + timer.Remove(timername) local speed = pl:ResetSpeed(true) -- Determine what speed we SHOULD get without actually setting it. if speed < pl:GetMaxSpeed() then pl:SetSpeed(speed) elseif pl:GetMaxSpeed() < speed then - timer.CreateEx(timername, 0.333, 1, ValidFunction, pl, "SetHumanSpeed", speed) + local unbound = pl:IsSkillActive(SKILL_UNBOUND) and 0.4 or 1 + + timer.Create(timername, (0.333 / (pl.DeploySpeedMultiplier or 1)) * unbound, 1, function() if pl:IsValid() then pl:SetHumanSpeed(speed) end end) end end @@ -2793,6 +3266,7 @@ function GM:KeyPress(pl, key) if key == IN_USE then if pl:Team() == TEAM_HUMAN and pl:Alive() then if pl:IsCarrying() then + pl.status_human_holding:OnRemove() -- No idea... pl.status_human_holding:RemoveNextFrame() else self:TryHumanPickup(pl, pl:TraceLine(64).Entity) @@ -2802,13 +3276,44 @@ function GM:KeyPress(pl, key) if pl:Alive() then if pl:Team() == TEAM_HUMAN then pl:DispatchAltUse() + + if not pl:IsCarrying() and pl:KeyPressed(IN_SPEED) and pl:IsSkillActive(SKILL_CARDIOTONIC) and pl:GetBloodArmor() > 0 then + pl:SetBloodArmor(pl:GetBloodArmor() - 1) + pl:EmitSound("player/suit_sprint.wav", 50) + if pl:GetBloodArmor() == 0 and pl:IsSkillActive(SKILL_BLOODLETTER) then + local bleed = pl:GiveStatus("bleed") + if bleed and bleed:IsValid() then + bleed:AddDamage(5) + bleed.Damager = pl + end + end + pl:ResetSpeed() + end elseif pl:Team() == TEAM_UNDEAD then - pl:CallZombieFunction("AltUse") + pl:CallZombieFunction0("AltUse") end end elseif key == IN_ZOOM then - if pl:Team() == TEAM_HUMAN and pl:Alive() and pl:IsOnGround() and not self.ZombieEscape then --and pl:GetGroundEntity():IsWorld() then - pl:SetBarricadeGhosting(true) + if pl:Team() == TEAM_HUMAN and pl:Alive() and not self.ZombieEscape then + if pl:IsOnGround() then + pl.LastGhostFailureVelocity = nil + pl:SetBarricadeGhosting(true) + else + local plvel = pl:GetVelocity() + if pl:GetPhysicsObject():IsPenetrating() then + if plvel == vector_origin then + pl.LastGhostFailureVelocity = nil + pl:SetBarricadeGhosting(true) + else + pl:SetLocalVelocity(vector_origin) + end + elseif pl.LastGhostFailureVelocity == plvel then + pl.LastGhostFailureVelocity = nil + pl:SetBarricadeGhosting(true) + else + pl.LastGhostFailureVelocity = plvel + end + end end end end @@ -2820,7 +3325,7 @@ function GM:GetNearestSpawn(pos, teamid) for _, ent in pairs(team.GetValidSpawnPoint(teamid)) do if ent.Disabled then continue end - local dist = ent:GetPos():Distance(pos) + local dist = ent:GetPos():DistToSqr(pos) if dist < nearestdist then nearestdist = dist nearest = ent @@ -2835,7 +3340,7 @@ function GM:EntityWouldBlockSpawn(ent) if spawnpoint:IsValid() then local spawnpos = spawnpoint:GetPos() - if spawnpos:Distance(ent:NearestPoint(spawnpos)) <= 40 then return true end + if spawnpos:DistToSqr(ent:NearestPoint(spawnpos)) <= 1600 then return true end end return false @@ -2850,6 +3355,10 @@ function GM:GetNearestSpawnDistance(pos, teamid) return -1 end +function GM:ShutDown() + self:SaveAllVaults() +end + function GM:PlayerUse(pl, ent) if not pl:Alive() or pl:Team() == TEAM_UNDEAD and pl:GetZombieClassTable().NoUse or pl:GetBarricadeGhosting() then return false end @@ -2862,7 +3371,11 @@ function GM:PlayerUse(pl, ent) end ent.m_AntiDoorSpam = CurTime() + 0.85 elseif entclass == "item_healthcharger" then - if pl:Team() == TEAM_UNDEAD then return false end + if pl:Team() == TEAM_UNDEAD then + return false + elseif pl:IsSkillActive(SKILL_D_FRAIL) and pl:Health() >= math.floor(pl:GetMaxHealth() * 0.25) then + return false + end elseif pl:Team() == TEAM_HUMAN and not pl:IsCarrying() and pl:KeyPressed(IN_USE) then self:TryHumanPickup(pl, ent) end @@ -2877,8 +3390,8 @@ function GM:PlayerDeathSound() return true end -local function SortDist(a, b) - return a._temp < b._temp +local function SortDist(pa, pb) + return pa._temp < pb._temp end function GM:CanPlayerSuicide(pl) if self.RoundEnded or pl:HasWon() then return false end @@ -2895,8 +3408,8 @@ function GM:CanPlayerSuicide(pl) local tosort = {} for _, zom in pairs(team.GetPlayers(TEAM_UNDEAD)) do if zom:Alive() then - local dist = zom:GetPos():Distance(plpos) - if dist <= 512 then + local dist = zom:GetPos():DistToSqr(plpos) + if dist <= 262144 then --512^2 zom._temp = dist table.insert(tosort, zom) end @@ -2910,7 +3423,7 @@ function GM:CanPlayerSuicide(pl) end end elseif pl:Team() == TEAM_UNDEAD then - local ret = pl:CallZombieFunction("CanPlayerSuicide") + local ret = pl:CallZombieFunction0("CanPlayerSuicide") if ret == false then return false end end @@ -2957,6 +3470,33 @@ function GM:HumanKilledZombie(pl, attacker, inflictor, dmginfo, headshot, suicid attacker:PointCashOut(pl, FM_NONE) end + if inflictor:IsValid() and inflictor == attacker:GetActiveWeapon() then + local wep = attacker:GetActiveWeapon() + if attacker.MeleeMovementSpeedOnKill and attacker.MeleeMovementSpeedOnKill ~= 0 and wep.IsMelee then + local boost = attacker:GiveStatus("adrenalineamp", 10) + if boost and boost:IsValid() then + boost:SetSpeed(attacker.MeleeMovementSpeedOnKill) + end + end + + if #self.Food > 0 and pl.ChefMarkTime and pl.ChefMarkTime > CurTime() and pl.ChefMarkOwner == attacker then + local rfood = self.Food[math.random(#self.Food)] + if not attacker:HasWeapon(rfood) then + attacker:Give(rfood) + end + end + + if pl:WasHitInHead() then + attacker.Headshots = (attacker.Headshots or 0) + 1 + end + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, wep:GetClass(), "Kills", 1) + + if wep.OnZombieKilled then + wep:OnZombieKilled(pl, totaldamage, dmginfo) + end + end + gamemode.Call("PostHumanKilledZombie", pl, attacker, inflictor, dmginfo, mostdamager, mostassistdamage, headshot) return mostdamager @@ -2969,14 +3509,21 @@ function GM:ZombieKilledHuman(pl, attacker, inflictor, dmginfo, headshot, suicid if self.RoundEnded then return end local plpos = pl:GetPos() - local dist = 99999 + local dist = 999999999 + local xp = 18 * (GAMEMODE.ZombieXPMulti or 1) for _, ent in pairs(team.GetValidSpawnPoint(TEAM_UNDEAD)) do - dist = math.min(math.ceil(ent:GetPos():Distance(plpos)), dist) + dist = math.min(ent:GetPos():DistToSqr(plpos), dist) end - pl.ZombieSpawnDeathDistance = dist + pl.ZombieSpawnDeathDistance = math.ceil(math.sqrt(dist)) attacker:AddBrains(1) attacker:AddLifeBrainsEaten(1) + attacker:AddZSXP(self.InitialVolunteers[attacker:UniqueID()] and xp or math.floor(xp/4)) + + local classtab = attacker:GetZombieClassTable() + if classtab and classtab.Name then + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_ZOMBIECLASS, classtab.Name, "BrainsEaten", 1) + end if not pl.Gibbed and not suicide then local status = pl:GiveStatus("revive_slump_human") @@ -2985,10 +3532,7 @@ function GM:ZombieKilledHuman(pl, attacker, inflictor, dmginfo, headshot, suicid status:SetZombieInitializeTime(CurTime() + 2) end - local classtab = self.ZombieEscape and self.ZombieClasses["Super Zombie"] or self:IsClassicMode() and self.ZombieClasses["Classic Zombie"] or self:IsBabyMode() and GAMEMODE.ZombieClasses["Gore Child"] or GAMEMODE.ZombieClasses["Fresh Dead"] - if classtab then - pl:SetZombieClass(classtab.Index) - end + pl:SetZombieClassName(self.ZombieEscape and "Super Zombie" or self:IsClassicMode() and "Classic Zombie" or self:IsBabyMode() and "Gore Child" or "Fresh Dead") end gamemode.Call("PostZombieKilledHuman", pl, attacker, inflictor, dmginfo, headshot, suicide) @@ -3009,19 +3553,23 @@ local function DelayedChangeToZombie(pl) pl:ChangeTeam(TEAM_UNDEAD) end end - function GM:DoPlayerDeath(pl, attacker, dmginfo) - pl:RemoveStatus("confusion", false, true) - pl:RemoveStatus("ghoultouch", false, true) + pl:RemoveEphemeralStatuses() + pl:Extinguish() + pl:SetPhantomHealth(0) local inflictor = dmginfo:GetInflictor() local plteam = pl:Team() local ct = CurTime() local suicide = attacker == pl or attacker:IsWorld() + if attacker.PBAttacker and attacker.PBAttacker:IsValid() then + attacker = attacker.PBAttacker + end + pl:Freeze(false) - local headshot = pl:LastHitGroup() == HITGROUP_HEAD and pl.m_LastHeadShot and CurTime() <= pl.m_LastHeadShot + 0.1 + local headshot = pl:WasHitInHead() if suicide then attacker = pl:GetLastAttacker() or attacker end pl:SetLastAttacker() @@ -3045,7 +3593,7 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) util.Effect("headshot", effectdata, true, true) end - if not pl:CallZombieFunction("OnKilled", attacker, inflictor, suicide, headshot, dmginfo) then + if not pl:CallZombieFunction5("OnKilled", attacker, inflictor, suicide, headshot, dmginfo) then if pl:Health() <= -70 and not pl.NoGibs and not self.ZombieEscape then pl:Gib(dmginfo) elseif not pl.KnockedDown then @@ -3055,13 +3603,33 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) pl:RemoveStatus("overridemodel", false, true) - local revive + local revive = false local assistpl if plteam == TEAM_UNDEAD then + if GAMEMODE.ZombieEscape then + local zewep = pl:GetWeapon("weapon_knife") + if zewep and zewep:IsValid() then + pl:DropWeapon(zewep) + end + end + local classtable = pl:GetZombieClassTable() pl:PlayZombieDeathSound() + if classtable.Boss and not self.ObjectiveMap and pl.BossDeathNotification then + net.Start("zs_boss_slain") + net.WriteEntity(pl) + net.WriteUInt(classtable.Index, 8) + net.Broadcast() + + timer.Simple(0, function() + pl:MakeBossDrop() + end) + + pl.BossDeathNotification = nil + end + if not classtable.NoDeaths then pl:AddDeaths(1) end @@ -3073,29 +3641,27 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) end if attacker:IsValid() and attacker:IsPlayer() and attacker ~= pl then - if classtable.Revives and not pl.Gibbed and not headshot then + if classtable.Revives and not pl.Gibbed and not headshot and CurTime() > pl.LastRevive + 4 then if classtable.ReviveCallback then revive = classtable:ReviveCallback(pl, attacker, dmginfo) - elseif math.random(1, 4) ~= 1 then + elseif math.random(4) ~= 1 then self:DefaultRevive(pl) revive = true end end - if not revive and attacker:Team() == TEAM_HUMAN then + if revive then + pl.LastRevive = CurTime() + elseif attacker:Team() == TEAM_HUMAN then assistpl = gamemode.Call("HumanKilledZombie", pl, attacker, inflictor, dmginfo, headshot, suicide) end end if not revive and (pl.LifeBarricadeDamage ~= 0 or pl.LifeHumanDamage ~= 0 or pl.LifeBrainsEaten ~= 0) then - net.Start("zs_lifestats") - net.WriteUInt(math.ceil(pl.LifeBarricadeDamage or 0), 24) - net.WriteUInt(math.ceil(pl.LifeHumanDamage or 0), 24) - net.WriteUInt(pl.LifeBrainsEaten or 0, 16) - net.Send(pl) + timer.Simple(0, function() if pl:IsValid() then pl:SendLifeStats() end end) end - pl:CallZombieFunction("PostOnKilled", attacker, inflictor, suicide, headshot, dmginfo) + pl:CallZombieFunction5("PostOnKilled", attacker, inflictor, suicide, headshot, dmginfo) elseif plteam == TEAM_HUMAN then pl.NextSpawnTime = ct + 4 @@ -3138,12 +3704,12 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) end end - if revive or pl:CallZombieFunction("NoDeathMessage", attacker, dmginfo) or pl:IsSpectator() then return end + if revive or pl:CallZombieFunction2("NoDeathMessage", attacker, dmginfo) or pl:IsSpectator() then return end if attacker == pl then net.Start("zs_pl_kill_self") net.WriteEntity(pl) - net.WriteUInt(plteam, 16) + net.WriteUInt(plteam, 8) net.Broadcast() elseif attacker:IsPlayer() then if assistpl then @@ -3152,8 +3718,8 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) net.WriteEntity(attacker) net.WriteEntity(assistpl) net.WriteString(inflictor:GetClass()) - net.WriteUInt(plteam, 16) - net.WriteUInt(attacker:Team(), 16) -- Assuming assistants are always on the same team. + net.WriteUInt(plteam, 8) + net.WriteUInt(attacker:Team(), 8) -- Assuming assistants are always on the same team. net.WriteBit(headshot) net.Broadcast() @@ -3163,8 +3729,8 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) net.WriteEntity(pl) net.WriteEntity(attacker) net.WriteString(inflictor:GetClass()) - net.WriteUInt(plteam, 16) - net.WriteUInt(attacker:Team(), 16) + net.WriteUInt(plteam, 8) + net.WriteUInt(attacker:Team(), 8) net.WriteBit(headshot) net.Broadcast() end @@ -3175,12 +3741,18 @@ function GM:DoPlayerDeath(pl, attacker, dmginfo) net.WriteEntity(pl) net.WriteString(inflictor:GetClass()) net.WriteString(attacker:GetClass()) - net.WriteUInt(plteam, 16) + net.WriteUInt(plteam, 8) net.Broadcast() end end -function GM:PlayerKilledByPlayer(pl, attacker, inflictor, headshot, dmginfo) +function GM:WeaponEquip(wep) + if wep.m_WeaponDeploySpeed then + timer.Simple(0, function() GAMEMODE:DoChangeDeploySpeed(wep) end) + end +end + +function GM:PlayerKilledByPlayer(pl, attacker, inflictor, headshot, dmginfo, is_assistant) end function GM:PlayerCanPickupWeapon(pl, ent) @@ -3188,234 +3760,63 @@ function GM:PlayerCanPickupWeapon(pl, ent) if pl:Team() == TEAM_UNDEAD then return ent:GetClass() == pl:GetZombieClassTable().SWEP end - return not ent.ZombieOnly and ent:GetClass() ~= "weapon_stunstick" + return not ent.ZombieOnly end +function GM:PlayerCanPickupItem(pl, ent) + if pl:IsSkillActive(SKILL_D_FRAIL) then + local class = ent:GetClass() + if class == "item_healthkit" or class == "item_healthvial" then + local healamount = #class == 14 and 25 or 10 + if pl:Health() + healamount > math.floor(pl:GetMaxHealth() * 0.25) then + return false + end + end + end + + return true +end + +-- This function is only for footsteps for players not in the local player's pvs or something. +-- The cl_init.lua version usually overrides this number so I just set it to a static number to save cycles. +function GM:PlayerStepSoundTime(pl, iType, bWalking) + return 350 +end + +-- Again, don't bother overriding anything due to above. function GM:PlayerFootstep(pl, vPos, iFoot, strSoundName, fVolume, pFilter) end -function GM:PlayerStepSoundTime(pl, iType, bWalking) - local fStepTime = 350 - - if iType == STEPSOUNDTIME_NORMAL or iType == STEPSOUNDTIME_WATER_FOOT then - local fMaxSpeed = pl:GetMaxSpeed() - if fMaxSpeed <= 100 then - fStepTime = 400 - elseif fMaxSpeed <= 300 then - fStepTime = 350 - else - fStepTime = 250 - end - elseif iType == STEPSOUNDTIME_ON_LADDER then - fStepTime = 450 - elseif iType == STEPSOUNDTIME_WATER_KNEE then - fStepTime = 600 - end - - if pl:Crouching() then - fStepTime = fStepTime + 50 - end - - return fStepTime -end - -concommand.Add("zsdropweapon", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not (sender:IsValid() and sender:Alive() and sender:Team() == TEAM_HUMAN) or CurTime() < (sender.NextWeaponDrop or 0) or GAMEMODE.ZombieEscape then return end - sender.NextWeaponDrop = CurTime() + 0.15 - - local currentwep = sender:GetActiveWeapon() - if currentwep and currentwep:IsValid() then - local ent = sender:DropWeaponByType(currentwep:GetClass()) - if ent and ent:IsValid() then - local shootpos = sender:GetShootPos() - local aimvec = sender:GetAimVector() - ent:SetPos(util.TraceHull({start = shootpos, endpos = shootpos + aimvec * 32, mask = MASK_SOLID, filter = sender, mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2)}).HitPos) - ent:SetAngles(sender:GetAngles()) - end - end -end) - -concommand.Add("zsemptyclip", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not (sender:IsValid() and sender:Alive() and sender:Team() == TEAM_HUMAN) then return end - - sender.NextEmptyClip = sender.NextEmptyClip or 0 - if sender.NextEmptyClip <= CurTime() then - sender.NextEmptyClip = CurTime() + 0.1 - - local wep = sender:GetActiveWeapon() - if wep:IsValid() and not wep.NoMagazine then - local primary = wep:ValidPrimaryAmmo() - if primary and 0 < wep:Clip1() then - sender:GiveAmmo(wep:Clip1(), primary, true) - wep:SetClip1(0) - end - local secondary = wep:ValidSecondaryAmmo() - if secondary and 0 < wep:Clip2() then - sender:GiveAmmo(wep:Clip2(), secondary, true) - wep:SetClip2(0) - end - end - end -end) - -concommand.Add("zsgiveammo", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not sender:IsValid() or not sender:Alive() or sender:Team() ~= TEAM_HUMAN then return end - - local ammotype = arguments[1] - if not ammotype or #ammotype == 0 or not GAMEMODE.AmmoCache[ammotype] then return end - - local count = sender:GetAmmoCount(ammotype) - if count <= 0 then - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "no_spare_ammo_to_give") - return - end - - local ent - local dent = Entity(tonumbersafe(arguments[2] or 0) or 0) - if GAMEMODE:ValidMenuLockOnTarget(sender, dent) then - ent = dent - end - - if not ent then - ent = sender:MeleeTrace(48, 2).Entity - end - - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_HUMAN and ent:Alive() then - local desiredgive = math.min(count, GAMEMODE.AmmoCache[ammotype]) - if desiredgive >= 1 then - sender:RemoveAmmo(desiredgive, ammotype) - ent:GiveAmmo(desiredgive, ammotype) - - if CurTime() >= (sender.NextGiveAmmoSound or 0) then - sender.NextGiveAmmoSound = CurTime() + 1 - sender:PlayGiveAmmoSound() - end - - sender:RestartGesture(ACT_GMOD_GESTURE_ITEM_GIVE) - - return - end - else - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "no_person_in_range") - end -end) - -concommand.Add("zsgiveweapon", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not (sender:IsValid() and sender:Alive() and sender:Team() == TEAM_HUMAN) or GAMEMODE.ZombieEscape then return end - - local currentwep = sender:GetActiveWeapon() - if currentwep and currentwep:IsValid() then - local ent - local dent = Entity(tonumbersafe(arguments[2] or 0) or 0) - if GAMEMODE:ValidMenuLockOnTarget(sender, dent) then - ent = dent - end - - if not ent then - ent = sender:MeleeTrace(48, 2).Entity - end - - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_HUMAN and ent:Alive() then - if not ent:HasWeapon(currentwep:GetClass()) then - sender:GiveWeaponByType(currentwep, ent, false) - else - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "person_has_weapon") - end - else - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "no_person_in_range") - end - end -end) - -concommand.Add("zsgiveweaponclip", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not (sender:IsValid() and sender:Alive() and sender:Team() == TEAM_HUMAN) then return end - - local currentwep = sender:GetActiveWeapon() - if currentwep and currentwep:IsValid() then - local ent - local dent = Entity(tonumbersafe(arguments[2] or 0) or 0) - if GAMEMODE:ValidMenuLockOnTarget(sender, dent) then - ent = dent - end - - if not ent then - ent = sender:MeleeTrace(48, 2).Entity - end - - if ent and ent:IsValid() and ent:IsPlayer() and ent:Team() == TEAM_HUMAN and ent:Alive() then - if not ent:HasWeapon(currentwep:GetClass()) then - sender:GiveWeaponByType(currentwep, ent, true) - else - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "person_has_weapon") - end - else - sender:SendLua("surface.PlaySound(\"buttons/button10.wav\")") - sender:PrintTranslatedMessage(HUD_PRINTCENTER, "no_person_in_range") - end - end -end) - -concommand.Add("zsdropammo", function(sender, command, arguments) - if GAMEMODE.ZombieEscape then return end - - if not sender:IsValid() or not sender:Alive() or sender:Team() ~= TEAM_HUMAN or CurTime() < (sender.NextDropClip or 0) then return end - - sender.NextDropClip = CurTime() + 0.2 - - local wep = sender:GetActiveWeapon() - if not wep:IsValid() then return end - - local ammotype = arguments[1] or wep:GetPrimaryAmmoTypeString() - if GAMEMODE.AmmoNames[ammotype] and GAMEMODE.AmmoCache[ammotype] then - local ent = sender:DropAmmoByType(ammotype, GAMEMODE.AmmoCache[ammotype] * 2) - if ent and ent:IsValid() then - ent:SetPos(sender:EyePos() + sender:GetAimVector() * 8) - ent:SetAngles(sender:GetAngles()) - local phys = ent:GetPhysicsObject() - if phys:IsValid() then - phys:Wake() - phys:SetVelocityInstantaneous(sender:GetVelocity() * 0.85) - end - end - end -end) - local VoiceSetTranslate = {} -VoiceSetTranslate["models/player/alyx.mdl"] = "alyx" -VoiceSetTranslate["models/player/barney.mdl"] = "barney" -VoiceSetTranslate["models/player/breen.mdl"] = "male" -VoiceSetTranslate["models/player/combine_soldier.mdl"] = "combine" -VoiceSetTranslate["models/player/combine_soldier_prisonguard.mdl"] = "combine" -VoiceSetTranslate["models/player/combine_super_soldier.mdl"] = "combine" -VoiceSetTranslate["models/player/eli.mdl"] = "male" -VoiceSetTranslate["models/player/gman_high.mdl"] = "male" -VoiceSetTranslate["models/player/kleiner.mdl"] = "male" -VoiceSetTranslate["models/player/monk.mdl"] = "monk" -VoiceSetTranslate["models/player/mossman.mdl"] = "female" -VoiceSetTranslate["models/player/odessa.mdl"] = "male" -VoiceSetTranslate["models/player/police.mdl"] = "combine" -VoiceSetTranslate["models/player/brsp.mdl"] = "female" -VoiceSetTranslate["models/player/moe_glados_p.mdl"] = "female" -VoiceSetTranslate["models/grim.mdl"] = "combine" -VoiceSetTranslate["models/jason278-players/gabe_3.mdl"] = "monk" +VoiceSetTranslate["models/player/alyx.mdl"] = VOICESET_ALYX +VoiceSetTranslate["models/player/barney.mdl"] = VOICESET_BARNEY +VoiceSetTranslate["models/player/combine_soldier.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/player/combine_soldier_prisonguard.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/player/combine_super_soldier.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/player/police.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/grim.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/player/police_fem.mdl"] = VOICESET_COMBINE +VoiceSetTranslate["models/player/monk.mdl"] = VOICESET_MONK +VoiceSetTranslate["models/jason278-players/gabe_3.mdl"] = VOICESET_MONK +VoiceSetTranslate["models/player/mossman.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/brsp.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/moe_glados_p.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/mossman_arctic.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/p2_chell.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/dawson/obese_male_deluxe/obese_male_deluxe.mdl"] = VOICESET_MONK +VoiceSetTranslate["models/player/cirno/cirno_player.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/dewobedil/eromanga_sensei/sagiri/pajama_p.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/loyalists/mmd/remilia/remilia_mp_pm.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/loyalists/mmd/flandre/flandre_mp_pm.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/jazzmcfly/kantai/yuudachi/yuudachi.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/dewobedil/vocaloid/haku/bikini_p.mdl"] = VOICESET_FEMALE +VoiceSetTranslate["models/player/dewobedil/touhou/junko/default_p.mdl"] = VOICESET_FEMALE function GM:PlayerSpawn(pl) pl:StripWeapons() + pl:WipePlayerInventory() + pl:GiveAmmo(1, "dummy", true) -- Fixes empty weapon deploy bug. pl:RemoveStatus("confusion", false, true) + pl:RemoveFlags(FL_ONGROUND) -- fixes :OnGround() returning true on spawn even if they're not on the ground. if pl:GetMaterial() ~= "" then pl:SetMaterial("") @@ -3436,8 +3837,17 @@ function GM:PlayerSpawn(pl) pl:SetLegDamage(0) pl:SetLastAttacker() + local pcol = Vector(pl:GetInfo("cl_playercolor")) + pcol.x = math.Clamp(pcol.x, 0, 2.5) + pcol.y = math.Clamp(pcol.y, 0, 2.5) + pcol.z = math.Clamp(pcol.z, 0, 2.5) + pl:SetPlayerColor(pcol) + if pl:Team() == TEAM_UNDEAD then - pl:RemoveStatus("overridemodel", false, true) + if pl.ActivatedHumanSkills then + pl.ActivatedHumanSkills = false + pl:ApplySkills({}) + end if not pl.Revived then pl.DamagedBy = {} @@ -3447,44 +3857,58 @@ function GM:PlayerSpawn(pl) pl.LifeHumanDamage = 0 pl.LifeBrainsEaten = 0 - if self:GetEscapeSequence() and self:GetEscapeStage() >= ESCAPESTAGE_BOSS then - local bossindex = pl:GetBossZombieIndex() - if bossindex ~= -1 then - pl:SetZombieClass(bossindex) - end + pl.BossHealRemaining = nil + + if self:GetUseSigils() and self:GetEscapeSequence() and self:GetEscapeStage() >= ESCAPESTAGE_BOSS and not pl.Revived then + pl:SetZombieClassName("Super Zombie") elseif pl.DeathClass and self:GetWaveActive() then - pl:SetZombieClass(pl.DeathClass) + pl:SetZombieClass(self:GetBestAvailableZombieClass(pl.DeathClass)) pl.DeathClass = nil end + local cur = pl:GetZombieClassTable().Name + local best = self:GetBestAvailableZombieClass(cur) + if cur ~= best then + pl:SetZombieClass(best) + end + local classtab = pl:GetZombieClassTable() pl:DoHulls(pl:GetZombieClass(), TEAM_UNDEAD) + --pl:SetCustomCollisionCheck(pl.NoCollideAll == true) + pl:CollisionRulesChanged() if classtab.Model then pl:SetModel(classtab.Model) elseif classtab.UsePlayerModel then - local desiredname = pl:GetInfo("cl_playermodel") - if #desiredname == 0 then + local mdl = player_manager.TranslatePlayerModel(pl:GetInfo("cl_playermodel")) + if table.HasValue(self.RestrictedModels, mdl) then pl:SelectRandomPlayerModel() else - pl:SetModel(player_manager.TranslatePlayerModel(desiredname)) + pl:SetModel(mdl) end elseif classtab.UsePreviousModel then local curmodel = string.lower(pl:GetModel()) - if table.HasValue(self.RestrictedModels, curmodel) or string.sub(curmodel, 1, 14) ~= "models/player/" then + if table.HasValue(self.RestrictedModels, curmodel) or (not VoiceSetTranslate[curmodel] and string.sub(curmodel, 1, 14) ~= "models/player") then pl:SelectRandomPlayerModel() end elseif classtab.UseRandomModel then pl:SelectRandomPlayerModel() else - pl:SetModel("models/player/zombie_classic.mdl") + pl:SetModel("models/player/zombie_classic_hbfix.mdl") end - local numundead = team.NumPlayers(TEAM_UNDEAD) - if self.OutnumberedHealthBonus <= numundead or classtab.Boss then + if classtab.NoPlayerColor then + pl:SetColor(COLOR_WHITE) + pl:SetPlayerColor(Vector(255, 255, 255)) + end + + if classtab.Boss then pl:SetHealth(classtab.Health) else - pl:SetHealth(classtab.Health * 1.5) + local lowundead = team.NumPlayers(TEAM_UNDEAD) < 4 + + local healthmulti = (self.ObjectiveMap or self.ZombieEscape) and 1 or lowundead and 1.5 or 1 + pl:SetHealth(classtab.Health * healthmulti) end if classtab.SWEP then @@ -3495,7 +3919,7 @@ function GM:PlayerSpawn(pl) pl:SetMaxHealth(1) pl:ResetSpeed() - pl:SetCrouchedWalkSpeed(classtab.CrouchedWalkSpeed or 0.70) + pl:SetCrouchedWalkSpeed(classtab.CrouchedWalkSpeed or 0.45) if not pl.Revived or not self:GetWaveActive() or CurTime() > self:GetWaveEnd() then pl.StartCrowing = 0 @@ -3506,16 +3930,36 @@ function GM:PlayerSpawn(pl) pl.ForceSpawnAngles = nil end - if pl.SpawnedOnSpawnPoint and not pl.DidntSpawnOnSpawnPoint and not pl.Revived and not pl:GetZombieClassTable().NeverAlive then - pl:GiveStatus("zombiespawnbuff", 3) + if not pl.Revived and not pl:GetZombieClassTable().NeverAlive and pl.SpawnedOnSpawnPoint and not pl.DidntSpawnOnSpawnPoint then + pl:GiveStatus("zombiespawnbuff", self.ObjectiveMap and 1.5 or 3) end pl.DidntSpawnOnSpawnPoint = nil pl.SpawnedOnSpawnPoint = nil - pl:CallZombieFunction("OnSpawned") + local overridemodel = pl:GetZombieClassTable().OverrideModel + if overridemodel then + local current = pl:GiveStatus("overridemodel") + if current and current:IsValid() then + current:SetModel(overridemodel) + current:ResetBones() + pl:CallZombieFunction1("ManipulateOverrideModel", current) + end + else + pl:RemoveStatus("overridemodel", false, true) + end + + local oldhands = pl:GetHands() + if IsValid(oldhands) then + oldhands:Remove() + end + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_ZOMBIECLASS, classtab.Name, "ClassSpawn", 1) + + pl:CallZombieFunction0("OnSpawned") elseif pl:Team() == TEAM_HUMAN then - pl.m_PointQueue = 0 + pl.PointQueue = 0 pl.PackedItems = {} + pl:ClearUselessDamage() local desiredname = pl:GetInfo("cl_playermodel") local modelname = player_manager.TranslatePlayerModel(#desiredname == 0 and self.RandomPlayerModels[math.random(#self.RandomPlayerModels)] or desiredname) @@ -3528,31 +3972,54 @@ function GM:PlayerSpawn(pl) -- Cache the voice set. if VoiceSetTranslate[lowermodelname] then - pl.VoiceSet = VoiceSetTranslate[lowermodelname] + pl:SetDTInt(DT_PLAYER_INT_VOICESET, VoiceSetTranslate[lowermodelname]) elseif string.find(lowermodelname, "female", 1, true) then - pl.VoiceSet = "female" + pl:SetDTInt(DT_PLAYER_INT_VOICESET, VOICESET_FEMALE) else - pl.VoiceSet = "male" + pl:SetDTInt(DT_PLAYER_INT_VOICESET, VOICESET_MALE) end - pl.HumanSpeedAdder = nil - - pl.BonusDamageCheck = CurTime() - - pl:ResetSpeed() - pl:SetJumpPower(DEFAULT_JUMP_POWER) - pl:SetCrouchedWalkSpeed(0.65) + --pl.HumanSpeedAdder = nil pl:SetNoTarget(false) pl:SetMaxHealth(100) + --pl:SetCustomCollisionCheck(false) + pl:CollisionRulesChanged() + + if not self.NoSkills then + pl.ActivatedHumanSkills = true + pl.AdjustedStartPointsSkill = nil + pl.AdjustedStartScrapSkill = nil + pl:ApplySkills() + end + + pl.StowageCaches = 0 + + net.Start("zs_stowagecaches") + net.WriteInt(pl.StowageCaches, 8) + net.Send(pl) + + pl:ResetSpeed() + pl:ResetJumpPower() + pl:SetCrouchedWalkSpeed(0.45) + + pl:SetViewOffset(DEFAULT_VIEW_OFFSET) + pl:SetViewOffsetDucked(DEFAULT_VIEW_OFFSET_DUCKED) if self.ZombieEscape then pl:Give("weapon_zs_zeknife") pl:Give("weapon_zs_zegrenade") - pl:Give(table.Random(self.ZombieEscapeWeapons)) + pl:Give(table.Random(self.ZombieEscapeWeaponsPrimary)) + pl:Give(table.Random(self.ZombieEscapeWeaponsSecondary)) else + local start = pl:GetRandomStartingItem() + if start then + local func = self:GetInventoryItemType(start) == INVCAT_TRINKETS and pl.AddInventoryItem or pl.Give + func(pl, start) + end + pl:Give("weapon_zs_fists") - + if self.StartingLoadout then self:GiveStartingLoadout(pl) elseif pl.m_PreRedeem then @@ -3579,30 +4046,19 @@ function GM:PlayerSpawn(pl) end end - pl:DoMuscularBones() - pl:DoNoodleArmBones() - - local pcol = Vector(pl:GetInfo("cl_playercolor")) - pcol.x = math.Clamp(pcol.x, 0, 2.5) - pcol.y = math.Clamp(pcol.y, 0, 2.5) - pcol.z = math.Clamp(pcol.z, 0, 2.5) - pl:SetPlayerColor(pcol) - local wcol = Vector(pl:GetInfo("cl_weaponcolor")) wcol.x = math.Clamp(wcol.x, 0, 2.5) wcol.y = math.Clamp(wcol.y, 0, 2.5) wcol.z = math.Clamp(wcol.z, 0, 2.5) pl:SetWeaponColor(wcol) - - pl.m_PreHurtHealth = pl:Health() end function GM:SetWave(wave) local previouslylocked = {} local UnlockedClasses = {} - for i, classtab in ipairs(GAMEMODE.ZombieClasses) do + for classid, classtab in ipairs(GAMEMODE.ZombieClasses) do if not gamemode.Call("IsClassUnlocked", classid) then - previouslylocked[i] = true + previouslylocked[classid] = true end end @@ -3611,6 +4067,9 @@ function GM:SetWave(wave) for classid in pairs(previouslylocked) do if gamemode.Call("IsClassUnlocked", classid) then local classtab = self.ZombieClasses[classid] + classtab.Locked = false + classtab.Unlocked = true + if not classtab.UnlockedNotify then classtab.UnlockedNotify = true table.insert(UnlockedClasses, classid) @@ -3622,6 +4081,11 @@ function GM:SetWave(wave) ent:Input("onclassunlocked", ent, ent, classname) end end + + net.Start("zs_classunlockstate") + net.WriteInt(classid, 8) + net.WriteBool(classtab.Unlocked) + net.Broadcast() end end @@ -3629,7 +4093,9 @@ function GM:SetWave(wave) for _, pl in pairs(player.GetAll()) do local classnames = {} for __, classid in pairs(UnlockedClasses) do - table.insert(classnames, translate.ClientGet(pl, self.ZombieClasses[classid].TranslationName)) + local classtbl = self.ZombieClasses[classid] + + table.insert(classnames, translate.ClientGet(pl, classtbl.TranslationName)) end net.Start("zs_classunlock") net.WriteString(string.AndSeparate(classnames)) @@ -3642,6 +4108,8 @@ GM.NextEscapeDamage = 0 function GM:WaveStateChanged(newstate) if newstate then if self:GetWave() == 0 then + gamemode.Call("CreateSigils", true) -- Try creating sigils again. Only really matters if nobody seeded the map yet. + self:SetClosestsToZombie() local humans = {} @@ -3651,17 +4119,16 @@ function GM:WaveStateChanged(newstate) end end - if #humans >= 1 then - for _, pl in pairs(humans) do + for _, pl in pairs(humans) do + if pl.PlayerReady then -- There's a chance they might not be ready to send their desired cart yet. gamemode.Call("GiveDefaultOrRandomEquipment", pl) - pl.BonusDamageCheck = CurTime() end end -- We should spawn a crate in a random spawn point if no one has any. if not self.ZombieEscape and #ents.FindByClass("prop_arsenalcrate") == 0 then local have = false - for _, pl in pairs(humans) do + for _, pl in pairs(humans) do if pl:HasWeapon("weapon_zs_arsenalcrate") then have = true break @@ -3673,7 +4140,7 @@ function GM:WaveStateChanged(newstate) if spawn and spawn:IsValid() then local ent = ents.Create("prop_arsenalcrate") if ent:IsValid() then - ent:SetPos(spawn:GetPos()) + ent:SetPos(spawn:GetPos() + Vector(0, 0, 8)) ent:Spawn() ent:DropToFloor() ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) -- Just so no one gets stuck in it. @@ -3704,6 +4171,7 @@ function GM:WaveStateChanged(newstate) for _, pl in pairs(team.GetPlayers(TEAM_UNDEAD)) do pl.m_LastWaveStartSpawn = CurTime() + if pl:GetZombieClassTable().Name == "Crow" then pl:SetZombieClass(pl.DeathClass or 1) pl:UnSpectateAndSpawn() @@ -3712,6 +4180,11 @@ function GM:WaveStateChanged(newstate) end end + for _, pl in pairs(player.GetAll()) do + pl.WaveBarricadeDamage = 0 + pl.WaveHumanDamage = 0 + end + local curwave = self:GetWave() for _, ent in pairs(ents.FindByClass("logic_waves")) do if ent.Wave == curwave or ent.Wave == -1 then @@ -3726,18 +4199,15 @@ function GM:WaveStateChanged(newstate) elseif self:GetWave() >= self:GetNumberOfWaves() then -- Last wave is over if self:GetUseSigils() then if self:GetEscapeStage() == ESCAPESTAGE_BOSS then + -- 2 minutes is enough to decide people left are stuck or griefing. self:SetEscapeStage(ESCAPESTAGE_DEATH) - PrintMessage(3, "Escape sequence death fog stage") - gamemode.Call("SetWaveEnd", -1) elseif self:GetEscapeStage() == ESCAPESTAGE_ESCAPE then self:SetEscapeStage(ESCAPESTAGE_BOSS) - -- 2 minutes to get out with everyone spawning as bosses. - gamemode.Call("SetWaveEnd", CurTime() + 120) - - PrintMessage(3, "Escape sequence boss stage") + -- Some time to get out with everyone spawning as bosses. + gamemode.Call("SetWaveEnd", CurTime() + 45) -- Start spawning boss zombies. elseif self:GetEscapeStage() == ESCAPESTAGE_NONE then @@ -3750,18 +4220,12 @@ function GM:WaveStateChanged(newstate) ent:Spawn() end - sigil:Destroy() + sigil:Remove() end - --[[net.Start("zs_waveend") - net.WriteInt(self:GetWave(), 16) - net.WriteFloat(CurTime()) - net.Broadcast()]] - PrintMessage(3, "Escape sequence started") - - -- 2 minutes to escape. + -- Some time to escape. gamemode.Call("SetWaveActive", true) - gamemode.Call("SetWaveEnd", CurTime() + 120) + gamemode.Call("SetWaveEnd", CurTime() + 45) self:SetEscapeStage(ESCAPESTAGE_ESCAPE) local curwave = self:GetWave() @@ -3800,11 +4264,25 @@ function GM:WaveStateChanged(newstate) net.WriteFloat(self:GetWaveStart()) net.Broadcast() + local pointsbonus + if self.EndWavePointsBonus > 0 then + pointsbonus = self.EndWavePointsBonus + (self:GetWave() - 1) * self.EndWavePointsBonusPerWave + end + for _, pl in pairs(player.GetAll()) do if pl:Team() == TEAM_HUMAN and pl:Alive() then if self.EndWaveHealthBonus > 0 then pl:SetHealth(math.min(pl:GetMaxHealth(), pl:Health() + self.EndWaveHealthBonus)) end + if pointsbonus then + local pointsreward = pointsbonus + (pl.EndWavePointsExtra or 0) + + if pl:IsSkillActive(SKILL_SCOURER) then + pl:GiveAmmo(math.ceil(pointsreward), "scrap") + else + pl:AddPoints(pointsreward, nil, nil, true) + end + end elseif pl:Team() == TEAM_UNDEAD and not pl:Alive() and not pl.Revive then local curclass = pl.DeathClass or pl:GetZombieClass() local crowindex = GAMEMODE.ZombieClasses["Crow"].Index @@ -3836,27 +4314,36 @@ end function GM:PlayerSwitchFlashlight(pl, newstate) if pl:Team() == TEAM_UNDEAD then - if pl:Alive() then - pl:SendLua("gamemode.Call(\"ToggleZombieVision\")") + if newstate then + net.Start("zs_togglezvision") + net.Send(pl) end return false end - return pl:Team() == TEAM_HUMAN + if pl:Team() == TEAM_HUMAN and CurTime() >= pl.NextFlashlightSwitch then + pl.NextFlashlightSwitch = CurTime() + 0.75 + return true + end + + return false end function GM:PlayerStepSoundTime(pl, iType, bWalking) return 350 end -concommand.Add("zs_class", function(sender, command, arguments) +function GM:OnZEWeaponPickup(pl, wep) +end + +net.Receive("zs_changeclass", function(len, sender) if sender:Team() ~= TEAM_UNDEAD or sender.Revive or GAMEMODE.PantsMode or GAMEMODE:IsClassicMode() or GAMEMODE:IsBabyMode() or GAMEMODE.ZombieEscape then return end - local classname = arguments[1] - local suicide = arguments[2] == "1" + local classname = GAMEMODE:GetBestAvailableZombieClass(net.ReadString()) + local suicide = net.ReadBool() local classtab = GAMEMODE.ZombieClasses[classname] - if not classtab or classtab.Hidden and not (classtab.CanUse and classtab:CanUse(sender)) then return end + if not classtab or classtab.Disabled or classtab.Hidden and not (classtab.CanUse and classtab:CanUse(sender)) then return end if not gamemode.Call("IsClassUnlocked", classname) then sender:CenterNotify(COLOR_RED, translate.ClientFormat(sender, "class_not_unlocked_will_be_unlocked_x", classtab.Wave)) @@ -3866,8 +4353,42 @@ concommand.Add("zs_class", function(sender, command, arguments) sender.DeathClass = classtab.Index sender:CenterNotify(translate.ClientFormat(sender, "you_will_spawn_as_a_x", translate.ClientGet(sender, classtab.TranslationName))) - if suicide and sender:Alive() and not sender:GetZombieClassTable().Boss and gamemode.Call("CanPlayerSuicide", sender) then + if suicide and sender:Alive() and GAMEMODE:GetWaveActive() and (CurTime() < GAMEMODE:GetWaveEnd() - 4 or GAMEMODE:GetWaveEnd() < 0) and not sender:GetZombieClassTable().Boss and gamemode.Call("CanPlayerSuicide", sender) then sender:Kill() end end end) + +net.Receive("zs_zsfriend", function(len, sender) + local zsfriendid = net:ReadString() + local zsfriendent = player.GetBySteamID(zsfriendid) + + if not zsfriendent then return end + local isfriend = net:ReadBool() + sender.ZSFriends[zsfriendent] = isfriend + + net.Start("zs_zsfriendadded") + net.WriteEntity(sender) + net.WriteBool(isfriend) + net.Send(zsfriendent) +end) + + +net.Receive("zs_nestspec", function(len, sender) + if not sender:IsValidZombie() then return end + if sender:GetObserverMode() == OBS_MODE_NONE then return end + + local nest = net:ReadEntity() + local neveralive = sender:GetZombieClassTable().NeverAlive + + if neveralive and nest.MinionSpawn then + sender:TrySpawnAsGoreChild(nest) + end + + if sender:Alive() or neveralive then return end + + if nest:IsValid() then + sender:Spectate(OBS_MODE_CHASE) + sender:SpectateEntity(nest) + end +end) diff --git a/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua b/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua new file mode 100644 index 0000000..7646a24 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua @@ -0,0 +1,374 @@ +GM.ZSInventory = {} + +INVCAT_TRINKETS = 1 +INVCAT_COMPONENTS = 2 +INVCAT_CONSUMABLES = 3 + +local meta = FindMetaTable("Player") +function meta:GetInventoryItems() + return GAMEMODE.ZSInventory +end + +function meta:HasInventoryItem(item) + return GAMEMODE.ZSInventory[item] and GAMEMODE.ZSInventory[item] > 0 +end + +net.Receive("zs_inventoryitem", function() + local item = net.ReadString() + local count = net.ReadInt(5) + local prevcount = GAMEMODE.ZSInventory[item] or 0 + + GAMEMODE.ZSInventory[item] = count + + if GAMEMODE.InventoryMenu and GAMEMODE.InventoryMenu:IsValid() then + if count > prevcount then + GAMEMODE:InventoryAddGridItem(item, GAMEMODE:GetInventoryItemType(item)) + else + GAMEMODE:InventoryRemoveGridItem(item) + end + end + + if MySelf and MySelf:IsValid() then + MySelf:ApplyTrinkets() + end +end) + +net.Receive("zs_wipeinventory", function() + GAMEMODE.ZSInventory = {} + + if GAMEMODE.InventoryMenu and GAMEMODE.InventoryMenu:IsValid() then + GAMEMODE:InventoryWipeGrid() + end + + MySelf:ApplyTrinkets() +end) + +local function TryCraftWithComponent(me) + net.Start("zs_trycraft") + net.WriteString(me.Item) + net.WriteString(me.WeaponCraft) + net.SendToServer() +end + +local function ItemPanelDoClick(self) + local item = self.Item + if not item then return end + + local category, sweptable = self.Category + if category == INVCAT_WEAPONS then + sweptable = weapons.Get(item) + else + sweptable = GAMEMODE.ZSInventoryItemData[item] + end + + local viewer = GAMEMODE.m_InvViewer + local screenscale = BetterScreenScale() + + if self.On then + if viewer and viewer:IsValid() then + viewer:SetVisible(false) + end + + self.On = false + + GAMEMODE.InventoryMenu.SelInv = false + GAMEMODE:DoAltSelectedItemUpdate() + return + else + for _, v in pairs(self:GetParent():GetChildren()) do + v.On = false + end + self.On = true + + GAMEMODE.InventoryMenu.SelInv = item + GAMEMODE:DoAltSelectedItemUpdate() + end + + GAMEMODE:CreateInventoryInfoViewer() + + viewer = GAMEMODE.m_InvViewer + viewer.m_Title:SetText(sweptable.PrintName) + viewer.m_Title:PerformLayout() + + local desctext = sweptable.Description or "" + if category == INVCAT_WEAPONS then + viewer.ModelPanel:SetModel(sweptable.WorldModel) + local mins, maxs = viewer.ModelPanel.Entity:GetRenderBounds() + viewer.ModelPanel:SetCamPos(mins:Distance(maxs) * Vector(1.15, 0.75, 0.5)) + viewer.ModelPanel:SetLookAt((mins + maxs) / 2) + viewer.m_VBG:SetVisible(true) + + if sweptable.NoDismantle then + desctext = desctext .. "\nCannot be dismantled for scrap." + end + + viewer.m_Desc:MoveBelow(viewer.m_VBG, 8) + viewer.m_Desc:SetFont("ZSBodyTextFont") + + local canammo = false + if sweptable.Primary then + local ammotype = sweptable.Primary.Ammo + if GAMEMODE.AmmoToPurchaseNames[ammotype] then + canammo = true + end + end + + if canammo and GAMEMODE.AmmoNames[string.lower(sweptable.Primary.Ammo)] then + viewer.m_AmmoType:SetText(GAMEMODE.AmmoNames[string.lower(sweptable.Primary.Ammo)]) + viewer.m_AmmoType:PerformLayout() + else + viewer.m_AmmoType:SetText("") + end + else + viewer.ModelPanel:SetModel("") + viewer.m_VBG:SetVisible(false) + + viewer.m_Desc:MoveBelow(viewer.m_Title, 20) + viewer.m_Desc:SetFont("ZSBodyTextFontBig") + + viewer.m_AmmoType:SetText("") + end + viewer.m_Desc:SetText(desctext) + + GAMEMODE:ViewerStatBarUpdate(viewer, category ~= INVCAT_WEAPONS, sweptable) + + for i = 1, 3 do + local crab, cral = viewer.m_CraftBtns[i][1], viewer.m_CraftBtns[i][2] + + crab:SetVisible(false) + cral:SetVisible(false) + end + + local assembles = {} + for k,v in pairs(GAMEMODE.Assemblies) do + if v[1] == item then + assembles[v[2]] = k + end + end + + local count = 0 + for k,v in pairs(assembles) do + count = count + 1 + + local crab, cral = viewer.m_CraftBtns[count][1], viewer.m_CraftBtns[count][2] + local iitype = GAMEMODE:GetInventoryItemType(k) ~= -1 + + crab.Item = item + crab.WeaponCraft = k + crab.DoClick = TryCraftWithComponent + crab:SetPos(viewer:GetWide() / 2 - crab:GetWide() / 2, (viewer:GetTall() - 33 * screenscale) - (count - 1) * 33 * screenscale) + crab:SetVisible(true) + + cral:SetText((iitype and GAMEMODE.ZSInventoryItemData[k] or weapons.Get(k)).PrintName) + cral:SetPos(crab:GetWide() / 2 - cral:GetWide() / 2, (crab:GetTall() * 0.5 - cral:GetTall() * 0.5)) + cral:SetContentAlignment(5) + cral:SetVisible(true) + end + + if count > 0 then + viewer.m_CraftWith:SetPos(viewer:GetWide() / 2 - viewer.m_CraftWith:GetWide() / 2, (viewer:GetTall() - 33 * screenscale) - 33 * count * screenscale) + viewer.m_CraftWith:SetContentAlignment(5) + viewer.m_CraftWith:SetVisible(true) + else + viewer.m_CraftWith:SetVisible(false) + end +end + +local categorycolors = { + [INVCAT_TRINKETS] = {COLOR_RED, COLOR_DARKRED}, + [INVCAT_COMPONENTS] = {COLOR_BLUE, COLOR_DARKBLUE}, + [INVCAT_CONSUMABLES] = {COLOR_YELLOW, COLOR_DARKYELLOW} +} +local colBG = Color(10, 10, 10, 252) +local colBGH = Color(200, 200, 200, 5) +local function ItemPanelPaint(self, w, h) + draw.RoundedBox(2, 0, 0, w, h, (self.Depressed or self.On) and categorycolors[self.Category][1] or categorycolors[self.Category][2]) + draw.RoundedBox(2, 2, 2, w - 4, h - 4, colBG) + if self.On or self.Hovered then + draw.RoundedBox(2, 2, 2, w - 4, h - 4, colBGH) + end + + return true +end + +function GM:CreateInventoryInfoViewer() + if self.m_InvViewer and self.m_InvViewer:IsValid() then + self.m_InvViewer:SetVisible(true) + return + end + + local leftframe = self.InventoryMenu + local viewer = vgui.Create("DFrame") + + local screenscale = BetterScreenScale() + + viewer:SetDeleteOnClose(false) + viewer:SetTitle(" ") + viewer:SetDraggable(false) + if viewer.btnClose and viewer.btnClose:IsValid() then viewer.btnClose:SetVisible(false) end + if viewer.btnMinim and viewer.btnMinim:IsValid() then viewer.btnMinim:SetVisible(false) end + if viewer.btnMaxim and viewer.btnMaxim:IsValid() then viewer.btnMaxim:SetVisible(false) end + + viewer:SetSize(leftframe:GetWide() / 1.25, leftframe:GetTall()) + viewer:MoveRightOf(leftframe, 32) + viewer:MoveAbove(leftframe, -leftframe:GetTall()) + self.m_InvViewer = viewer + + self:CreateItemViewerGenericElems(viewer) + + local craftbtns = {} + for i = 1, 3 do + local craftb = vgui.Create("DButton", viewer) + craftb:SetText("") + craftb:SetSize(viewer:GetWide() / 1.15, 27 * screenscale) + craftb:SetVisible(false) + + local namelab = EasyLabel(craftb, "...", "ZSBodyTextFont", COLOR_WHITE) + namelab:SetWide(craftb:GetWide()) + namelab:SetVisible(false) + + craftbtns[i] = {craftb, namelab} + end + viewer.m_CraftBtns = craftbtns + + local craftwith = EasyLabel(viewer, "Craft With...", "ZSBodyTextFontBig", COLOR_WHITE) + craftwith:SetSize(viewer:GetWide() / 1.15, 27 * screenscale) + craftwith:SetVisible(false) + viewer.m_CraftWith = craftwith +end + +local NumToRomanNumeral = { + "I", "II", "III", "IV", "V", "VI" +} + +function GM:InventoryAddGridItem(item, category) + local screenscale = BetterScreenScale() + local grid = self.InventoryMenu.Grid + + local itempan = vgui.Create("DButton") + itempan:SetText("") + itempan:SetSize(64 * screenscale, 64 * screenscale) + itempan.Paint = ItemPanelPaint + itempan.DoClick = ItemPanelDoClick + itempan.Item = item + itempan.Category = category + + grid:AddItem(itempan) + grid:SortByMember("Category") + + local mdlframe = vgui.Create("DPanel", itempan) + mdlframe:SetSize(60 * screenscale, 30 * screenscale) + mdlframe:Center() + mdlframe:SetMouseInputEnabled(false) + mdlframe.Paint = function() end + + local trintier = EasyLabel(itempan, "", "ZSHUDFontSmaller", COLOR_WHITE) + trintier:CenterHorizontal(0.8) + trintier:CenterVertical(0.8) + + if category == INVCAT_TRINKETS then + local tier = GAMEMODE.ZSInventoryItemData[item].Tier or 1 + trintier:SetText(NumToRomanNumeral[tier]) + trintier:SizeToContents() + trintier:CenterHorizontal(0.8) + trintier:CenterVertical(0.8) + end + + local kitbl = killicon.Get(category == INVCAT_TRINKETS and "weapon_zs_trinket" or "weapon_zs_craftables") + if kitbl then + self:AttachKillicon(kitbl, itempan, mdlframe) + end +end + +function GM:InventoryRemoveGridItem(item) + local grid = self.InventoryMenu.Grid + for k, v in pairs(grid:GetChildren()) do + if v.Item == item then + grid:RemoveItem(v) + break + end + end + grid:SortByMember("Category") + + if self.InventoryMenu.SelInv == item then + if self.m_InvViewer and self.m_InvViewer:IsValid() and self.InventoryMenu.SelInv then + self.m_InvViewer:SetVisible(false) + end + + self.InventoryMenu.SelInv = nil + self:DoAltSelectedItemUpdate() + end +end + +function GM:InventoryWipeGrid() + local grid = self.InventoryMenu.Grid + for k, v in pairs(grid:GetChildren()) do + grid:RemoveItem(v) + end + + if self.m_InvViewer and self.m_InvViewer:IsValid() then + self.m_InvViewer:SetVisible(false) + end + + self.InventoryMenu.SelInv = nil + self:DoAltSelectedItemUpdate() +end + +function GM:OpenInventory() + if self.InventoryMenu and self.InventoryMenu:IsValid() then + self.InventoryMenu:SetVisible(true) + + if self.m_InvViewer and self.m_InvViewer:IsValid() and self.InventoryMenu.SelInv then + self.m_InvViewer:SetVisible(true) + end + return + end + + local screenscale = BetterScreenScale() + local wid, hei = math.max(400, math.min(ScrW(), 400) * screenscale), math.min(ScrH(), 370) * screenscale + + local frame = vgui.Create("DFrame") + frame:SetSize(wid, hei) + frame:CenterHorizontal(0.385) + frame:CenterVertical(0.25) + frame:SetDeleteOnClose(false) + frame:SetTitle(" ") + frame:SetDraggable(false) + + if frame.btnClose and frame.btnClose:IsValid() then frame.btnClose:SetVisible(false) end + if frame.btnMinim and frame.btnMinim:IsValid() then frame.btnMinim:SetVisible(false) end + if frame.btnMaxim and frame.btnMaxim:IsValid() then frame.btnMaxim:SetVisible(false) end + + self.InventoryMenu = frame + + local topspace = vgui.Create("DPanel", frame) + topspace:SetWide(wid - 16) + + local title = EasyLabel(topspace, "Inventory", "ZSHUDFontSmall", COLOR_WHITE) + title:CenterHorizontal() + + local _, y = title:GetPos() + topspace:SetTall(y + title:GetTall() + 2) + topspace:AlignTop(8) + topspace:CenterHorizontal() + + local invgrid = vgui.Create("DGrid", frame) + invgrid:SetSize(wid - 16 * screenscale, frame:GetTall() - 8 - topspace:GetTall()) + invgrid:MoveBelow(topspace, 16) + invgrid:SetCols(5) + invgrid:SetColWide((70 + (invgrid:GetWide() - 70*5) / 4) * screenscale) + invgrid:SetRowHeight(70 * screenscale) + invgrid:CenterHorizontal() + frame.Grid = invgrid + + for item, count in pairs(self.ZSInventory) do + if count > 0 then + for i = 1, count do + self:InventoryAddGridItem(item, self:GetInventoryItemType(item)) + end + end + end + invgrid:SortByMember("Category") + + frame:MakePopup() +end diff --git a/gamemodes/zombiesurvival/gamemode/inventory/server/sv_components.lua b/gamemodes/zombiesurvival/gamemode/inventory/server/sv_components.lua new file mode 100644 index 0000000..d9d08d9 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/inventory/server/sv_components.lua @@ -0,0 +1,23 @@ +GM.WorldConversions = {} +GM.StarterTrinkets = { + "trinket_armband", + "trinket_condiments", + "trinket_emanual", + "trinket_aimaid", + "trinket_vitamins", + "trinket_welfare", + "trinket_chemistry" +} + +function GM:AddWorldPropConversionRecipe(model, result) + local datatab = {Result = result, Index = wcindex} + self.WorldConversions[model] = datatab + self.WorldConversions[#self.WorldConversions + 1] = datatab +end + +GM:AddWorldPropConversionRecipe("models/props_combine/breenbust.mdl", "comp_busthead") +GM:AddWorldPropConversionRecipe("models/props_junk/sawblade001a.mdl", "comp_sawblade") +GM:AddWorldPropConversionRecipe("models/props_junk/propane_tank001a.mdl", "comp_propanecan") +GM:AddWorldPropConversionRecipe("models/items/car_battery01.mdl", "comp_electrobattery") +GM:AddWorldPropConversionRecipe("models/props_lab/reciever01b.mdl", "comp_reciever") +GM:AddWorldPropConversionRecipe("models/props_lab/harddrive01.mdl", "comp_cpuparts") diff --git a/gamemodes/zombiesurvival/gamemode/inventory/server/sv_inventory.lua b/gamemodes/zombiesurvival/gamemode/inventory/server/sv_inventory.lua new file mode 100644 index 0000000..bf83d56 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/inventory/server/sv_inventory.lua @@ -0,0 +1,194 @@ +local meta = FindMetaTable("Player") + +function meta:AddInventoryItem(item) + if not GAMEMODE:IsInventoryItem(item) then return false end + + self.ZSInventory[item] = self.ZSInventory[item] and self.ZSInventory[item] + 1 or 1 + + if GAMEMODE:GetInventoryItemType(item) == INVCAT_TRINKETS then + self:ApplyTrinkets() + end + + net.Start("zs_inventoryitem") + net.WriteString(item) + net.WriteInt(self.ZSInventory[item], 5) + net.Send(self) + + return true +end + +function meta:TakeInventoryItem(item) + if not self:HasInventoryItem(item) then return false end + + local setnil = self.ZSInventory[item] == 1 + self.ZSInventory[item] = self.ZSInventory[item] - 1 + + if setnil then + self.ZSInventory[item] = nil + end + + if GAMEMODE:GetInventoryItemType(item) == INVCAT_TRINKETS then + self:ApplyTrinkets() + end + + net.Start("zs_inventoryitem") + net.WriteString(item) + net.WriteInt(self.ZSInventory[item] or 0, 5) + net.Send(self) + + return true -- Return true aka item was taken +end + +function meta:WipePlayerInventory() + if not self.ZSInventory or table.Count(self.ZSInventory) == 0 then return end + + self.ZSInventory = {} + self:ApplyTrinkets() + + net.Start("zs_wipeinventory") + net.Send(self) +end + +net.Receive("zs_trycraft", function(len, pl) + local component = net:ReadString() + local weapon = net:ReadString() + + pl:TryAssembleItem(component, weapon) +end) + +function meta:TryAssembleItem(component, heldclass) + local heldwep, desiassembly = self:GetWeapon(heldclass) + local heldwepiitype = GAMEMODE:GetInventoryItemType(heldclass) ~= -1 + + if heldwepiitype then + if not self:HasInventoryItem(heldclass) then + self:CenterNotify(COLOR_RED, "You don't have the item to craft this with.") + self:SendLua("surface.PlaySound(\"buttons/button10.wav\")") + return + end + else + if not heldwep or not heldwep:IsValid() then + self:CenterNotify(COLOR_RED, "You don't have the weapon to craft this with.") + self:SendLua("surface.PlaySound(\"buttons/button10.wav\")") + return + end + end + + for assembly, reqs in pairs(GAMEMODE.Assemblies) do + local reqcomp, reqweapon = reqs[1], reqs[2] + if reqcomp == component and reqweapon == heldclass then + desiassembly = assembly + break + end + end + + if not desiassembly then + self:CenterNotify(COLOR_RED, "You can't make anything with this component and your currently held weapon.") + self:SendLua("surface.PlaySound(\"buttons/button10.wav\")") + return + end + + local invitemresult = GAMEMODE:GetInventoryItemType(desiassembly) ~= -1 + + local desitable + if invitemresult then + if not self:TakeInventoryItem(component) then return end + + self:AddInventoryItem(desiassembly) + self:CenterNotify(COLOR_LIMEGREEN, translate.ClientGet(self, "crafting_successful"), color_white, " ("..GAMEMODE.ZSInventoryItemData[desiassembly].PrintName..")") + else + desitable = weapons.Get(desiassembly) + if (not desitable.AmmoIfHas and self:HasWeapon(desiassembly)) or not self:TakeInventoryItem(component) then return end + + if desitable.AmmoIfHas then + self:GiveAmmo(1, desitable.Primary.Ammo) + end + self:GiveEmptyWeapon(desiassembly) + self:SelectWeapon(desiassembly) + self:UpdateAltSelectedWeapon() + + self:CenterNotify(COLOR_LIMEGREEN, translate.ClientGet(self, "crafting_successful"), color_white, " ("..desitable.PrintName..")") + end + + if heldwepiitype then + self:TakeInventoryItem(heldclass) + else + heldwep:EmptyAll(true) + if heldwep.AmmoIfHas then + self:RemoveAmmo(1, heldwep.Primary.Ammo) + end + self:StripWeapon(heldclass) + end + self:SendLua("surface.PlaySound(\"buttons/lever"..math.random(5)..".wav\")") + + GAMEMODE.StatTracking:IncreaseElementKV(STATTRACK_TYPE_WEAPON, desiassembly, "Crafts", 1) +end + +function meta:DropInventoryItemByType(itype) + if GAMEMODE.ZombieEscape then return end + if not self:HasInventoryItem(itype) then return end + + local ent = ents.Create("prop_invitem") + if ent:IsValid() then + ent:SetInventoryItemType(itype) + ent:Spawn() + ent.DroppedTime = CurTime() + + self:TakeInventoryItem(itype) + self:UpdateAltSelectedWeapon() + + return ent + end +end + +function meta:DropAllInventoryItems() + local vPos = self:GetPos() + local vVel = self:GetVelocity() + local zmax = self:OBBMaxs().z * 0.75 + for invitem, count in pairs(self:GetInventoryItems()) do + for i = 1, count do + local ent = self:DropInventoryItemByType(invitem) + if ent and ent:IsValid() then + ent:SetPos(vPos + Vector(math.Rand(-16, 16), math.Rand(-16, 16), math.Rand(2, zmax))) + ent:SetAngles(VectorRand():Angle()) + local phys = ent:GetPhysicsObject() + if phys:IsValid() then + phys:AddAngleVelocity(Vector(math.Rand(-720, 720), math.Rand(-720, 720), math.Rand(-720, 720))) + phys:ApplyForceCenter(phys:GetMass() * (math.Rand(32, 328) * VectorRand():GetNormalized() + vVel)) + end + end + end + end +end + +function meta:GiveInventoryItemByType(itype, plyr) + if GAMEMODE.ZombieEscape then return end + if not self:HasInventoryItem(itype) then return end + + if GAMEMODE:GetInventoryItemType(itype) == INVCAT_TRINKETS and plyr:HasInventoryItem(itype) then + self:CenterNotify(COLOR_RED, translate.ClientGet(self, "they_already_have_this_trinket")) + return + end + + self:TakeInventoryItem(itype) + self:UpdateAltSelectedWeapon() + + net.Start("zs_invgiven") + net.WriteString(itype) + net.WriteEntity(self) + net.Send(plyr) + + plyr:AddInventoryItem(itype) +end + +function GM:IsInventoryItem(item) + return self.ZSInventoryItemData[item] +end + +function meta:GetInventoryItems() + return self.ZSInventory +end + +function meta:HasInventoryItem(item) + return self.ZSInventory[item] +end diff --git a/gamemodes/zombiesurvival/gamemode/inventory/shared/sh_inventory.lua b/gamemodes/zombiesurvival/gamemode/inventory/shared/sh_inventory.lua new file mode 100644 index 0000000..424a4ab --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/inventory/shared/sh_inventory.lua @@ -0,0 +1,492 @@ +INVCAT_TRINKETS = 1 +INVCAT_COMPONENTS = 2 +INVCAT_CONSUMABLES = 3 + +GM.ZSInventoryItemData = {} +GM.ZSInventoryCategories = { + [INVCAT_TRINKETS] = "Trinkets", + [INVCAT_COMPONENTS] = "Components", + [INVCAT_CONSUMABLES] = "Consumables" +} +GM.ZSInventoryPrefix = { + [INVCAT_TRINKETS] = "trin", + [INVCAT_COMPONENTS] = "comp", + [INVCAT_CONSUMABLES] = "cons" +} + +GM.Assemblies = {} +GM.Breakdowns = {} + +function GM:GetInventoryItemType(item) + for typ, aff in pairs(self.ZSInventoryPrefix) do + if string.sub(item, 1, 4) == aff then + return typ + end + end + + return -1 +end + +local index = 1 +function GM:AddInventoryItemData(intname, name, description, weles, tier, stocks) + local datatab = {PrintName = name, DroppedEles = weles, Tier = tier, Description = description, Stocks = stocks, Index = index} + self.ZSInventoryItemData[intname] = datatab + self.ZSInventoryItemData[index] = datatab + + index = index + 1 +end + + +function GM:AddWeaponBreakdownRecipe(weapon, result) + local datatab = {Result = result, Index = index} + self.Breakdowns[weapon] = datatab + for i = 1, 3 do + self.Breakdowns[self:GetWeaponClassOfQuality(weapon, i)] = datatab + self.Breakdowns[self:GetWeaponClassOfQuality(weapon, i, 1)] = datatab + end + + self.Breakdowns[#self.Breakdowns + 1] = datatab +end + +GM:AddWeaponBreakdownRecipe("weapon_zs_stubber", "comp_modbarrel") +GM:AddWeaponBreakdownRecipe("weapon_zs_z9000", "comp_basicecore") +GM:AddWeaponBreakdownRecipe("weapon_zs_blaster", "comp_pumpaction") +GM:AddWeaponBreakdownRecipe("weapon_zs_novablaster", "comp_contaecore") +GM:AddWeaponBreakdownRecipe("weapon_zs_waraxe", "comp_focusbarrel") +GM:AddWeaponBreakdownRecipe("weapon_zs_innervator", "comp_gaussframe") +GM:AddWeaponBreakdownRecipe("weapon_zs_swissarmyknife", "comp_shortblade") +GM:AddWeaponBreakdownRecipe("weapon_zs_owens", "comp_multibarrel") +GM:AddWeaponBreakdownRecipe("weapon_zs_onyx", "comp_precision") +GM:AddWeaponBreakdownRecipe("weapon_zs_minelayer", "comp_launcher") +GM:AddWeaponBreakdownRecipe("weapon_zs_fracture", "comp_linearactuator") +GM:AddWeaponBreakdownRecipe("weapon_zs_harpoon", "comp_metalpole") + +-- Assemblies (Assembly, Component, Weapon) +GM.Assemblies["weapon_zs_waraxe"] = {"comp_modbarrel", "weapon_zs_glock3"} +GM.Assemblies["weapon_zs_bust"] = {"comp_busthead", "weapon_zs_plank"} +GM.Assemblies["weapon_zs_sawhack"] = {"comp_sawblade", "weapon_zs_axe"} +GM.Assemblies["weapon_zs_manhack_saw"] = {"comp_sawblade", "weapon_zs_manhack"} +GM.Assemblies["weapon_zs_megamasher"] = {"comp_propanecan", "weapon_zs_sledgehammer"} +GM.Assemblies["weapon_zs_electrohammer"] = {"comp_electrobattery", "weapon_zs_hammer"} +GM.Assemblies["weapon_zs_novablaster"] = {"comp_basicecore", "weapon_zs_magnum"} +GM.Assemblies["weapon_zs_tithonus"] = {"comp_contaecore", "weapon_zs_oberon"} +GM.Assemblies["weapon_zs_fracture"] = {"comp_pumpaction", "weapon_zs_sawedoff"} +GM.Assemblies["weapon_zs_seditionist"] = {"comp_focusbarrel", "weapon_zs_deagle"} +GM.Assemblies["weapon_zs_molotov"] = {"comp_propanecan", "weapon_zs_glassbottle"} +GM.Assemblies["weapon_zs_blareduct"] = {"trinket_ammovestii", "weapon_zs_pipe"} +GM.Assemblies["weapon_zs_cinderrod"] = {"comp_propanecan", "weapon_zs_blareduct"} +GM.Assemblies["weapon_zs_innervator"] = {"comp_electrobattery", "weapon_zs_jackhammer"} +GM.Assemblies["weapon_zs_hephaestus"] = {"comp_gaussframe", "weapon_zs_tithonus"} +GM.Assemblies["weapon_zs_stabber"] = {"comp_shortblade", "weapon_zs_annabelle"} +GM.Assemblies["weapon_zs_galestorm"] = {"comp_multibarrel", "weapon_zs_uzi"} +GM.Assemblies["weapon_zs_eminence"] = {"trinket_ammovestiii", "weapon_zs_barrage"} +GM.Assemblies["weapon_zs_gladiator"] = {"trinket_ammovestiii", "weapon_zs_sweepershotgun"} +GM.Assemblies["weapon_zs_ripper"] = {"comp_sawblade", "weapon_zs_zeus"} +GM.Assemblies["weapon_zs_avelyn"] = {"trinket_ammovestiii", "weapon_zs_charon"} +GM.Assemblies["weapon_zs_asmd"] = {"comp_precision", "weapon_zs_quasar"} +GM.Assemblies["weapon_zs_enkindler"] = {"comp_launcher", "weapon_zs_cinderrod"} +GM.Assemblies["weapon_zs_proliferator"] = {"comp_linearactuator", "weapon_zs_galestorm"} +GM.Assemblies["trinket_electromagnet"] = {"comp_electrobattery", "trinket_magnet"} +GM.Assemblies["trinket_projguide"] = {"comp_cpuparts", "trinket_targetingvisori"} +GM.Assemblies["trinket_projwei"] = {"comp_busthead", "trinket_projguide"} +GM.Assemblies["trinket_controlplat"] = {"comp_cpuparts", "trinket_mainsuite"} + +GM:AddInventoryItemData("comp_modbarrel", "Modular Barrel", "A modular barrel suited for pairing up with another gun barrel.", "models/props_c17/trappropeller_lever.mdl") +GM:AddInventoryItemData("comp_burstmech", "Burst Fire Mechanism", "A mechanism that could be used to make a gun burst fire.", "models/props_c17/trappropeller_lever.mdl") +GM:AddInventoryItemData("comp_basicecore", "Basic Energy Core", "A small energy core. Needs a weapon with a cylinder mechanism to contain the energy output.", "models/Items/combine_rifle_cartridge01.mdl") +GM:AddInventoryItemData("comp_busthead", "Bust Head", "A bust head that could be fitted on to something handle shaped.", "models/props_combine/breenbust.mdl") +GM:AddInventoryItemData("comp_sawblade", "Saw Blade", "A sharp saw blade ready to be fitted onto fast moving objects.", "models/props_junk/sawblade001a.mdl") +GM:AddInventoryItemData("comp_propanecan", "Propane Canister", "A propane canister. With the correct setup, has the potential to ignite things.", "models/props_junk/propane_tank001a.mdl") +GM:AddInventoryItemData("comp_electrobattery", "Electrobattery", "An electrobattery. Could be used to improve repairing motions.", "models/items/car_battery01.mdl") +--GM:AddInventoryItemData("comp_hungrytether", "Hungry Tether", "A hungry tether from a devourer that comes from a devourer rib.", "models/gibs/HGIBS_rib.mdl")]] +GM:AddInventoryItemData("comp_contaecore", "Contained Energy Core", "A contained energy core, that has an internal charging mechanism.", "models/Items/combine_rifle_cartridge01.mdl") +GM:AddInventoryItemData("comp_pumpaction", "Pump Action Mechanism", "A standard pump action mechanism from a blaster shotgun.", "models/props_c17/trappropeller_lever.mdl") +GM:AddInventoryItemData("comp_focusbarrel", "Focused Barrel", "A large focused barrel made from the barrels of the waraxe. Suitable for a handcannon.", "models/props_c17/trappropeller_lever.mdl") +GM:AddInventoryItemData("comp_gaussframe", "Gauss Frame", "A highly advanced gauss frame. It's almost alien in design, making it hard to use.", "models/Items/combine_rifle_cartridge01.mdl") +GM:AddInventoryItemData("comp_metalpole", "Metal Pole", "Long metal pole that could be used to attack things from a distance.", "models/props_c17/signpole001.mdl") +GM:AddInventoryItemData("comp_salleather", "Salvaged Leather", "Pieces of leather that are hard enough to make a nasty impact.", "models/props_junk/shoe001.mdl") +GM:AddInventoryItemData("comp_gyroscope", "Gyroscope", "A metal gyroscope used to calculate orientation.", "models/maxofs2d/hover_rings.mdl") +GM:AddInventoryItemData("comp_reciever", "Reciever", "A radio reciever. Could be used for automation and communication purposes.", "models/props_lab/reciever01b.mdl") +GM:AddInventoryItemData("comp_cpuparts", "CPU Parts", "Parts from a central processor.", "models/props_lab/harddrive01.mdl") +GM:AddInventoryItemData("comp_launcher", "Launching Tube", "A metal tube made to launch objects.", "models/weapons/w_rocket_launcher.mdl") +GM:AddInventoryItemData("comp_launcherh", "Heavy Launching Tube", "A heavy metal tube made to launch large objects.", "models/weapons/w_rocket_launcher.mdl") +GM:AddInventoryItemData("comp_shortblade", "Short Blade", "A short metal blade for cutting and stabbing.", "models/weapons/w_knife_t.mdl") +GM:AddInventoryItemData("comp_multibarrel", "Multi-Bored Barrel", "An unusual gun barrel which allows multiple bullets to pass through.", "models/props_lab/pipesystem03a.mdl") +GM:AddInventoryItemData("comp_holoscope", "Holographic Scope", "A holographic weapon sight with magnification.", { + ["base"] = { type = "Model", model = "models/props_c17/utilityconnecter005.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.273, 1.728, -0.843), angle = Angle(74.583, 180, 0), size = Vector(2.207, 0.105, 0.316), color = Color(50, 50, 66, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_combine/tprotato1.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0.492, -1.03, 0), angle = Angle(0, -78.715, 90), size = Vector(0.03, 0.02, 0.032), color = Color(50, 50, 66, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal02", skin = 0, bodygroup = {} } +}) +GM:AddInventoryItemData("comp_linearactuator", "Linear Actuator", "A linear actuator from a shell holder. Requires a heavy base to mount properly.", "models/Items/combine_rifle_cartridge01.mdl") +GM:AddInventoryItemData("comp_pulsespool", "Pulse Spool", "Used to inject more pulse power to a system. Could be used to stabilise something.", "models/Items/combine_rifle_cartridge01.mdl") +GM:AddInventoryItemData("comp_flak", "Flak Chamber", "An internal chamber for projecting heated scrap.", "models/weapons/w_rocket_launcher.mdl") +GM:AddInventoryItemData("comp_precision", "Precision Chassis", "A suite setup for rewarding precise shots on moving targets.", "models/Items/combine_rifle_cartridge01.mdl") + +-- Trinkets +local trinket, description, trinketwep +local hpveles = { + ["ammo"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 3.5, 3), angle = Angle(15.194, 80.649, 180), size = Vector(0.6, 0.6, 1.2), color = Color(145, 132, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local hpweles = { + ["ammo"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.5, 2.5, 3), angle = Angle(15.194, 80.649, 180), size = Vector(0.6, 0.6, 1.2), color = Color(145, 132, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local ammoveles = { + ["ammo"] = { type = "Model", model = "models/props/de_prodigy/ammo_can_02.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 3, -0.519), angle = Angle(0, 85.324, 101.688), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local ammoweles = { + ["ammo"] = { type = "Model", model = "models/props/de_prodigy/ammo_can_02.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 2, -1.558), angle = Angle(5.843, 82.986, 111.039), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local mveles = { + ["band++"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "band", pos = Vector(2.599, 1, 1), angle = Angle(0, -25, 0), size = Vector(0.019, 0.15, 0.15), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["band"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 3, -1), angle = Angle(97.013, 29.221, 0), size = Vector(0.045, 0.045, 0.025), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["band+"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "band", pos = Vector(-2.401, -1, 0.5), angle = Angle(0, 155.455, 0), size = Vector(0.019, 0.15, 0.15), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} +local mweles = { + ["band++"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "band", pos = Vector(2.599, 1, 1), angle = Angle(0, -25, 0), size = Vector(0.019, 0.15, 0.15), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["band+"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "band", pos = Vector(-2.401, -1, 0.5), angle = Angle(0, 155.455, 0), size = Vector(0.019, 0.15, 0.15), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} }, + ["band"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.5, 2, -0.5), angle = Angle(111.039, -92.338, 97.013), size = Vector(0.045, 0.045, 0.025), color = Color(55, 52, 51, 255), surpresslightning = false, material = "models/props_pipes/pipemetal001a", skin = 0, bodygroup = {} } +} +local pveles = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.596, 1.557, -2.597), angle = Angle(5.843, 90, 0), size = Vector(0.25, 0.15, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local pweles = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_lock01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 0.5, -2), angle = Angle(5, 90, 0), size = Vector(0.25, 0.15, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local oveles = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.799, 2, -1.5), angle = Angle(5, 180, 0), size = Vector(0.05, 0.039, 0.07), color = Color(196, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local oweles = { + ["perf"] = { type = "Model", model = "models/props_combine/combine_generator01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.799, 2, -1.5), angle = Angle(5, 180, 0), size = Vector(0.05, 0.039, 0.07), color = Color(196, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local develes = { + ["perf"] = { type = "Model", model = "models/props_lab/blastdoor001b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.799, 2.5, -5.715), angle = Angle(5, 180, 0), size = Vector(0.1, 0.039, 0.09), color = Color(168, 155, 0, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} } +} +local deweles = { + ["perf"] = { type = "Model", model = "models/props_lab/blastdoor001b.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 2, -5.715), angle = Angle(0, 180, 0), size = Vector(0.1, 0.039, 0.09), color = Color(168, 155, 0, 255), surpresslightning = false, material = "models/props_pipes/pipeset_metal", skin = 0, bodygroup = {} } +} +local supveles = { + ["perf"] = { type = "Model", model = "models/props_lab/reciever01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.299, 2.5, -2), angle = Angle(5, 180, 92.337), size = Vector(0.2, 0.699, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} +local supweles = { + ["perf"] = { type = "Model", model = "models/props_lab/reciever01c.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 1.5, -2), angle = Angle(5, 180, 92.337), size = Vector(0.2, 0.699, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +-- Health Trinkets +trinket, trinketwep = GM:AddTrinket("Health Package", "vitpackagei", false, hpveles, hpweles, 2, "+10 maximum health\n+5% healing received") +GM:AddSkillModifier(trinket, SKILLMOD_HEALTH, 10) +GM:AddSkillModifier(trinket, SKILLMOD_HEALING_RECEIVED, 0.05) +trinketwep.PermitDismantle = true + +trinket = GM:AddTrinket("Vitality Bank", "vitpackageii", false, hpveles, hpweles, 4, "+21 maximum health\n+6% healing received") +GM:AddSkillModifier(trinket, SKILLMOD_HEALTH, 21) +GM:AddSkillModifier(trinket, SKILLMOD_HEALING_RECEIVED, 0.06) + +trinket, trinketwep = GM:AddTrinket("Blood Transfusion Pack", "bloodpack", false, hpveles, hpweles, 2, "Generates 20 blood armor if health falls bellow 50%\nConsumes itself on activation.", nil, 15) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Blood Package", "cardpackagei", false, hpveles, hpweles, 2, "+10 maximum blood armor") +GM:AddSkillModifier(trinket, SKILLMOD_BLOODARMOR, 10) +trinketwep.PermitDismantle = true + +GM:AddSkillModifier(GM:AddTrinket("Blood Bank", "cardpackageii", false, hpveles, hpweles, 4, "+30 maximum blood armor"), SKILLMOD_BLOODARMOR, 30) + +GM:AddTrinket("Regeneration Implant", "regenimplant", false, hpveles, hpweles, 3, "Heals 1 health every 12 seconds provided no damage was taken recently") + +trinket, trinketwep = GM:AddTrinket("Bio Cleanser", "biocleanser", false, hpveles, hpweles, 2, "Blocks one harmful status effect every 20 seconds") +trinketwep.PermitDismantle = true + +GM:AddSkillModifier(GM:AddTrinket("Cutlery Set", "cutlery", false, hpveles, hpweles, nil, "-80% time to eat food"), SKILLMOD_FOODEATTIME_MUL, -0.8) + +-- Melee Trinkets + +description = "5 hits from fist weapons applies significant leg and arm damage\n-15% time before next unarmed strike" +trinket = GM:AddTrinket("Boxing Training Manual", "boxingtraining", false, mveles, mweles, nil, description) +GM:AddSkillModifier(trinket, SKILLMOD_UNARMED_SWING_DELAY_MUL, -0.15) +GM:AddSkillFunction(trinket, function(pl, active) pl.BoxingTraining = active end) + +trinket, trinketwep = GM:AddTrinket("Momentum Support", "momentumsupsysii", false, mveles, mweles, 2, "-13% melee swing impact delay\n+10% melee knockback") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_SWING_DELAY_MUL, -0.13) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_KNOCKBACK_MUL, 0.1) +trinketwep.PermitDismantle = true + +trinket = GM:AddTrinket("Momentum Scaffold", "momentumsupsysiii", false, mveles, mweles, 3, "-20% melee swing impact delay\n+12% melee knockback") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_SWING_DELAY_MUL, -0.20) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_KNOCKBACK_MUL, 0.12) + +GM:AddSkillModifier(GM:AddTrinket("Hemo-Adrenal Converter I", "hemoadrenali", false, mveles, mweles, nil, "+2% melee damage converted to blood armor."), SKILLMOD_MELEE_DAMAGE_TO_BLOODARMOR_MUL, 0.02) + +trinket = GM:AddTrinket("Hemo-Adrenaline Amplifier", "hemoadrenalii", false, mveles, mweles, 3, "+3% melee damage converted to blood armor\n+30 speed on melee kill for 10 seconds") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_DAMAGE_TO_BLOODARMOR_MUL, 0.03) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_MOVEMENTSPEED_ON_KILL, 30) + +GM:AddSkillModifier(GM:AddTrinket("Hemo-Adrenal Converter II", "hemoadrenaliii", false, mveles, mweles, 4, "+4% melee damage converted to blood armor."), SKILLMOD_MELEE_DAMAGE_TO_BLOODARMOR_MUL, 0.04) + +GM:AddSkillModifier(GM:AddTrinket("Power Gauntlet", "powergauntlet", false, mveles, mweles, 3, "Charges your melee damage up to +45% with each hit\nMissing resets damage"), SKILLMOD_MELEE_POWERATTACK_MUL, 0.45) + +GM:AddTrinket("Finesse Kit", "sharpkit", false, mveles, mweles, 2, "Deal up to +32% melee damage to slowed zombies") + +GM:AddTrinket("Sharp Stone", "sharpstone", false, mveles, mweles, 3, "+5% melee damage") + +-- Performance Trinkets +GM:AddTrinket("Oxygen Tank", "oxygentank", true, nil, { + ["base"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 3, -1), angle = Angle(180, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}, nil, "10x breathing time underwater.", "oxygentank") + +GM:AddSkillModifier(GM:AddTrinket("Acrobat Frame", "acrobatframe", false, pveles, pweles, nil, "+8% jump power."), SKILLMOD_JUMPPOWER_MUL, 0.08) + +trinket = GM:AddTrinket("Night Vision Goggles", "nightvision", true, pveles, pweles, 2, "-50% effect of dim vision and ability to see in the dark\n-40% effect of vision affecting effects\n-45% fright duration") +GM:AddSkillModifier(trinket, SKILLMOD_DIMVISION_EFF_MUL, -0.5) +GM:AddSkillModifier(trinket, SKILLMOD_FRIGHT_DURATION_MUL, -0.45) +GM:AddSkillModifier(trinket, SKILLMOD_VISION_ALTER_DURATION_MUL, -0.4) +GM:AddSkillFunction(trinket, function(pl, active) + if CLIENT and pl == MySelf and GAMEMODE.m_NightVision and not active then + surface.PlaySound("items/nvg_off.wav") + GAMEMODE.m_NightVision = false + end +end) +trinketwep.PermitDismantle = true + +trinket = GM:AddTrinket("Portable Weapons Satchel", "portablehole", false, pveles, pweles, nil, "+15% weapon switch speed\n+3% reload speed") +GM:AddSkillModifier(trinket, SKILLMOD_DEPLOYSPEED_MUL, 0.15) +GM:AddSkillModifier(trinket, SKILLMOD_RELOADSPEED_MUL, 0.03) + +trinket = GM:AddTrinket("Agility Magnifier", "pathfinder", false, pveles, pweles, 2, "+40% barricade phasing movement speed\n-45% sigil teleportation time\n+13% jump power") +GM:AddSkillModifier(trinket, SKILLMOD_BARRICADE_PHASE_SPEED_MUL, 0.4) +GM:AddSkillModifier(trinket, SKILLMOD_SIGIL_TELEPORT_MUL, -0.45) +GM:AddSkillModifier(trinket, SKILLMOD_JUMPPOWER_MUL, 0.13) + +trinket = GM:AddTrinket("Galvanizer Implant", "analgestic", false, pveles, pweles, 3, "-50% low health slow intensity\n-50% slow vulnerability\n-50% knockdown time\n-66% duration of pulling attacks\n+25% weapon switch speed") +GM:AddSkillModifier(trinket, SKILLMOD_SLOW_EFF_TAKEN_MUL, -0.50) +GM:AddSkillModifier(trinket, SKILLMOD_LOW_HEALTH_SLOW_MUL, -0.50) +GM:AddSkillModifier(trinket, SKILLMOD_KNOCKDOWN_RECOVERY_MUL, -0.5) +GM:AddSkillModifier(trinket, SKILLMOD_DEPLOYSPEED_MUL, 0.25) + +GM:AddSkillModifier(GM:AddTrinket("Ammo Vest", "ammovestii", false, ammoveles, ammoweles, 2, "+5% reload speed"), SKILLMOD_RELOADSPEED_MUL, 0.05) +GM:AddSkillModifier(GM:AddTrinket("Ammo Bandolier", "ammovestiii", false, ammoveles, ammoweles, 4, "+12% reload speed"), SKILLMOD_RELOADSPEED_MUL, 0.12) + +GM:AddTrinket("Automated Reloader", "autoreload", false, ammoveles, ammoweles, 2, "Reloads one weapon you switched away from 4 seconds ago automatically") + +-- Offensive Implants +GM:AddSkillModifier(GM:AddTrinket("Targeting Visor", "targetingvisori", false, oveles, oweles, nil, "+5% tighter aiming reticule."), SKILLMOD_AIMSPREAD_MUL, -0.05) + +GM:AddSkillModifier(GM:AddTrinket("Targeting Unifier", "targetingvisoriii", false, oveles, oweles, 4, "+11% tighter aiming reticule."), SKILLMOD_AIMSPREAD_MUL, -0.11) + +GM:AddTrinket("Refined Subscope", "refinedsub", false, oveles, oweles, 4, "+27% tighter aiming reticule with tier 3 or lower weapons") + +trinket = GM:AddTrinket("Aim Compensator", "aimcomp", false, oveles, oweles, 3, "-52% reduced effect of aim shake effects\n+5% tighter aiming reticule\nZombies you look at have an indicator showing their health") +GM:AddSkillModifier(trinket, SKILLMOD_AIMSPREAD_MUL, -0.05) +GM:AddSkillModifier(trinket, SKILLMOD_AIM_SHAKE_MUL, -0.52) +GM:AddSkillFunction(trinket, function(pl, active) pl.TargetLocus = active end) + +GM:AddSkillModifier(GM:AddTrinket("Pulse Booster", "pulseampi", false, oveles, oweles, nil, "+14% slow from pulse weapons and stun batons"), SKILLMOD_PULSE_WEAPON_SLOW_MUL, 0.14) + +trinket = GM:AddTrinket("Pulse Infuser", "pulseampii", false, oveles, oweles, 3, "+20% slow from pulse weapons and stun batons\n+7% explosion radius") +GM:AddSkillModifier(trinket, SKILLMOD_PULSE_WEAPON_SLOW_MUL, 0.2) +GM:AddSkillModifier(trinket, SKILLMOD_EXP_DAMAGE_RADIUS, 0.07) + +trinket = GM:AddTrinket("Resonance Cascade Device", "resonance", false, oveles, oweles, 4, "Dealing enough pulse damage will cause a pulse explosion\n-25% slow from pulse weapons and stun batons") +GM:AddSkillModifier(trinket, SKILLMOD_PULSE_WEAPON_SLOW_MUL, -0.25) + +trinket = GM:AddTrinket("Cryogenic Inductor", "cryoindu", false, oveles, oweles, 4, "Ice based weapons have a chance to shatter zombies based on how much health they have") + +trinket = GM:AddTrinket("Extended Magazine", "extendedmag", false, oveles, oweles, 3, "Increases the clip size of weapons with 8 or more clip size by +15%") + +trinket = GM:AddTrinket("Pulse Impedance Module", "pulseimpedance", false, oveles, oweles, 5, "Slow from pulse weapons and stun batons also slow zombie attack speed\n+24% slow from pulse weapons and stun batons") +GM:AddSkillFunction(trinket, function(pl, active) pl.PulseImpedance = active end) +GM:AddSkillModifier(trinket, SKILLMOD_PULSE_WEAPON_SLOW_MUL, 0.24) + +trinket = GM:AddTrinket("Curb Stompers", "curbstompers", false, oveles, oweles, 2, "Instantly kills headcrabs and deals 50 damage to torso classes you land on\nDeals 500% fall damage to zombies landed on\nNo fall damage taken when landing on zombies\n-25% slow down from landing or fall damage") +GM:AddSkillModifier(trinket, SKILLMOD_FALLDAMAGE_SLOWDOWN_MUL, -0.25) + +GM:AddTrinket("Superior Assembly", "supasm", false, oveles, oweles, 5, "Increases to weapon damage via remantling affect reload speed on tier 2 or lower weapons") + +trinket = GM:AddTrinket("Olympian Frame", "olympianframe", false, oveles, oweles, 2, "+100% object throwing strength\n-25% prop carrying slow down\n-35% movement speed reduction with heavy weapons") +GM:AddSkillModifier(trinket, SKILLMOD_PROP_THROW_STRENGTH_MUL, 1) +GM:AddSkillModifier(trinket, SKILLMOD_PROP_CARRY_SLOW_MUL, -0.25) +GM:AddSkillModifier(trinket, SKILLMOD_WEAPON_WEIGHT_SLOW_MUL, -0.35) + +-- Defensive Trinkets +trinket, trinketwep = GM:AddTrinket("Kevlar Underlay", "kevlar", false, develes, deweles, 2, "-11% melee damage taken\n-11% projectile damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_DAMAGE_TAKEN_MUL, -0.11) +GM:AddSkillModifier(trinket, SKILLMOD_PROJECTILE_DAMAGE_TAKEN_MUL, -0.11) +trinketwep.PermitDismantle = true + +trinket = GM:AddTrinket("Barbed Armor", "barbedarmor", false, develes, deweles, 3, "100% of melee damage taken reflected back to melee attackers\nAdditional 14 damage reflected back to melee attackers\nMelee attackers take 14 arm damage\n-4% melee damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_ATTACKER_DMG_REFLECT, 14) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_ATTACKER_DMG_REFLECT_PERCENT, 1) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_DAMAGE_TAKEN_MUL, -0.04) + +trinket = GM:AddTrinket("Antitoxin Package", "antitoxinpack", false, develes, deweles, 2, "-17% poison damage taken\n-40% poison damage over time speed") +GM:AddSkillModifier(trinket, SKILLMOD_POISON_DAMAGE_TAKEN_MUL, -0.17) +GM:AddSkillModifier(trinket, SKILLMOD_POISON_SPEED_MUL, -0.4) + +trinket = GM:AddTrinket("Hemostasis Implant", "hemostasis", false, develes, deweles, 2, "-30% bleed damage taken\n-60% bleeding speed.") +GM:AddSkillModifier(trinket, SKILLMOD_BLEED_DAMAGE_TAKEN_MUL, -0.3) +GM:AddSkillModifier(trinket, SKILLMOD_BLEED_SPEED_MUL, -0.6) + +trinket = GM:AddTrinket("EOD Vest", "eodvest", false, develes, deweles, 4, "-35% explosive damage taken\n-50% fire damage taken\n-5% self damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_EXP_DAMAGE_TAKEN_MUL, -0.35) +GM:AddSkillModifier(trinket, SKILLMOD_FIRE_DAMAGE_TAKEN_MUL, -0.50) +GM:AddSkillModifier(trinket, SKILLMOD_SELF_DAMAGE_MUL, -0.05) + +trinket = GM:AddTrinket("Feather Fall Frame", "featherfallframe", false, develes, deweles, 3, "-35% fall damage taken\n+30% fall damage threshold\n-65% slow down from landing or fall damage") +GM:AddSkillModifier(trinket, SKILLMOD_FALLDAMAGE_DAMAGE_MUL, -0.35) +GM:AddSkillModifier(trinket, SKILLMOD_FALLDAMAGE_THRESHOLD_MUL, 0.30) +GM:AddSkillModifier(trinket, SKILLMOD_FALLDAMAGE_SLOWDOWN_MUL, -0.65) + +local eicev = { + ["base"] = { type = "Model", model = "models/gibs/glass_shard04.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.339, 2.697, -2.309), angle = Angle(4.558, -34.502, -72.395), size = Vector(0.5, 0.5, 0.5), color = Color(0, 137, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +} + +local eicew = { + ["base"] = { type = "Model", model = "models/gibs/glass_shard04.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.556, 2.519, -1.468), angle = Angle(0, -5.844, -75.974), size = Vector(0.5, 0.5, 0.5), color = Color(0, 137, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +} + +GM:AddTrinket("Iceburst Shield", "iceburst", false, eicev, eicew, nil, "Releases an ice burst when taking a melee hit, slowing zombies down\nRecharges every 40 seconds") + +GM:AddSkillModifier(GM:AddTrinket("Force Dampening Field Emitter", "forcedamp", false, develes, deweles, 2, "-33% physics impact damage taken\nImmune to knockdowns from props\nTake normal physics damage from shades."), SKILLMOD_PHYSICS_DAMAGE_TAKEN_MUL, -0.33) + +GM:AddSkillFunction(GM:AddTrinket("Necrotic Senses Distorter", "necrosense", false, develes, deweles, 2, "Hides aura from zombies in close proximity"), function(pl, active) pl:SetDTBool(DT_PLAYER_BOOL_NECRO, active) end) + +trinket, trinketwep = GM:AddTrinket("Reactive Flasher", "reactiveflasher", false, develes, deweles, 2, "Blinds and disorients melee attacker for 2 seconds\nRecharges every 75 seconds") +trinketwep.PermitDismantle = true + +trinket = GM:AddTrinket("Composite Underlay", "composite", false, develes, deweles, 4, "-16% melee damage taken\n-16% projectile damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_DAMAGE_TAKEN_MUL, -0.16) +GM:AddSkillModifier(trinket, SKILLMOD_PROJECTILE_DAMAGE_TAKEN_MUL, -0.16) + +-- Support Trinkets +trinket, trinketwep = GM:AddTrinket("Arsenal Pack", "arsenalpack", false, { + ["base"] = { type = "Model", model = "models/Items/item_item_crate.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.35, 0.35, 0.35), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}, { + ["base"] = { type = "Model", model = "models/Items/item_item_crate.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.35, 0.35, 0.35), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}, 4, "Allows nearby humans to purchase from the arsenal menu.", "arsenalpack", 3) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Resupply Pack", "resupplypack", true, nil, { + ["base"] = { type = "Model", model = "models/Items/ammocrate_ar2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, -1), angle = Angle(0, -90, 180), size = Vector(0.35, 0.35, 0.35), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +}, 4, "Allows humans to resupply from you\nPress LMB with the pack in your hand to resupply yourself.", "resupplypack", 3) +trinketwep.PermitDismantle = true + +GM:AddTrinket("Magnet", "magnet", true, supveles, supweles, nil, "Slowly pulls ammo and weapons towards you\nMust be equipped to take effect", "magnet") +GM:AddTrinket("Electromagnet", "electromagnet", true, supveles, supweles, nil, "Pulls ammo and weapons towards you quickly\nMust be equipped to take effect", "magnet_electro") + +trinket, trinketwep = GM:AddTrinket("Loading Exoskeleton", "loadingex", false, supveles, supweles, 2, "-55% prop carrying slow down\n-20% deployable pack time") +GM:AddSkillModifier(trinket, SKILLMOD_PROP_CARRY_SLOW_MUL, -0.55) +GM:AddSkillModifier(trinket, SKILLMOD_DEPLOYABLE_PACKTIME_MUL, -0.2) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Blueprints", "blueprintsi", false, supveles, supweles, 2, "+10% repair rate") +GM:AddSkillModifier(trinket, SKILLMOD_REPAIRRATE_MUL, 0.1) +trinketwep.PermitDismantle = true + +GM:AddSkillModifier(GM:AddTrinket("Advanced Blueprints", "blueprintsii", false, supveles, supweles, 4, "+20% repair rate"), SKILLMOD_REPAIRRATE_MUL, 0.2) + +trinket, trinketwep = GM:AddTrinket("Medical Processor", "processor", false, supveles, supweles, 2, "-5% medic kit cooldown\n-10% medic tool fire delay\nReprocess food into medical ammo with right click") +GM:AddSkillModifier(trinket, SKILLMOD_MEDKIT_COOLDOWN_MUL, -0.05) +GM:AddSkillModifier(trinket, SKILLMOD_MEDGUN_FIRE_DELAY_MUL, -0.1) + +trinket = GM:AddTrinket("Curative Kit", "curativeii", false, supveles, supweles, 3, "-10% medic kit cooldown\n-20% medic tool fire delay") +GM:AddSkillModifier(trinket, SKILLMOD_MEDKIT_COOLDOWN_MUL, -0.1) +GM:AddSkillModifier(trinket, SKILLMOD_MEDGUN_FIRE_DELAY_MUL, -0.2) + +trinket = GM:AddTrinket("Remedial Booster", "remedy", false, supveles, supweles, 3, "+8% medic tool effectiveness") +GM:AddSkillModifier(trinket, SKILLMOD_MEDKIT_EFFECTIVENESS_MUL, 0.08) + +trinket = GM:AddTrinket("Maintenance Suite", "mainsuite", false, supveles, supweles, 2, "+10% zapper and repair field range\n-7% zapper and repair field delay\n+10% turret range") +GM:AddSkillModifier(trinket, SKILLMOD_FIELD_RANGE_MUL, 0.1) +GM:AddSkillModifier(trinket, SKILLMOD_FIELD_DELAY_MUL, -0.07) +GM:AddSkillModifier(trinket, SKILLMOD_TURRET_RANGE_MUL, 0.1) + +trinket = GM:AddTrinket("Control Platform", "controlplat", false, supveles, supweles, 2, "+15% controllable health\n+15% controllable speed\n+20% manhack damage") +GM:AddSkillModifier(trinket, SKILLMOD_CONTROLLABLE_HEALTH_MUL, 0.15) +GM:AddSkillModifier(trinket, SKILLMOD_CONTROLLABLE_SPEED_MUL, 0.15) +GM:AddSkillModifier(trinket, SKILLMOD_MANHACK_DAMAGE_MUL, 0.2) + +trinket = GM:AddTrinket("Projectile Guidance", "projguide", false, supveles, supweles, 2, "+25% projectile speed") +GM:AddSkillModifier(trinket, SKILLMOD_PROJ_SPEED, 0.25) + +trinket = GM:AddTrinket("Projectile Weight", "projwei", false, supveles, supweles, 2, "-50% projectile speed\n+5% projectile damage") +GM:AddSkillModifier(trinket, SKILLMOD_PROJ_SPEED, -0.5) +GM:AddSkillModifier(trinket, SKILLMOD_PROJECTILE_DAMAGE_MUL, 0.05) + +local ectov = { + ["base"] = { type = "Model", model = "models/props_junk/glassjug01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.381, 2.617, 2.062), angle = Angle(180, 12.243, 0), size = Vector(0.6, 0.6, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 4.07), angle = Angle(180, 12.243, 0), size = Vector(0.123, 0.123, 0.085), color = Color(0, 0, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +} + +local ectow = { + ["base"] = { type = "Model", model = "models/props_junk/glassjug01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.506, 1.82, 1.758), angle = Angle(-164.991, 19.691, 8.255), size = Vector(0.6, 0.6, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, + ["base+"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 4.07), angle = Angle(180, 12.243, 0), size = Vector(0.123, 0.123, 0.085), color = Color(0, 0, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +} + +trinket = GM:AddTrinket("Reactive Chemicals", "reachem", false, ectov, ectow, 3, "+30% explosive damage taken\n+10% explosive damage radius") +GM:AddSkillModifier(trinket, SKILLMOD_EXP_DAMAGE_TAKEN_MUL, 0.3) +GM:AddSkillModifier(trinket, SKILLMOD_EXP_DAMAGE_RADIUS, 0.1) + +trinket = GM:AddTrinket("Operations Matrix", "opsmatrix", false, supveles, supweles, 4, "+15% zapper and repair field range\n-13% zapper and repair field delay\n+15% turret range") +GM:AddSkillModifier(trinket, SKILLMOD_FIELD_RANGE_MUL, 0.15) +GM:AddSkillModifier(trinket, SKILLMOD_FIELD_DELAY_MUL, -0.13) +GM:AddSkillModifier(trinket, SKILLMOD_TURRET_RANGE_MUL, 0.15) + +GM:AddSkillModifier(GM:AddTrinket("Acquisitions Manifest", "acqmanifest", false, supveles, supweles, 2, "-6% resupply delay time"), SKILLMOD_RESUPPLY_DELAY_MUL, -0.06) +GM:AddSkillModifier(GM:AddTrinket("Procurement Manifest", "promanifest", false, supveles, supweles, 4, "-9% resupply delay time"), SKILLMOD_RESUPPLY_DELAY_MUL, -0.09) + +-- Boss Trinkets + +local blcorev = { + ["black_core_2+"] = { type = "Sprite", sprite = "effects/splashwake1", bone = "ValveBiped.Bip01_Spine4", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 10, y = 10 }, color = Color(0, 0, 0, 255), nocull = false, additive = false, vertexalpha = true, vertexcolor = true, ignorez = true}, + ["black_core"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Grenade_body", rel = "", pos = Vector(0, 0.5, -1.701), angle = Angle(0, 0, 0), size = Vector(0.349, 0.349, 0.349), color = Color(20, 20, 20, 255), surpresslightning = false, material = "models/shiny", skin = 0, bodygroup = {} }, + ["black_core_2"] = { type = "Sprite", sprite = "effects/splashwake3", bone = "ValveBiped.Bip01_Spine4", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 7.697, y = 7.697 }, color = Color(0, 0, 0, 255), nocull = false, additive = false, vertexalpha = true, vertexcolor = true, ignorez = true} +} + +local blcorew = { + ["black_core_2"] = { type = "Sprite", sprite = "effects/splashwake3", bone = "ValveBiped.Bip01_R_Hand", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 7.697, y = 7.697 }, color = Color(0, 0, 0, 255), nocull = false, additive = false, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["black_core_2+"] = { type = "Sprite", sprite = "effects/splashwake1", bone = "ValveBiped.Bip01_R_Hand", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 10, y = 10 }, color = Color(0, 0, 0, 255), nocull = false, additive = false, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["black_core"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, 0), angle = Angle(0, 0, 0), size = Vector(0.349, 0.349, 0.349), color = Color(20, 20, 20, 255), surpresslightning = false, material = "models/shiny", skin = 0, bodygroup = {} } +} + +GM:AddTrinket("Bleak Soul", "bleaksoul", false, blcorev, blcorew, nil, "Blinds and knocks zombies away when attacked\nRecharges every 35 seconds") + +trinket = GM:AddTrinket("Spirit Essence", "spiritess", false, nil, { + ["black_core_2"] = { type = "Sprite", sprite = "effects/splashwake3", bone = "ValveBiped.Bip01_R_Hand", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 7.697, y = 7.697 }, color = Color(255, 255, 255, 255), nocull = false, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["black_core_2+"] = { type = "Sprite", sprite = "effects/splashwake1", bone = "ValveBiped.Bip01_R_Hand", rel = "black_core", pos = Vector(0, 0.1, -0.201), size = { x = 10, y = 10 }, color = Color(255, 255, 255, 255), nocull = false, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}, + ["black_core"] = { type = "Model", model = "models/dav0r/hoverball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4, 2, 0), angle = Angle(0, 0, 0), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/shiny", skin = 0, bodygroup = {} } +}, nil, "+10% jump height.") +GM:AddSkillModifier(trinket, SKILLMOD_JUMPPOWER_MUL, 0.13) + +-- Starter Trinkets + +trinket, trinketwep = GM:AddTrinket("Armband", "armband", false, mveles, mweles, nil, "-10% melee swing impact delay\n-6% melee damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_SWING_DELAY_MUL, -0.1) +GM:AddSkillModifier(trinket, SKILLMOD_MELEE_DAMAGE_TAKEN_MUL, -0.06) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Condiments", "condiments", false, supveles, supweles, nil, "+20% recovery from food\n-20% time to eat food") +GM:AddSkillModifier(trinket, SKILLMOD_FOODRECOVERY_MUL, 0.20) +GM:AddSkillModifier(trinket, SKILLMOD_FOODEATTIME_MUL, -0.20) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Escape Manual", "emanual", false, develes, deweles, nil, "+20% phasing speed\n-12% low health slow intensity") +GM:AddSkillModifier(trinket, SKILLMOD_BARRICADE_PHASE_SPEED_MUL, 0.20) +GM:AddSkillModifier(trinket, SKILLMOD_LOW_HEALTH_SLOW_MUL, -0.12) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Aiming Aid", "aimaid", false, develes, deweles, nil, "+5% tighter aiming reticule\n-7% reduced effect of aim shake effects") +GM:AddSkillModifier(trinket, SKILLMOD_AIMSPREAD_MUL, -0.05) +GM:AddSkillModifier(trinket, SKILLMOD_AIM_SHAKE_MUL, -0.06) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Vitamin Capsules", "vitamins", false, hpveles, hpweles, nil, "+5 maximum health\n-12% poison damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_HEALTH, 5) +GM:AddSkillModifier(trinket, SKILLMOD_POISON_DAMAGE_TAKEN_MUL, -0.12) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Welfare Shield", "welfare", false, hpveles, hpweles, nil, "-5% resupply delay\n-7% self damage taken") +GM:AddSkillModifier(trinket, SKILLMOD_RESUPPLY_DELAY_MUL, -0.05) +GM:AddSkillModifier(trinket, SKILLMOD_SELF_DAMAGE_MUL, -0.07) +trinketwep.PermitDismantle = true + +trinket, trinketwep = GM:AddTrinket("Chemistry Set", "chemistry", false, hpveles, hpweles, nil, "+6% medic tool effectiveness\n+12% cloud bomb time") +GM:AddSkillModifier(trinket, SKILLMOD_MEDKIT_EFFECTIVENESS_MUL, 0.06) +GM:AddSkillModifier(trinket, SKILLMOD_CLOUD_TIME, 0.12) +trinketwep.PermitDismantle = true diff --git a/gamemodes/zombiesurvival/gamemode/itemstocks/cl_stock.lua b/gamemodes/zombiesurvival/gamemode/itemstocks/cl_stock.lua new file mode 100644 index 0000000..f301c62 --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/itemstocks/cl_stock.lua @@ -0,0 +1,12 @@ +include("sh_stock.lua") + +function GM:ClearItemStocks() + self.ItemStocks = {} +end + +net.Receive("zs_itemstock", function(length) + local itemid = net.ReadString() + local stock = net.ReadInt(16) + + GAMEMODE.ItemStocks[itemid] = stock +end) diff --git a/gamemodes/zombiesurvival/gamemode/itemstocks/sh_stock.lua b/gamemodes/zombiesurvival/gamemode/itemstocks/sh_stock.lua new file mode 100644 index 0000000..84d8bfb --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/itemstocks/sh_stock.lua @@ -0,0 +1,19 @@ +GM.ItemStocks = {} + +function GM:GetItemStocks(itemid) + if self.ItemStocks[itemid] then + return self.ItemStocks[itemid] + end + + local item = FindItem(itemid) + if item and item.MaxStock then + return item.MaxStock + end + + return -1 +end + +function GM:HasItemStocks(itemid) + local stock = self:GetItemStocks(itemid) + return stock > 0 or stock == -1 +end diff --git a/gamemodes/zombiesurvival/gamemode/itemstocks/sv_stock.lua b/gamemodes/zombiesurvival/gamemode/itemstocks/sv_stock.lua new file mode 100644 index 0000000..6de4c4e --- /dev/null +++ b/gamemodes/zombiesurvival/gamemode/itemstocks/sv_stock.lua @@ -0,0 +1,42 @@ +include("sh_stock.lua") + +AddCSLuaFile("cl_stock.lua") +AddCSLuaFile("sh_stock.lua") + +function GM:SetItemStocks(itemid, stock) + self.ItemStocks[itemid] = stock + + self:SendItemStocks(itemid) +end + +function GM:AddItemStocks(itemid, stock) + local currentstock = self:GetItemStocks(itemid) + if currentstock ~= -1 then + self:SetItemStocks(itemid, math.max(currentstock + stock, 0)) + end +end + +function GM:RefreshItemStocks(pl) + for k in pairs(self.ItemStocks) do + self:SendItemStocks(pl) + end +end + +function GM:SendItemStocks(itemid, pl) + net.Start("zs_itemstock") + net.WriteString(tostring(itemid)) + net.WriteInt(self:GetItemStocks(itemid), 16) + if pl then + net.Send(pl) + else + net.Send(team.GetPlayers(TEAM_HUMAN)) + end +end + +function GM:ClearItemStocks(nosend) + self.ItemStocks = {} + + if not nosend then + self:RefreshItemStocks() + end +end diff --git a/gamemodes/zombiesurvival/gamemode/languages/english.lua b/gamemodes/zombiesurvival/gamemode/languages/english.lua index c76c1c4..e69ddb0 100644 --- a/gamemodes/zombiesurvival/gamemode/languages/english.lua +++ b/gamemodes/zombiesurvival/gamemode/languages/english.lua @@ -25,12 +25,18 @@ LANGUAGE.infliction_reached = "%d%% of humans have died!" LANGUAGE.x_unlocked = "%s unlocked!" LANGUAGE.disconnect_killed = "%s was disconnect killed by %s." LANGUAGE.nail_removed_by = "%s removed a nail belonging to %s." -LANGUAGE.banned_for_life_warning = "You're banned for life so you can't purchase anything!" +LANGUAGE.banned_for_life_warning = "You have the Banned for Life skill active so you can't purchase anything!" +LANGUAGE.late_buyer_warning = "You have the Late Buyer skill active so you can't purchase anything until the second half!" +LANGUAGE.late_buyer_finished = "The late buyer period has finished. You can now purchase items from the arsenal." LANGUAGE.need_to_be_near_arsenal_crate = "You need to be near an Arsenal Crate to purchase items!" +LANGUAGE.need_to_be_near_remantler = "You need to be near a Remantler!" LANGUAGE.cant_purchase_right_now = "You can't purchase anything right now." LANGUAGE.dont_have_enough_points = "You don't have enough points." +LANGUAGE.need_to_have_enough_scrap = "You don't have enough scrap." +LANGUAGE.cannot_dismantle = "You cannot dismantle this item." LANGUAGE.prepare_yourself = "Prepare yourself..." LANGUAGE.purchased_x_for_y_points = "Purchased %s for %d points!" +LANGUAGE.created_x_for_y_scrap = "Created %s for %d scrap!" LANGUAGE.give_time_before_suicide = "Give others time to spawn before suiciding." LANGUAGE.no_spare_ammo_to_give = "No spare ammo to give!" LANGUAGE.no_person_in_range = "No person in range!" @@ -38,13 +44,20 @@ LANGUAGE.that_life = "That life..." LANGUAGE.x_damage_to_barricades = "%d damage to barricades" LANGUAGE.x_damage_to_humans = "%d damage to humans" LANGUAGE.x_brains_eaten = "%d brains eaten" + LANGUAGE.press_jump_to_free_roam = "Press JUMP to free roam" LANGUAGE.press_rmb_to_cycle_targets = "Press RMB to cycle targets" LANGUAGE.press_lmb_to_spawn_on_them = "Press LMB to spawn on them" -LANGUAGE.press_lmb_to_spawn = "Press LMB to spawn" +LANGUAGE.press_lmb_to_spawn = "Press LMB to spawn randomly" +LANGUAGE.press_reload_to_spawn_far = "Press RELOAD to spawn far away from survivors" +LANGUAGE.press_alt_nest_menu = "Press ALT to open the nest menu/spawn on minions" LANGUAGE.press_reload_to_spawn_at_normal_point = "Press RELOAD to spawn at a normal spawn point" -LANGUAGE.press_walk_to_spawn_as_x = "Press WALK to spawn as a %s" +LANGUAGE.press_walk_to_spawn_as_x = "Press %s to spawn as a %s" +LANGUAGE.press_rmb_to_spawn_close = "Press RMB to spawn close to survivors" +LANGUAGE.press_left_and_right_to_cycle_targets = "Press STRAFE LEFT and STRAFE RIGHT to cycle targets" + LANGUAGE.observing_x = "Observing %s (%d)" +LANGUAGE.observing_x_simple = "Observing %s" LANGUAGE.waiting_for_next_wave = "Waiting for the next wave to begin..." LANGUAGE.impossible = "Impossible." LANGUAGE.trying_to_put_nails_in_glass = "Trying to put nails in glass is a silly thing to do." @@ -61,6 +74,7 @@ LANGUAGE.you_decide_to_leave_some = "You decide to leave some for your team. LANGUAGE.you_cant_purchase_now = "You can't purchase items right now." LANGUAGE.no_ammo_here = "There's no ammo here right now." LANGUAGE.you_redeemed = "You have redeemed!" +LANGUAGE.x_redeemed = "%s has redeemed!" LANGUAGE.kill_the_last_human = "Kill the last human!" LANGUAGE.kick_the_last_human = "Kick the last human!" LANGUAGE.you_are_the_last_human = "YOU ARE THE LAST HUMAN!" @@ -75,10 +89,13 @@ LANGUAGE.final_wave_sub = "ALL classes unlocked and the chance for redemp LANGUAGE.wave_x_has_begun = "Wave %d has begun!" LANGUAGE.x_unlocked = "%s unlocked!" LANGUAGE.wave_x_is_over = "Wave %d is over!" -LANGUAGE.wave_x_is_over_sub = "The Undead have stopped rising and the Points Shop is %d%% off." +LANGUAGE.wave_x_is_over_sub = "The Undead have stopped rising." +LANGUAGE.points_for_surviving = "You've gained %d points for surviving." +LANGUAGE.scrap_for_surviving = "You've gained %d scrap for surviving." LANGUAGE.you_are_x = "You are %s!" LANGUAGE.x_has_risen_as_y = "%s has risen as %s!!" -LANGUAGE.x_has_risen = "%s has risen!" +LANGUAGE.x_has_risen = "A boss zombie has risen!" +LANGUAGE.x_has_been_slain_as_y = "%s has been slain as %s!" LANGUAGE.cant_use_worth_anymore = "You can't use the Worth menu any more!" LANGUAGE.class_not_unlocked_will_be_unlocked_x = "That class is not unlocked yet. It will be unlocked at the start of wave %d." LANGUAGE.you_are_already_a_x = "You are already a %s." @@ -89,7 +106,7 @@ LANGUAGE.escape_from_the_zombies = "Escape from the zombies!" LANGUAGE.too_close_to_another_nail = "Too close to another nail." LANGUAGE.object_too_damaged_to_be_used = "That object is too damaged to be used anymore." LANGUAGE.thanks_for_being_a_fan_of_zs = "Thanks for being a fan of Zombie Survival!" -LANGUAGE.cant_remove_nails_of_superior_player = "You can't remove the nails of a player doing so much better than you." +LANGUAGE.cant_remove_nails_of_superior_player = "You can't remove the nails of a player with the barricade expert skill because you don't also have the skill." LANGUAGE.x_turned_on_noclip = "%s turned on noclip." LANGUAGE.x_turned_off_noclip = "%s turned off noclip." LANGUAGE.unlocked_on_wave_x = "Unlocked on wave %d" @@ -98,6 +115,7 @@ LANGUAGE.points_x = "Points: %s" LANGUAGE.next_wave_in_x = "Next wave in %s" LANGUAGE.wave_ends_in_x = "Wave ends in %s" LANGUAGE.wave_x_of_y = "Wave %d of %d" +LANGUAGE.round_x_of_y = "Round %d of %d" LANGUAGE.zombie_invasion_in_x = "Zombie invasion in %s" LANGUAGE.intermission = "Intermission" LANGUAGE.press_f2_for_the_points_shop = "Press F2 for the Points Shop!" @@ -116,6 +134,7 @@ LANGUAGE.ze_humans_are_frozen_until_x = "Humans are frozen until %d seconds b LANGUAGE.loading = "Loading..." LANGUAGE.next_round_in_x = "Next round in: %s" LANGUAGE.warning = "Warning!" +LANGUAGE.ready = "Ready" LANGUAGE.ok_and_no_reminder = "OK and don't pop this message up anymore" LANGUAGE.classic_mode_warning = "This server is running Zombie Survival in 'Classic Mode'\nClassic Mode is a setting which greatly alters gameplay. Things that are changed:\n* No selection of zombie classes. Everyone uses the Classic Zombie class\n* No barricading tools such as nailing or turrets\n* More but faster waves\n\nThis is NOT original Zombie Survival!\n\n-- Servers which run classic mode will display CLASSIC MODE in the bottom left of the screen --" LANGUAGE.classic_mode = "CLASSIC MODE" @@ -136,20 +155,71 @@ LANGUAGE.nest_destroyed = "A Flesh Creeper nest has been destroyed." LANGUAGE.wait_x_seconds_before_making_a_new_nest = "You must wait %d more seconds before creating a new nest." LANGUAGE.too_close_to_a_human = "Too close to a human!" LANGUAGE.too_close_to_a_spawn = "Too close to a zombie spawn!" ---LANGUAGE.nest_already_being_built = "This nest is already being built by someone else!" +LANGUAGE.too_close_to_uncorrupt = "Too close to an uncorrupted sigil!" LANGUAGE.x_has_built_this_nest_and_is_still_around = "%s has built this nest and is still around, so you can't demolish it." LANGUAGE.no_other_nests = "You can't destroy a nest if only one remains." +LANGUAGE.there_are_too_many_nests = "There are too many nests so you can't build any more!" +LANGUAGE.you_have_made_too_many_nests = "You've already created enough nests. Demolish one and try again." LANGUAGE.no_free_channel = "Radio interference from too many already being placed!" +LANGUAGE.tier_x_items_unlock_at_wave_y = "Tier %d items unlock at wave %d" +LANGUAGE.tier_x_items = "Tier %d items" +LANGUAGE.humans_furthest_from_sigils_are_zombies = "The humans furthest from a Sanity Sigil will start as zombies." +LANGUAGE.out_of_stock = "That item is out of stock!" +LANGUAGE.obtained_x_y_ammo = "Obtained %d %s ammo" +LANGUAGE.gave_x_y_ammo_to_z = "Gave %d %s ammo to %s" +LANGUAGE.obtained_x_y_ammo_from_z = "Obtained %d %s ammo from %s" +LANGUAGE.healed_x_by_y = "%s healed you for %d HP" +LANGUAGE.healed_x_for_y = "Healed %s for %d HP" +LANGUAGE.buffed_x_with_y = "%s buffed you with a %s" +LANGUAGE.buffed_x_with_a_y = "Buffed %s with a %s" +LANGUAGE.removed_your_nail = "%s removed one of your nails" +LANGUAGE.giving_items_to = "Giving items to %s" +LANGUAGE.weapon_remantler = "Weapon Remantler" +LANGUAGE.remantle_success = "Weapon Remantled:" +LANGUAGE.remantle_used = "%d scrap has been created in your remantler." +LANGUAGE.remantle_cannot = "You already have an upgraded weapon of this type." +LANGUAGE.teleporting_to_sigil = "Teleporting to Sigil %s" +LANGUAGE.press_shift_to_cancel = "Press SHIFT to cancel" +LANGUAGE.point_at_a_sigil_to_choose_destination = "Point at another sigil to choose destination." +LANGUAGE.frail_healdart_warning = "Healing blocked because %s has DEBUFF: FRAIL!" +LANGUAGE.obtained_a_inv = "%s added to inventory" +LANGUAGE.you_already_have_this_trinket = "You already have this trinket in your inventory." +LANGUAGE.they_already_have_this_trinket = "They already have this trinket in their inventory." +LANGUAGE.you_cannot_carry_more_comps = "You cannot carry more crafting components." +LANGUAGE.they_cannot_carry_more_comps = "They cannot carry more crafting components." +LANGUAGE.obtained_inv_item_from_z = "Obtained %s from %s added to inventory" +LANGUAGE.deployable_lost = "Your %s was lost." +LANGUAGE.deployable_claimed = "You've claimed a %s." +LANGUAGE.trinket_consumed = "Your %s has been consumed and activated." +LANGUAGE.ran_out_of_ammo = "Your %s has run out of ammo." +LANGUAGE.trinket_recharged = "Your %s has recharged and is ready to use again." +LANGUAGE.evolves_in_to_x_on_wave_y = "Evolves in to %s on wave %d." -- Sigils point objectives -LANGUAGE.sigil_destroyed = "The Undead have destroyed a Sigil!" -LANGUAGE.sigil_destroyed_only_one_remain_h = "Only one remains! If it falls then there is no hope of escape!" -LANGUAGE.sigil_destroyed_only_one_remain_z = "Only one remains!" -LANGUAGE.sigil_destroyed_x_remain = "%d Sigils remaining." -LANGUAGE.last_sigil_destroyed_all_is_lost = "The Undead have destroyed the last Sigil." -LANGUAGE.last_sigil_destroyed_all_is_lost2 = "There is no hope of escape." +LANGUAGE.sigil = "Sanity Sigil" +--LANGUAGE.sigil_destroyed = "A Sanity Sigil has been destroyed. The Undead grow stronger!" +LANGUAGE.sigil_corrupted = "A Sanity Sigil has been corrupted. The Undead grow more resilient." +LANGUAGE.sigil_corrupted_last = "The last Sanity Sigil has been corrupted! The Undead grow very resilient!" +LANGUAGE.sigil_uncorrupted = "A Sanity Sigil has been uncorrupted, the Undead have weakened!" +--[[LANGUAGE.sigil_destroyed_only_one_remain_h = "Only one Sanity Sigil remains!" +LANGUAGE.sigil_destroyed_only_one_remain_z = "Only one Sanity Sigil remains!" +LANGUAGE.sigil_destroyed_x_remain = "%d remaining."]] +LANGUAGE.sigil_corrupted_x_remain = "%d remain uncorrupted." +--[[LANGUAGE.last_sigil_destroyed_all_is_lost = "The Undead have destroyed the last Sanity Sigil..." +LANGUAGE.last_sigil_destroyed_all_is_lost2 = "Time to die!"]] LANGUAGE.prop_obj_exit_h = "Escape!" LANGUAGE.prop_obj_exit_z = "Stop them!" +LANGUAGE.x_sigils_appeared = "%d Sanity Sigils have appeared. Humans may teleport between them." +LANGUAGE.has_survived = "has survived!" + +-- Skill system messages +LANGUAGE.unspent_skill_points_press_x = "You have unspent skill points. Press %q to unlock new skills." +LANGUAGE.x_requires_a_skill_you_dont_have = "%s requires a skill you don't have!" +LANGUAGE.you_ascended_to_level_x = "You have ascended to level %d!" +LANGUAGE.you_have_remorted_now_rl_x = "You have remorted and ascended to remort level %d!" +LANGUAGE.you_now_have_x_extra_sp = "You now have %d extra skill points!" +LANGUAGE.x_has_remorted_to_rl_y = "%s has remorted to remort level %d!!" +LANGUAGE.you_have_reset_all = "All of your skills, XP, and skill points have been reset." -- Message beacon messages LANGUAGE.message_beacon_1 = "Meet up here" @@ -157,7 +227,7 @@ LANGUAGE.message_beacon_2 = "Need defense here" LANGUAGE.message_beacon_3 = "Need turrets here" LANGUAGE.message_beacon_4 = "Need arsenal crates here" LANGUAGE.message_beacon_5 = "Need medics here" -LANGUAGE.message_beacon_6 = "Ammunition box here" +LANGUAGE.message_beacon_6 = "Resupply box here" LANGUAGE.message_beacon_7 = "Arsenal crate here" LANGUAGE.message_beacon_8 = "Need force fields here" LANGUAGE.message_beacon_9 = "Need explosives here" @@ -180,79 +250,186 @@ LANGUAGE.message_beacon_25 = "Plan B here" -- Class names LANGUAGE.class_zombie = "Zombie" +LANGUAGE.class_zombie_gore_blaster = "Gore Blaster Zombie" LANGUAGE.class_poison_zombie = "Poison Zombie" +LANGUAGE.class_wild_poison_zombie = "Wild Poison Zombie" LANGUAGE.class_fast_zombie = "Fast Zombie" +LANGUAGE.class_fast_zombie_slingshot = "Slingshot Zombie" LANGUAGE.class_bloated_zombie = "Bloated Zombie" +LANGUAGE.class_vile_bloated_zombie = "Vile Bloated Zombie" LANGUAGE.class_classic_zombie = "Classic Zombie" LANGUAGE.class_super_zombie = "Super Zombie" LANGUAGE.class_fresh_dead = "Fresh Dead" +LANGUAGE.class_recent_dead = "Recent Dead" +LANGUAGE.class_agile_dead = "Agile Dead" LANGUAGE.class_ghoul = "Ghoul" +LANGUAGE.class_chilled_ghoul = "Frigid Ghoul" +LANGUAGE.class_elderghoul = "Elder Ghoul" +LANGUAGE.class_noxiousghoul = "Noxious Ghoul" LANGUAGE.class_headcrab = "Headcrab" LANGUAGE.class_fast_headcrab = "Fast Headcrab" +LANGUAGE.class_bloodsucker_headcrab = "Bloodsucker Headcrab" LANGUAGE.class_poison_headcrab = "Poison Headcrab" +LANGUAGE.class_barbed_headcrab = "Barbed Headcrab" LANGUAGE.class_the_tickle_monster = "The Tickle Monster" LANGUAGE.class_nightmare = "Nightmare" +LANGUAGE.class_ancient_nightmare = "Ancient Nightmare" +LANGUAGE.class_devourer = "Devourer" LANGUAGE.class_pukepus = "Pukepus" LANGUAGE.class_bonemesh = "Bonemesh" LANGUAGE.class_crow = "Crow" LANGUAGE.class_wilowisp = "Wil O' Wisp" +LANGUAGE.class_coolwisp = "Cool Wisp" LANGUAGE.class_zombie_torso = "Zombie Torso" LANGUAGE.class_zombie_legs = "Zombie Legs" LANGUAGE.class_wraith = "Wraith" +LANGUAGE.class_tormented_wraith = "Tormented Wraith" LANGUAGE.class_fast_zombie_legs = "Fast Zombie Legs" -LANGUAGE.class_chem_zombie = "Chem Zombie" +LANGUAGE.class_fast_zombie_torso = "Fast Zombie Torso" +LANGUAGE.class_fast_zombie_torso_slingshot = "Slingshot Zombie Torso" +LANGUAGE.class_chem_burster = "Chem Burster" LANGUAGE.class_shade = "Shade" +LANGUAGE.class_frostshade = "Frost Shade" LANGUAGE.class_butcher = "The Butcher" +LANGUAGE.class_gravedigger = "The Grave Digger" LANGUAGE.class_flesh_creeper = "Flesh Creeper" LANGUAGE.class_gore_child = "Gore Child" LANGUAGE.class_giga_gore_child = "Giga Gore Child" +LANGUAGE.class_shadow_gore_child = "Shadow Child" +LANGUAGE.class_giga_shadow_child = "Giga Shadow Child" +LANGUAGE.class_asskicker = "Ass Kicker" +LANGUAGE.class_shitslapper = "Shit Slapper" +LANGUAGE.class_doomcrab = "Doom Crab" +LANGUAGE.class_red_marrow = "Red Marrow" +LANGUAGE.class_skeletal_walker = "Skeletal Walker" +LANGUAGE.class_skeletal_shambler = "Skeletal Shambler" +LANGUAGE.class_skeletal_lurker = "Skeletal Crawler" +LANGUAGE.class_shadow_lurker = "Shadow Lurker" +LANGUAGE.class_shadow_walker = "Shadow Walker" +LANGUAGE.class_frigid_revenant = "Frigid Revenant" +LANGUAGE.class_initial_dead = "Initial Dead" +LANGUAGE.class_lacerator = "Lacerator" +LANGUAGE.class_lacerator_charging = "Charger" +LANGUAGE.class_eradicator = "Eradicator" +LANGUAGE.class_howler = "Howler" +LANGUAGE.class_extinctioncrab = "Extinction Crab" -- Class descriptions LANGUAGE.description_zombie = "The basic zombie is very durable and has powerful claws.\nIt's hard to keep down, especially if not shot in the head." +LANGUAGE.description_zombie_gore_blaster = "Gore Blaster Zombies send viscera in all direction when killed which can cause minor harm.\nTheir claws can also inflict bleeding." LANGUAGE.description_poison_zombie = "This mutated zombie is not only extremely durable but has abnormal strength.\nIts body is extremely toxic and will even tear out and toss its own flesh at things too far away to hit." +LANGUAGE.description_wild_poison_zombie = "An erratic mutation of the poison zombie, making it stronger and tankier.\nIts flesh toss is much more sporadic and deadly." LANGUAGE.description_fast_zombie = "This boney cadaver is much faster than other zombies.\nThey aren't much of a threat by themselves but can reach nearly any area by climbing with their razor sharp claws\nThey also have no problem hunting down weak or hurt humans." +LANGUAGE.description_fast_zombie_slingshot = "An abnormal Fast Zombie with a powerful lunge.\nThe force applied is so great that it destroys their lower body, sending what's left at incredible speed.\nThe impact it causes will leave humans crippled for a while." LANGUAGE.description_bloated_zombie = "Their body is comprised of volatile, toxic chemicals.\nAlthough they move slower, they can take slightly more of a beating." -LANGUAGE.description_ghoul = "This zombie has highly toxic flesh.\nIt's slightly weaker than other zombies but makes up for it with its debilitating attacks.\nIts claws can debuff a human for a short time, causing increased damage from other attacks." +LANGUAGE.description_vile_bloated_zombie = "Their body is comprised of volatile, toxic chemicals which they can vomit a fair distance away.\nThey're a little faster than regular bloated zombies at the cost of being not as hardy." +LANGUAGE.description_fresh_dead = "These are zombies who have come back from the dead recently.\nThey have less durability and power than those who have rotted but make up for it in speed." +LANGUAGE.description_agile_dead = "These are zombies who have come back from the dead recently.\nThis mutation allows the fresh dead to climb at the cost of being extremely flimsy." +LANGUAGE.description_ghoul = "This zombie has highly toxic flesh.\nIt's slightly weaker than other zombies but makes up for it with its debilitating attacks.\nIts claws can debuff a human for a short time, causing increased damage from other attacks and it can throw goop which slows them." +LANGUAGE.description_chilled_ghoul = "This zombie has extremely cold flesh.\nIt's slightly weaker than other zombies but makes up for it with its debilitating attacks." +LANGUAGE.description_frigid_revenant = "A dark skeleton with a cold heart.\nDerived from the Frigid Ghoul, and has the Shadow Walker's resistance to melee attacks.\nCan chill and blind with its attacks." +LANGUAGE.description_elderghoul = "An aged Ghoul with a highly poisonous body which they throw pieces of at distant victims.\nTheir frail body will discharge poison towards attackers when harmed." +LANGUAGE.description_noxiousghoul = "A deeply aged ghoul with highly virulent goop merged with their body.\nTheir projectiles will slow and enfeeble unlucky victims, and their body will discharge poison towards attackers when harmed." LANGUAGE.description_headcrab = "Headcrabs are what caused the initial infection.\nNo one knows where they truely came from.\nTheir method of attack is lunging with the sharp beaks on their belly." LANGUAGE.description_fast_headcrab = "The male headcrab is considerably faster but less beefy than the female.\nEither way, it's equally as annoying and deadly in groups." -LANGUAGE.description_poison_headcrab = "This Headcrab is full of deadly nuerotoxins.\nOne bite is usually enough to kill an adult human.\nIt also has the ability to spit a less potent version of its poisons.\nThe spit is just as deadly if its victim is hit in the face." +LANGUAGE.description_bloodsucker_headcrab = "Bloodsuckers are stockier fast headcrabs with bleed inflicting bites.\nEach successful bite will heal a small amount of health." +LANGUAGE.description_poison_headcrab = "This Headcrab is full of deadly neurotoxins.\nOne bite is usually enough to kill an adult human.\nIt also has the ability to spit a less potent version of its poisons.\nThe spit is just as deadly if its victim is hit in the face." +LANGUAGE.description_barbed_headcrab = "This Headcrab bristles with sharp quills.\nIt can project a bristle at high speed inflicting bleeding upon unlucky humans." LANGUAGE.description_the_tickle_monster = "Said to be the monster that hides in your closet at night to drag you from your bed.\nThe Tickle Monster's almost elastic arms make it extremely hard to outrun and they also make it an ideal barricade destroyer." LANGUAGE.description_nightmare = "An extremely rare mutation gives the Nightmare its abnormal abilities.\nStronger than the every day zombie in almost every way, the Nightmare is a force to be reckoned with.\nOne swipe of its claws is enough to put down almost any person." -LANGUAGE.description_pukepus = "The rotting body of the Puke Pus is comprised entirely of organs used for the generation of poison.\nIts capable of vomiting gallons of poison puke at a time making it extremely dangerous." +LANGUAGE.description_ancient_nightmare = "An elderly Nightmare that has been roaming the land for ages.\nIts body has been tempered by the years, making it sturdier and less mobile but still formidable up close." +LANGUAGE.description_devourer = "A horrific malformation of bone and flesh, with a throwable rib that pierces into victims to reel them in.\nNot very fast on its own but incredibly dangerous to deal with alone." +LANGUAGE.description_pukepus = "The rotting body of the Puke Pus is comprised entirely of organs used for the generation of poison.\nIt's capable of vomiting gallons of poison puke at a time making it extremely dangerous." LANGUAGE.description_bonemesh = "Disfigured and mangled, the Bonemesh is capable of tossing blood bombs.\nEach bomb is comprised of bones and flesh that damages humans while giving precious food to other zombies." LANGUAGE.description_crow = "Carrion Crows are more of a pest than they were before the infection.\nThey feed on infected flesh and become 'carriers' for the undead.\nWhy would you ever make this class not hidden?\nWhat is wrong with you?" -LANGUAGE.description_wilowisp = "Sometimes referred to as spirits of the dead." +LANGUAGE.description_wilowisp = "Sometimes referred to as spirits of the dead.\nDoes minimal damage but is capable of blinding humans and explodes when killed.\nInduces almost no fear." +LANGUAGE.description_coolwisp = "An arctic Wisp with the ability to impede humans with frost.\nFrost reduces the fire rate and reload speed of firearms." LANGUAGE.description_zombie_torso = "You shouldn't even be seeing this." LANGUAGE.description_zombie_legs = "You shouldn't even be seeing this." LANGUAGE.description_wraith = "A zombie or an apparition?\nNot much is known about it besides the fact that it uses its\nunique stealth ability and sharp claws to cut things to ribbons." +LANGUAGE.description_tormented_wraith = "A more twisted kin of the Wraith.\nThis variant is capable of becoming crazed after taking damage, speeding up their attacks and movement.\nThey attack much faster at the cost of less damage per hit overall.\n" +LANGUAGE.description_fast_zombie_torso = "You shouldn't even be seeing this." +LANGUAGE.description_fast_zombie_torso_slingshot = "You shouldn't even be seeing this." LANGUAGE.description_fast_zombie_legs = "You shouldn't even be seeing this." -LANGUAGE.description_chem_zombie = "The Chem Zombie body is comprised of volatile, toxic chemicals.\nIt has no other means of attack besides being killed in hopes of blowing up next to any nearby humans." -LANGUAGE.description_shade = "By creating a strong magnetic field around itself, all bullets and melee attacks are rendered useless against it.\nFor some reason the Shade is vulnerable to bright lights." +LANGUAGE.description_chem_burster = "The Chem Burster body is comprised of volatile, toxic chemicals.\nIt has no other means of attack besides being killed in hopes of blowing up next to any nearby humans." +LANGUAGE.description_shade = "By creating a strong magnetic field around itself with a channeled shield, all bullets and projectiles are rendered useless against it until the shield is destroyed.\nThey can hurl any unnailed object at high velocity towards humans for devastating effect." +LANGUAGE.description_frostshade = "Frost Shades create weaker shields and projectiles than their normal counterpart, but can afflict humans with frost once shattered.\nThe cold will slow down their actions and jam their weapons, making them fire slower." LANGUAGE.description_butcher = "A crazed, undead butcher. It isn't very tough but anyone unlucky enough to be near it will most likely be torn to shreds." -LANGUAGE.description_flesh_creeper = "Flesh Creepers possess the ability to create nests.\nFrom these nests, other zombified creatures emerge.\nThe way this works is unknown but it is imperitive to destroy any nests or creepers." +LANGUAGE.description_gravedigger = "A deranged, undead grave keeper. It wields a shovel made from bones found in a cemetery." +LANGUAGE.description_flesh_creeper = "Flesh Creepers possess the ability to create nests.\nFrom these nests, other zombified creatures emerge.\nThe way this works is unknown but it is imperative to destroy any nests or creepers." LANGUAGE.description_gore_child = "Once zombified, an unborn child becomes infected as well.\nPossessing no special abilities, their strength comes from their numbers." LANGUAGE.description_giga_gore_child = "The result of a Gore Child which has been left unchecked for too long.\nA horror to behold, their massive body is the result of zombified stem cells.\nThey also become a host for Gore Children which can always be found in tow with it." +LANGUAGE.description_giga_shadow_child = "A corrupted Gore Child with the ability to obscure a human's vision.\nLess sturdy than the Giga Gore Child but with a high resistance to melee weapons.\nThe spawns it creates are equally resistant and capable of vision obscuration." +LANGUAGE.description_shadow_gore_child = "A Gore Child that has been corrupted by the darkness." +LANGUAGE.description_asskicker = "It's time to kick humans and chew ass, and I'm all out of ass." +LANGUAGE.description_shitslapper = "How about I slap your shit?" +LANGUAGE.description_doomcrab = "A massive headcrab that leaps on its victims to crush them.\nAlso has the ability to throw doom balls which debilitate humans." +LANGUAGE.description_red_marrow = "Mutated polycythemia gives the Red Marrow its color and ability to prfusely expel blood.\nAfter taking some damage a blood shield is created, rendering the Red Marrow impervious to attacks." +LANGUAGE.description_skeletal_walker = "Animated skeletons don't have a lot of health but they take minimal damage from bullets." +LANGUAGE.description_skeletal_shambler = "A behemoth of a skeleton that is moderately durable but also take minimal damage from bullets.\nThey also have the capacity to make a second wind." +LANGUAGE.description_skeletal_lurker = "A Skeletal Walker that lost the use of its legs.\nAnimated skeletons don't have a lot of health but they take minimal damage from bullets." +LANGUAGE.description_shadow_lurker = "Extremely hard to see in the dark and resistant against melee attacks. Their hits inflict a vision dimming debuff." +LANGUAGE.description_shadow_walker = "An evolved form of the Shadow Lurker with less mobility.\nExtremely hard to see in the dark and resistant against melee attacks. Their hits inflict a vision dimming debuff." +LANGUAGE.description_lacerator = "Lacerators are identical to Fast Zombies in almost every way.\nDespite their similarities, they are even deadlier and do not share their counterpart's fragility" +LANGUAGE.description_lacerator_charging = "These brutes can run deceptively fast while charging despite their burly demeanor.\nThe force behind their charge can knock anyone off their feet." +LANGUAGE.description_eradicator = "Bringers of death and destruction. The Eradicators sport a durable body that require a lot of fire power to take down.\nUnless shot in the head, they are almost garanteed to rise again." +LANGUAGE.description_howler = "A terrifying flesh titan with a piercing shriek.\nIts howl inspires the undead and instills fear in the living." +LANGUAGE.description_extinctioncrab = "Vile diseases churn within this giant headcrab.\nThe spores it spits will afflict those near it, reducing the effectiveness of healing." -- Class control schemes LANGUAGE.controls_zombie = "> PRIMARY: Claws\n> SECONDARY: Scream\n> RELOAD: Moan\n> SPRINT: Feign death\n> ON FATAL HIT IN LEGS: Revive / Transform" +LANGUAGE.controls_zombie_gore_blaster = "> PRIMARY: Claws\n> ON HIT HUMAN: Bleed\n> SECONDARY: Scream\n> SPRINT: Feign death\n> ON DEATH: Gore Blast" LANGUAGE.controls_poison_zombie = "> PRIMARY: Claws\n> SECONDARY: Flesh toss\n> RELOAD: Scream" -LANGUAGE.controls_fast_zombie = "> PRIMARY: Claws\n> SECONDARY: Lunge / Climb (next to wall)\n> RELOAD: Scream" +LANGUAGE.controls_wild_poison_zombie = "> PRIMARY: Claws\n> SECONDARY: Flesh toss\n> RELOAD: Scream" +LANGUAGE.controls_fast_zombie = "> PRIMARY: Claws\n> SECONDARY: Lunge / Climb wall\n> RELOAD: Scream\n> ON FATAL HIT IN LEGS: Transform" +LANGUAGE.controls_fast_zombie_slingshot = "> PRIMARY: Claws\n> SECONDARY: Slingshot / Climb wall\n> RELOAD: Scream\n> ON SLINGSHOT HUMAN: Slow" LANGUAGE.controls_bloated_zombie = "> PRIMARY: Claws\n> SECONDARY: Moan\n> SPRINT: Feign death\n> ON DEATH: Poison Gibs" -LANGUAGE.controls_ghoul = "> PRIMARY: Poison claws\n> SECONDARY: Flesh toss\n> SPRINT: Feign death\n> RELOAD: Scream\n> ON HIT HUMAN: Ghoul Touch" +LANGUAGE.controls_vile_bloated_zombie = "> PRIMARY: Claws\n> SECONDARY: Poison Vomit\n> SPRINT: Feign death" +LANGUAGE.controls_fresh_dead = "> PRIMARY: Claws\n> SECONDARY: Scream\n> SPRINT: Feign death" +LANGUAGE.controls_agile_dead = "> PRIMARY: Claws\n> SECONDARY: Climb wall" +LANGUAGE.controls_ghoul = "> PRIMARY: Poison claws\n> SECONDARY: Throw slowing goop\n> SPRINT: Feign death\n> RELOAD: Scream\n> ON HIT HUMAN: Ghoul Touch" +LANGUAGE.controls_chilled_ghoul = "> PRIMARY: Frost claws\n> SECONDARY: Throw frozen goop\n> SPRINT: Feign death\n> RELOAD: Scream\n> ON HIT HUMAN: Frost" +LANGUAGE.controls_frigid_revenant = "> PRIMARY: Frost and blind claws\n> SECONDARY: Throw dark ice goop\n> ON HIT HUMAN: Frost and dim vision" +LANGUAGE.controls_elderghoul = "> PRIMARY: Poison claws\n> SECONDARY: Flesh toss\n> RELOAD: Scream\n> ON DAMAGE TAKEN: Poison spray" +LANGUAGE.controls_noxiousghoul = "> PRIMARY: Poison claws\n> SECONDARY: Throw disabling goop\n> RELOAD: Scream\n> ON DAMAGE TAKEN: Poison spray\n> ON HIT HUMAN: Ghoul Touch" LANGUAGE.controls_headcrab = "> PRIMARY: Lunge attack\n> RELOAD: Burrow" LANGUAGE.controls_fast_headcrab = "> PRIMARY: Lunge attack" +LANGUAGE.controls_bloodsucker_headcrab = "> PRIMARY: Lunge attack\n> ON HIT HUMAN: Bleed and heal for a small amount of health" LANGUAGE.controls_poison_headcrab = "> PRIMARY: Lunge attack\n> SECONDARY: Spit poison\n> ON HIT HUMAN: Deadly poison\n> ON HIT POISON IN EYES: Blind\n> RELOAD: Scream" +LANGUAGE.controls_barbed_headcrab = "> PRIMARY: Lunge attack\n> SECONDARY: Spit bristle\n> ON HIT HUMAN: Strong bleed\n> RELOAD: Scream" LANGUAGE.controls_the_tickle_monster = "> PRIMARY: Elastic claws\n> SECONDARY: Moan" LANGUAGE.controls_nightmare = "> PRIMARY: Death touch\n> SECONDARY: Moan" -LANGUAGE.controls_pukepus = "> PRIMARY: Puke" +LANGUAGE.controls_ancient_nightmare = "> PRIMARY: Death claw\n> SECONDARY: Moan" +LANGUAGE.controls_devourer = "> PRIMARY: Claw\n> SECONDARY: Reel target in with projectile" +LANGUAGE.controls_pukepus = "> PRIMARY: Puke\n> ON DAMAGE TAKEN: Poison spray\n> ON DEATH: Poison explosion" LANGUAGE.controls_bonemesh = "> PRIMARY: Claws\n> SECONDARY: Toss blood bomb" LANGUAGE.controls_wraith = "> PRIMARY: Claws\n> SECONDARY: Scream\n> INVISIBILITY BASED ON MOVEMENT AND VIEW DISTANCE" -LANGUAGE.controls_chem_zombie = "> ON DEATH: Poison Bomb" -LANGUAGE.controls_shade = "> PRIMARY: Lift\n> SECONDARY: Throw" +LANGUAGE.controls_tormented_wraith = "> PRIMARY: Claws\n> SECONDARY: Scream\n> INVISIBILITY BASED ON MOVEMENT AND VIEW DISTANCE\n> MADDENED WHEN TAKING DAMAGE BELOW 70 HP" +LANGUAGE.controls_chem_burster = "> PRIMARY: Death Charge\n> ON DEATH: Poison Bomb (power based on charge time)" +LANGUAGE.controls_shade = "> PRIMARY: Throw\n> SECONDARY: Lift\n> RELOAD: Pull rock from ground\n> SPRINT: Channel shield" +LANGUAGE.controls_frostshade = "> PRIMARY: Throw\n> SECONDARY: Lift\n> RELOAD: Create ice missile\n> SPRINT: Channel frost shield" LANGUAGE.controls_butcher = "> PRIMARY: Chop" -LANGUAGE.controls_flesh_creeper = "> PRIMARY: Head Smash\n> SECONDARY: Nest" +LANGUAGE.controls_gravedigger = "> PRIMARY: Smack" +LANGUAGE.controls_flesh_creeper = "> PRIMARY: Head Smash\n> SECONDARY: Nest\n> RELOAD: Leap" LANGUAGE.controls_gore_child = "> PRIMARY: Claws" -LANGUAGE.controls_giga_gore_child = "> PRIMARY: Smash\n> SECONDARY: Throw Gore Child" +LANGUAGE.controls_giga_gore_child = "> PRIMARY: Smash\n> SECONDARY: Throw Gore Child\n> RELOAD: Knockdown Cry" +LANGUAGE.controls_giga_shadow_child = "> PRIMARY: Smash\n> SECONDARY: Throw Shadow Child\n> RELOAD: Obscuring Knockdown Cry\n> ON HIT: Dim Vision\n> ON HIT BY MELEE: Resist damage" +LANGUAGE.controls_shadow_gore_child = "> PRIMARY: Claws\n> ON HIT: Dim Vision\n> ON HIT BY MELEE: Resist damage" +LANGUAGE.controls_asskicker = "> PRIMARY: Left kick\n> SECONDARY: Right kick" +LANGUAGE.controls_shitslapper = "> PRIMARY: Slap" +LANGUAGE.controls_doomcrab = "> PRIMARY: Leap attack\n> SECONDARY: Doom ball" +LANGUAGE.controls_red_marrow = "> PRIMARY: Claws\n> SECONDARY: Scream\n> ON EVERY 200 DAMAGE TAKEN: Create blood shield" +LANGUAGE.controls_skeletal_walker = "> PRIMARY: Claws\n> SECONDARY: Scream\n> RELOAD: Moan\n> SPRINT: Feign death\n> ON HIT BY BULLET: Resist damage" +LANGUAGE.controls_skeletal_shambler = "> PRIMARY: Claws\n> SECONDARY: Scream\n> RELOAD: Moan\n> SPRINT: Feign death\n> ON HIT BY BULLET: Resist damage\n> ON FATAL HIT IN LEGS: Revive" +LANGUAGE.controls_skeletal_lurker = "> PRIMARY: Claws\n> SECONDARY: Moan\n> ON HIT BY BULLET: Resist damage" +LANGUAGE.controls_wilowisp = "> PRIMARY: Blinding Light\n> RELOAD: Moan\n> ON DEATH: Blinding Explosion" +LANGUAGE.controls_coolwisp = "> PRIMARY: Freezing Pulse\n> RELOAD: Moan\n> ON DEATH: Arctic Explosion" +LANGUAGE.controls_shadow_lurker = "> PRIMARY: Claws\n> ON HIT: Dim Vision\n> ON HIT BY MELEE: Resist damage" +LANGUAGE.controls_lacerator = "> PRIMARY: Claws\n> SECONDARY: Lunge / Climb wall\n> RELOAD: Scream" +LANGUAGE.controls_lacerator_charging = "> PRIMARY: Bleeding Claws\n> ON HIT HUMAN: Bleed\n> SECONDARY: Charge\n> RELOAD: Scream" +LANGUAGE.controls_eradicator = "> PRIMARY: Claws\n> SECONDARY: Scream\n> ON FATAL HIT: Revive" +LANGUAGE.controls_howler = "> PRIMARY: Claws\n> SECONDARY: Howl\n> RELOAD: Moan" +LANGUAGE.controls_extinctioncrab = "> PRIMARY: Leap Attack\n> SECONDARY: Extinction Spore" -- The help file... Quite big! I wouldn't blame you if you didn't translate this part. LANGUAGE.help_cat_introduction = "Introduction" @@ -329,8 +506,7 @@ To deploy the turret, position it in a way so that the ghost is green. It must b
  • Use bigger props for barricades. The nails take less damage and the prop has room for more nails. In addition to that, it even acts as cover from projectiles.
  • ]] LANGUAGE.help_cont_upgrades = [[

    Points are obtained through killing zombies, healing team mates, and building defenses. -You can then exchange points in the Points Shop which is available during wave breaks. -Try to make your purchases at Arsenal Crates for a hefty discount!

    +You can then exchange points in the Points Shop at Arsenal Crates.

    Tips for this section: