├── gamemodes └── nzombies │ ├── gamemode │ ├── cl_init.lua │ ├── effects │ │ ├── sh_constructor.lua │ │ └── cl_electricarcs.lua │ ├── enemies │ │ ├── sh_constructor.lua │ │ └── sv_enemies.lua │ ├── misc │ │ ├── sh_constructor.lua │ │ ├── sv_resources.lua │ │ ├── sv_autoreload.lua │ │ ├── sh_weightedrandom.lua │ │ ├── sh_playerinit.lua │ │ ├── cl_precache.lua │ │ └── sv_consolecommands.lua │ ├── random_box │ │ └── sh_constructor.lua │ ├── doors │ │ ├── sh_constructor.lua │ │ ├── sv_hooks.lua │ │ └── sv_door_meta_functions.lua │ ├── round │ │ ├── sh_constructor.lua │ │ ├── cl_round_meta.lua │ │ ├── sv_hooks.lua │ │ ├── cl_round.lua │ │ └── sh_player.lua │ ├── weapons │ │ ├── sh_constructor.lua │ │ ├── sv_roundresupply.lua │ │ ├── sh_wep_sync.lua │ │ ├── sh_weps.lua │ │ ├── cl_wepswitch.lua │ │ └── sv_wonderweapons.lua │ ├── mainmenu │ │ ├── cl_player.lua │ │ └── sv_controls.lua │ ├── interfaces │ │ ├── sh_constructor.lua │ │ ├── sh_sync.lua │ │ └── sh_int_configsaver.lua │ ├── perks │ │ ├── sh_constructor.lua │ │ ├── sv_solorevive.lua │ │ └── sh_sync.lua │ ├── easter_eggs │ │ ├── sh_constructor.lua │ │ ├── sv_major_ee.lua │ │ └── sv_ee.lua │ ├── revive_system │ │ ├── sh_constructor.lua │ │ ├── sv_hooks.lua │ │ ├── sh_playerdeath.lua │ │ └── sh_animation.lua │ ├── q_menu │ │ ├── sh_constructor.lua │ │ ├── sh_populate.lua │ │ ├── cl_search_models.lua │ │ └── sh_net.lua │ ├── electricity │ │ ├── sh_constructor.lua │ │ ├── sh_sync.lua │ │ └── sv_elec.lua │ ├── tools │ │ ├── sh_constructor.lua │ │ ├── sh_meta.lua │ │ ├── sh_tools_pspawn.lua │ │ ├── sh_tools_elec.lua │ │ ├── sh_tools_ee.lua │ │ ├── sh_sync.lua │ │ ├── sh_tools_rbox.lua │ │ ├── sh_tools_barricade.lua │ │ └── sh_tools_perk.lua │ ├── chatcommand │ │ └── sh_player.lua │ ├── notifications │ │ ├── sh_constructor.lua │ │ ├── sh_sync.lua │ │ └── sh_sounds.lua │ ├── init.lua │ ├── display │ │ ├── cl_hudblock.lua │ │ ├── cl_gamemodehooks.lua │ │ ├── cl_player.lua │ │ ├── sh_papnames.lua │ │ └── cl_fonts.lua │ ├── navigation │ │ └── sh_constructor.lua │ ├── spectator │ │ ├── sv_player.lua │ │ └── sv_override.lua │ ├── mapping │ │ ├── sv_validation.lua │ │ ├── sh_constructor.lua │ │ ├── sh_sync.lua │ │ └── sv_mapsettings.lua │ ├── scoring │ │ ├── sv_update.lua │ │ └── sh_player.lua │ ├── shared.lua │ ├── debugging │ │ └── sh_constructor.lua │ ├── player_class │ │ ├── sv_healthregen.lua │ │ ├── sh_player_create.lua │ │ ├── sh_constructor.lua │ │ ├── sv_players.lua │ │ └── sh_player_ingame.lua │ ├── special_weapons │ │ ├── sh_constructor.lua │ │ ├── sh_specialweapons.lua │ │ └── sh_sync.lua │ ├── function_override │ │ └── sh_hookorder.lua │ ├── powerups │ │ └── sh_constructor.lua │ ├── curves │ │ └── sh_constructor.lua │ ├── traps_logic │ │ └── sh_constructor.lua │ ├── loader.lua │ ├── itemcarrying │ │ ├── sv_gameplay.lua │ │ └── sh_meta.lua │ ├── ragdoll │ │ └── sh_zombierags.lua │ └── points │ │ └── sh_points.lua │ ├── logo.png │ ├── icon24.png │ └── entities │ ├── entities │ ├── nz_spawn_zombie_normal.lua │ ├── sent_grenade_frag │ │ ├── shared.lua │ │ └── outputs.lua │ ├── nz_prop_effect_attachment.lua │ ├── point_worldhint │ │ ├── shared.lua │ │ ├── cl_init.lua │ │ └── init.lua │ ├── logic_waves │ │ ├── cl_init.lua │ │ └── init.lua │ ├── nz_trapbase.lua │ ├── nz_spawn_zombie_special.lua │ ├── random_box_spawns │ │ └── shared.lua │ ├── breakable_entry_plank │ │ └── shared.lua │ ├── nz_script_prop │ │ └── shared.lua │ ├── player_spawns │ │ └── shared.lua │ ├── easter_egg │ │ └── shared.lua │ ├── nz_electricity.lua │ ├── base_edit.lua │ ├── ttt_traitor_button │ │ └── shared.lua │ ├── buildable_table_prop │ │ └── shared.lua │ ├── button_elec │ │ └── shared.lua │ ├── nz_zombie_special_burning.lua │ ├── edit_fog.lua │ ├── wall_block │ │ └── shared.lua │ ├── invis_wall │ │ └── shared.lua │ ├── edit_fog_special.lua │ ├── pap_weapon_trigger │ │ └── shared.lua │ ├── logic_winlose │ │ └── init.lua │ ├── pap_weapon_fly │ │ └── shared.lua │ ├── point_zsmessage │ │ └── init.lua │ ├── nz_button_and.lua │ ├── power_box │ │ └── shared.lua │ ├── drop_bloodmoney │ │ └── shared.lua │ ├── nz_zombieshield_back.lua │ ├── drop_powerup │ │ └── shared.lua │ ├── edit_sky.lua │ ├── logic_points │ │ └── init.lua │ ├── nz_script_soulcatcher │ │ └── shared.lua │ ├── nz_script_triggerzone │ │ └── shared.lua │ ├── nz_fraggrenade.lua │ └── drop_tombstone │ │ └── shared.lua │ ├── weapons │ ├── nz_tool_base │ │ ├── init.lua │ │ └── cl_init.lua │ ├── nz_quickknife_crowbar │ │ ├── init.lua │ │ ├── ai_translations.lua │ │ └── cl_init.lua │ ├── nz_revive_morphine.lua │ ├── nz_packapunch_arms.lua │ └── nz_grenade.lua │ ├── entitiestemporary │ ├── info_player_undead │ │ └── init.lua │ └── info_player_zombie │ │ └── init.lua │ └── effects │ ├── panzer_explode │ └── init.lua │ ├── panzer_land_dust │ └── init.lua │ ├── powerup_glow │ └── init.lua │ ├── web_explosion │ └── init.lua │ ├── vulture_gascloud │ └── init.lua │ ├── zapper_lightning │ └── init.lua │ ├── zombie_soul │ └── init.lua │ ├── one_inch_punch_blow │ └── init.lua │ └── zombie_spawn_dust │ └── init.lua ├── maps ├── ttt_kosovos.nav ├── ttt_casino_b2.nav └── zs_obj_station.nav ├── resource └── fonts │ ├── HauntAOE.ttf │ └── DK Umbilical Noose.ttf ├── materials └── nzmapicons │ ├── nz_ttt_kosovos;Breakout.png │ └── nz_ttt_casino_b2;High Stakes.png ├── addon.json ├── .gitattributes ├── lua └── nzmapscripts │ └── template.lua └── README.md /gamemodes/nzombies/gamemode/cl_init.lua: -------------------------------------------------------------------------------- 1 | include( "shared.lua" ) 2 | include( "loader.lua" ) -------------------------------------------------------------------------------- /maps/ttt_kosovos.nav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/maps/ttt_kosovos.nav -------------------------------------------------------------------------------- /maps/ttt_casino_b2.nav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/maps/ttt_casino_b2.nav -------------------------------------------------------------------------------- /maps/zs_obj_station.nav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/maps/zs_obj_station.nav -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/effects/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | nzEffects = nzEffects or AddNZModule("Effects") 2 | -------------------------------------------------------------------------------- /gamemodes/nzombies/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/gamemodes/nzombies/logo.png -------------------------------------------------------------------------------- /resource/fonts/HauntAOE.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/resource/fonts/HauntAOE.ttf -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/enemies/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | 2 | nzEnemies = nzEnemies or AddNZModule("Enemies") 3 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzMisc = nzMisc or AddNZModule("Misc") 3 | -------------------------------------------------------------------------------- /gamemodes/nzombies/icon24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/gamemodes/nzombies/icon24.png -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/random_box/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | nzRandomBox = nzRandomBox or AddNZModule("RandomBox") 2 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/doors/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Setup Doors module 2 | nzDoors = nzDoors or AddNZModule("Doors") 3 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/round/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Setup round module 2 | nzRound = nzRound or AddNZModule("Round") 3 | -------------------------------------------------------------------------------- /resource/fonts/DK Umbilical Noose.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/resource/fonts/DK Umbilical Noose.ttf -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzWeps = nzWeps or AddNZModule("Weps") 3 | 4 | -- Variables 5 | -------------------------------------------------------------------------------- /materials/nzmapicons/nz_ttt_kosovos;Breakout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/materials/nzmapicons/nz_ttt_kosovos;Breakout.png -------------------------------------------------------------------------------- /materials/nzmapicons/nz_ttt_casino_b2;High Stakes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zet0rz/nzombies/HEAD/materials/nzmapicons/nz_ttt_casino_b2;High Stakes.png -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mainmenu/cl_player.lua: -------------------------------------------------------------------------------- 1 | local plyMeta = FindMetaTable("Player") 2 | 3 | function plyMeta:IsNZMenuOpen() 4 | return IsValid(g_Settings) 5 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mainmenu/sv_controls.lua: -------------------------------------------------------------------------------- 1 | function GM:ShowHelp( ply ) 2 | if IsValid( ply ) then 3 | ply:ConCommand("nz_settings") 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /addon.json: -------------------------------------------------------------------------------- 1 | { 2 | "title" : "nZombies 3", 3 | "type" : "gamemode", 4 | "tags" : [ "fun", "realism" ], 5 | "ignore" : 6 | [ 7 | "*.psd", 8 | "*.vcproj", 9 | "*.svn*" 10 | ] 11 | } -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/interfaces/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzInterfaces = nzInterfaces or AddNZModule("Interfaces") 3 | nzInterfaces.Data = nzInterfaces.Data or {} 4 | 5 | -- Variables -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_spawn_zombie_normal.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Base = "nz_spawn_zombie" 4 | ENT.PrintName = "nz_spawn_zombie_normal" 5 | 6 | ENT.NZOnlyVisibleInCreative = true -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/perks/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzPerks = nzPerks or AddNZModule("Perks") 3 | nzPerks.Data = nzPerks.Data or {} 4 | 5 | -- Variables 6 | 7 | nzPerks.Players = nzPerks.Players or {} -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_tool_base/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( "cl_init.lua" ) 2 | AddCSLuaFile( "shared.lua" ) 3 | 4 | include('shared.lua') 5 | 6 | SWEP.Weight = 5 7 | SWEP.AutoSwitchTo = false 8 | SWEP.AutoSwitchFrom = false -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/easter_eggs/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzEE = nzEE or AddNZModule("EE") 3 | nzEE.Data = nzEE.Data or {} 4 | nzEE.Major = nzEE.Major or {} 5 | 6 | nzEE.Data.EggCount = 0 7 | nzEE.Data.MaxEggCount = 0 8 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/revive_system/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzRevive = nzRevive or AddNZModule("Revive") 3 | 4 | -- Variables 5 | nzRevive.Players = {} 6 | 7 | if CLIENT then 8 | nzRevive.Notify = {} 9 | end 10 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/sent_grenade_frag/shared.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | ENT.Type = "anim" 4 | ENT.Base = "base_anim" 5 | ENT.PrintName = "" 6 | ENT.Author = "" 7 | 8 | ENT.Spawnable = false 9 | ENT.AdminSpawnable = false 10 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/q_menu/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzQMenu = nzQMenu or AddNZModule("QMenu") 3 | nzQMenu.Data = nzQMenu.Data or {} 4 | 5 | nzQMenu.Data.SpawnedEntities = {} 6 | 7 | -- sh_populate 8 | nzQMenu.Data.Entities = {} -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/electricity/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzElec = nzElec or AddNZModule("Elec") 3 | 4 | -- Variables 5 | nzElec.Active = false 6 | 7 | function nzElec.IsOn() 8 | return nzElec.Active 9 | end 10 | 11 | IsElec = nzElec.IsOn 12 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sv_resources.lua: -------------------------------------------------------------------------------- 1 | //Fonts (Since they don't work with workshop) 2 | resource.AddFile( "resource/fonts/DK Umbilical Noose.ttf" ) 3 | 4 | //Content Pack 5 | --resource.AddWorkshop( "485777655" ) 6 | 7 | //FAS2 Base Weapons 8 | --resource.AddWorkshop( "180507408" ) 9 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | //Main Tables 2 | nzTools = nzTools or AddNZModule("Tools") 3 | nzTools.ToolData = nzTools.ToolData or {} 4 | 5 | //Variables 6 | if CLIENT then 7 | nzTools.Advanced = nzTools.Advanced or false 8 | nzTools.SavedData = nzTools.SavedData or {} 9 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_tool_base/cl_init.lua: -------------------------------------------------------------------------------- 1 | include('shared.lua') 2 | 3 | SWEP.PrintName = "nz_base_tool" 4 | SWEP.Slot = 0 5 | SWEP.SlotPos = 10 6 | SWEP.DrawAmmo = false 7 | SWEP.DrawCrosshair = true 8 | 9 | SWEP.Spawnable = false 10 | SWEP.AdminSpawnable = false -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/chatcommand/sh_player.lua: -------------------------------------------------------------------------------- 1 | function player.GetByName(name) 2 | name = string.lower(name) 3 | for _,v in ipairs(player.GetHumans()) do 4 | if string.find(string.lower(v:Nick()), name, 1, true) != nil then 5 | return v 6 | end 7 | end 8 | 9 | return nil 10 | end 11 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/enemies/sv_enemies.lua: -------------------------------------------------------------------------------- 1 | function nzEnemies:TotalAlive() 2 | local c = 0 3 | 4 | -- Count 5 | for k,v in pairs(nzConfig.ValidEnemies) do 6 | c = c + #ents.FindByClass(k) 7 | end 8 | 9 | return c 10 | end 11 | 12 | function nzEnemies:OnZombieSpawned(zombie, spawnpoint) 13 | 14 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/notifications/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzNotifications = nzNotifications or AddNZModule("Notifications") 3 | nzNotifications.Data = {} 4 | 5 | -- Variables 6 | if CLIENT then 7 | nzNotifications.Data.SoundQueue = {} 8 | nzNotifications.Data.NextSound = CurTime() 9 | end 10 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_prop_effect_attachment.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | 4 | ENT.Type = "anim" 5 | 6 | ENT.PrintName = "" 7 | ENT.Author = "" 8 | ENT.Contact = "" 9 | ENT.Purpose = "" 10 | ENT.Instructions = "" 11 | ENT.Spawnable = false 12 | ENT.AdminOnly = false 13 | 14 | -- We have absolutely nothing here. That's right, this is just to differentiate it from normal prop_dynamics -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/init.lua: -------------------------------------------------------------------------------- 1 | local plyMeta = FindMetaTable("Player") 2 | FullSyncModules = {} 3 | 4 | function plyMeta:SendFullSync() 5 | -- Modules add their own fullsync functions into this table 6 | for k,v in pairs(FullSyncModules) do 7 | v(self) 8 | end 9 | end 10 | 11 | include( "shared.lua" ) 12 | AddCSLuaFile( "shared.lua" ) 13 | 14 | include( "loader.lua" ) 15 | AddCSLuaFile( "loader.lua" ) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_meta.lua: -------------------------------------------------------------------------------- 1 | local playerMeta = FindMetaTable("Player") 2 | 3 | function playerMeta:SetNZToolData( data ) 4 | self.NZToolData = nil 5 | if data then 6 | self.NZToolData = data 7 | end 8 | end 9 | 10 | function playerMeta:SetActiveNZTool( tool ) 11 | local wep = self:GetActiveWeapon() 12 | if IsValid(wep) and wep:GetClass() == "nz_multi_tool" then 13 | wep.ToolMode = tool 14 | end 15 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/point_worldhint/shared.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "anim" 2 | 3 | AccessorFuncDT(ENT, "Viewable", "Int", 0) 4 | AccessorFuncDT(ENT, "Hint", "String", 0) 5 | AccessorFuncDT(ENT, "Range", "Float", 0) 6 | AccessorFuncDT(ENT, "Translated", "Bool", 0) 7 | 8 | function ENT:GetHint() 9 | local hint = self:GetDTString(0) 10 | 11 | --if self:GetTranslated() then return translate.Get(hint) end 12 | 13 | return hint 14 | end 15 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sv_autoreload.lua: -------------------------------------------------------------------------------- 1 | function GM:OnReloaded( ) 2 | print("Reloading Data!") 3 | //Reload the data from the entities back into the tables 4 | //Door data 5 | for k,v in pairs(ents.GetAll()) do 6 | if v:IsDoor() or v:IsBuyableProp() then 7 | local data = v.Data 8 | if data != nil then 9 | nzDoors:CreateLink(v, data) 10 | end 11 | end 12 | end 13 | 14 | 15 | nzPlayers:FullSync( ply ) 16 | 17 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/logic_waves/cl_init.lua: -------------------------------------------------------------------------------- 1 | 2 | function ENT:Initialize() 3 | self:DrawShadow(false) 4 | self:SetMoveType(MOVETYPE_NONE) 5 | self:SetSolid(SOLID_NONE) 6 | self:SetCollisionGroup(COLLISION_GROUP_WORLD) 7 | end 8 | 9 | local GripMaterial = Material( "sprites/grip" ) 10 | function ENT:Draw() 11 | if !nzRound:InState( ROUND_CREATE ) then return end 12 | render.SetMaterial( GripMaterial ) 13 | render.DrawSprite( self:GetPos(), 16, 16, color_white ) 14 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/display/cl_hudblock.lua: -------------------------------------------------------------------------------- 1 | local blockedhuds = { 2 | ["CHudAmmo"] = true, 3 | ["CHudSecondaryAmmo"] = true, 4 | ["CHudBattery"] = true, 5 | } 6 | 7 | hook.Add( "HUDShouldDraw", "HideHUD", function( name ) 8 | if blockedhuds[name] then return false end 9 | if name == "CHudWeaponSelection" then return !nzRound:InProgress() and !nzRound:InState(ROUND_GO) end -- Has it's own value 10 | if name == "CHudHealth" then return !GetConVar("nz_bloodoverlay"):GetBool() end -- Same 11 | end ) 12 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/navigation/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzNav = nzNav or AddNZModule("Nav") 3 | nzNav.Locks = nzNav.Locks or {} 4 | 5 | function IsNavApplicable(ent) 6 | -- All classes that can be linked with navigation 7 | if !IsValid(ent) then return false end 8 | if (ent:IsDoor() or ent:IsBuyableProp() or ent:IsButton()) and ent:GetDoorData().link then 9 | return true 10 | else 11 | return false 12 | end 13 | end 14 | 15 | function nzNav.FlushAllNavModifications() 16 | nzNav.Locks = {} 17 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_trapbase.lua: -------------------------------------------------------------------------------- 1 | -- Use this class as base when creating traps 2 | 3 | AddCSLuaFile( ) 4 | 5 | ENT.Type = "anim" 6 | ENT.Base = "nz_activatable" 7 | 8 | ENT.PrintName = "nz_trapbase" 9 | 10 | DEFINE_BASECLASS("nz_activatable") 11 | 12 | function ENT:SetupDataTables() 13 | BaseClass.SetupDataTables( self ) 14 | 15 | self:SetRemoteActivated(true) 16 | end 17 | 18 | -- IMPLEMENT ME 19 | function ENT:OnActivation() end 20 | 21 | function ENT:OnDeactivation() end 22 | 23 | function ENT:OnReady() end 24 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/display/cl_gamemodehooks.lua: -------------------------------------------------------------------------------- 1 | function GM:ContextMenuOpen() 2 | return nzRound:InState( ROUND_CREATE ) and LocalPlayer():IsAdmin() 3 | end 4 | 5 | function GM:PopulateMenuBar(panel) 6 | panel:Remove() 7 | return false 8 | end 9 | 10 | function GM:OnUndo( name, strCustomString ) 11 | if ( !strCustomString ) then 12 | notification.AddLegacy( "Undone "..name, NOTIFY_UNDO, 2 ) 13 | else 14 | notification.AddLegacy( strCustomString, NOTIFY_UNDO, 2 ) 15 | end 16 | surface.PlaySound( "buttons/button15.wav" ) 17 | end 18 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/spectator/sv_player.lua: -------------------------------------------------------------------------------- 1 | --Get the meta Table 2 | local plyMeta = FindMetaTable( "Player" ) 3 | --accessors 4 | AccessorFunc( plyMeta, "iSpectatingID", "SpectatingID", FORCE_NUMBER ) 5 | AccessorFunc( plyMeta, "iSpectatingType", "SpectatingType", FORCE_NUMBER ) 6 | 7 | function plyMeta:SetSpectator() 8 | if self:Alive() then 9 | self:KillSilent() 10 | end 11 | self:SetTeam( TEAM_SPECTATOR ) 12 | self:SetSpectatingType( OBS_MODE_CHASE ) 13 | self:Spectate( self:GetSpectatingType() ) 14 | self:SetSpectatingID( 1 ) 15 | end 16 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mapping/sv_validation.lua: -------------------------------------------------------------------------------- 1 | function nzMapping:CheckSpawns() 2 | 3 | --Check Player spawns 4 | if #ents.FindByClass("player_spawns") == 0 then 5 | return false 6 | end 7 | 8 | --Check Zombie Spawns 9 | if #ents.FindByClass("nz_spawn_zombie_*") == 0 then 10 | return false 11 | end 12 | 13 | return true 14 | end 15 | 16 | function nzMapping:CheckEnoughPlayerSpawns() 17 | 18 | //Check Player spawns 19 | if #ents.FindByClass("player_spawns") < #player.GetAll() then 20 | return false 21 | end 22 | 23 | return true 24 | end 25 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_spawn_zombie_special.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Base = "nz_spawn_zombie" 4 | ENT.PrintName = "nz_spawn_zombie_special" 5 | 6 | ENT.NZOnlyVisibleInCreative = true 7 | 8 | function ENT:Initialize() 9 | self:SetModel( "models/player/odessa.mdl" ) 10 | self:SetMoveType( MOVETYPE_NONE ) 11 | self:SetSolid( SOLID_VPHYSICS ) 12 | self:SetCollisionGroup( COLLISION_GROUP_WEAPON ) 13 | self:SetColor(Color(255, 0, 0)) 14 | self:DrawShadow( false ) 15 | self:SetSpawnWeight(0) 16 | self:SetZombiesToSpawn(0) 17 | self:SetNextSpawn(CurTime()) 18 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/sv_roundresupply.lua: -------------------------------------------------------------------------------- 1 | nzWeps.RoundResupply = {} 2 | 3 | function nzWeps:AddAmmoToRoundResupply(ammo, count, max) 4 | nzWeps.RoundResupply[ammo] = {count = count, max = max} 5 | end 6 | 7 | function nzWeps:DoRoundResupply() 8 | for k,v in pairs(player.GetAllPlaying()) do 9 | for k2,v2 in pairs(nzWeps.RoundResupply) do 10 | local give = math.Clamp(v2.max - v:GetAmmoCount(k2), 0, v2.count) 11 | v:GiveAmmo(give, k2, true) 12 | end 13 | end 14 | end 15 | 16 | -- Standard grenades 17 | nzWeps:AddAmmoToRoundResupply(GetNZAmmoID( "grenade" ) or "nz_grenade", 2, 4) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/scoring/sv_update.lua: -------------------------------------------------------------------------------- 1 | function GM:OnZombieKilled(zombie, dmgInfo) 2 | local attacker = dmgInfo:GetAttacker() 3 | if IsValid(attacker) and attacker:IsPlayer() then 4 | attacker:IncrementTotalKills() 5 | end 6 | end 7 | 8 | hook.Add("PlayerRevived", "nzupdateReviveScore", function(ply, revivor) 9 | if IsValid(revivor) and revivor:IsPlayer() then 10 | revivor:IncrementTotalRevives() 11 | end 12 | end ) 13 | 14 | hook.Add("PlayerDowned", "nzupdateDownedScore", function(ply) 15 | if IsValid(ply) and ply:IsPlayer() then 16 | ply:IncrementTotalDowns() 17 | end 18 | end ) 19 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_quickknife_crowbar/init.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile( "cl_init.lua" ) 3 | AddCSLuaFile( "shared.lua" ) 4 | 5 | include( "shared.lua" ) 6 | include( "ai_translations.lua" ) 7 | 8 | SWEP.Weight = 0 9 | SWEP.AutoSwitchTo = false 10 | SWEP.AutoSwitchFrom = false 11 | 12 | /*--------------------------------------------------------- 13 | Name: OnDrop 14 | Desc: Weapon was dropped 15 | ---------------------------------------------------------*/ 16 | function SWEP:OnDrop() 17 | 18 | if ( IsValid( self.Weapon ) ) then 19 | // self.Weapon:Remove() 20 | end 21 | 22 | end 23 | 24 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/shared.lua: -------------------------------------------------------------------------------- 1 | GM.Name = "nZombies" 2 | GM.Author = "Alig96, Zet0r, Lolle" 3 | GM.Email = "N/A" 4 | GM.Website = "N/A" 5 | 6 | -- Constants -- 7 | 8 | --Round Constants 9 | 10 | ROUND_WAITING = 0 11 | ROUND_INIT = 1 12 | ROUND_PREP = 2 13 | ROUND_PROG = 3 14 | ROUND_CREATE = 4 15 | ROUND_GO = 5 16 | 17 | --Team Constants 18 | 19 | TEAM_SPECS = 1 20 | TEAM_PLAYERS = 2 21 | TEAM_ZOMBIES = 3 22 | 23 | --Setup Teams 24 | team.SetUp( TEAM_SPECS, "Spectators", Color( 255, 255, 255 ) ) 25 | team.SetUp( TEAM_PLAYERS, "Players", Color( 255, 0, 0 ) ) 26 | team.SetUp( TEAM_ZOMBIES, "Zombies", Color( 0, 255, 0 ) ) 27 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/random_box_spawns/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "random_box_spawns" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:Initialize() 12 | self:SetModel( "models/nzprops/mysterybox_pile.mdl" ) 13 | self:SetColor( Color(255, 255, 255) ) 14 | self:SetMoveType( MOVETYPE_NONE ) 15 | self:SetSolid( SOLID_VPHYSICS ) 16 | --self:SetNotSolid(true) 17 | --self:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER ) 18 | --self:DrawShadow( false ) 19 | end 20 | 21 | if CLIENT then 22 | 23 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/round/cl_round_meta.lua: -------------------------------------------------------------------------------- 1 | function nzRound:GetState() return self.State end 2 | function nzRound:SetState( state ) self.State = state end 3 | 4 | function nzRound:GetNumber() return self.Number or 0 end 5 | function nzRound:SetNumber( num ) self.Number = num end 6 | 7 | function nzRound:IsSpecial() return self.SpecialRound or false end 8 | function nzRound:SetSpecial( bool ) self.SpecialRound = bool end 9 | 10 | function nzRound:InState( state ) 11 | return nzRound:GetState() == state 12 | end 13 | 14 | function nzRound:InProgress() 15 | return nzRound:GetState() == ROUND_PREP or nzRound:GetState() == ROUND_PROG 16 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/breakable_entry_plank/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "breakable_entry_plank" 6 | ENT.Author = "Alig96" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | //models/props_interiors/elevatorshaft_door01a.mdl 11 | //models/props_debris/wood_board02a.mdl 12 | function ENT:Initialize() 13 | 14 | self:SetModel("models/props_debris/wood_board02a.mdl") 15 | self:SetMoveType( MOVETYPE_VPHYSICS ) 16 | self:SetSolid( SOLID_VPHYSICS ) 17 | self:SetModelScale(1.25) 18 | 19 | end 20 | 21 | if CLIENT then 22 | function ENT:Draw() 23 | self:DrawModel() 24 | end 25 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_script_prop/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "nz_script_prop" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "youtube.com/Zet0r" 8 | ENT.Purpose = "Scriptable prop for nZombies" 9 | ENT.Instructions = "" 10 | 11 | function ENT:Initialize() 12 | if SERVER then 13 | self:SetMoveType( MOVETYPE_NONE ) 14 | self:SetSolid( SOLID_VPHYSICS ) 15 | --self:DrawShadow( false ) 16 | self:SetUseType( SIMPLE_USE ) 17 | end 18 | end 19 | 20 | function ENT:OnRemove() 21 | hook.Call("nzmapscript_PropRemoved", nil, self) 22 | end 23 | 24 | if CLIENT then 25 | function ENT:Draw() 26 | self:DrawModel() 27 | end 28 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/debugging/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | NZ_DEBUG_LOGLEVEL_MAX = 3 2 | NZ_DEBUG_LOGLEVEL_INFO = 2 3 | NZ_DEBUG_LOGLEVEL_ERROR = 1 4 | 5 | CreateConVar("nz_log_level", "0", FCVAR_ARCHIVE, "The nz log level.") 6 | 7 | -- Usage: Provide a loglevel and a comma seperated list of values 8 | function DebugPrint(logLevel, ...) 9 | local requiredLvl = GetConVar("nz_log_level"):GetInt() or 0 10 | if requiredLvl >= logLevel then 11 | local arg = {...} 12 | local result = "" 13 | for i=1, #arg do 14 | if istable(arg[i]) then 15 | PrintTable(arg[i]) 16 | else 17 | result = result .. tostring(arg[i]) .. "\t" 18 | end 19 | end 20 | print(result) 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/round/sv_hooks.lua: -------------------------------------------------------------------------------- 1 | function nzRound:OnPlayerReady( ply ) 2 | 3 | self:SendReadyState( ply, true ) 4 | 5 | --Start Round if we have enough players 6 | if self:InState( ROUND_WAITING ) and #player.GetAllReady() > #player.GetAllNonSpecs() / 3 then 7 | self:Init() 8 | end 9 | 10 | end 11 | 12 | function nzRound:OnPlayerUnReady( ply ) 13 | 14 | self:SendReadyState( ply, false ) 15 | 16 | end 17 | 18 | function nzRound:OnPlayerDropIn( ply ) 19 | 20 | self:SendPlayingState( ply, true ) 21 | self:SendReadyState( ply, true ) 22 | 23 | end 24 | 25 | function nzRound:OnPlayerDropOut( ply ) 26 | 27 | self:SendPlayingState( ply, false ) 28 | self:SendReadyState( ply, false ) 29 | 30 | end 31 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/player_spawns/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "player_spawns" 6 | ENT.Author = "Alig96" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | ENT.NZOnlyVisibleInCreative = true 12 | 13 | function ENT:Initialize() 14 | self:SetModel( "models/player/odessa.mdl" ) 15 | self:SetMoveType( MOVETYPE_NONE ) 16 | self:SetSolid( SOLID_VPHYSICS ) 17 | self:SetCollisionGroup( COLLISION_GROUP_WEAPON ) 18 | self:SetColor(Color(0,0,255)) 19 | self:DrawShadow( false ) 20 | end 21 | 22 | if CLIENT then 23 | function ENT:Draw() 24 | if nzRound:InState( ROUND_CREATE ) then 25 | self:DrawModel() 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entitiestemporary/info_player_undead/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | function ENT:Initialize() 4 | end 5 | 6 | function ENT:KeyValue(key, value) 7 | key = string.lower(key) 8 | if key == "disabled" then 9 | self.Disabled = tonumber(value) == 1 10 | elseif key == "active" then 11 | self.Disabled = tonumber(value) == 0 12 | end 13 | end 14 | 15 | function ENT:AcceptInput(name, activator, caller, arg) 16 | name = string.lower(name) 17 | if name == "enable" then 18 | self.Disabled = false 19 | return true 20 | elseif name == "disable" then 21 | self.Disabled = true 22 | return true 23 | elseif name == "toggle" then 24 | self.Disabled = not self.Disabled 25 | return true 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/doors/sv_hooks.lua: -------------------------------------------------------------------------------- 1 | function nzDoors:OnPlayerBuyDoor( ply, door ) 2 | 3 | end 4 | 5 | function nzDoors:OnAllDoorsLocked( ) 6 | self:SendAllDoorsLocked() 7 | end 8 | 9 | function nzDoors:OnDoorUnlocked( door, link, rebuyable, ply ) 10 | self:SendDoorOpened( door, rebuyable ) 11 | end 12 | 13 | function nzDoors:OnMapDoorLinkCreated( door, flags, id ) 14 | self:SendMapDoorCreation(door, flags, id) 15 | end 16 | 17 | function nzDoors:OnMapDoorLinkRemoved( door, id ) 18 | self:SendMapDoorRemoval(door) 19 | end 20 | 21 | function nzDoors:OnPropDoorLinkCreated( ent, flags ) 22 | self:SendPropDoorCreation( ent, flags ) 23 | end 24 | 25 | function nzDoors:OnPropDoorLinkRemoved( ent ) 26 | self:SendPropDoorRemoval( ent ) 27 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entitiestemporary/info_player_zombie/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | function ENT:Initialize() 4 | end 5 | 6 | function ENT:Think() 7 | end 8 | 9 | function ENT:KeyValue(key, value) 10 | key = string.lower(key) 11 | if key == "disabled" then 12 | self.Disabled = tonumber(value) == 1 13 | elseif key == "active" then 14 | self.Disabled = tonumber(value) == 0 15 | end 16 | end 17 | 18 | function ENT:AcceptInput(name, activator, caller, arg) 19 | name = string.lower(name) 20 | if name == "enable" then 21 | self.Disabled = false 22 | return true 23 | elseif name == "disable" then 24 | self.Disabled = true 25 | return true 26 | elseif name == "toggle" then 27 | self.Disabled = not self.Disabled 28 | return true 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/player_class/sv_healthregen.lua: -------------------------------------------------------------------------------- 1 | local HealthRegen = { 2 | Amount = 10, 3 | Delay = 3, 4 | Rate = 0.05 5 | } 6 | 7 | hook.Add( "Think", "RegenHealth", function() 8 | for k,v in pairs( player.GetAll() ) do 9 | 10 | if v:Alive() and v:GetNotDowned() and v:Health() < v:GetMaxHealth() and (!v.lastregen or CurTime() > v.lastregen + HealthRegen.Rate) and (!v.lasthit or CurTime() > v.lasthit + HealthRegen.Delay) then 11 | v.lastregen = CurTime() 12 | v:SetHealth( math.Clamp(v:Health() + HealthRegen.Amount, 0, v:GetMaxHealth() ) ) 13 | end 14 | end 15 | end ) 16 | 17 | hook.Add( "EntityTakeDamage", "PreventHealthRegen", function(ent, dmginfo) 18 | if ent:IsPlayer() and ent:GetNotDowned() then 19 | ent.lasthit = CurTime() 20 | end 21 | end) 22 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/special_weapons/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Setup Doors module 2 | nzSpecialWeapons = nzSpecialWeapons or AddNZModule("SpecialWeapons") 3 | 4 | --nzSpecialWeapons.Categories = nzSpecialWeapons.Categories or {} 5 | 6 | nzSpecialWeapons.Keys = nzSpecialWeapons.Keys or { 7 | ["knife"] = KEY_V, 8 | ["grenade"] = KEY_G, 9 | ["specialgrenade"] = KEY_B, 10 | } 11 | 12 | function nzSpecialWeapons:RegisterSpecialWeaponCategory(id, defaultkey) 13 | if !self.Keys[id] then 14 | if defaultkey and CLIENT then CreateClientConVar("nz_key_"..string.lower(id), defaultkey, true, true, "Sets the key that equips "..id..". Uses numbers from gmod's KEY_ enums: http://wiki.garrysmod.com/page/Enums/KEY") end 15 | self.Keys[id] = defaultkey -- To use as default 16 | end 17 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/easter_egg/shared.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "anim" 2 | 3 | ENT.PrintName = "easter_egg" 4 | ENT.Author = "Alig96" 5 | ENT.Contact = "Don't" 6 | ENT.Purpose = "" 7 | ENT.Instructions = "" 8 | 9 | 10 | AddCSLuaFile() 11 | 12 | 13 | 14 | function ENT:Initialize() 15 | 16 | self:SetModel( "models/props_lab/huladoll.mdl" ) 17 | self:SetMoveType( MOVETYPE_NONE ) 18 | self:SetSolid( SOLID_VPHYSICS ) 19 | self:SetCollisionGroup( COLLISION_GROUP_WEAPON ) 20 | self.Used = false 21 | if SERVER then 22 | self:SetUseType(SIMPLE_USE) 23 | end 24 | end 25 | 26 | function ENT:Use( activator, caller ) 27 | if !self.Used and nzRound:InProgress() then 28 | nzEE:ActivateEgg( self, activator ) 29 | end 30 | end 31 | 32 | function ENT:Draw() 33 | self:DrawModel() 34 | end 35 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/notifications/sh_sync.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | if SERVER then 4 | 5 | -- Server to client (Server) 6 | util.AddNetworkString( "nz.Notifications.Request" ) 7 | 8 | function nzNotifications:SendRequest(header, data) 9 | net.Start( "nz.Notifications.Request" ) 10 | net.WriteString( header ) 11 | net.WriteTable( data ) 12 | net.Broadcast() 13 | end 14 | 15 | end 16 | 17 | if CLIENT then 18 | 19 | -- Server to client (Client) 20 | local function ReceiveRequest( length ) 21 | --print("Received Notifications Request") 22 | local header = net.ReadString() 23 | local data = net.ReadTable() 24 | 25 | if header == "sound" then 26 | nzNotifications:AddSoundToQueue(data) 27 | end 28 | end 29 | 30 | -- Receivers 31 | net.Receive( "nz.Notifications.Request", ReceiveRequest ) 32 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/q_menu/sh_populate.lua: -------------------------------------------------------------------------------- 1 | 2 | function nzQMenu.AddNewEntity( ent, icon, name ) 3 | table.insert(nzQMenu.Data.Entities, {ent, icon, name}) 4 | end 5 | 6 | -- QuickFunctions 7 | PropMenuAddEntity = nzQMenu.AddNewEntity 8 | 9 | PropMenuAddEntity("edit_fog", "entities/edit_fog.png", "Base Fog Editor") 10 | PropMenuAddEntity("edit_fog_special", "entities/edit_fog.png", "Special Round Fog Editor") 11 | PropMenuAddEntity("edit_sky", "entities/edit_sky.png", "Sky Editor") 12 | PropMenuAddEntity("edit_sun", "entities/edit_sun.png", "Sun Editor") 13 | PropMenuAddEntity("edit_color", "gmod/demo.png", "Color Correction Editor") 14 | PropMenuAddEntity("nz_fire_effect", "icon16/fire.png", "Fire Effect") 15 | PropMenuAddEntity("edit_dynlight", "icon16/lightbulb.png", "Dynamic Light") 16 | --PropMenuAddEntity("edit_damage", "icon16/lightbulb.png", "Damage") -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_quickknife_crowbar/ai_translations.lua: -------------------------------------------------------------------------------- 1 | 2 | /*--------------------------------------------------------- 3 | Name: SetupWeaponHoldTypeForAI 4 | Desc: Mainly a Todo.. In a seperate file to clean up the init.lua 5 | ---------------------------------------------------------*/ 6 | function SWEP:SetupWeaponHoldTypeForAI( t ) 7 | 8 | self.ActivityTranslateAI = {} 9 | self.ActivityTranslateAI [ ACT_STAND ] = ACT_IDLE_MELEE 10 | self.ActivityTranslateAI [ ACT_IDLE_ANGRY ] = ACT_IDLE_ANGRY_MELEE 11 | 12 | self.ActivityTranslateAI [ ACT_MP_RUN ] = ACT_HL2MP_RUN_MELEE 13 | self.ActivityTranslateAI [ ACT_MP_CROUCHWALK ] = ACT_HL2MP_WALK_CROUCH_MELEE 14 | 15 | self.ActivityTranslateAI [ ACT_MELEE_ATTACK1 ] = ACT_MELEE_ATTACK1 16 | 17 | self.ActivityTranslateAI [ ACT_RELOAD ] = ACT_RELOAD 18 | 19 | end 20 | 21 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/perks/sv_solorevive.lua: -------------------------------------------------------------------------------- 1 | function nzPerks:UpdateQuickRevive() 2 | if #player.GetAllPlaying() <= 1 then 3 | for k,v in pairs(ents.FindByClass("perk_machine")) do 4 | if v:GetPerkID() == "revive" then 5 | v:SetPrice(500) -- Price is 500 for Solo variant and always on 6 | v:TurnOn() 7 | end 8 | end 9 | else 10 | for k,v in pairs(ents.FindByClass("perk_machine")) do 11 | if v:GetPerkID() == "revive" then 12 | v:SetPrice(1500) -- Reset to default 1500 and turn off if power is not on 13 | if !IsElec() then 14 | v:TurnOff() 15 | else 16 | v:TurnOn() 17 | end 18 | end 19 | end 20 | end 21 | end 22 | 23 | hook.Add("OnPlayerDropIn", "UpdateRevive", function() 24 | nzPerks:UpdateQuickRevive() 25 | end) 26 | 27 | hook.Add("OnPlayerDropOut", "UpdateRevive", function() 28 | nzPerks:UpdateQuickRevive() 29 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mapping/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Setup round module 2 | nzMapping = nzMapping or AddNZModule("Mapping") 3 | 4 | -- Variables 5 | nzMapping.Settings = nzMapping.Settings or {} 6 | nzMapping.MarkedProps = nzMapping.MarkedProps or {} 7 | nzMapping.ScriptHooks = nzMapping.ScriptHooks or {} 8 | 9 | -- Once more gamemode entities are added, add the gamemodes to this list 10 | nzMapping.GamemodeExtensions = nzMapping.GamemodeExtensions or { 11 | ["Zombie Survival"] = false, 12 | } 13 | 14 | -- Prevent undo without being in creative 15 | -- This can be circumvented with "alias", but it's more for accidental undos than exploit fixing 16 | if CLIENT then 17 | hook.Add("PlayerBindPress", "nzUndoHandling", function(ply, bind, pressed) 18 | if string.find(bind, "undo") then 19 | if !ply:IsInCreative() then 20 | return true 21 | end 22 | end 23 | end) 24 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_electricity.lua: -------------------------------------------------------------------------------- 1 | 2 | ENT.Type = "point" 3 | ENT.Base = "base_point" 4 | 5 | -- An entity to be used in Hammer that can turn the electricity on or off, and will fire outputs when this happens. 6 | -- To use it, grab the nzombies.fgd from the gamemode and import it into Hammer. 7 | 8 | function ENT:Initialize() 9 | -- Calling this when the entity is created so you can turn off the lights only if the gamemode is nZombies. 10 | if engine.ActiveGamemode() == "nzombies3" then 11 | self:TriggerOutput("OnInitialized", self) 12 | end 13 | end 14 | 15 | function ENT:KeyValue(k, v) 16 | 17 | end 18 | 19 | function ENT:AcceptInput(name, activator, caller, data) 20 | if name == "TurnElectricityOn" then 21 | nzElec:Activate(data == "1") 22 | return true 23 | elseif name == "TurnElectricityOff" then 24 | nzElec:Reset(data == "1") 25 | return true 26 | end 27 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/revive_system/sv_hooks.lua: -------------------------------------------------------------------------------- 1 | local defaultdata = { 2 | DownTime = true, 3 | ReviveTime = true, 4 | RevivePlayer = true, 5 | } 6 | 7 | function nzRevive:PlayerDowned( ply ) 8 | local attdata = {} 9 | -- Attach whatever other data was attached to the table, other than the default ones 10 | for k,v in pairs(nzRevive.Players[ply:EntIndex()]) do 11 | if !defaultdata[k] then attdata[k] = v end 12 | end 13 | self:SendPlayerDowned( ply, nil, attdata ) 14 | end 15 | 16 | function nzRevive:PlayerRevived( ply ) 17 | self:SendPlayerRevived( ply ) 18 | end 19 | 20 | function nzRevive:PlayerBeingRevived( ply, revivor ) 21 | self:SendPlayerBeingRevived( ply, revivor ) 22 | end 23 | 24 | function nzRevive:PlayerNoLongerBeingRevived( ply ) 25 | self:SendPlayerBeingRevived( ply ) -- No second argument means no revivor 26 | end 27 | 28 | 29 | function nzRevive:PlayerKilled( ply ) 30 | self:SendPlayerKilled( ply ) 31 | end 32 | -------------------------------------------------------------------------------- /lua/nzmapscripts/template.lua: -------------------------------------------------------------------------------- 1 | local mapscript = {} 2 | 3 | -- Any function added to this table will automatically get hooked to the hook with the same name 4 | function mapscript.RoundInit() 5 | -- E.g. this function will run with the RoundInit hook 6 | print(mapscript.TestPrint) 7 | end 8 | 9 | -- This one will be called at the start of each round 10 | function mapscript.RoundStart() 11 | 12 | end 13 | 14 | -- Will be called every second if a round is in progress (zombies are alive) 15 | function mapscript.RoundThink() 16 | 17 | end 18 | 19 | -- Will be called after each round 20 | function mapscript.RoundEnd() 21 | 22 | end 23 | 24 | -- Only functions will be hooked, meaning you can safely store data as well 25 | mapscript.TestPrint = "v0.0" 26 | local testprint2 = "This is cool" -- You can also store the data locally 27 | 28 | -- Always return the mapscript table. This gives it on to the gamemode so it can use it. 29 | return mapscript 30 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/notifications/sh_sounds.lua: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | if SERVER then 4 | 5 | function nzNotifications:PlaySound(path, delay) 6 | self:SendRequest("sound", {path = path, delay = delay}) 7 | end 8 | 9 | end 10 | 11 | if CLIENT then 12 | 13 | function nzNotifications:AddSoundToQueue(data) 14 | table.insert(self.Data.SoundQueue, data) 15 | end 16 | 17 | function nzNotifications.SoundHandler() 18 | -- Check we're allowed to play the next sound 19 | if CurTime() > nzNotifications.Data.NextSound then 20 | -- Check the queue 21 | if nzNotifications.Data.SoundQueue[1] != nil then 22 | local data = nzNotifications.Data.SoundQueue[1] 23 | table.remove(nzNotifications.Data.SoundQueue, 1) 24 | surface.PlaySound( data.path ) 25 | nzNotifications.Data.NextSound = CurTime() + data.delay 26 | end 27 | end 28 | end 29 | 30 | timer.Create("nz.Sound.Handler", 1, 0, nzNotifications.SoundHandler) 31 | end 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/sh_wep_sync.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | 4 | if SERVER then 5 | 6 | -- Server to client (Server) 7 | util.AddNetworkString( "nzWeps.Sync" ) 8 | 9 | function nzWeps:SendSync( ply, weapon, modifier, revert ) 10 | net.Start( "nzWeps.Sync" ) 11 | net.WriteEntity( weapon ) 12 | net.WriteString( modifier ) 13 | net.WriteBool( revert ) 14 | return ply and net.Send( ply ) or net.Broadcast() 15 | end 16 | 17 | end 18 | 19 | if CLIENT then 20 | 21 | -- Server to client (Client) 22 | local function ReceiveSync( length ) 23 | local wep = net.ReadEntity() 24 | local modifier = net.ReadString() 25 | local revert = net.ReadBool() 26 | 27 | if !IsValid(wep) or !modifier then return end 28 | 29 | if revert then 30 | wep:RevertNZModifier(modifier) 31 | else 32 | wep:ApplyNZModifier(modifier) 33 | end 34 | end 35 | 36 | -- Receivers 37 | net.Receive( "nzWeps.Sync", ReceiveSync ) 38 | end 39 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/scoring/sh_player.lua: -------------------------------------------------------------------------------- 1 | local meta = FindMetaTable("Player") 2 | 3 | function meta:GetTotalKills() 4 | return self:GetNWInt("iZombiesKilled", 0) 5 | end 6 | 7 | function meta:SetTotalKills(value) 8 | self:SetNWInt("iZombiesKilled", value) 9 | end 10 | 11 | function meta:IncrementTotalKills() 12 | self:SetTotalKills(self:GetTotalKills() + 1) 13 | end 14 | 15 | function meta:GetTotalDowns() 16 | return self:GetNWInt("iTotalDowns", 0) 17 | end 18 | 19 | function meta:SetTotalDowns(value) 20 | self:SetNWInt("iTotalDowns", value) 21 | end 22 | 23 | function meta:IncrementTotalDowns() 24 | self:SetTotalDowns(self:GetTotalDowns() + 1) 25 | end 26 | 27 | function meta:GetTotalRevives() 28 | return self:GetNWInt("iTotalRevieves", 0) 29 | end 30 | 31 | function meta:SetTotalRevives(value) 32 | self:SetNWInt("iTotalRevieves", value) 33 | end 34 | 35 | function meta:IncrementTotalRevives() 36 | self:SetTotalRevives(self:GetTotalRevives() + 1) 37 | end 38 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_pspawn.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("pspawn", { 2 | displayname = "Player Spawn Creator", 3 | desc = "LMB: Place Spawnpoint, RMB: Remove Spawnpoint", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | PrimaryAttack = function(wep, ply, tr, data) 8 | nzMapping:PlayerSpawn(tr.HitPos, ply) 9 | end, 10 | SecondaryAttack = function(wep, ply, tr, data) 11 | if IsValid(tr.Entity) and tr.Entity:GetClass() == "player_spawns" then 12 | tr.Entity:Remove() 13 | end 14 | end, 15 | Reload = function(wep, ply, tr, data) 16 | -- Nothing 17 | end, 18 | OnEquip = function(wep, ply, data) 19 | 20 | end, 21 | OnHolster = function(wep, ply, data) 22 | 23 | end 24 | }, { 25 | displayname = "Player Spawn Creator", 26 | desc = "LMB: Place Spawnpoint, RMB: Remove Spawnpoint", 27 | icon = "icon16/user.png", 28 | weight = 2, 29 | condition = function(wep, ply) 30 | return true 31 | end, 32 | interface = function(frame, data) end, 33 | -- defaultdata = {} 34 | }) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/easter_eggs/sv_major_ee.lua: -------------------------------------------------------------------------------- 1 | nzEE.Major.Steps = nzEE.Major.Steps or {} 2 | nzEE.Major.CurrentStep = nzEE.Major.CurrentStep or 1 3 | 4 | function nzEE.Major:AddStep(func, step) 5 | if step and tonumber(step) then 6 | nzEE.Major.Steps[step] = func 7 | else 8 | table.insert(nzEE.Major.Steps, func) 9 | end 10 | end 11 | 12 | function nzEE.Major:SetCurrentStep(step) 13 | nzEE.Major.CurrentStep = step 14 | end 15 | 16 | function nzEE.Major:CompleteStep(step, ...) 17 | if nzEE.Major.CurrentStep == step then 18 | if nzEE.Major.Steps[step] then 19 | print("Completed step "..step) 20 | local args = {...} 21 | nzEE.Major.Steps[step](args) -- Varargs passable if you call Complete Step with more stuff 22 | end 23 | nzEE.Major.CurrentStep = nzEE.Major.CurrentStep + 1 24 | end 25 | end 26 | 27 | util.AddNetworkString("nzMajorEEEndScreen") 28 | 29 | function nzEE.Major:Reset() 30 | nzEE.Major.CurrentStep = 1 31 | end 32 | 33 | function nzEE.Major:Cleanup() 34 | nzEE.Major.CurrentStep = 1 35 | nzEE.Major.Steps = {} 36 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/base_edit.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile() 3 | DEFINE_BASECLASS( "base_anim" ) 4 | 5 | ENT.PrintName = "" 6 | ENT.Author = "" 7 | ENT.Contact = "" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | ENT.Spawnable = false 12 | ENT.AdminOnly = false 13 | ENT.Editable = true 14 | 15 | function ENT:Initialize() 16 | 17 | if ( CLIENT ) then return end 18 | 19 | self:SetModel( "models/MaxOfS2D/cube_tool.mdl" ) 20 | self:PhysicsInit( SOLID_VPHYSICS ) 21 | self:SetUseType( ONOFF_USE ) 22 | 23 | end 24 | 25 | function ENT:SpawnFunction( ply, tr, ClassName ) 26 | 27 | if ( !tr.Hit ) then return end 28 | 29 | local SpawnPos = tr.HitPos + tr.HitNormal * 10 30 | local SpawnAng = ply:EyeAngles() 31 | SpawnAng.p = 0 32 | SpawnAng.y = SpawnAng.y + 180 33 | 34 | local ent = ents.Create( ClassName ) 35 | ent:SetPos( SpawnPos ) 36 | ent:SetAngles( SpawnAng ) 37 | ent:Spawn() 38 | ent:Activate() 39 | 40 | return ent 41 | 42 | end 43 | 44 | 45 | function ENT:EnableForwardArrow() 46 | 47 | self:SetBodygroup( 1, 1 ) 48 | 49 | end 50 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_elec.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("elec", { 2 | displayname = "Electricity Switch Placer", 3 | desc = "LMB: Place Electricity Switch, RMB: Remove Switch", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | 8 | PrimaryAttack = function(wep, ply, tr, data) 9 | nzMapping:Electric(tr.HitPos + tr.HitNormal*5, tr.HitNormal:Angle(), nil, ply) 10 | end, 11 | 12 | SecondaryAttack = function(wep, ply, tr, data) 13 | if IsValid(tr.Entity) and tr.Entity:GetClass() == "power_box" then 14 | tr.Entity:Remove() 15 | end 16 | end, 17 | Reload = function(wep, ply, tr, data) 18 | -- Nothing 19 | end, 20 | OnEquip = function(wep, ply, data) 21 | 22 | end, 23 | OnHolster = function(wep, ply, data) 24 | 25 | end 26 | }, { 27 | displayname = "Electricity Switch Placer", 28 | desc = "LMB: Place Electricity Switch, RMB: Remove Switch", 29 | icon = "icon16/lightning.png", 30 | weight = 8, 31 | condition = function(wep, ply) 32 | return true 33 | end, 34 | interface = function(frame, data) 35 | 36 | end, 37 | --defaultdata = {} 38 | }) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/ttt_traitor_button/shared.lua: -------------------------------------------------------------------------------- 1 | -- We remake the Traitor Button so it can be given a price and triggered in nZombies 2 | -- If it has no price, it will not be usable - A price of 0 will make it usable for free 3 | 4 | ENT.Type = "anim" 5 | ENT.Base = "base_anim" 6 | 7 | function ENT:SetupDataTables() 8 | self:NetworkVar("Float", 0, "Delay") 9 | self:NetworkVar("Float", 1, "NextUseTime") 10 | self:NetworkVar("Bool", 0, "TTTLocked") 11 | self:NetworkVar("String", 0, "Description") 12 | self:NetworkVar("Int", 0, "UsableRange", {KeyName = "UsableRange"}) 13 | end 14 | 15 | function ENT:IsUsable() 16 | return (not self:GetTTTLocked()) and self:GetNextUseTime() < CurTime() and self:GetDoorData() 17 | end 18 | 19 | if CLIENT then 20 | local mat = Material( "icon16/exclamation.png" ) 21 | function ENT:Draw() 22 | if !nzRound:InState( ROUND_CREATE ) then return end 23 | 24 | render.SetMaterial( mat ) 25 | render.DrawSprite( self:GetPos(), 4, 4, color_white ) 26 | end 27 | 28 | -- Handling of buttons (copied from TTT Code) 29 | 30 | 31 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/buildable_table_prop/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "buildable_table_prop" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "youtube.com/Zet0r" 8 | ENT.Purpose = "Scriptable prop for nZombies" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | self:NetworkVar( "Entity", 0, "Workbench" ) 13 | end 14 | 15 | function ENT:Initialize() 16 | if SERVER then 17 | --if !IsValid(self.Table) then self:Remove() end 18 | self:SetMoveType( MOVETYPE_NONE ) 19 | self:SetSolid( SOLID_VPHYSICS ) 20 | --self:DrawShadow( false ) 21 | self:SetUseType( SIMPLE_USE ) 22 | self.RelayUse = self:GetWorkbench() 23 | end 24 | end 25 | 26 | function ENT:Use(arg1, arg2, arg3, arg4) 27 | local tbl = self:GetWorkbench() 28 | if IsValid(tbl) then 29 | tbl:Use(arg1, arg2, arg3, arg4) -- Relay info 30 | end 31 | end 32 | 33 | if CLIENT then 34 | function ENT:GetNZTargetText() 35 | local tbl = self:GetWorkbench() 36 | if IsValid(tbl) then 37 | return tbl:GetNZTargetText() -- Relay info 38 | end 39 | end 40 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/electricity/sh_sync.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | if SERVER then 4 | 5 | -- Server to client (Server) 6 | util.AddNetworkString( "nz.nzElec.Sync" ) 7 | util.AddNetworkString( "nz.nzElec.Sound" ) 8 | 9 | function nzElec:SendSync(ply) 10 | net.Start( "nz.nzElec.Sync" ) 11 | net.WriteBool(self.Active) 12 | return IsValid(ply) and net.Send(ply) or net.Broadcast() 13 | end 14 | 15 | FullSyncModules["Elec"] = function(ply) 16 | nzElec:SendSync(ply) 17 | end 18 | 19 | end 20 | 21 | if CLIENT then 22 | 23 | -- Server to client (Client) 24 | local function ReceiveSync( length ) 25 | local active = net.ReadBool() 26 | nzElec.Active = active 27 | end 28 | 29 | local function RecievePowerSound() 30 | local on = net.ReadBool() 31 | print(on) 32 | if on then 33 | surface.PlaySound("nz/machines/power_up.wav") 34 | else 35 | surface.PlaySound("nz/machines/power_down.wav") 36 | end 37 | end 38 | 39 | -- Receivers 40 | net.Receive( "nz.nzElec.Sync", ReceiveSync ) 41 | net.Receive( "nz.nzElec.Sound", RecievePowerSound ) 42 | 43 | 44 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_ee.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("ee", { 2 | displayname = "Easter Egg Placer", 3 | desc = "LMB: Easter Egg, RMB: Remove Easter Egg, Use Player Handler to select song", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | PrimaryAttack = function(wep, ply, tr, data) 8 | nzMapping:EasterEgg(tr.HitPos, Angle(0,0,0), "models/props_lab/huladoll.mdl", ply) 9 | end, 10 | SecondaryAttack = function(wep, ply, tr, data) 11 | if IsValid(tr.Entity) and tr.Entity:GetClass() == "easter_egg" then 12 | tr.Entity:Remove() 13 | end 14 | end, 15 | Reload = function(wep, ply, tr, data) 16 | -- Nothing 17 | end, 18 | OnEquip = function(wep, ply, data) 19 | 20 | end, 21 | OnHolster = function(wep, ply, data) 22 | 23 | end 24 | }, { 25 | displayname = "Easter Egg Placer", 26 | desc = "LMB: Easter Egg, RMB: Remove Easter Egg, Use Player Handler to select song", 27 | icon = "icon16/music.png", 28 | weight = 20, 29 | condition = function(wep, ply) 30 | return true 31 | end, 32 | interface = function(frame, data) 33 | 34 | end, 35 | --defaultdata = {} 36 | }) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/round/cl_round.lua: -------------------------------------------------------------------------------- 1 | function nzRound:GetEndTime() 2 | return GetGlobalFloat( "gwEndTime", 0 ) 3 | end 4 | 5 | local states = { 6 | [ROUND_INIT] = "OnRoundInit", 7 | [ROUND_PREP] = "OnRoundPreparation", 8 | [ROUND_PROG] = "OnRoundStart", 9 | [ROUND_GO] = "OnRoundEnd", 10 | [ROUND_CREATE] = "OnRoundCreative", 11 | } 12 | 13 | function nzRound:StateChange( old, new ) 14 | if new == ROUND_WAITING then 15 | nzRound:EnableSpecialFog( false ) 16 | hook.Call( "OnRoundWating", nzRound ) 17 | else 18 | hook.Call( states[new], nzRound ) 19 | end 20 | hook.Call( "OnRoundChangeState", nzRound, new, old ) 21 | end 22 | 23 | function nzRound:OnRoundPreperation() 24 | if !self:IsSpecial() then 25 | self:EnableSpecialFog(false) 26 | end 27 | end 28 | 29 | function nzRound:OnRoundStart() 30 | if self:IsSpecial() then 31 | self:EnableSpecialFog(true) 32 | else 33 | self:EnableSpecialFog(false) 34 | end 35 | end 36 | 37 | net.Receive("nz_hellhoundround", function() 38 | if net.ReadBool() then 39 | hook.Call( "OnSpecialRoundStart" ) 40 | surface.PlaySound("nz/round/dog_start.wav") 41 | end 42 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/special_weapons/sh_specialweapons.lua: -------------------------------------------------------------------------------- 1 | 2 | local function RegisterDefaultSpecialWeps() 3 | nzSpecialWeapons:AddKnife( "nz_quickknife_crowbar", false, 0.65 ) 4 | nzSpecialWeapons:AddKnife( "nz_bowie_knife", true, 0.65, 2.5 ) 5 | nzSpecialWeapons:AddKnife( "nz_one_inch_punch", true, 0.75, 1.5 ) 6 | 7 | nzSpecialWeapons:AddGrenade( "nz_grenade", 4, false, 0.85, false, 0.4 ) -- ALWAYS pass false instead of nil or it'll assume default value 8 | nzSpecialWeapons:AddSpecialGrenade( "nz_monkey_bomb", 3, false, 3, false, 0.4 ) 9 | 10 | nzSpecialWeapons:AddDisplay( "nz_revive_morphine", false, function(wep) 11 | return !IsValid(wep.Owner:GetPlayerReviving()) 12 | end) 13 | 14 | nzSpecialWeapons:AddDisplay( "nz_perk_bottle", false, function(wep) 15 | return SERVER and CurTime() > wep.nzDeployTime + 3.1 16 | end) 17 | 18 | nzSpecialWeapons:AddDisplay( "nz_packapunch_arms", false, function(wep) 19 | return SERVER and CurTime() > wep.nzDeployTime + 2.5 20 | end) 21 | end 22 | 23 | hook.Add("InitPostEntity", "nzRegisterSpecialWeps", RegisterDefaultSpecialWeps) 24 | --hook.Add("OnReloaded", "nzRegisterSpecialWeps", RegisterDefaultSpecialWeps) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/point_worldhint/cl_init.lua: -------------------------------------------------------------------------------- 1 | include("shared.lua") 2 | 3 | function ENT:Initialize() 4 | self:DrawShadow(false) 5 | self:SetMoveType(MOVETYPE_NONE) 6 | self:SetSolid(SOLID_NONE) 7 | self:SetCollisionGroup(COLLISION_GROUP_WORLD) 8 | end 9 | 10 | local GripMaterial = Material( "sprites/grip" ) 11 | function ENT:Draw() 12 | if !nzRound:InState( ROUND_CREATE ) then return end 13 | render.SetMaterial( GripMaterial ) 14 | render.DrawSprite( self:GetPos(), 16, 16, color_white ) 15 | --self:DrawHint() 16 | end 17 | 18 | function ENT:DrawHint() 19 | -- Only if set to ALL or HUMANS 20 | if self:GetViewable() == 0 or self:GetViewable() == 4 then 21 | local pos = self:GetPos() 22 | local eyepos = EyePos() 23 | local range = self:GetRange() 24 | 25 | if range <= 0 then 26 | DrawWorldHint(self:GetHint(), pos) 27 | else 28 | local dist = pos:Distance(eyepos) 29 | if dist <= range then 30 | --[[local fadeoff = range * 0.75 31 | if dist >= fadeoff then 32 | DrawWorldHint(self:GetHint(), pos, 1 - (dist - fadeoff) / range) 33 | else]] 34 | DrawWorldHint(self:GetHint(), pos) 35 | --end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/special_weapons/sh_sync.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | util.AddNetworkString("nzSendSpecialWeapon") 3 | 4 | function nzSpecialWeapons:SendSpecialWeaponAdded(ply, wep, id) 5 | timer.Simple(0.5, function() 6 | if IsValid(ply) then 7 | net.Start("nzSendSpecialWeapon") 8 | net.WriteString(id) 9 | net.WriteBool(true) 10 | net.WriteEntity(wep) 11 | net.Send(ply) 12 | end 13 | end) 14 | end 15 | 16 | function nzSpecialWeapons:SendSpecialWeaponRemoved(ply, id) 17 | timer.Simple(0.1, function() 18 | if IsValid(ply) then 19 | net.Start("nzSendSpecialWeapon") 20 | net.WriteString(id) 21 | net.WriteBool(false) 22 | net.Send(ply) 23 | end 24 | end) 25 | end 26 | end 27 | 28 | if CLIENT then 29 | local function ReceiveSpecialWeaponAdded() 30 | if !LocalPlayer().NZSpecialWeapons then LocalPlayer().NZSpecialWeapons = {} end 31 | local id = net.ReadString() 32 | local bool = net.ReadBool() 33 | 34 | if bool then 35 | local ent = net.ReadEntity() 36 | LocalPlayer().NZSpecialWeapons[id] = ent 37 | else 38 | LocalPlayer().NZSpecialWeapons[id] = nil 39 | end 40 | end 41 | net.Receive("nzSendSpecialWeapon", ReceiveSpecialWeaponAdded) 42 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sh_weightedrandom.lua: -------------------------------------------------------------------------------- 1 | -- http://snippets.luacode.org/snippets/Weighted_random_choice_104 2 | 3 | -- Modified to allow special weight keys 4 | 5 | local function weighted_total( choices, weightkey ) 6 | local total = 0 7 | if weightkey then 8 | for choice, weight in pairs(choices) do 9 | total = total + weight[weightkey] 10 | end 11 | else 12 | for choice, weight in pairs(choices) do 13 | total = total + weight 14 | end 15 | end 16 | return total 17 | end 18 | 19 | local function weighted_random_choice( choices, weightkey ) 20 | local threshold = math.random(0, weighted_total( choices, weightkey )) 21 | local last_choice 22 | if weightkey then 23 | for choice, weight in pairs(choices) do 24 | threshold = threshold - weight[weightkey] 25 | if threshold <= 0 then return choice end 26 | last_choice = choice 27 | end 28 | else 29 | for choice, weight in pairs(choices) do 30 | threshold = threshold - weight 31 | if threshold <= 0 then return choice end 32 | last_choice = choice 33 | end 34 | end 35 | return last_choice 36 | end 37 | 38 | function nzMisc.WeightedRandom( choices, weightkey ) 39 | return weighted_random_choice( choices, weightkey ) 40 | end 41 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/function_override/sh_hookorder.lua: -------------------------------------------------------------------------------- 1 | -- Add to this table as more conflicting hook names are found 2 | local hooks = { 3 | "PlayerUse", 4 | } 5 | 6 | -- This rehooks all hooks marked in the above table, making nZ-hooks run first to avoid conflicts 7 | hook.Add("InitPostEntity", "nzReorderHooks", function() 8 | timer.Simple(3, function() 9 | local tbl = hook.GetTable() 10 | for k,v in pairs(hooks) do 11 | local funcs = tbl[v] 12 | if funcs then 13 | local nzfuncs = {} 14 | local nonfuncs = {} 15 | 16 | for k2,v2 in pairs(funcs) do -- Loop through all hooks 17 | if string.sub(k2, 1, 2) == "nz" then -- Store which ones are nZ and which are not 18 | nzfuncs[k2] = v2 19 | else 20 | nonfuncs[k2] = v2 21 | end 22 | hook.Remove(v, k2) -- Unhook 23 | end 24 | 25 | -- Now rehook all hooks so the pairs iterator loops through nZ first 26 | for k2,v2 in pairs(nzfuncs) do 27 | hook.Add(v, "_"..k2, v2) -- Prepend _ to make it alphabetically first 28 | end 29 | for k2,v2 in pairs(nonfuncs) do 30 | hook.Add(v, "addon_"..k2, v2) -- Prepend "addon_" to make sure, doesn't actually change anything 31 | end 32 | end 33 | end 34 | end) 35 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_quickknife_crowbar/cl_init.lua: -------------------------------------------------------------------------------- 1 | 2 | include('shared.lua') 3 | 4 | 5 | SWEP.PrintName = "Crowbar" 6 | SWEP.ClassName = "nz_quickknife_crowbar" 7 | SWEP.Slot = 0 8 | SWEP.SlotPos = 0 9 | SWEP.DrawAmmo = false 10 | SWEP.DrawCrosshair = true 11 | SWEP.DrawWeaponInfoBox = false 12 | SWEP.BounceWeaponIcon = false 13 | 14 | SWEP.WepSelectFont = "HL2MPTypeDeath" 15 | SWEP.WepSelectLetter = "6" 16 | SWEP.IconFont = "HL2MPTypeDeath" 17 | SWEP.IconLetter = "6" 18 | 19 | /*--------------------------------------------------------- 20 | Checks the objects before any action is taken 21 | This is to make sure that the entities haven't been removed 22 | ---------------------------------------------------------*/ 23 | function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) 24 | 25 | // Set us up the texture 26 | surface.SetDrawColor( color_transparent ) 27 | surface.SetTextColor( 255, 220, 0, alpha ) 28 | surface.SetFont( self.WepSelectFont ) 29 | local w, h = surface.GetTextSize( self.WepSelectLetter ) 30 | 31 | // Draw that mother 32 | surface.SetTextPos( x + ( wide / 2 ) - ( w / 2 ), 33 | y + ( tall / 2 ) - ( h / 2 ) ) 34 | surface.DrawText( self.WepSelectLetter ) 35 | 36 | end 37 | 38 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/point_worldhint/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile("cl_init.lua") 2 | AddCSLuaFile("shared.lua") 3 | 4 | include("shared.lua") 5 | 6 | function ENT:Initialize() 7 | -- Remove it as soon as it spawns, if the gamemode hasn't been enabled in Map Settings 8 | if !nzMapping.Settings.gamemodeentities then 9 | self:Remove() 10 | end 11 | 12 | self:DrawShadow(false) 13 | self:SetMoveType(MOVETYPE_NONE) 14 | self:SetSolid(SOLID_NONE) 15 | self:SetCollisionGroup(COLLISION_GROUP_WORLD) 16 | end 17 | 18 | function ENT:AcceptInput(name, activator, caller, args) 19 | if name == "setviewer" then 20 | self:SetKeyValue("viewer", args) 21 | return true 22 | elseif name == "sethint" then 23 | self:SetKeyValue("hint", args) 24 | return true 25 | elseif name == "setrange" then 26 | self:SetKeyValue("range", args) 27 | return true 28 | end 29 | end 30 | 31 | function ENT:KeyValue(key, value) 32 | key = string.lower(key) 33 | if key == "viewer" then 34 | self:SetViewable(tonumber(value) or 0) 35 | elseif key == "hint" then 36 | self:SetHint(value) 37 | elseif key == "range" then 38 | self:SetRange(tonumber(value) or 0) 39 | end 40 | end 41 | 42 | function ENT:UpdateTransmitState() 43 | return TRANSMIT_ALWAYS 44 | end 45 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/powerups/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzPowerUps = nzPowerUps or AddNZModule("PowerUps") 3 | nzPowerUps.Data = nzPowerUps.Data or {} 4 | 5 | -- Tables storing the active powerups and their expiration time 6 | nzPowerUps.ActivePowerUps = nzPowerUps.ActivePowerUps or {} 7 | nzPowerUps.ActivePlayerPowerUps = nzPowerUps.ActivePlayerPowerUps or {} 8 | 9 | AccessorFunc(nzPowerUps, "fPowerUpChance", "PowerUpChance", FORCE_NUMBER) 10 | 11 | 12 | function nzPowerUps:ResetPowerUpChance() 13 | -- pseudo random so we start a bit lower than the actual chance 14 | self:SetPowerUpChance(GetConVar("nz_difficulty_powerup_chance"):GetFloat() / 10) 15 | end 16 | 17 | function nzPowerUps:IncreasePowerUpChance() 18 | -- function: 19 | -- f(0) = initialchance, f(n) = f(n-1) + initialchance 20 | 21 | -- % = chance of powerup spawning per zombie. 22 | -- for default 2% this would be 0.2% on reset 23 | -- after one kill it would be 0.04% 24 | -- after 10 kills 2.2% 25 | -- ... 26 | -- after 50 kills 10.2% 27 | -- .. 28 | -- after 100 kills 20.2% 29 | -- ... 30 | -- after 499 kills a powerup drop is guaranteed 31 | -- for default 2%: f(n) = n+1/5 32 | self:SetPowerUpChance(self:GetPowerUpChance() + (GetConVar("nz_difficulty_powerup_chance"):GetFloat() / 10)) 33 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/button_elec/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "button_elec" 6 | ENT.Author = "Alig96" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "Bool", 0, "Switch" ) 14 | 15 | end 16 | 17 | function ENT:Initialize() 18 | if SERVER then 19 | self:SetModel( "models/MaxOfS2D/button_01.mdl" ) 20 | self:SetSolid( SOLID_VPHYSICS ) 21 | self:SetMoveType( MOVETYPE_NONE ) 22 | self:SetUseType( ONOFF_USE ) 23 | self:SetSwitch(false) 24 | else 25 | self.PosePosition = 0 26 | end 27 | end 28 | 29 | function ENT:Use( activator ) 30 | 31 | if ( !activator:IsPlayer() ) then return end 32 | if !IsElec() and nzRound:InProgress() then 33 | self:SetSwitch(true) 34 | nz.nzElec.Functions.Activate() 35 | end 36 | 37 | end 38 | 39 | if CLIENT then 40 | 41 | function ENT:Think() 42 | 43 | local TargetPos = 0.0; 44 | 45 | if ( self:GetSwitch() ) then TargetPos = 1.0; end 46 | 47 | self.PosePosition = math.Approach( self.PosePosition, TargetPos, FrameTime() * 5.0 ) 48 | 49 | self:SetPoseParameter( "switch", self.PosePosition ) 50 | self:InvalidateBoneCache() 51 | 52 | end 53 | 54 | function ENT:Draw() 55 | self:DrawModel() 56 | end 57 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/panzer_explode/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | EFFECT.Mat = { 4 | Model("particle/particle_smokegrenade"), 5 | Model("particle/particle_noisesphere") 6 | } 7 | 8 | function EFFECT:Init( data ) 9 | local pos = data:GetOrigin() 10 | local duration = data:GetMagnitude() 11 | local em = ParticleEmitter( pos ) 12 | for i = 0, 20 do 13 | local p = em:Add( self.Mat[math.random(#self.Mat)] , pos ) 14 | if p then 15 | p:SetColor(math.random(100,120), math.random(100,150), math.random(150,170)) 16 | p:SetStartAlpha(255) 17 | p:SetEndAlpha(150) 18 | local vel = VectorRand() * math.Rand(50,300) 19 | vel.z = 0 20 | p:SetVelocity(vel) 21 | p:SetLifeTime(0) 22 | 23 | p:SetDieTime(math.Rand(duration + 0.75, duration + 1.5)) 24 | 25 | p:SetStartSize(math.random(45, 50)) 26 | p:SetEndSize(math.random(20, 30)) 27 | p:SetRoll(math.random(-180, 180)) 28 | p:SetRollDelta(math.Rand(-0.1, 0.1)) 29 | p:SetAirResistance(100) 30 | 31 | p:SetCollide(true) 32 | p:SetBounce(0.4) 33 | 34 | p:SetLighting(false) 35 | end 36 | end 37 | em:Finish() 38 | end 39 | 40 | function EFFECT:Think() 41 | return false 42 | end 43 | 44 | function EFFECT:Render() 45 | return false 46 | end 47 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/panzer_land_dust/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | EFFECT.Mat = { 4 | Model("particle/particle_smokegrenade"), 5 | Model("particle/particle_noisesphere") 6 | } 7 | 8 | function EFFECT:Init( data ) 9 | local pos = data:GetOrigin() 10 | local duration = data:GetMagnitude() 11 | local em = ParticleEmitter( pos ) 12 | for i = 0, 20 do 13 | local p = em:Add( self.Mat[math.random(#self.Mat)] , pos ) 14 | if p then 15 | p:SetColor(math.random(100,120), math.random(100,150), math.random(150,170)) 16 | p:SetStartAlpha(255) 17 | p:SetEndAlpha(150) 18 | local vel = VectorRand() * math.Rand(50,300) 19 | vel.z = 0 20 | p:SetVelocity(vel) 21 | p:SetLifeTime(0) 22 | 23 | p:SetDieTime(math.Rand(duration + 0.75, duration + 1.5)) 24 | 25 | p:SetStartSize(math.random(45, 50)) 26 | p:SetEndSize(math.random(20, 30)) 27 | p:SetRoll(math.random(-180, 180)) 28 | p:SetRollDelta(math.Rand(-0.1, 0.1)) 29 | p:SetAirResistance(100) 30 | 31 | p:SetCollide(true) 32 | p:SetBounce(0.4) 33 | 34 | p:SetLighting(false) 35 | end 36 | end 37 | em:Finish() 38 | end 39 | 40 | function EFFECT:Think() 41 | return false 42 | end 43 | 44 | function EFFECT:Render() 45 | return false 46 | end 47 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/interfaces/sh_sync.lua: -------------------------------------------------------------------------------- 1 | //Client Server Syncing 2 | 3 | if SERVER then 4 | 5 | //Server to client (Server) 6 | util.AddNetworkString( "nz.Interfaces.Send" ) 7 | 8 | function nzInterfaces.SendInterface(ply, interface, data) 9 | net.Start( "nz.Interfaces.Send" ) 10 | net.WriteString( interface ) 11 | net.WriteTable( data ) 12 | net.Send(ply) 13 | end 14 | 15 | //Client to Server (Server) 16 | util.AddNetworkString( "nz.Interfaces.Requests" ) 17 | 18 | function nzInterfaces.ReceiveRequests( len, ply ) 19 | local interface = net.ReadString() 20 | local data = net.ReadTable() 21 | 22 | nzInterfaces[interface.."Handler"](ply, data) 23 | end 24 | 25 | //Receivers 26 | net.Receive( "nz.Interfaces.Requests", nzInterfaces.ReceiveRequests ) 27 | 28 | end 29 | 30 | if CLIENT then 31 | 32 | //Server to client (Client) 33 | function nzInterfaces.ReceiveSync( length ) 34 | local interface = net.ReadString() 35 | local data = net.ReadTable() 36 | 37 | nzInterfaces[interface](data) 38 | end 39 | 40 | //Receivers 41 | net.Receive( "nz.Interfaces.Send", nzInterfaces.ReceiveSync ) 42 | 43 | //Client to Server (Client) 44 | function nzInterfaces.SendRequests( interface, data ) 45 | net.Start( "nz.Interfaces.Requests" ) 46 | net.WriteString( interface ) 47 | net.WriteTable( data ) 48 | net.SendToServer() 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/display/cl_player.lua: -------------------------------------------------------------------------------- 1 | local playerColors = { 2 | Color(239,154,154), 3 | Color(244,143,177), 4 | Color(159,168,218), 5 | Color(129,212,250), 6 | Color(128,203,196), 7 | Color(165,214,167), 8 | Color(230,238,156), 9 | Color(255,241,118), 10 | Color(255,224,130), 11 | Color(255,171,145), 12 | Color(161,136,127), 13 | Color(224,224,224), 14 | Color(144,164,174), 15 | nil 16 | } 17 | 18 | local blooddecals = { 19 | Material("bloodline_score1.png", "unlitgeneric smooth"), 20 | Material("bloodline_score2.png", "unlitgeneric smooth"), 21 | Material("bloodline_score3.png", "unlitgeneric smooth"), 22 | Material("bloodline_score4.png", "unlitgeneric smooth"), 23 | nil 24 | } 25 | 26 | --shuffle the colors on map start 27 | local rand = math.random 28 | local n = #playerColors 29 | 30 | while n > 2 do 31 | 32 | local k = rand(n) -- 1 <= k <= n 33 | 34 | playerColors[n], playerColors[k] = playerColors[k], playerColors[n] 35 | n = n - 1 36 | end 37 | 38 | n = #blooddecals 39 | 40 | while n > 2 do 41 | 42 | local k = rand(n) -- 1 <= k <= n 43 | 44 | blooddecals[n], blooddecals[k] = blooddecals[k], blooddecals[n] 45 | n = n - 1 46 | end 47 | 48 | function player.GetColorByIndex(index) 49 | return playerColors[((index - 1) % #playerColors) + 1] 50 | end 51 | 52 | function player.GetBloodByIndex(index) 53 | return blooddecals[((index - 1) % #blooddecals) + 1] 54 | end 55 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/powerup_glow/init.lua: -------------------------------------------------------------------------------- 1 | function EFFECT:Init( data ) 2 | 3 | local vOffset = data:GetOrigin() 4 | 5 | local NumParticles = 1 6 | 7 | local emitter = ParticleEmitter( vOffset ) 8 | 9 | for i=0, NumParticles do 10 | 11 | local particle = emitter:Add( "sprites/physg_glow1", vOffset ) 12 | if (particle) then 13 | 14 | particle:SetVelocity( Vector(0,0,0) ) 15 | particle:SetColor(math.random(50,100), math.random(200,255), math.random(100,150)) 16 | 17 | particle:SetLifeTime( 0 ) 18 | particle:SetDieTime( 0.3 ) 19 | 20 | particle:SetStartAlpha( 100 ) 21 | particle:SetEndAlpha( 0 ) 22 | 23 | particle:SetStartSize( 25 ) 24 | particle:SetEndSize( 25 ) 25 | 26 | particle:SetRoll( math.Rand(0, 36)*10 ) 27 | --particle:SetRollDelta( math.Rand(-200, 200) ) 28 | 29 | particle:SetAirResistance( 400 ) 30 | 31 | particle:SetGravity( Vector( 0, 0, 0 ) ) 32 | 33 | end 34 | 35 | end 36 | 37 | emitter:Finish() 38 | 39 | end 40 | 41 | 42 | --[[--------------------------------------------------------- 43 | THINK 44 | -----------------------------------------------------------]] 45 | function EFFECT:Think( ) 46 | return false 47 | end 48 | 49 | --[[--------------------------------------------------------- 50 | Draw the effect 51 | -----------------------------------------------------------]] 52 | function EFFECT:Render() 53 | end 54 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_zombie_special_burning.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | ENT.Base = "nz_zombie_walker" 4 | ENT.PrintName = "Burning Walker" 5 | ENT.Category = "Brainz" 6 | ENT.Author = "Lolle" 7 | 8 | function ENT:StatsInitialize() 9 | if SERVER then 10 | if nzRound:GetNumber() == -1 then 11 | self:SetRunSpeed( math.random(20, 260) ) 12 | self:SetHealth( math.random(75, 1000) ) 13 | else 14 | local speeds = nzRound:GetZombieSpeeds() 15 | if speeds then 16 | self:SetRunSpeed( nzMisc.WeightedRandom(speeds) - 20 ) -- A bit slower here 17 | end 18 | self:SetHealth( nzRound:GetZombieHealth() or 75 ) 19 | end 20 | self:Flames( true ) 21 | 22 | self:SetEmergeSequenceIndex(math.random(#self.EmergeSequences)) 23 | end 24 | end 25 | 26 | function ENT:OnTargetInAttackRange() 27 | local atkData = {} 28 | atkData.dmglow = 20 29 | atkData.dmghigh = 30 30 | atkData.dmgforce = Vector( 0, 0, 0 ) 31 | self:Attack( atkData ) 32 | self:TimedEvent( 0.45, function() 33 | if self:IsValidTarget( self:GetTarget() ) and self:TargetInRange( self.AttackRange + 10 ) then 34 | self:Explode( math.random( 50, 100 ) ) 35 | end 36 | end) 37 | end 38 | 39 | function ENT:OnZombieDeath(dmgInfo) 40 | self:Explode( math.random( 25, 50 )) 41 | self:EmitSound(self.DeathSounds[ math.random( #self.DeathSounds ) ], 50, math.random(75, 130)) 42 | self:BecomeRagdoll(dmgInfo) 43 | end 44 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/q_menu/cl_search_models.lua: -------------------------------------------------------------------------------- 1 | 2 | -- A copy paste of the sandbox one, but only for models 3 | 4 | local HasCreated = HasCreated or false 5 | 6 | local function GetAllFiles( tab, folder, extension, path ) 7 | 8 | local files, folders = file.Find( folder .. "/*", path ) 9 | 10 | for k, v in pairs( files ) do 11 | 12 | if ( v:EndsWith( extension ) ) then 13 | table.insert( tab, (folder .. v):lower() ) 14 | end 15 | 16 | end 17 | 18 | for k, v in pairs( folders ) do 19 | timer.Simple( k * 0.1, function() 20 | GetAllFiles( tab, folder .. v .. "/", extension, path ) 21 | end ) 22 | end 23 | 24 | if ( folder == "models/" ) then 25 | hook.Run( "SearchUpdate" ) 26 | end 27 | 28 | end 29 | 30 | 31 | local model_list = nil 32 | -- 33 | -- Model Search 34 | -- 35 | if !HasCreated then 36 | search.AddProvider( function( str ) 37 | 38 | str = str:PatternSafe() 39 | 40 | if ( model_list == nil ) then 41 | 42 | model_list = {} 43 | GetAllFiles( model_list, "models/", ".mdl", "GAME" ) 44 | timer.Simple( 1, function() hook.Run( "SearchUpdate" ) end ) 45 | 46 | end 47 | 48 | local list = {} 49 | 50 | for k, v in pairs( model_list ) do 51 | 52 | if ( v:find( str ) ) then 53 | 54 | if ( IsUselessModel( v ) ) then continue end 55 | 56 | table.insert( list, v ) 57 | 58 | end 59 | 60 | if ( #list >= 128 ) then break end 61 | 62 | end 63 | 64 | return list 65 | 66 | end ) 67 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/web_explosion/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | local mats = { 4 | Material( "decals/glass/shot1" ), 5 | Material( "decals/glass/shot2" ), 6 | Material( "decals/glass/shot3" ), 7 | Material( "decals/glass/shot4" ), 8 | Material( "decals/glass/shot5" ), 9 | nil 10 | } 11 | 12 | function EFFECT:Init( data ) 13 | local pos = data:GetOrigin() 14 | local mag = data:GetMagnitude() 15 | 16 | local em = ParticleEmitter( pos ) 17 | for i = 0, 10 do 18 | local p = em:Add( mats[math.random(#mats)], pos ) 19 | if p then 20 | p:SetColor(math.random(120,170), math.random(100,120), math.random(100,120)) 21 | p:SetStartAlpha(255) 22 | p:SetEndAlpha(150) 23 | local vel = VectorRand() * math.Rand(50,300) 24 | vel.z = 300 25 | p:SetVelocity(vel) 26 | p:SetLifeTime(0) 27 | 28 | p:SetDieTime(math.Rand(0.5, 1)) 29 | 30 | p:SetStartSize(math.random(20, 30)) 31 | p:SetEndSize(math.random(50, 70)) 32 | p:SetRoll(math.random(-180, 180)) 33 | p:SetRollDelta(math.Rand(-2, 2)) 34 | p:SetAirResistance(200) 35 | p:SetGravity(Vector(0,0,-100)) 36 | 37 | p:SetCollide(true) 38 | p:SetBounce(0.4) 39 | 40 | p:SetLighting(false) 41 | end 42 | end 43 | em:Finish() 44 | end 45 | 46 | function EFFECT:Think() 47 | return false 48 | end 49 | 50 | function EFFECT:Render() 51 | return false 52 | end 53 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/player_class/sh_player_create.lua: -------------------------------------------------------------------------------- 1 | DEFINE_BASECLASS( "player_default" ) 2 | 3 | local PLAYER = {} 4 | 5 | -- 6 | -- See gamemodes/base/player_class/player_default.lua for all overridable variables 7 | -- 8 | PLAYER.WalkSpeed = 300 9 | PLAYER.RunSpeed = 600 10 | PLAYER.CanUseFlashlight = true 11 | 12 | function PLAYER:SetupDataTables() 13 | self.Player:NetworkVar("Bool", 0, "UsingSpecialWeapon") 14 | end 15 | 16 | function PLAYER:Init() 17 | -- Don't forget Colours 18 | -- This runs when the player is first brought into the game 19 | -- print("create") 20 | end 21 | 22 | function PLAYER:Loadout() 23 | 24 | -- Creation Tools 25 | self.Player:Give( "weapon_physgun" ) 26 | self.Player:Give( "nz_multi_tool" ) 27 | 28 | timer.Simple(0.1, function() 29 | if IsValid(self.Player) then 30 | if !self.Player:HasWeapon( "weapon_physgun" ) then 31 | self.Player:Give( "weapon_physgun" ) 32 | end 33 | if !self.Player:HasWeapon( "nz_multi_tool" ) then 34 | self.Player:Give( "nz_multi_tool" ) 35 | end 36 | end 37 | end) 38 | 39 | end 40 | 41 | function PLAYER:Spawn() 42 | -- if we are in create or debuging make zombies target us 43 | if nzRound:InState(ROUND_CREATE) or GetConVar( "nz_zombie_debug" ):GetBool() then --TODO this is bullshit? 44 | self.Player:SetTargetPriority(TARGET_PRIORITY_PLAYER) 45 | end 46 | self.Player:SetUsingSpecialWeapon(false) 47 | end 48 | 49 | player_manager.RegisterClass( "player_create", PLAYER, "player_default" ) 50 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/vulture_gascloud/init.lua: -------------------------------------------------------------------------------- 1 | local gasparticles = { 2 | Model("particle/particle_smokegrenade"), 3 | Model("particle/particle_noisesphere") 4 | } 5 | 6 | --Main function 7 | function EFFECT:Init(data) 8 | --Create particle emitter 9 | local emitter = ParticleEmitter(data:GetOrigin()) 10 | --Amount of particles to create 11 | for i=0, 16 do 12 | --Safeguard 13 | if !emitter then return end 14 | 15 | local Pos = (data:GetOrigin() + Vector( math.Rand(-5,5), math.Rand(-5,5), math.Rand(-5,5) )) 16 | local particle = emitter:Add( table.Random(gasparticles), Pos ) 17 | if (particle) then 18 | particle:SetVelocity(VectorRand() * math.Rand(100,200)) 19 | particle:SetLifeTime(0) 20 | particle:SetDieTime(math.Rand(4, 6)) 21 | particle:SetColor(100,255,150) 22 | particle:SetLighting(false) 23 | particle:SetStartAlpha(255) 24 | particle:SetEndAlpha(0) 25 | 26 | local Size = math.Rand(10,20) 27 | particle:SetStartSize(Size) 28 | particle:SetEndSize(Size) 29 | particle:SetRoll(math.Rand(-360, 360)) 30 | particle:SetRollDelta(math.Rand(-0.21, 0.21)) 31 | particle:SetAirResistance(math.Rand(520,620)) 32 | particle:SetGravity( Vector(0, 0, 0) ) 33 | particle:SetCollide(false) 34 | particle:SetBounce(0.42) 35 | particle:SetLighting(1) 36 | end 37 | end 38 | --We're done with this emitter 39 | emitter:Finish() 40 | end 41 | 42 | --Kill effect 43 | function EFFECT:Think() 44 | return false 45 | end 46 | 47 | --Not used 48 | function EFFECT:Render() 49 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/zapper_lightning/init.lua: -------------------------------------------------------------------------------- 1 | --Name: Lightning strike using midpoint displacement 2 | --Author: Lolle 3 | 4 | --EFFECT.MatCenter = Material( "lightning.png", "unlitgeneric smooth" ) 5 | EFFECT.MatTracer = Material( "effects/tool_tracer" ) 6 | 7 | --[[--------------------------------------------------------- 8 | Init( data table ) 9 | -----------------------------------------------------------]] 10 | function EFFECT:Init( data ) 11 | 12 | self.StartPos = data:GetStart() 13 | self.EndPos = data:GetOrigin() 14 | self.Duration = data:GetMagnitude() or 10 15 | 16 | self.Flash = DynamicLight( LocalPlayer():EntIndex() ) 17 | 18 | self.Flash.pos = self.StartPos 19 | self.Flash.r = 255 20 | self.Flash.g = 255 21 | self.Flash.b = 255 22 | self.Flash.brightness = 1 23 | self.Flash.Decay = 200 24 | self.Flash.Size = 200 25 | self.Flash.style = 6 26 | self.Flash.DieTime = CurTime() + self.Duration 27 | 28 | self.Life = 0 29 | 30 | self:SetRenderBoundsWS( self.StartPos, self.EndPos ) 31 | end 32 | 33 | function EFFECT:Think() 34 | self.Life = self.Life + FrameTime() 35 | --self.Alpha = 255 * ( 1 - self.Life ) 36 | 37 | return ( self.Life < self.Duration ) 38 | end 39 | 40 | function EFFECT:Render() 41 | local texcoord = math.Rand( 0, 1 ) 42 | 43 | render.SetMaterial(self.MatTracer) 44 | 45 | render.DrawBeam( 46 | self.StartPos, 47 | self.EndPos, 48 | 12, 49 | texcoord, 50 | texcoord + ((self.StartPos - self.EndPos):Length() / 128), 51 | Color(math.random(200, 255), math.random(220, 255), math.random(150, 200)) 52 | ) 53 | end 54 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/revive_system/sh_playerdeath.lua: -------------------------------------------------------------------------------- 1 | 2 | function nzRevive.DoPlayerDeath(ply, dmg) 3 | 4 | if IsValid(ply) and ply:IsPlayer() then 5 | if ply:Health() - dmg:GetDamage() <= 0 then 6 | local allow = hook.Call("PlayerShouldTakeDamage", nil, ply, dmg:GetAttacker()) 7 | --print(allow, "Allowed or not") 8 | if allow != false then -- Only false should prevent it (not nil) 9 | if ply:GetNotDowned() then 10 | print(ply:Nick() .. " got downed!") 11 | ply:DownPlayer() 12 | --ply:SetMaxHealth(100) -- failsafe for Jugg not resetting 13 | return true 14 | else 15 | ply:KillDownedPlayer() -- Kill them if they are already downed 16 | end 17 | end 18 | elseif !ply:GetNotDowned() then 19 | return true -- Downed players cannot take non-fatal damage 20 | end 21 | end 22 | 23 | end 24 | 25 | function nzRevive.PostPlayerDeath(ply) 26 | -- Performs all the resetting functions without actually killing the player 27 | if !ply:GetNotDowned() then ply:KillDownedPlayer(nil, false, true) end 28 | end 29 | 30 | local function HandleKillCommand(ply) 31 | if (ply:IsPlaying() and !ply:IsSpectating()) or ply:IsInCreative() then 32 | if ply:GetNotDowned() then 33 | ply:DownPlayer() 34 | else 35 | ply:KillDownedPlayer() 36 | end 37 | end 38 | return false 39 | end 40 | 41 | -- Hooks 42 | hook.Add("EntityTakeDamage", "nzDownKilledPlayers", nzRevive.DoPlayerDeath) 43 | hook.Add("PostPlayerDeath", "nzPlayerDeathRevivalReset", nzRevive.PostPlayerDeath) 44 | hook.Add("CanPlayerSuicide", "nzSuicideDowning", HandleKillCommand) 45 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/easter_eggs/sv_ee.lua: -------------------------------------------------------------------------------- 1 | // 2 | 3 | function nzEE:Reset() 4 | -- Reset the counter of eggs 5 | self.Data.EggCount = 0 6 | self.Data.MaxEggCount = 0 7 | 8 | -- Reset all easter eggs 9 | for k,v in pairs(ents.FindByClass("easter_egg")) do 10 | v.Used = false 11 | end 12 | hook.Call("OnEasterEggsReset") 13 | end 14 | 15 | function nzEE:ActivateEgg( ent, ply ) 16 | 17 | ent.Used = true 18 | ent:EmitSound("WeaponDissolve.Dissolve", 100, 100) 19 | 20 | self.Data.EggCount = self.Data.EggCount + 1 21 | hook.Call( "OnEasterEggFound", ply, ent ) 22 | 23 | if self.Data.MaxEggCount == 0 then 24 | self.Data.MaxEggCount = #ents.FindByClass("easter_egg") 25 | end 26 | 27 | -- What we should do when we have all the eggs 28 | if self.Data.EggCount == self.Data.MaxEggCount then 29 | print("All easter eggs found yay!") 30 | hook.Call( "OnAllEasterEggsFound", ply, ent ) 31 | end 32 | end 33 | 34 | util.AddNetworkString("EasterEggSong") 35 | util.AddNetworkString("EasterEggSongPreload") 36 | util.AddNetworkString("EasterEggSongStop") 37 | 38 | hook.Add("OnAllEasterEggsFound", "PlayEESong", function() 39 | net.Start("EasterEggSong") 40 | net.Broadcast() 41 | end) 42 | 43 | hook.Add("OnEasterEggsReset", "StopEESong", function() 44 | net.Start("EasterEggSongStop") 45 | net.Broadcast() 46 | end) 47 | 48 | hook.Add("PlayerFullyInitialized", "PreloadEESongSpawn", function(ply) 49 | -- Send players the map settings - this will trigger the preload client-side 50 | net.Start("nzMapping.SyncSettings") 51 | net.WriteTable(nzMapping.Settings) 52 | net.Send(ply) 53 | end) 54 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/q_menu/sh_net.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | if CLIENT then 4 | 5 | -- Client to Server (Client) 6 | function nzQMenu:Request( model, entity ) 7 | local entity = entity or false 8 | net.Start( "nzQMenu.Request" ) 9 | net.WriteString( model ) 10 | net.WriteBool( entity ) 11 | net.SendToServer() 12 | end 13 | 14 | end 15 | 16 | if SERVER then 17 | 18 | -- Client to Server (Server) 19 | util.AddNetworkString( "nzQMenu.Request" ) 20 | 21 | local function HandleRequest( len, ply ) 22 | local model = net.ReadString() 23 | local entity = net.ReadBool() 24 | if nzRound:InState( ROUND_CREATE ) then 25 | print(ply:Nick() .. " requested prop " .. model) 26 | if ply:IsInCreative() then 27 | local tr = util.GetPlayerTrace( ply ) 28 | tr.mask = bit.bor( CONTENTS_SOLID, CONTENTS_MOVEABLE, CONTENTS_MONSTER, CONTENTS_WINDOW, CONTENTS_DEBRIS, CONTENTS_GRATE, CONTENTS_AUX ) 29 | local trace = util.TraceLine( tr ) 30 | if entity then 31 | nzMapping:SpawnEntity(trace.HitPos, Angle(0,0,0), model, ply) 32 | else 33 | if util.IsValidProp(model) then 34 | nzMapping:PropBuy(trace.HitPos, Angle(0,0,0), model, nil, ply) 35 | else 36 | nzMapping:SpawnEffect(trace.HitPos, Angle(0,0,0), model, ply) 37 | end 38 | end 39 | -- Since we're adding a prop, lets switch to the phys gun for convenience 40 | ply:SelectWeapon( "weapon_physgun" ) 41 | else 42 | print("Denied request from " .. ply:Nick()) 43 | end 44 | end 45 | end 46 | 47 | -- Receivers 48 | net.Receive( "nzQMenu.Request", HandleRequest ) 49 | 50 | end 51 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sh_playerinit.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | util.AddNetworkString("nz_PlayerInit") 3 | net.Receive("nz_PlayerInit", function(len, ply) 4 | hook.Call("PlayerFullyInitialized", nil, ply) 5 | end) 6 | 7 | hook.Add("PlayerInitialSpawn", "nzCheckIfInSteamGroup", function(ply) 8 | -- I ask of you that you do not remove the below part. This part was made as a reward for being part of my Steam Group. 9 | -- Since this reward is to be used universally on all servers, I ask of you that you do not remove it. Thank you :) 10 | http.Fetch( "http://steamcommunity.com/groups/the_banter_brigade/memberslistxml/?xml=1", 11 | function(body) -- On Success 12 | local playerIDStartIndex = ply:SteamID64() and string.find( tostring(body), ""..ply:SteamID64().."" ) or print("Can't get SteamID64 in single player. Weaponized YTi-L4 is unavailable.") 13 | if playerIDStartIndex == nil then return else 14 | ply.nz_InSteamGroup = true 15 | ply:PrintMessage(HUD_PRINTCONSOLE, "Thank you for being part of the Banter Brigade Steam Group. YTi-L4 is accessible to you in the box.") 16 | end 17 | end, 18 | function() -- On fail 19 | print("Couldn't get it the data from the Banter Brigade Steam Group. Weaponized YTi-L4 is unavailable") 20 | end 21 | ) 22 | end) 23 | 24 | hook.Add("PlayerFullyInitialized", "SetPlayerClassInit", function(ply) 25 | player_manager.SetPlayerClass( ply, "player_ingame" ) 26 | end) 27 | else 28 | hook.Add("InitPostEntity", "PlayerFullyInitialized", function() 29 | net.Start("nz_PlayerInit") 30 | net.SendToServer() 31 | end) 32 | 33 | end 34 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/perks/sh_sync.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | if SERVER then 4 | 5 | -- Server to client (Server) 6 | util.AddNetworkString( "nz.Perks.Sync" ) 7 | util.AddNetworkString( "nz.Perks.FullSync" ) 8 | 9 | function nzPerks:SendSync(ply, receiver) 10 | if !ply then nzPerks:SendFullSync(receiver) return end -- No valid player set, just do a full sync 11 | if !nzPerks.Players[ply] then nzPerks.Players[ply] = {} end -- Create table should it not exist (for some reason) 12 | 13 | local data = table.Copy(nzPerks.Players[ply]) 14 | 15 | net.Start( "nz.Perks.Sync" ) 16 | net.WriteEntity( ply ) 17 | net.WriteTable( data ) 18 | return receiver and net.Send(receiver) or net.Broadcast() 19 | end 20 | 21 | function nzPerks:SendFullSync(receiver) 22 | local data = table.Copy(nzPerks.Players) 23 | 24 | net.Start( "nz.Perks.FullSync" ) 25 | net.WriteTable( data ) 26 | return receiver and net.Send(receiver) or net.Broadcast() 27 | end 28 | 29 | FullSyncModules["Perks"] = function(ply) 30 | nzPerks:SendFullSync(ply) 31 | end 32 | 33 | end 34 | 35 | if CLIENT then 36 | 37 | -- Server to client (Client) 38 | local function ReceiveSync( length ) 39 | print("Received Player Perks Sync") 40 | local ply = net.ReadEntity() 41 | nzPerks.Players[ply] = net.ReadTable() 42 | --PrintTable(nzPerks.Players) 43 | end 44 | 45 | local function ReceiveFullSync( length ) 46 | print("Received Full Perks Sync") 47 | nzPerks.Players = net.ReadTable() 48 | PrintTable(nzPerks.Players) 49 | end 50 | 51 | -- Receivers 52 | net.Receive( "nz.Perks.Sync", ReceiveSync ) 53 | net.Receive( "nz.Perks.FullSync", ReceiveFullSync ) 54 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/edit_fog.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile() 3 | DEFINE_BASECLASS( "base_edit" ) 4 | 5 | ENT.Spawnable = true 6 | ENT.AdminOnly = true 7 | 8 | ENT.PrintName = "Fog Editor" 9 | ENT.Category = "Editors" 10 | 11 | ENT.NZOnlyVisibleInCreative = true 12 | 13 | function ENT:Initialize() 14 | 15 | BaseClass.Initialize( self ) 16 | 17 | self:SetMaterial( "gmod/edit_fog" ) 18 | 19 | -- There can only be one! 20 | if IsValid(ents.FindByClass("edit_fog")[1]) and ents.FindByClass("edit_fog")[1] != self then ents.FindByClass("edit_fog")[1]:Remove() end 21 | 22 | if ( CLIENT ) then 23 | nzRound:EnableSpecialFog( false ) 24 | end 25 | 26 | end 27 | 28 | function ENT:SetupDataTables() 29 | 30 | self:NetworkVar( "Float", 0, "FogStart", { KeyName = "fogstart", Edit = { type = "Float", min = 0, max = 100000, order = 1 } } ); 31 | self:NetworkVar( "Float", 1, "FogEnd", { KeyName = "fogend", Edit = { type = "Float", min = 0, max = 100000, order = 2 } } ); 32 | self:NetworkVar( "Float", 2, "Density", { KeyName = "density", Edit = { type = "Float", min = 0, max = 1, order = 3 } } ); 33 | 34 | self:NetworkVar( "Vector", 0, "FogColor", { KeyName = "fogcolor", Edit = { type = "VectorColor", order = 3 } } ); 35 | 36 | -- 37 | -- TODO: Should skybox fog be edited seperately? 38 | -- 39 | 40 | if ( SERVER ) then 41 | 42 | -- defaults 43 | self:SetFogStart( 0.0 ) 44 | self:SetFogEnd( 10000 ) 45 | self:SetDensity( 0.9 ) 46 | self:SetFogColor( Vector( 0.6, 0.7, 0.8 ) ) 47 | 48 | end 49 | 50 | end 51 | 52 | -- 53 | -- This edits something global - so always network - even when not in PVS 54 | -- 55 | function ENT:UpdateTransmitState() 56 | 57 | return TRANSMIT_ALWAYS 58 | end 59 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/sh_weps.lua: -------------------------------------------------------------------------------- 1 | local wepMeta = FindMetaTable("Weapon") 2 | 3 | function wepMeta:NZPerkSpecialTreatment( ) 4 | if self:IsFAS2() or self:IsCW2() or self:IsTFA() then 5 | return true 6 | end 7 | 8 | return false 9 | end 10 | 11 | function wepMeta:IsFAS2() 12 | if self.Category == "FA:S 2 Weapons" or self.Base == "fas2_base" then 13 | return true 14 | else 15 | local base = weapons.Get(self.Base) 16 | if base and base.Base == "fas2_base" then 17 | return true 18 | end 19 | end 20 | 21 | return false 22 | end 23 | 24 | function wepMeta:IsCW2() 25 | if self.Category == "CW 2.0" or self.Base == "cw_base" then 26 | return true 27 | else 28 | local base = weapons.Get(self.Base) 29 | if base and base.Base == "cw_base" then 30 | return true 31 | end 32 | end 33 | 34 | return false 35 | end 36 | 37 | function wepMeta:IsTFA() 38 | if self.Category == "TFA" or self.Base == "tfa_gun_base" or string.sub(self:GetClass(), 1, 3) == "tfa" then 39 | return true 40 | else 41 | local base = weapons.Get(self.Base) 42 | if base and base.Base == "tfa_gun_base" then 43 | return true 44 | end 45 | end 46 | 47 | return false 48 | end 49 | 50 | function wepMeta:CanRerollPaP() 51 | return (self.OnRePaP or (self.Attachments and ((self:IsCW2() and CustomizableWeaponry) or self:IsTFA()) or self:IsFAS2())) 52 | end 53 | 54 | local old = wepMeta.GetPrintName 55 | function wepMeta:GetPrintName() 56 | local name = old(self) 57 | if !name or name == "" then name = self:GetClass() end 58 | if self:HasNZModifier("pap") then 59 | name = self.NZPaPName or nz.Display_PaPNames[self:GetClass()] or nz.Display_PaPNames[name] or "Upgraded "..name 60 | end 61 | return name 62 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/curves/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | -- Main Tables 3 | nzCurves = nzCurves or AddNZModule("Curves") 4 | 5 | function nzCurves.GenerateHealthCurve(round) 6 | local base = GetConVar("nz_difficulty_zombie_health_base"):GetFloat() 7 | local scale = GetConVar("nz_difficulty_zombie_health_scale"):GetFloat() 8 | 9 | return math.Round(base*math.pow(scale,round - 1)) 10 | end 11 | 12 | function nzCurves.GenerateMaxZombies(round) 13 | local base = GetConVar("nz_difficulty_zombie_amount_base"):GetInt() 14 | local scale = GetConVar("nz_difficulty_zombie_amount_scale"):GetFloat() 15 | 16 | return math.Round((base + (scale * (#player.GetAllPlaying() - 1))) * round) 17 | end 18 | 19 | function nzCurves.GenerateSpeedTable(round) 20 | if !round then return {[50] = 100} end -- Default speed for any invalid round (Say, creative mode test zombies) 21 | local tbl = {} 22 | local range = 3 -- The range on either side of the tip (current round) of speeds in steps of "steps" 23 | local min = 30 -- Minimum speed (Round 1) 24 | local max = 300 -- Maximum speed 25 | local maxround = 27 -- The round at which the 300 speed has its tip 26 | local steps = ((max-min)/maxround) -- The different speed steps speed can exist in 27 | 28 | print("Generating round speeds with steps of "..steps.."...") 29 | for i = -range, range do 30 | local speed = (min - steps + steps*round) + (steps*i) 31 | if speed >= min and speed <= max then 32 | local chance = 100 - 10*math.abs(i)^2 33 | --print("Speed is "..speed..", with a chance of "..chance) 34 | tbl[speed] = chance 35 | elseif speed >= max then 36 | tbl[max] = 100 37 | end 38 | end 39 | return tbl 40 | end 41 | 42 | end 43 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/wall_block/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "wall_block" 6 | ENT.Author = "Alig96 & Zet0r" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | ENT.NZOnlyVisibleInCreative = true 12 | 13 | --[[function ENT:SetupDataTables() 14 | self:NetworkVar("Bool", 0, "BlockPlayers") 15 | self:NetworkVar("Bool", 1, "BlockZombies") 16 | end 17 | 18 | function ENT:SetFilter(players, zombies) 19 | if players and zombies then 20 | self:SetBlockPlayers(true) 21 | self:SetBlockZombies(true) 22 | self:SetCustomCollisionCheck(false) 23 | self:SetColor(Color(255,255,255)) 24 | elseif players and !zombies then 25 | self:SetBlockPlayers(true) 26 | self:SetBlockZombies(false) 27 | self:SetCustomCollisionCheck(true) 28 | self:SetColor(Color(100,100,255)) 29 | elseif !players and zombies then 30 | self:SetBlockPlayers(false) 31 | self:SetBlockZombies(true) 32 | self:SetCustomCollisionCheck(true) 33 | self:SetColor(Color(255,100,100)) 34 | end 35 | end]] 36 | 37 | function ENT:Initialize() 38 | self:SetMoveType( MOVETYPE_NONE ) 39 | self:SetSolid( SOLID_VPHYSICS ) 40 | self:DrawShadow( false ) 41 | self:SetRenderMode( RENDERMODE_TRANSCOLOR ) 42 | self:SetCustomCollisionCheck(true) 43 | 44 | -- YES! Finally found a way to make bullets pass through without disabling solidity! 45 | --self:AddSolidFlags(FSOLID_CUSTOMRAYTEST) 46 | --self:AddSolidFlags(FSOLID_CUSTOMBOXTEST) 47 | 48 | end 49 | 50 | if CLIENT then 51 | function ENT:Draw() 52 | if ConVarExists("nz_creative_preview") and !GetConVar("nz_creative_preview"):GetBool() and nzRound:InState( ROUND_CREATE ) then 53 | self:DrawModel() 54 | end 55 | end 56 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/traps_logic/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Setup round module 2 | nzTraps = nzTraps or AddNZModule("Traps") 3 | nzLogic = nzLogic or AddNZModule("Logic") 4 | 5 | nzTraps.Registry = nzTraps.Registry or {} 6 | nzLogic.Registry = nzLogic.Registry or {} 7 | 8 | local function register (tbl, classname) 9 | table.insert(tbl, classname) 10 | end 11 | 12 | function nzTraps:Register(classname) 13 | if !table.HasValue(self.Registry, classname) then 14 | register(self.Registry, classname) 15 | end 16 | end 17 | 18 | function nzLogic:Register(classname) 19 | if !table.HasValue(self.Registry, classname) then 20 | register(self.Registry, classname) 21 | end 22 | end 23 | 24 | function nzTraps:GetAll() 25 | return self.Registry 26 | end 27 | 28 | function nzLogic:GetAll() 29 | return self.Registry 30 | end 31 | 32 | if SERVER then 33 | nzMapping:AddSaveModule("TrapsLogic", { 34 | savefunc = function() 35 | local traps_logic = {} 36 | local classes = nzTraps:GetAll() 37 | table.Add(classes, nzLogic:GetAll()) 38 | for k, class in pairs(classes) do 39 | for _, ent in pairs(ents.FindByClass(class)) do 40 | table.insert(traps_logic, duplicator.CopyEntTable(ent)) 41 | end 42 | end 43 | return traps_logic 44 | end, 45 | loadfunc = function(data) 46 | for _, entTable in pairs(data) do 47 | local ent = duplicator.CreateEntityFromTable(ply, entTable) 48 | ent:Activate() 49 | ent:Spawn() 50 | 51 | for k, v in pairs(entTable.DT) do 52 | if ent["Set" .. k] then 53 | timer.Simple( 0.1, function() ent["Set" .. k](ent, v) end) 54 | end 55 | end 56 | end 57 | end, 58 | cleanents = {"nz_button", "nz_button_and", "nz_trap_turret", "nz_trap_zapper"}, 59 | }) 60 | end 61 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/invis_wall/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "invis_wall" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "youtube.com/Zet0r" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | -- Min bound is for now just the position 13 | --self:NetworkVar("Vector", 0, "MinBound") 14 | self:NetworkVar("Vector", 0, "MaxBound") 15 | end 16 | 17 | function ENT:Initialize() 18 | --self:SetMoveType( MOVETYPE_NONE ) 19 | self:DrawShadow( false ) 20 | self:SetRenderMode( RENDERMODE_TRANSCOLOR ) 21 | if self.SetRenderBounds then 22 | self:SetRenderBounds(Vector(0,0,0), self:GetMaxBound()) 23 | end 24 | self:SetCustomCollisionCheck(true) 25 | --self:SetFilter(true, true) 26 | end 27 | 28 | local mat = Material("color") 29 | local white = Color(255,150,0,30) 30 | 31 | if CLIENT then 32 | 33 | if not ConVarExists("nz_creative_preview") then CreateClientConVar("nz_creative_preview", "0") end 34 | 35 | function ENT:Draw() 36 | if ConVarExists("nz_creative_preview") and !GetConVar("nz_creative_preview"):GetBool() and nzRound:InState( ROUND_CREATE ) then 37 | cam.Start3D() 38 | render.SetMaterial(mat) 39 | render.DrawBox(self:GetPos(), self:GetAngles(), Vector(0,0,0), self:GetMaxBound(), white, true) 40 | cam.End3D() 41 | end 42 | end 43 | end 44 | 45 | -- Causes collisions to completely disappear, not just traces :( 46 | --[[function ENT:TestCollision(start, delta, hulltrace, bounds) 47 | return nil -- Traces pass through it! 48 | end]] 49 | 50 | hook.Add("PhysgunPickup", "nzInvisWallNotPickup", function(ply, wall) 51 | if wall:GetClass() == "invis_wall" or wall:GetClass() == "invis_damage_wall" then return false end 52 | end) 53 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/interfaces/sh_int_configsaver.lua: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | if SERVER then 4 | util.AddNetworkString("nz_SaveConfig") 5 | 6 | function nzInterfaces.ConfigSaverHandler( ply, data ) 7 | if ply:IsSuperAdmin() then 8 | nzMapping:SaveConfig( data.name ) 9 | end 10 | end 11 | end 12 | 13 | if CLIENT then 14 | function nzInterfaces.ConfigSaver(name) 15 | local DermaPanel = vgui.Create( "DFrame" ) 16 | DermaPanel:SetPos( 100, 100 ) 17 | DermaPanel:SetSize( 300, 120 ) 18 | DermaPanel:SetTitle( "Save config" ) 19 | DermaPanel:SetVisible( true ) 20 | DermaPanel:SetDraggable( true ) 21 | DermaPanel:ShowCloseButton( true ) 22 | DermaPanel:MakePopup() 23 | DermaPanel:Center() 24 | 25 | local WarnText = vgui.Create("DLabel", DermaPanel) 26 | WarnText:SetSize(280, 20) 27 | WarnText:SetPos(10, 50) 28 | WarnText:SetText("") 29 | WarnText:SetTextColor( Color(150,0,0) ) 30 | 31 | local TextEntry = vgui.Create("DTextEntry", DermaPanel) 32 | TextEntry:SetPos(10, 30) 33 | TextEntry:SetSize(280, 20) 34 | TextEntry:SetText(name) 35 | TextEntry.OnChange = function(self) 36 | if string.find(self:GetValue(), ";") then 37 | WarnText:SetText("The name cannot contain ';'!") 38 | else 39 | WarnText:SetText("") 40 | end 41 | end 42 | 43 | local DermaButton = vgui.Create( "DButton", DermaPanel ) 44 | DermaButton:SetText( "Save" ) 45 | DermaButton:SetPos( 10, 80 ) 46 | DermaButton:SetSize( 280, 30 ) 47 | DermaButton.DoClick = function() 48 | local name = TextEntry:GetValue() 49 | nzInterfaces.SendRequests( "ConfigSaver", {name = name} ) 50 | end 51 | end 52 | 53 | net.Receive("nz_SaveConfig", function() 54 | local name = net.ReadString() 55 | nzInterfaces.ConfigSaver(name) 56 | end) 57 | 58 | end 59 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/loader.lua: -------------------------------------------------------------------------------- 1 | -- Load all our files in to the respective realms 2 | 3 | -- Main Tables 4 | nz = nz or {} 5 | function AddNZModule(id) 6 | local tbl = {} 7 | --nz[id] = tbl -- Enabling this line will make all tables parented to nz again 8 | return tbl 9 | end 10 | 11 | local gmfolder = "nzombies" 12 | 13 | local _,dirs = file.Find( gmfolder.."/gamemode/*", "LUA" ) 14 | 15 | print("nZombies Loading...") 16 | 17 | function AutoInclude(name, dir) 18 | 19 | local sep = string.Explode("_", name) 20 | name = dir..name 21 | 22 | if sep[1] == "cl" and SERVER then 23 | print("Sending: "..name) 24 | else 25 | print("Including: "..name) 26 | end 27 | 28 | -- Determine where to load the files 29 | if sep[1] == "sv" then 30 | if SERVER then 31 | include(name) 32 | end 33 | elseif sep[1] == "sh" then 34 | if SERVER then 35 | AddCSLuaFile(name) 36 | include(name) 37 | else 38 | include(name) 39 | end 40 | elseif sep[1] == "cl" then 41 | if SERVER then 42 | AddCSLuaFile(name) 43 | else 44 | include(name) 45 | end 46 | end 47 | 48 | end 49 | 50 | -- Run this on both client and server 51 | if SERVER then print(" ** Server List **") else print(" ** Client List **") end 52 | for k,v in pairs(dirs) do 53 | local f2,d2 = file.Find( gmfolder.."/gamemode/"..v.."/*", "LUA" ) 54 | 55 | -- Load construction file before everything else 56 | if table.HasValue(f2, "sh_constructor.lua") then 57 | print("Constructing: " .. v) 58 | AutoInclude("sh_constructor.lua", v.."/") 59 | end 60 | 61 | for k2,v2 in pairs(f2) do 62 | -- we already loaded the construction file once, so dont load again 63 | if v2 != "sh_constructor.lua" then 64 | AutoInclude(v2, v.."/") 65 | end 66 | end 67 | 68 | end 69 | print(" ** End List **") 70 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mapping/sh_sync.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | util.AddNetworkString( "nzMapping.SyncSettings" ) 3 | 4 | local function receiveMapData(len, ply) 5 | local tbl = net.ReadTable() 6 | PrintTable(tbl) 7 | nzMapping:LoadMapSettings(tbl) 8 | -- nzMapping.Settings = tbl 9 | end 10 | net.Receive( "nzMapping.SyncSettings", receiveMapData ) 11 | 12 | function nzMapping:SendMapData(ply) 13 | if !self.GamemodeExtensions then self.GamemodeExtensions = {} end 14 | net.Start("nzMapping.SyncSettings") 15 | net.WriteTable(self.Settings) 16 | return IsValid(ply) and net.Send(ply) or net.Broadcast() 17 | end 18 | end 19 | 20 | if CLIENT then 21 | local function cleanUpMap() 22 | game.CleanUpMap() 23 | end 24 | 25 | net.Receive("nzCleanUp", cleanUpMap ) 26 | 27 | local function receiveMapData() 28 | local oldeeurl = nzMapping.Settings.eeurl or "" 29 | nzMapping.Settings = net.ReadTable() 30 | 31 | if !EEAudioChannel or (oldeeurl != nzMapping.Settings.eeurl and nzMapping.Settings.eeurl) then 32 | EasterEggData.ParseSong() 33 | end 34 | 35 | -- Precache all random box weapons in the list 36 | if nzMapping.Settings.rboxweps then 37 | local model = ClientsideModel("models/hoff/props/teddy_bear/teddy_bear.mdl") 38 | for k,v in pairs(nzMapping.Settings.rboxweps) do 39 | local wep = weapons.Get(k) 40 | if wep and (wep.WM or wep.WorldModel) then 41 | util.PrecacheModel(wep.WM or wep.WorldModel) 42 | model:SetModel(wep.WM or wep.WorldModel) 43 | end 44 | end 45 | model:Remove() 46 | end 47 | end 48 | net.Receive( "nzMapping.SyncSettings", receiveMapData ) 49 | 50 | function nzMapping:SendMapData( data ) 51 | if data then 52 | net.Start("nzMapping.SyncSettings") 53 | net.WriteTable(data) 54 | net.SendToServer() 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/edit_fog_special.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile() 3 | DEFINE_BASECLASS( "base_edit" ) 4 | 5 | ENT.Spawnable = false 6 | ENT.AdminOnly = false 7 | 8 | ENT.PrintName = "Fog Editor for Special Rounds" 9 | ENT.Category = "Editors" 10 | 11 | ENT.NZOnlyVisibleInCreative = true 12 | 13 | function ENT:Initialize() 14 | 15 | BaseClass.Initialize( self ) 16 | 17 | self:SetMaterial( "gmod/edit_fog" ) 18 | 19 | -- There can only be one! 20 | if IsValid(ents.FindByClass("edit_fog_special")[1]) and ents.FindByClass("edit_fog_special")[1] != self then ents.FindByClass("edit_fog_special")[1]:Remove() end 21 | 22 | if ( CLIENT ) then 23 | if nzRound:InState( ROUND_CREATE ) or nzRound:IsSpecial() then 24 | --self:HookFogHooks() 25 | end 26 | end 27 | 28 | end 29 | 30 | function ENT:SetupDataTables() 31 | 32 | self:NetworkVar( "Float", 0, "FogStart", { KeyName = "fogstart", Edit = { type = "Float", min = 0, max = 100000, order = 1 } } ); 33 | self:NetworkVar( "Float", 1, "FogEnd", { KeyName = "fogend", Edit = { type = "Float", min = 0, max = 100000, order = 2 } } ); 34 | self:NetworkVar( "Float", 2, "Density", { KeyName = "density", Edit = { type = "Float", min = 0, max = 1, order = 3 } } ); 35 | 36 | self:NetworkVar( "Vector", 0, "FogColor", { KeyName = "fogcolor", Edit = { type = "VectorColor", order = 3 } } ); 37 | 38 | -- 39 | -- TODO: Should skybox fog be edited seperately? 40 | -- 41 | 42 | if ( SERVER ) then 43 | 44 | -- defaults 45 | self:SetFogStart( 0.0 ) 46 | self:SetFogEnd( 10000 ) 47 | self:SetDensity( 0.9 ) 48 | self:SetFogColor( Vector( 0.6, 0.7, 0.8 ) ) 49 | 50 | end 51 | 52 | end 53 | 54 | -- 55 | -- This edits something global - so always network - even when not in PVS 56 | -- 57 | function ENT:UpdateTransmitState() 58 | 59 | return TRANSMIT_ALWAYS 60 | end 61 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/revive_system/sh_animation.lua: -------------------------------------------------------------------------------- 1 | 2 | local function HandlePlayerDowned(ply, vel) 3 | if !ply:GetNotDowned() then 4 | 5 | ply.CalcIdeal = ACT_HL2MP_SWIM_REVOLVER 6 | 7 | local len = vel:Length2D() 8 | if ( len <= 1 ) then 9 | ply.CalcIdeal = ACT_HL2MP_SWIM_PISTOL 10 | end 11 | 12 | return ply.CalcIdeal, ply.CalcSeqOverride 13 | end 14 | end 15 | hook.Add("CalcMainActivity", "nzPlayerDownedAnims", HandlePlayerDowned) 16 | 17 | local function PlayerDownedParameters(ply, vel, seqspeed) 18 | if !ply:GetNotDowned() then 19 | local len = vel:Length2D() 20 | local movement = 0 21 | 22 | if ( len > 1 ) then 23 | movement = ( len / seqspeed ) 24 | elseif math.Round(ply:GetCycle(), 1) != 0.7 then 25 | movement = 5 26 | end 27 | 28 | local rate = math.min( movement, 1 ) 29 | 30 | ply:SetPoseParameter("move_x", -1) 31 | ply:SetPlaybackRate( movement ) 32 | 33 | if !ply.NZDownedAnim then 34 | ply:SetHull(Vector(-16,-16,25), Vector(16,16,97)) 35 | ply.NZDownedAnim = true 36 | end 37 | 38 | --ply:SetNetworkOrigin(ply:GetPos() - Vector(0,0,20)) 39 | -- 40 | return true 41 | elseif ply.NZDownedAnim then 42 | --ply:SetPos(ply:GetPos() + Vector(0,0,25)) 43 | ply:ResetHull() 44 | ply.NZDownedAnim = false 45 | end 46 | end 47 | hook.Add("UpdateAnimation", "nzPlayerDownedAnims", PlayerDownedParameters) 48 | 49 | if CLIENT then 50 | local function RenderDownedPlayers(ply) 51 | if !ply:GetNotDowned() then 52 | ply:SetRenderOrigin(ply:GetPos() - Vector(0,0,50)) 53 | local ang = ply:GetAngles() 54 | ply:SetRenderAngles(Angle(-30,ang[2],ang[3])) 55 | ply:InvalidateBoneCache() 56 | 57 | local wep = ply:GetActiveWeapon() 58 | if IsValid(wep) then wep:InvalidateBoneCache() end 59 | end 60 | end 61 | hook.Add("PrePlayerDraw", "nzPlayerDownedAnims", RenderDownedPlayers) 62 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/player_class/sh_constructor.lua: -------------------------------------------------------------------------------- 1 | -- Main Tables 2 | nzPlayers = nzPlayers or AddNZModule("Players") 3 | nzPlayers.Data = nzPlayers.Data or {} 4 | 5 | -- Variables 6 | local downedspeed = 30 7 | 8 | -- Copy-pasted from the wiki, a nice little function 9 | local CMoveData = FindMetaTable( "CMoveData" ) 10 | function CMoveData:RemoveKeys( keys ) 11 | -- Using bitwise operations to clear the key bits. 12 | local newbuttons = bit.band( self:GetButtons(), bit.bnot( keys ) ) 13 | self:SetButtons( newbuttons ) 14 | end 15 | 16 | -- Stops players from moving if downed 17 | hook.Add( "SetupMove", "nzFreezePlayersDowned", function( ply, mv, cmd ) 18 | if !ply:GetNotDowned() then 19 | mv:SetMaxClientSpeed( downedspeed ) 20 | mv:RemoveKeys(IN_JUMP + IN_DUCK) 21 | 22 | --[[if mv:GetVelocity():Length2D() > 10 then -- Can't shoot while crawling! 23 | mv:RemoveKeys(IN_ATTACK + IN_ATTACK2) -- Doesn't work for some reason? :( 24 | end]] 25 | end 26 | end ) 27 | 28 | hook.Add("PlayerSpawn", "SetupHands", function(ply) 29 | 30 | local mdl = ply:GetInfo( "cl_playermodel" ) 31 | ply:SetModel(mdl) 32 | 33 | local col = ply:GetInfo( "cl_playercolor" ) 34 | ply:SetPlayerColor( Vector( col ) ) 35 | 36 | local col = Vector( ply:GetInfo( "cl_weaponcolor" ) ) 37 | if col:Length() == 0 then 38 | col = Vector( 0.001, 0.001, 0.001 ) 39 | end 40 | ply:SetWeaponColor( col ) 41 | 42 | local skin = ply:GetInfoNum( "cl_playerskin", 0 ) 43 | ply:SetSkin( skin ) 44 | 45 | local groups = ply:GetInfo( "cl_playerbodygroups" ) 46 | if ( groups == nil ) then groups = "" end 47 | local groups = string.Explode( " ", groups ) 48 | for k = 0, ply:GetNumBodyGroups() - 1 do 49 | ply:SetBodygroup( k, tonumber( groups[ k + 1 ] ) or 0 ) 50 | end 51 | 52 | timer.Simple(0, function() 53 | if IsValid(ply) then ply:SetupHands() end 54 | end) 55 | 56 | end) 57 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_sync.lua: -------------------------------------------------------------------------------- 1 | -- Client Server Syncing 2 | 3 | if SERVER then 4 | 5 | -- Server to client (Server) 6 | --util.AddNetworkString( "nzToolsSync" ) 7 | util.AddNetworkString( "nzToolsUpdate" ) 8 | 9 | local function ReceiveData(len, ply) 10 | if !IsValid(ply) then return end 11 | local id = net.ReadString() 12 | local wep = ply:GetActiveWeapon() 13 | 14 | -- Call holster on the old tool 15 | if nzTools.ToolData[wep.ToolMode] then 16 | nzTools.ToolData[wep.ToolMode].OnHolster(wep, ply, ply.NZToolData) 17 | end 18 | 19 | ply:SetActiveNZTool( id ) 20 | -- Only read the data if the tool has any - as shown by the bool 21 | if net.ReadBool() then 22 | ply:SetNZToolData( net.ReadTable() ) 23 | end 24 | 25 | -- Then call equip on the new one 26 | if nzTools.ToolData[id] then 27 | nzTools.ToolData[id].OnEquip(wep, ply, ply.NZToolData) 28 | end 29 | end 30 | net.Receive( "nzToolsUpdate", ReceiveData ) 31 | end 32 | 33 | if CLIENT then 34 | 35 | -- Client to server 36 | function nzTools:SendData( data, tool, savedata ) 37 | if data then 38 | net.Start("nzToolsUpdate") 39 | net.WriteString(tool) 40 | -- Let the server know we're also sending a table of data 41 | net.WriteBool(true) 42 | net.WriteTable(data) 43 | net.SendToServer() 44 | else 45 | -- This tool doesn't have any data 46 | net.Start("nzToolsUpdate") 47 | net.WriteString(tool) 48 | net.WriteBool(false) 49 | net.SendToServer() 50 | end 51 | 52 | -- Always save on submit - if a special table of savedata is provided, use that 53 | if savedata then 54 | nzTools:SaveData( savedata, tool ) 55 | else 56 | nzTools:SaveData( data, tool ) 57 | end 58 | end 59 | 60 | function nzTools:SaveData( data, tool ) 61 | self.SavedData[tool] = nil 62 | self.SavedData[tool] = data 63 | end 64 | 65 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/round/sh_player.lua: -------------------------------------------------------------------------------- 1 | local plyMeta = FindMetaTable( "Player" ) 2 | 3 | AccessorFunc( plyMeta, "bReady", "Ready", FORCE_BOOL ) 4 | function plyMeta:IsReady() return self:GetReady() end 5 | 6 | AccessorFunc( plyMeta, "bPlaying", "Playing", FORCE_BOOL ) 7 | function plyMeta:IsPlaying() return self:GetPlaying() end 8 | 9 | function plyMeta:IsSpectating() return self:Team() == TEAM_SPECTATOR end 10 | 11 | function plyMeta:IsInCreative() return player_manager.GetPlayerClass( self ) == "player_create" end 12 | 13 | local player = player 14 | 15 | --player.utils 16 | function player.GetAllReady() 17 | local result = {} 18 | for _, ply in pairs( player.GetAll() ) do 19 | if ply:IsReady() then 20 | table.insert( result, ply ) 21 | end 22 | end 23 | 24 | return result 25 | end 26 | 27 | function player.GetAllPlaying() 28 | local result = {} 29 | for _, ply in pairs( player.GetAll() ) do 30 | if ply:IsPlaying() then 31 | table.insert( result, ply ) 32 | end 33 | end 34 | 35 | return result 36 | end 37 | 38 | function player.GetAllPlayingAndAlive() 39 | local result = {} 40 | for _, ply in pairs( player.GetAllPlaying() ) do 41 | if ply:Alive() and (ply:GetNotDowned() or ply.HasWhosWho or ply.DownedWithSoloRevive) then -- Who's Who will respawn the player, don't end yet 42 | table.insert( result, ply ) 43 | end 44 | end 45 | 46 | return result 47 | end 48 | 49 | function player.GetAllNonSpecs() 50 | local result = {} 51 | for _, ply in pairs( player.GetAll() ) do 52 | if ply:Team() != TEAM_SPECTATOR then 53 | table.insert( result, ply ) 54 | end 55 | end 56 | 57 | return result 58 | end 59 | 60 | function player.GetAllTargetable() 61 | local result = {} 62 | for _, ply in pairs(player.GetAll()) do 63 | if ply:GetTargetPriority() > 0 then 64 | table.insert( result, ply ) 65 | end 66 | end 67 | 68 | return result 69 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/itemcarrying/sv_gameplay.lua: -------------------------------------------------------------------------------- 1 | 2 | function nzItemCarry.OnPlayerPickItemUp( ply, ent ) 3 | -- Downed players can't pick up anything! 4 | if !ply:GetNotDowned() then return false end 5 | 6 | -- Players can't pick stuff up while using special weapons! (Perk bottles, knives, etc) 7 | if IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():IsSpecial() then return false end 8 | 9 | -- Used in map scripting 10 | if ent.OnUsed and type(ent.OnUsed) == "function" then 11 | if ply:KeyPressed(IN_USE) then 12 | ent:OnUsed(ply) 13 | end 14 | end 15 | 16 | local category = ent:GetNWString("NZItemCategory") 17 | if category != "" then 18 | local item = nzItemCarry.Items[category] 19 | if item.pickupfunction and item:condition(ply) then -- If it has a pickup function and it is allowed in this case 20 | --print("allowed") 21 | item:pickupfunction(ply, ent) 22 | end 23 | end 24 | end 25 | hook.Add( "PlayerUse", "nzPlayerPickupItems", nzItemCarry.OnPlayerPickItemUp ) 26 | 27 | function nzItemCarry.RemoveItemsOnRemoved( ent ) 28 | local item = nzItemCarry.Items[ent:GetNWString("NZItemCategory")] 29 | if item and item.items and table.HasValue(item.items, ent) then 30 | table.RemoveByValue(item.items, ent) 31 | end 32 | end 33 | hook.Add( "EntityRemoved", "nzItemCarryRemoveItems", nzItemCarry.RemoveItemsOnRemoved ) 34 | 35 | -- These correctly obey Use types (SIMPLE_USE etc.) by directly injecting into ENTITY:Use() 36 | 37 | local meta = FindMetaTable("Entity") 38 | function meta:AddUseFunction( func ) 39 | local olduse = self.Use 40 | if olduse then 41 | self.Use = function(self2,a,b,c,d) 42 | olduse(self2,a,b,c,d) 43 | func(self2,a,b,c,d) 44 | end 45 | else 46 | self:ReplaceUseFunction(func) 47 | end 48 | end 49 | function meta:ReplaceUseFunction( func ) 50 | self.Use = function(self2,a,b,c,d) 51 | func(self2,a,b,c,d) 52 | end 53 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_rbox.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("rbox", { 2 | displayname = "Random Box Spawnpoint", 3 | desc = "LMB: Place Random Box Spawnpoint, RMB: Remove Random Box Spawnpoint", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | 8 | PrimaryAttack = function(wep, ply, tr, data) 9 | nzMapping:BoxSpawn(tr.HitPos, Angle(0,(tr.HitPos - ply:GetPos()):Angle()[2] - 90,0), data.PossibleSpawn, ply) 10 | end, 11 | 12 | SecondaryAttack = function(wep, ply, tr, data) 13 | if IsValid(tr.Entity) and tr.Entity:GetClass() == "random_box_spawns" then 14 | tr.Entity:Remove() 15 | end 16 | end, 17 | Reload = function(wep, ply, tr, data) 18 | -- Nothing 19 | end, 20 | OnEquip = function(wep, ply, data) 21 | 22 | end, 23 | OnHolster = function(wep, ply, data) 24 | 25 | end 26 | }, { 27 | displayname = "Random Box Spawnpoint", 28 | desc = "LMB: Place Random Box Spawnpoint, RMB: Remove Random Box Spawnpoint", 29 | icon = "icon16/briefcase.png", 30 | weight = 4, 31 | condition = function(wep, ply) 32 | return true 33 | end, 34 | interface = function(frame, data) 35 | local valz = {} 36 | valz["Row1"] = data.PossibleSpawn 37 | 38 | local DProperties = vgui.Create( "DProperties", frame ) 39 | DProperties:SetSize( 280, 180 ) 40 | DProperties:SetPos( 10, 10 ) 41 | 42 | function DProperties.CompileData() 43 | data.PossibleSpawn = valz["Row1"] 44 | return data 45 | end 46 | 47 | function DProperties.UpdateData(data) 48 | nzTools:SendData(data, "rbox") 49 | end 50 | 51 | local Row1 = DProperties:CreateRow( "Random Box", "Possible Spawn?" ) 52 | Row1:Setup( "Boolean" ) 53 | Row1:SetValue( valz["Row1"] ) 54 | Row1.DataChanged = function( _, val ) valz["Row1"] = val DProperties.UpdateData(DProperties.CompileData()) end 55 | 56 | return DProperties 57 | end, 58 | defaultdata = { 59 | PossibleSpawn = 0, 60 | } 61 | }) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/zombie_soul/init.lua: -------------------------------------------------------------------------------- 1 | function EFFECT:Init( data ) 2 | 3 | self.Start = data:GetOrigin() 4 | self.Catcher = data:GetEntity() 5 | self.ParticleDelay = 0.1 6 | self.MoveSpeed = 50 7 | self.DistToCatch = 100 -- Squared (10) 8 | 9 | self.NextParticle = CurTime() 10 | 11 | self.Emitter = ParticleEmitter( self.Start ) 12 | 13 | print(self.Emitter, self.NextParticle, self, self.Catcher) 14 | 15 | end 16 | 17 | 18 | --[[--------------------------------------------------------- 19 | THINK 20 | -----------------------------------------------------------]] 21 | function EFFECT:Think( ) 22 | if CurTime() >= self.NextParticle then 23 | local particle = self.Emitter:Add("sprites/glow04_noz", self.Emitter:GetPos()) 24 | if (particle) then 25 | particle:SetVelocity( Vector(0,0,0) ) 26 | particle:SetColor(math.random(200,255), math.random(100,200), math.random(100,150)) 27 | particle:SetLifeTime( 0 ) 28 | particle:SetDieTime( 0.3 ) 29 | particle:SetStartAlpha( 255 ) 30 | particle:SetEndAlpha( 0 ) 31 | particle:SetStartSize( 25 ) 32 | particle:SetEndSize( 25 ) 33 | particle:SetRoll( math.Rand(0, 36)*10 ) 34 | --particle:SetRollDelta( math.Rand(-200, 200) ) 35 | particle:SetAirResistance( 400 ) 36 | particle:SetGravity( Vector( 0, 0, 0 ) ) 37 | 38 | self.NextParticle = CurTime() + self.ParticleDelay 39 | end 40 | end 41 | self.Emitter:SetPos( (self.Catcher:GetPos()-self.Emitter:GetPos()):GetNormal() * self.MoveSpeed * FrameTime() + self.Emitter:GetPos() ) 42 | if self.Emitter:GetPos():DistToSqr(self.Catcher:GetPos()) <= self.DistToCatch then 43 | self.Catcher:CollectSoul() 44 | return false 45 | else 46 | return true 47 | end 48 | end 49 | 50 | --[[--------------------------------------------------------- 51 | Draw the effect 52 | -----------------------------------------------------------]] 53 | function EFFECT:Render() 54 | end 55 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/pap_weapon_trigger/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "pap_weapon_trigger" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "String", 0, "WepClass" ) 14 | self:NetworkVar( "Entity", 0, "PaPOwner" ) 15 | 16 | end 17 | 18 | function ENT:Initialize() 19 | self:SetMoveType( MOVETYPE_NONE ) 20 | self:SetSolid( SOLID_OBB ) 21 | self:SetModel("models/hunter/blocks/cube05x1x025.mdl") 22 | self:DrawShadow(false) 23 | 24 | if SERVER then 25 | self:SetUseType( SIMPLE_USE ) 26 | end 27 | end 28 | 29 | function ENT:Use( activator, caller ) 30 | if activator == self:GetPaPOwner() then 31 | local class = self:GetWepClass() 32 | local weapon 33 | if self.RerollingAtts then 34 | weapon = activator:GiveNoAmmo(class) 35 | else 36 | weapon = activator:Give(class) 37 | end 38 | timer.Simple(0, function() 39 | if IsValid(weapon) and IsValid(activator) then 40 | if activator:HasPerk("speed") and weapon:IsFAS2() then 41 | weapon:ApplyNZModifier("speed") 42 | end 43 | if (activator:HasPerk("dtap") or activator:HasPerk("dtap2")) and weapon:IsFAS2() then 44 | weapon:ApplyNZModifier("dtap") 45 | end 46 | weapon:ApplyNZModifier("pap") 47 | weapon:SetClip1(weapon.Primary.ClipSize) 48 | if IsValid(self.wep) then 49 | self.wep.machine:SetBeingUsed(false) 50 | self.wep:Remove() 51 | end 52 | end 53 | --[[if !self.RerollingAtts then -- A 2000 point reroll should not give max ammo 54 | print("Giving ammo") 55 | nzWeps:GiveMaxAmmoWep(activator, class, true) -- We give pap ammo count 56 | end]] 57 | self:Remove() 58 | end) 59 | else 60 | if IsValid(self:GetPaPOwner()) then 61 | activator:PrintMessage( HUD_PRINTTALK, "This is " .. self:GetPaPOwner():Nick() .. "'s gun. You cannot take it." ) 62 | end 63 | end 64 | end 65 | 66 | if CLIENT then 67 | function ENT:Draw() 68 | return 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/one_inch_punch_blow/init.lua: -------------------------------------------------------------------------------- 1 | local particles = { 2 | Model("particle/particle_ring_wave_8"), 3 | } 4 | 5 | local delay = 0.05 6 | local amount = 3 7 | 8 | --Main function 9 | function EFFECT:Init(data) 10 | --Create particle emitter 11 | local emitter = ParticleEmitter(data:GetOrigin()) 12 | local bone = math.Round(data:GetMagnitude()) 13 | local num = 0 14 | timer.Create("one_inch_punch_effect", delay, amount, function() 15 | if IsValid(LocalPlayer()) and LocalPlayer():GetActiveWeapon():GetClass() == "nz_one_inch_punch" then 16 | num = num + 1 17 | local pos = LocalPlayer():GetViewModel():GetBoneMatrix(bone):GetTranslation() 18 | local particle = emitter:Add( table.Random(particles), pos ) 19 | if (particle) then 20 | particle:SetVelocity(LocalPlayer():GetVelocity()) 21 | particle:SetLifeTime(0) 22 | particle:SetDieTime(1.1) 23 | particle:SetColor(200,200,200) 24 | particle:SetLighting(false) 25 | particle:SetStartAlpha(100) 26 | particle:SetEndAlpha(0) 27 | 28 | local Size = math.Rand(5,10) 29 | particle:SetStartSize(Size) 30 | particle:SetEndSize(Size) 31 | particle:SetRoll(math.Rand(-360, 360)) 32 | particle:SetRollDelta(math.Rand(-2, 2)) 33 | particle:SetAirResistance(math.Rand(200, 400)) 34 | particle:SetGravity( Vector(0, 0, 0) ) 35 | particle:SetCollide(false) 36 | particle:SetBounce(0.42) 37 | --particle:SetLighting(1) 38 | end 39 | 40 | if num >= amount then 41 | emitter:Finish() 42 | timer.Destroy("one_inch_punch_effect") 43 | end 44 | else 45 | emitter:Finish() 46 | timer.Destroy("one_inch_punch_effect") 47 | end 48 | end) 49 | end 50 | 51 | function EFFECT:Think() 52 | if !self.NextParticle or self.NextParticle < CurTime() then 53 | 54 | self.NextParticle = CurTime() + delay 55 | end 56 | if self.KillTime and self.KillTime < CurTime() then 57 | print("Done") 58 | emitter:Finish() 59 | return false 60 | end 61 | self:NextThink(CurTime()) 62 | end 63 | 64 | --Not used 65 | function EFFECT:Render() 66 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/logic_winlose/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | 4 | function ENT:Initialize() 5 | -- Remove it as soon as it spawns, if the gamemode hasn't been enabled in Map Settings 6 | if !nzMapping.Settings.gamemodeentities then 7 | self:Remove() 8 | end 9 | end 10 | 11 | function ENT:Think() 12 | end 13 | 14 | function ENT:AcceptInput(name, activator, caller, args) 15 | name = string.lower(name) 16 | if string.sub(name, 1, 2) == "on" then 17 | self:FireOutput(name, activator, caller, args) 18 | return true 19 | elseif name == "win" then 20 | nzRound:Win("You survived after "..nzRound:GetNumber().." rounds!") 21 | return true 22 | elseif name == "lose" then 23 | nzRound:Lose("You got overwhelmed after "..nzRound:GetNumber().." rounds!") 24 | return true 25 | elseif name == "setendslomo" then 26 | self:SetKeyValue("endslomo", args) 27 | return true 28 | elseif name == "setendcamera" then 29 | self:SetKeyValue("endcamera", args) 30 | return true 31 | elseif name == "setendcamerapos" then 32 | self:SetKeyValue("endcamerapos", args) 33 | return true 34 | elseif name == "setwinmusic" then 35 | self:SetKeyValue("winmusic", args) 36 | return true 37 | elseif name == "setlosemusic" then 38 | self:SetKeyValue("losemusic", args) 39 | return true 40 | end 41 | end 42 | 43 | function ENT:KeyValue(key, value) 44 | key = string.lower(key) 45 | if string.sub(key, 1, 2) == "on" then 46 | self:AddOnOutput(key, value) 47 | elseif key == "endslomo" then 48 | nzRound.OverrideEndSlomo = value == "1" 49 | elseif key == "endcamera" then 50 | SetGlobalBool("endcamera", value == "1") 51 | elseif key == "setendcamerapos" then 52 | SetGlobalVector("endcamerapos", Vector(value)) 53 | elseif key == "winmusic" then 54 | if value == "default" then 55 | SetGlobalString("winmusic", nil) 56 | else 57 | SetGlobalString("winmusic", value) 58 | end 59 | elseif key == "losemusic" then 60 | if value == "default" then 61 | SetGlobalString("losemusic", nil) 62 | else 63 | SetGlobalString("losemusic", value) 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/logic_waves/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | function ENT:Initialize() 4 | -- Remove it as soon as it spawns, if gamemode extensions hasn't been enabled in Map Settings 5 | if !nzMapping.Settings.gamemodeentities then 6 | self:Remove() 7 | end 8 | self.Wave = self.Wave or -1 9 | end 10 | 11 | function ENT:Think() 12 | end 13 | 14 | function ENT:AcceptInput(name, activator, caller, args) 15 | name = string.lower(name) 16 | if string.sub(name, 1, 2) == "on" then 17 | self:FireOutput(name, activator, caller, args) 18 | elseif name == "advancewave" then 19 | -- We do not allow manually advancing rounds 20 | return true 21 | elseif name == "endwave" then 22 | -- Or ending them 23 | return true 24 | elseif name == "setwave" then 25 | -- Or changing which one we're on 26 | return true 27 | elseif name == "setwaves" then 28 | SetGlobalInt("numwaves", tonumber(args) or GAMEMODE.NumberOfWaves) 29 | return true 30 | elseif name == "startwave" then 31 | 32 | return true 33 | elseif name == "setwavestart" then 34 | 35 | return true 36 | elseif name == "setwaveend" then 37 | 38 | return true 39 | end 40 | end 41 | 42 | function ENT:KeyValue(key, value) 43 | key = string.lower(key) 44 | if string.sub(key, 1, 2) == "on" then 45 | self:AddOnOutput(key, value) 46 | elseif key == "wave" then 47 | self.Wave = tonumber(value) or -1 48 | end 49 | end 50 | 51 | -- Rounds in nZombies are different than those on Zombie Survival 52 | local conversionrate = 2 53 | 54 | hook.Add("OnRoundStart", "nz_zsLogicWavesRoundStart", function(num) 55 | local curwave = num / conversionrate 56 | for _, ent in pairs(ents.FindByClass("logic_waves")) do 57 | if ent.Wave == curwave or ent.Wave == -1 then 58 | ent:Input("onwavestart", ent, ent, curwave) 59 | end 60 | end 61 | end) 62 | 63 | hook.Add("OnRoundPreparation", "nz_zsLogicWavesRoundEnd", function(num) 64 | local curwave = (num - 1) / conversionrate 65 | for _, ent in pairs(ents.FindByClass("logic_waves")) do 66 | if ent.Wave == curwave or ent.Wave == -1 then 67 | ent:Input("onwaveend", ent, ent, curwave) 68 | end 69 | end 70 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/pap_weapon_fly/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "pap_weapon_fly" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | self:NetworkVar( "String", 0, "WeaponClass") 13 | end 14 | 15 | function ENT:Initialize() 16 | 17 | self:SetMoveType( MOVETYPE_FLY ) 18 | self:SetSolid( SOLID_OBB ) 19 | --self:SetCollisionBounds(Vector(-5, -10, -3), Vector(5, 10, 3)) 20 | --self:UseTriggerBounds(true, 1) 21 | self:SetMoveType(MOVETYPE_FLY) 22 | self:PhysicsInitBox(Vector(-5, -10, -3), Vector(5, 10, 3)) 23 | self:GetPhysicsObject():EnableCollisions(false) 24 | self:SetNotSolid(true) 25 | self:DrawShadow( false ) 26 | self.TriggerPos = self:GetPos() 27 | 28 | if SERVER then 29 | self:SetUseType( SIMPLE_USE ) 30 | self:SetWeaponClass(self.WepClass) 31 | else 32 | local wep = weapons.Get(self:GetWeaponClass()) 33 | if wep and wep.DrawWorldModel then self.WorldModelFunc = wep.DrawWorldModel end 34 | end 35 | end 36 | 37 | function ENT:SetWepClass(class) 38 | if IsValid(self.button) then 39 | self.button:SetWepClass(class) 40 | end 41 | self:SetWeaponClass(class) 42 | end 43 | 44 | function ENT:CreateTriggerZone(reroll) 45 | if SERVER then 46 | self.button = ents.Create("pap_weapon_trigger") 47 | self.button:SetPos(self.TriggerPos) 48 | self.button:SetAngles(self:GetAngles() - Angle(90,90,0)) 49 | self.button:Spawn() 50 | self.button:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) 51 | self.button.RerollingAtts = reroll 52 | self.button:SetPaPOwner(self.Owner) 53 | self.button.wep = self 54 | self.button:SetWepClass(self.WepClass) 55 | end 56 | end 57 | 58 | function ENT:OnRemove() 59 | if IsValid(self.button) then self.button:Remove() end 60 | end 61 | 62 | if CLIENT then 63 | function ENT:Draw() 64 | -- We can use the stored world model draw function from the original weapon, but if it doesn't exist or errors, then just draw model 65 | if !self.WorldModelFunc or !pcall(self.WorldModelFunc, self) then self:DrawModel() end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/point_zsmessage/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | function ENT:Initialize() 4 | -- Remove it as soon as it spawns, if the gamemode hasn't been enabled in Map Settings 5 | if !nzMapping.Settings.gamemodeentities then 6 | self:Remove() 7 | end 8 | self.SendTo = self.SendTo or -1 9 | end 10 | 11 | function ENT:Think() 12 | end 13 | 14 | function ENT:AcceptInput(name, caller, activator, args) 15 | name = string.lower(name) 16 | if name == "message" then 17 | args = args or "" 18 | 19 | args = string.gsub(args, "<.-=.->", "") 20 | args = string.gsub(args, "", "") 21 | 22 | if self.SendTo == 0 then 23 | nz_zsCenterNotifyAll(args) 24 | elseif self.SendTo == -1 then 25 | for _, pl in pairs(player.GetAll()) do 26 | if pl == activator or pl == caller then 27 | nz_zsCenterNotifyPlayer(pl, args) 28 | break 29 | end 30 | end 31 | else 32 | for _, pl in pairs(player.GetAll()) do 33 | if self.SendTo == TEAM_HUMAN then -- Only humans 34 | nz_zsCenterNotifyPlayer(pl, args) 35 | end 36 | end 37 | end 38 | 39 | return true 40 | elseif name == "setundeadhudmessage" or name == "setzombiehudmessage" then 41 | SetGlobalString("hudoverride"..TEAM_UNDEAD, args) 42 | elseif name == "sethumanhudmessage" or name == "setsurvivorhudmessage" then 43 | --SetGlobalString("hudoverride"..TEAM_HUMAN, args) 44 | elseif name == "clearundeadhudmessage" or name == "clearzombiehudmessage" then 45 | --SetGlobalString("hudoverride"..TEAM_UNDEAD, "") 46 | elseif name == "clearhumanhudmessage" or name == "clearsurvivorhudmessage" then 47 | SetGlobalString("hudoverride"..TEAM_HUMAN, "") 48 | end 49 | end 50 | 51 | function ENT:KeyValue(key, value) 52 | key = string.lower(key) 53 | if key == "team" then 54 | value = string.lower(value or "") 55 | if value == "zombie" or value == "undead" or value == "zombies" then 56 | self.SendTo = TEAM_UNDEAD 57 | elseif value == "human" or value == "humans" then 58 | self.SendTo = TEAM_HUMAN 59 | elseif value == "activator" or value == "caller" or value == "private" then 60 | self.SendTo = -1 61 | else 62 | self.SendTo = 0 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/sent_grenade_frag/outputs.lua: -------------------------------------------------------------------------------- 1 | 2 | ENT.Sound = {} 3 | ENT.Sound.Blip = "Grenade.Blip" 4 | ENT.Sound.Explode = "BaseGrenade.Explode" 5 | 6 | ENT.Trail = {} 7 | ENT.Trail.Color = Color( 255, 0, 0, 255 ) 8 | ENT.Trail.Material = "sprites/bluelaser1.vmt" 9 | ENT.Trail.StartWidth = 8.0 10 | ENT.Trail.EndWidth = 1.0 11 | ENT.Trail.LifeTime = 0.5 12 | 13 | // Nice helper function, this does all the work. 14 | 15 | /*--------------------------------------------------------- 16 | Name: DoExplodeEffect 17 | ---------------------------------------------------------*/ 18 | function ENT:DoExplodeEffect() 19 | 20 | local info = EffectData(); 21 | info:SetEntity( self.Entity ); 22 | info:SetOrigin( self.Entity:GetPos() ); 23 | 24 | util.Effect( "Explosion", info ); 25 | 26 | end 27 | 28 | /*--------------------------------------------------------- 29 | Name: OnExplode 30 | Desc: The grenade has just exploded. 31 | ---------------------------------------------------------*/ 32 | function ENT:OnExplode( pTrace ) 33 | 34 | local Pos1 = pTrace.HitPos + pTrace.HitNormal 35 | local Pos2 = pTrace.HitPos - pTrace.HitNormal 36 | 37 | util.Decal( "Scorch", Pos1, Pos2 ); 38 | 39 | end 40 | 41 | /*--------------------------------------------------------- 42 | Name: OnInitialize 43 | ---------------------------------------------------------*/ 44 | function ENT:OnInitialize() 45 | end 46 | 47 | /*--------------------------------------------------------- 48 | Name: StartTouch 49 | ---------------------------------------------------------*/ 50 | function ENT:StartTouch( entity ) 51 | end 52 | 53 | /*--------------------------------------------------------- 54 | Name: EndTouch 55 | ---------------------------------------------------------*/ 56 | function ENT:EndTouch( entity ) 57 | end 58 | 59 | /*--------------------------------------------------------- 60 | Name: Touch 61 | ---------------------------------------------------------*/ 62 | function ENT:Touch( entity ) 63 | end 64 | 65 | /*--------------------------------------------------------- 66 | Name: OnThink 67 | ---------------------------------------------------------*/ 68 | function ENT:OnThink() 69 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/electricity/sv_elec.lua: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | function nzElec:Activate(nochat) 4 | 5 | --if self.Active then return end -- We don't wanna turn it on twice 6 | 7 | self.Active = true 8 | self:SendSync() 9 | 10 | -- Open all doors with no price and electricity requirement 11 | for k,v in pairs(ents.GetAll()) do 12 | if v:IsBuyableEntity() then 13 | local data = v:GetDoorData() 14 | if data then 15 | if tonumber(data.price) == 0 and tobool(data.elec) == true then 16 | nzDoors:OpenDoor( v ) 17 | end 18 | end 19 | end 20 | end 21 | 22 | -- Turn on all perk machines 23 | for k,v in pairs(ents.FindByClass("perk_machine")) do 24 | v:TurnOn() 25 | end 26 | 27 | for k,v in pairs(ents.FindByClass("wunderfizz_machine")) do 28 | v:TurnOff() -- Reset all Wunderfizz's 29 | end 30 | 31 | local wund = ents.FindByClass("wunderfizz_machine") 32 | local machine = wund[math.random(#wund)] 33 | if IsValid(machine) then machine:TurnOn() end 34 | 35 | -- Inform players 36 | if !nochat then 37 | PrintMessage(HUD_PRINTTALK, "[NZ] Electricity is on!") 38 | net.Start("nz.nzElec.Sound") 39 | net.WriteBool(true) 40 | net.Broadcast() 41 | end 42 | 43 | for k,v in pairs(ents.FindByClass("nz_electricity")) do 44 | v:Fire("OnElectricityOn") 45 | end 46 | 47 | hook.Call("ElectricityOn") 48 | 49 | end 50 | 51 | function nzElec:Reset(nochat) 52 | 53 | if !self.Active then return end -- No need to turn it off again 54 | 55 | self.Active = false 56 | -- Reset the button aswell 57 | local prevs = ents.FindByClass("power_box") 58 | for k,v in pairs(prevs) do 59 | v:SetSwitch(false) 60 | end 61 | 62 | -- Turn off all perk machines 63 | for k,v in pairs(ents.FindByClass("perk_machine")) do 64 | v:TurnOff() 65 | end 66 | 67 | -- And Wunderfizz Machines 68 | for k,v in pairs(ents.FindByClass("wunderfizz_machine")) do 69 | v:TurnOff() 70 | end 71 | 72 | self:SendSync() 73 | 74 | if !nochat then 75 | net.Start("nz.nzElec.Sound") 76 | net.WriteBool(false) 77 | net.Broadcast() 78 | end 79 | 80 | for k,v in pairs(ents.FindByClass("nz_electricity")) do 81 | v:Fire("OnElectricityOff") 82 | end 83 | 84 | hook.Call("ElectricityOff") 85 | 86 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_button_and.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | ENT.Base = "base_entity" 5 | 6 | nzLogic:Register("nz_button_and") 7 | ENT.SpawnIcon = "models/maxofs2d/button_03.mdl" 8 | ENT.PrintName = "AND Gate/Button" 9 | ENT.Description = "This Gate will trigger if all activators linked to this butoons are activate at the same time." 10 | 11 | DEFINE_BASECLASS("nz_button") 12 | 13 | function ENT:ButtonSetupDataTables() 14 | self:SetModelID(5) 15 | 16 | self:NetworkVar( "String", 1, "ActivatorNZName1", {KeyName = "nz_activator_name1", Edit = {order = 20, type = "Generic"}} ) 17 | self:NetworkVar( "String", 2, "ActivatorNZName2", {KeyName = "nz_activator_name2", Edit = {order = 21, type = "Generic"}} ) 18 | self:NetworkVar( "String", 3, "LinkedNZName", {KeyName = "nz_linked_name1", Edit = {order = 22, type = "Generic"}} ) 19 | 20 | self:SetRemoteActivated(true) 21 | end 22 | 23 | function ENT:GetLinkedEnts() 24 | local result = {} 25 | table.insert(result, self:GetEntsByNZName(self:GetLinkedNZName())) 26 | return result 27 | end 28 | 29 | function ENT:GetActivatorEnts() 30 | local result = {} 31 | table.insert(result, self:GetEntsByNZName(self:GetActivatorNZName1())) 32 | table.insert(result, self:GetEntsByNZName(self:GetActivatorNZName2())) 33 | return result 34 | end 35 | 36 | function ENT:Activation(caller, duration, cooldown) 37 | local shouldBeActivated = true 38 | 39 | -- only activated if all activators are active 40 | for _, lEntsWithName in pairs(self:GetActivatorEnts()) do 41 | for _, lEnt in pairs(lEntsWithName) do 42 | if IsValid(lEnt) and not lEnt:IsPlayer() then 43 | print(lEnt, lEnt:IsActive()) 44 | if not lEnt:IsActive() then 45 | shouldBeActivated = false 46 | end 47 | end 48 | end 49 | end 50 | 51 | if shouldBeActivated then 52 | BaseClass.Activation(self, caller, duration, cooldown) 53 | end 54 | end 55 | 56 | function ENT:Ready() 57 | BaseClass.Ready(self) 58 | end 59 | 60 | function ENT:Use() 61 | -- prevent using the and gate 62 | return false 63 | end 64 | 65 | -- IMPLEMENT ME 66 | function ENT:OnActivation(caller, duration, cooldown) end 67 | 68 | function ENT:OnDeactivation() end 69 | 70 | function ENT:OnReady() end 71 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/power_box/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "Zombies Power" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "Bool", 0, "Switch" ) 14 | self:NetworkVar( "Entity", 0, "PowerHandle") 15 | 16 | end 17 | 18 | function ENT:Initialize() 19 | if SERVER then 20 | self:SetModel( "models/nzprops/zombies_power_lever.mdl" ) 21 | self:SetSolid( SOLID_VPHYSICS ) 22 | self:SetMoveType( MOVETYPE_NONE ) 23 | self:SetUseType( ONOFF_USE ) 24 | self:SetSwitch(false) 25 | 26 | self.Handle = ents.Create("nz_prop_effect_attachment") 27 | self.Handle:SetModel("models/nzprops/zombies_power_lever_handle.mdl") 28 | self.Handle:SetAngles( self:GetAngles() ) 29 | self.Handle:SetPos(self:GetPos() + self:GetAngles():Up()*46 + self:GetAngles():Forward()*7) 30 | self.Handle:Spawn() 31 | self.Handle:SetParent(self) 32 | self:SetPowerHandle(self.Handle) 33 | 34 | self:DeleteOnRemove( self.Handle ) 35 | else 36 | self.Switched = false 37 | end 38 | end 39 | 40 | function ENT:Use( activator ) 41 | 42 | if ( !activator:IsPlayer() ) then return end 43 | if !IsElec() and nzRound:InProgress() then 44 | self:SetSwitch(true) 45 | self.Switched = 0 46 | nzElec:Activate() 47 | end 48 | 49 | end 50 | 51 | if CLIENT then 52 | 53 | local offang = Angle(0,0,0) 54 | local onang = Angle(-90,0,0) 55 | 56 | function ENT:Think() 57 | local handle = self:GetPowerHandle() 58 | if self:GetSwitch() != self.Switched then 59 | self.Switching = math.Approach( self.Switching or 0, 1, FrameTime() * 2 ) 60 | local ang = self:GetAngles() 61 | if self:GetSwitch() then 62 | handle:SetRenderAngles(LerpAngle(self.Switching, self:LocalToWorldAngles(offang), self:LocalToWorldAngles(onang))) 63 | else 64 | handle:SetRenderAngles(LerpAngle(self.Switching, self:LocalToWorldAngles(onang), self:LocalToWorldAngles(offang))) 65 | end 66 | 67 | if self.Switching >= 1 then 68 | self.Switched = self:GetSwitch() 69 | self.Switching = nil 70 | end 71 | end 72 | end 73 | 74 | function ENT:Draw() 75 | self:DrawModel() 76 | end 77 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/display/sh_papnames.lua: -------------------------------------------------------------------------------- 1 | nz.Display_PaPNames = { 2 | -- You can use both class names and display names, class names take priority but display names can apply to multiple weapons 3 | ["fas2_glock20"] = "Glock-115c", 4 | ["Ray Gun"] = "Porter's X2 Ray Gun", 5 | ["Raygun"] = "Porter's X2 Ray Gun", 6 | ["fas2_ak12"] = "AK-12EAPER", 7 | ["fas2_ak47"] = "AK-4TW", 8 | ["fas2_ak74"] = "AK74FU2", 9 | ["fas2_an94"] = "Actuated Neutralizer 94000", 10 | ["fas2_famas"] = "F4M3-A55", 11 | ["fas2_g36c"] = "GL-HF36", 12 | ["fas2_g3"] = "G3T-GUD", 13 | ["fas2_deagle"] = "Desert Hawk", 14 | ["fas2_galil"] = "Gabig", 15 | ["fas2_uzi"] = "Uncle Gal", 16 | ["fas2_ks23"] = "K1LL-ST34L", 17 | ["fas2_mac11"] = "Big Mac", 18 | ["fas2_m14"] = "M8-YUDODIZ", 19 | ["fas2_m1911"] = "M9-K11L", 20 | ["fas2_m21"] = "M21GHT", 21 | ["fas2_m24"] = "M2ATH", 22 | ["fas2_m3s90"] = "M30 Ultra 9000", 23 | ["fas2_m4a1"] = "M4A115", 24 | ["fas2_m82"] = "M8-U2", 25 | ["fas2_mp5a5"] = "M115 A55", 26 | ["fas2_mp5k"] = "M115 Kollider", 27 | ["fas2_mp5sd6"] = "M115 S4D", 28 | ["fas2_ots33"] = "Ostrich-33", 29 | ["fas2_p226"] = "P-4U2", 30 | ["fas2_pp19"] = "PP20 Buffalo", 31 | ["fas2_ragingbull"] = "Furious Bull", 32 | ["fas2_rem870"] = "REM-3MB3R M3", 33 | ["fas2_rpk"] = "RPK-4TW", 34 | ["fas2_rk95"] = "Sa-KO 9500", 35 | ["fas2_sg550"] = "SG 11500", 36 | ["fas2_sg552"] = "SG 11502", 37 | ["fas2_sks"] = "Seeking Kill Steals", 38 | ["fas2_sr25"] = "SR3KT", 39 | 40 | -- CW 2 weapons 41 | ["cw_ak74"] = "AK-4TW", 42 | ["cw_ar15"] = "All-Right15", 43 | ["cw_auggsm"] = "AUG-SOM3", 44 | ["cw_g3a3"] = "G3T-B3TTER", 45 | ["cw_mp5"] = "MP115", 46 | ["cw_deagle"] = "Desert Hawk", 47 | ["cw_l115"] = "L-Emnt 115", 48 | ["cw_lr300"] = "Liberator 115x2", 49 | ["cw_mr96"] = "Mr.Rekker 96", 50 | ["UMP45"] = "Unified Material Penetrator 4D5", 51 | ["cw_c7a1"] = "C7-KILL7", 52 | ["cw_kimber_kw"] = "Kimber Knight Warlord", 53 | ["cw_mk11"] = "Mr.Kill 115", 54 | ["cw_ppsh-41"] = "The Reaper", 55 | ["cw_xm1014"] = "XTREME1015", 56 | ["cw_dz_ru556"] = "Codename Rul3R-5000", 57 | 58 | 59 | } 60 | 61 | function AddPackAPunchName(class, papname) -- The function also works with display names just like above 62 | nz.Display_PaPNames[class] = papname 63 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/mapping/sv_mapsettings.lua: -------------------------------------------------------------------------------- 1 | 2 | function nzMapping:LoadMapSettings(data) 3 | if !data then return end 4 | 5 | if data.startwep then 6 | nzMapping.Settings.startwep = weapons.Get(data.startwep) and data.startwep or nzConfig.BaseStartingWeapons[1] 7 | end 8 | if data.startpoints then 9 | nzMapping.Settings.startpoints = tonumber(data.startpoints) or 500 10 | end 11 | if data.eeurl then 12 | nzMapping.Settings.eeurl = data.eeurl or nil 13 | end 14 | if data.script then 15 | nzMapping.Settings.script = data.script or nil 16 | end 17 | if data.scriptinfo then 18 | nzMapping.Settings.scriptinfo = data.scriptinfo or nil 19 | end 20 | if data.rboxweps then 21 | if table.Count(data.rboxweps) > 0 then 22 | local tbl = {} 23 | for k,v in pairs(data.rboxweps) do 24 | local wep = weapons.Get(k) 25 | if wep and !wep.NZTotalBlacklist and !wep.NZPreventBox then -- Weapons are keys 26 | tbl[k] = tonumber(v) or 10 -- Set weight to value or 10 27 | else 28 | wep = weapons.Get(v) -- Weapons are values (old format) 29 | if wep and !wep.NZTotalBlacklist and !wep.NZPreventBox then 30 | tbl[v] = 10 -- Set weight to 10 31 | else 32 | -- No valid weapon on either key or value 33 | if tonumber(k) == nil then -- For every key that isn't a number (new format keys are classes) 34 | tbl[k] = 10 35 | end 36 | if tonumber(v) == nil then -- Or for every value that isn't a number (old format values are classes) 37 | tbl[v] = 10 -- Insert them anyway to make use of mismatch 38 | end 39 | end 40 | end 41 | end 42 | nzMapping.Settings.rboxweps = tbl 43 | else 44 | nzMapping.Settings.rboxweps = nil 45 | end 46 | end 47 | if data.wunderfizzperks then 48 | nzMapping.Settings.wunderfizzperks = table.Count(data.wunderfizzperks) > 0 and data.wunderfizzperks or nil 49 | end 50 | if data.gamemodeentities then 51 | nzMapping.Settings.gamemodeentities = data.gamemodeentities or nil 52 | end 53 | if data.specialroundtype then 54 | nzMapping.Settings.specialroundtype = data.specialroundtype or "Hellhounds" 55 | end 56 | if data.bosstype then 57 | nzMapping.Settings.bosstype = data.bosstype or "Panzer" 58 | end 59 | 60 | nzMapping:SendMapData() 61 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_revive_morphine.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | AddCSLuaFile("nz_revive_morphine.lua") 3 | SWEP.Weight = 5 4 | SWEP.AutoSwitchTo = false 5 | SWEP.AutoSwitchFrom = true 6 | end 7 | 8 | if CLIENT then 9 | 10 | SWEP.PrintName = "Morphine" 11 | SWEP.Slot = 1 12 | SWEP.SlotPos = 1 13 | SWEP.DrawAmmo = false 14 | SWEP.DrawCrosshair = true 15 | 16 | SWEP.Category = "nZombies" 17 | 18 | end 19 | 20 | 21 | SWEP.Author = "Zet0r" 22 | SWEP.Contact = "youtube.com/Zet0r" 23 | SWEP.Purpose = "Fancy Viewmodel Animations" 24 | SWEP.Instructions = "Let the gamemode give you it" 25 | 26 | SWEP.Spawnable = false 27 | SWEP.AdminSpawnable = false 28 | 29 | SWEP.HoldType = "slam" 30 | 31 | SWEP.ViewModel = "models/weapons/c_revive_morphine.mdl" 32 | SWEP.WorldModel = "" 33 | SWEP.UseHands = true 34 | SWEP.vModel = true 35 | 36 | SWEP.Primary.ClipSize = -1 37 | SWEP.Primary.DefaultClip = -1 38 | SWEP.Primary.Automatic = false 39 | SWEP.Primary.Ammo = "none" 40 | 41 | SWEP.Secondary.ClipSize = -1 42 | SWEP.Secondary.DefaultClip = -1 43 | SWEP.Secondary.Automatic = false 44 | SWEP.Secondary.Ammo = "none" 45 | 46 | SWEP.NZPreventBox = true 47 | SWEP.NZTotalBlacklist = true 48 | 49 | function SWEP:Initialize() 50 | 51 | self:SetHoldType( "slam" ) 52 | 53 | end 54 | 55 | function SWEP:Deploy() 56 | self:SendWeaponAnim(ACT_VM_DRAW) 57 | self.WepOwner = self.Owner 58 | end 59 | 60 | function SWEP:Equip( owner ) 61 | owner:SetActiveWeapon("nz_revive_morphine") 62 | end 63 | 64 | function SWEP:PrimaryAttack() 65 | 66 | end 67 | 68 | function SWEP:PostDrawViewModel() 69 | 70 | end 71 | 72 | function SWEP:DrawWorldModel() 73 | 74 | end 75 | 76 | function SWEP:OnRemove() 77 | if SERVER then 78 | if !IsValid(self.WepOwner:GetActiveWeapon()) or !self.WepOwner:GetActiveWeapon():IsSpecial() then 79 | self.WepOwner:SetUsingSpecialWeapon(false) 80 | end 81 | self.WepOwner:SetActiveWeapon(nil) 82 | self.WepOwner:EquipPreviousWeapon() 83 | end 84 | end 85 | 86 | function SWEP:GetViewModelPosition( pos, ang ) 87 | 88 | local newpos = LocalPlayer():EyePos() 89 | local newang = LocalPlayer():EyeAngles() 90 | local up = newang:Up() 91 | 92 | newpos = newpos + LocalPlayer():GetAimVector()*6 - up*63 93 | 94 | return newpos, newang 95 | 96 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/spectator/sv_override.lua: -------------------------------------------------------------------------------- 1 | --Gamemode Overrides 2 | 3 | function GM:PlayerInitialSpawn( ply ) 4 | timer.Simple( 0, function() ply:SetSpectator() end ) 5 | end 6 | 7 | function GM:PlayerDeath( ply, wep, killer ) 8 | ply:SetSpectator() 9 | ply:SetTargetPriority(TARGET_PRIORITY_NONE) 10 | end 11 | 12 | function GM:PlayerDeathThink( ply ) 13 | 14 | -- Allow players in creative mode to respawn 15 | if ply:IsInCreative() and nzRound:InState( ROUND_CREATE ) then 16 | if ply:KeyDown(IN_JUMP) or ply:KeyDown(IN_ATTACK) then 17 | ply:Spawn() 18 | return true 19 | end 20 | end 21 | 22 | local players = player.GetAllPlayingAndAlive() 23 | 24 | if ply:KeyPressed( IN_RELOAD ) then 25 | ply:SetSpectatingType( ply:GetSpectatingType() + 1 ) 26 | if ply:GetSpectatingType() > 5 then 27 | ply:SetSpectatingType( 4 ) 28 | ply:SetupHands(players[ ply:GetSpectatingID() ]) 29 | end 30 | ply:Spectate( ply:GetSpectatingType() ) 31 | elseif ply:KeyPressed( IN_ATTACK ) then 32 | ply:SetSpectatingID( ply:GetSpectatingID() + 1 ) 33 | if ply:GetSpectatingID() > #players then ply:SetSpectatingID( 1 ) end 34 | ply:SpectateEntity( players[ ply:GetSpectatingID() ] ) 35 | elseif ply:KeyPressed( IN_ATTACK2 ) then 36 | ply:SetSpectatingID( ply:GetSpectatingID() - 1 ) 37 | if ply:GetSpectatingID() <= 0 then ply:SetSpectatingID( #players ) end 38 | ply:SpectateEntity( players[ ply:GetSpectatingID() ] ) 39 | end 40 | end 41 | 42 | local function disableDeadUse( ply, ent ) 43 | if !ply:Alive() then return false end 44 | end 45 | 46 | hook.Add( "PlayerUse", "nzDisableDeadUse", disableDeadUse) 47 | 48 | local hooks = hook.GetTable().AllowPlayerPickup 49 | if hooks then 50 | for k,v in pairs(hooks) do 51 | hook.Remove("AllowPlayerPickup", k) 52 | end 53 | end 54 | 55 | local function disableDeadPickups( ply, ent ) 56 | if !ply:Alive() then 57 | return false 58 | else 59 | -- This will allow pickups even if the weapon can't holster 60 | local wep = ply:GetActiveWeapon() 61 | if IsValid(wep) and !wep:IsSpecial() then 62 | local holster = wep.Holster 63 | wep.Holster = function() return true end 64 | timer.Simple(0, function() wep.Holster = holster end) 65 | end 66 | return true 67 | end 68 | end 69 | 70 | hook.Add( "AllowPlayerPickup", "_nzDisableDeadPickups", disableDeadPickups) 71 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/ragdoll/sh_zombierags.lua: -------------------------------------------------------------------------------- 1 | 2 | local function cleanrag(ent, ragdoll, time) 3 | local dTime = math.random( time*0.75, time*1.25 ) 4 | 5 | if ent.GetDecapitated and ent:GetDecapitated() then 6 | local bone = ragdoll:LookupBone("ValveBiped.Bip01_Head1") 7 | if !bone then bone = ragdoll:LookupBone("j_head") end 8 | 9 | if bone then 10 | ragdoll:ManipulateBoneScale(bone, Vector(0.00001,0.00001,0.00001)) 11 | --- Y GMOD YYYYYYYY I DONT UNDERSTAND 12 | ragdoll:ManipulateBoneScale(bone, Vector(0.00001,0.00001,0.00001)) 13 | end 14 | end 15 | 16 | --[[ 17 | timer.Simple( dTime, function() 18 | if IsValid(ragdoll) then 19 | ragdoll:PhysWake() 20 | ragdoll:SetMoveType(MOVETYPE_NOCLIP) 21 | ragdoll:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE) 22 | -- ragdoll:Fire("EnableMotion") 23 | PrintTable(debug.getmetatable(ragdoll)) 24 | for i = 0, ragdoll:GetPhysicsObjectCount() - 1 do 25 | 26 | local phys = ragdoll:GetPhysicsObjectNum( i ) 27 | phys:Wake() 28 | phys:EnableCollisions(false) 29 | phys:EnableGravity(false) 30 | phys:SetVelocityInstantaneous( Vector( 0, 0, -15) ) 31 | 32 | -- apply another push after dealy 33 | timer.Simple(2, function() if IsValid(phys) then phys:SetVelocityInstantaneous(Vector( 0, 0, -20)) end end) 34 | end 35 | ragdoll:SetVelocity(Vector( 0, 0, -15)) 36 | end 37 | end) 38 | ]]-- 39 | --SafeRemoveEntityDelayed( ragdoll, dTime + 2.5 ) 40 | timer.Simple( dTime + 2.5, function() 41 | if ragdoll ~= NULL then 42 | SafeRemoveEntity( ragdoll ) 43 | end 44 | end) 45 | end 46 | 47 | if CLIENT then 48 | if not ConVarExists("nz_client_ragdolltime") then CreateConVar("nz_client_ragdolltime", 30, {FCVAR_ARCHIVE}, "How long clientside Zombie ragdolls will stay in the map.") end 49 | 50 | function GM:CreateClientsideRagdoll( ent, ragdoll ) 51 | local convar = GetConVar("nz_client_ragdolltime"):GetInt() 52 | cleanrag(ent, ragdoll, convar) 53 | end 54 | else -- Server ragdolls 55 | if not ConVarExists("nz_server_ragdolltime") then CreateConVar("nz_server_ragdolltime", 30, {FCVAR_ARCHIVE}, "How long serverside Zombie ragdolls will stay in the map.") end 56 | 57 | function GM:CreateEntityRagdoll( ent, ragdoll ) 58 | local convar = GetConVar("nz_server_ragdolltime"):GetInt() 59 | cleanrag(ent, ragdoll, convar) 60 | end 61 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/drop_bloodmoney/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "drop_powerups" 6 | ENT.Author = "Alig96" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "String", 0, "Points" ) 14 | 15 | end 16 | 17 | function ENT:Initialize() 18 | 19 | self:SetModel("models/nzpowerups/bloodmoney.mdl") 20 | --self:PhysicsInit(SOLID_VPHYSICS) 21 | self:PhysicsInitSphere(60, "default_silent") 22 | self:SetMoveType(MOVETYPE_NONE) 23 | self:SetSolid(SOLID_NONE) 24 | if SERVER then 25 | self:SetTrigger(true) 26 | self:SetUseType(SIMPLE_USE) 27 | else 28 | self.NextParticle = CurTime() 29 | end 30 | self:UseTriggerBounds(true, 0) 31 | self:SetMaterial("models/shiny.vtf") 32 | self:SetColor( Color(255,200,0) ) 33 | --self:SetTrigger(true) 34 | 35 | --[[timer.Create( self:EntIndex().."_deathtimer", 30, 1, function() 36 | if IsValid(self) then 37 | timer.Destroy(self:EntIndex().."_deathtimer") 38 | if SERVER then 39 | self:Remove() 40 | end 41 | end 42 | end)]] 43 | 44 | self.RemoveTime = CurTime() + 30 45 | end 46 | 47 | if SERVER then 48 | function ENT:StartTouch(hitEnt) 49 | if (hitEnt:IsValid() and hitEnt:IsPlayer()) then 50 | hitEnt:GivePoints(self:GetPoints()) 51 | self:Remove() 52 | end 53 | end 54 | 55 | function ENT:Think() 56 | if self.RemoveTime and CurTime() > self.RemoveTime then 57 | self:Remove() 58 | end 59 | end 60 | end 61 | 62 | if CLIENT then 63 | --local glow = Material ( "sprites/glow04_noz" ) 64 | --local col = Color(0,200,255,255) 65 | 66 | local particledelay = 0.1 67 | 68 | function ENT:Draw() 69 | if CurTime() > self.NextParticle then 70 | local effectdata = EffectData() 71 | effectdata:SetOrigin( self:GetPos() ) 72 | util.Effect( "powerup_glow", effectdata ) 73 | self.NextParticle = CurTime() + particledelay 74 | end 75 | self:DrawModel() 76 | end 77 | 78 | function ENT:Think() 79 | if !self:GetRenderAngles() then self:SetRenderAngles(self:GetAngles()) end 80 | self:SetRenderAngles(self:GetRenderAngles()+(Angle(0,50,0)*FrameTime())) 81 | end 82 | 83 | --[[hook.Add( "PreDrawHalos", "drop_powerups_halos", function() 84 | halo.Add( ents.FindByClass( "drop_powerup" ), Color( 0, 255, 0 ), 2, 2, 2 ) 85 | end )]] 86 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_zombieshield_back.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile() 3 | 4 | DEFINE_BASECLASS( "base_anim" ) 5 | 6 | ENT.PrintName = "Zombie Shield (Back)" 7 | ENT.Author = "Zet0r" 8 | ENT.Information = "When the shield is holstered, it goes on the back" 9 | 10 | ENT.Spawnable = false 11 | ENT.AdminOnly = false 12 | ENT.RenderGroup = RENDERGROUP_BOTH 13 | 14 | function ENT:Initialize() 15 | 16 | self:SetModel("models/weapons/w_zombieshield.mdl") 17 | if SERVER then 18 | self:SetHealth(450) -- 15 hits (30 damage per hit) 19 | self:SetMaxHealth(450) 20 | end 21 | self:SetParent(self.Owner) 22 | self:AddEffects(EF_BONEMERGE) 23 | 24 | self.Weapon = self:GetParent():GetWeapon("nz_zombieshield") 25 | 26 | end 27 | 28 | function ENT:Draw() 29 | self:DrawModel() 30 | if IsValid(self.Weapon) and self.Weapon:GetElectrified() then 31 | local pos, ang = self:GetBonePosition(1) 32 | nzEffects:DrawElectricArcs( self, pos, ang, 1, 1, 0.3 ) 33 | end 34 | end 35 | 36 | local function DrawShields() 37 | 38 | end 39 | --hook.Add( "PostPlayerDraw", "nzZombieShieldDrawing", DrawShields ) 40 | 41 | function ENT:OnTakeDamage(dmginfo) 42 | local dmg = dmginfo:GetDamage() 43 | self:SetHealth(self:Health() - dmg) 44 | local att = dmginfo:GetAttacker() 45 | if att:IsValidZombie() and IsValid(self.Weapon) and self.Weapon:GetElectrified() then 46 | local d = DamageInfo() 47 | d:SetDamage( 250 ) 48 | d:SetAttacker( self:GetParent() ) 49 | d:SetDamageType( DMG_SHOCK ) 50 | 51 | att:TakeDamageInfo( d ) 52 | end 53 | if self:Health() <= 0 then 54 | self.Owner:EmitSound("physics/metal/metal_box_break"..math.random(1,2)..".wav") 55 | self.Owner:StripWeapon("nz_zombieshield") 56 | self.Owner:EquipPreviousWeapon() 57 | else 58 | local pct = self:Health()/self:GetMaxHealth() 59 | if pct < 0.2 then 60 | self:SetBodygroup(0,2) 61 | self.Weapon:SetDamage(2) 62 | elseif pct < 0.6 then 63 | self:SetBodygroup(0,1) 64 | self.Weapon:SetDamage(1) 65 | else 66 | self:SetBodygroup(0,0) 67 | self.Weapon:SetDamage(0) 68 | end 69 | self:EmitSound("physics/metal/metal_box_impact_hard"..math.random(1,3)..".wav") 70 | end 71 | end 72 | 73 | hook.Add("PostMapCleanup", "nzRestoreShields", function() 74 | for k,v in pairs(player.GetAll()) do 75 | local wep = v:GetWeapon("nz_zombieshield") 76 | if IsValid(wep) then 77 | wep:CreateBackShield(v) 78 | end 79 | end 80 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/drop_powerup/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "drop_powerups" 6 | ENT.Author = "Alig96" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "String", 0, "PowerUp" ) 14 | 15 | end 16 | 17 | function ENT:Initialize() 18 | 19 | //self:SetPowerUp("dp") 20 | self:SetModelScale(nzPowerUps:Get(self:GetPowerUp()).scale, 0) 21 | 22 | --self:PhysicsInit(SOLID_VPHYSICS) 23 | self:PhysicsInitSphere(60, "default_silent") 24 | self:SetMoveType(MOVETYPE_NONE) 25 | self:SetSolid(SOLID_NONE) 26 | if SERVER then 27 | self:SetTrigger(true) 28 | self:SetUseType(SIMPLE_USE) 29 | else 30 | self.NextParticle = CurTime() 31 | end 32 | self:UseTriggerBounds(true, 0) 33 | self:SetMaterial("models/shiny.vtf") 34 | self:SetColor( Color(255,200,0) ) 35 | --self:SetTrigger(true) 36 | 37 | --[[timer.Create( self:EntIndex().."_deathtimer", 30, 1, function() 38 | if IsValid(self) then 39 | timer.Destroy(self:EntIndex().."_deathtimer") 40 | if SERVER then 41 | self:Remove() 42 | end 43 | end 44 | end)]] 45 | self.RemoveTime = CurTime() + 30 46 | end 47 | 48 | if SERVER then 49 | function ENT:StartTouch(hitEnt) 50 | if (hitEnt:IsValid() and hitEnt:IsPlayer()) then 51 | nzPowerUps:Activate(self:GetPowerUp(), hitEnt, self) 52 | self:Remove() 53 | end 54 | end 55 | 56 | function ENT:Think() 57 | if self.RemoveTime and CurTime() > self.RemoveTime then 58 | self:Remove() 59 | end 60 | end 61 | end 62 | 63 | if CLIENT then 64 | --local glow = Material ( "sprites/glow04_noz" ) 65 | --local col = Color(0,200,255,255) 66 | 67 | local particledelay = 0.1 68 | 69 | function ENT:Draw() 70 | if CurTime() > self.NextParticle then 71 | local effectdata = EffectData() 72 | effectdata:SetOrigin( self:GetPos() ) 73 | util.Effect( "powerup_glow", effectdata ) 74 | self.NextParticle = CurTime() + particledelay 75 | end 76 | self:DrawModel() 77 | end 78 | 79 | function ENT:Think() 80 | if !self:GetRenderAngles() then self:SetRenderAngles(self:GetAngles()) end 81 | self:SetRenderAngles(self:GetRenderAngles()+(Angle(0,50,0)*FrameTime())) 82 | end 83 | 84 | --[[hook.Add( "PreDrawHalos", "drop_powerups_halos", function() 85 | halo.Add( ents.FindByClass( "drop_powerup" ), Color( 0, 255, 0 ), 2, 2, 2 ) 86 | end )]] 87 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/edit_sky.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile() 3 | DEFINE_BASECLASS( "base_edit" ) 4 | 5 | ENT.Spawnable = true 6 | ENT.AdminOnly = true 7 | 8 | ENT.PrintName = "Sky Editor" 9 | ENT.Category = "Editors" 10 | 11 | local oldsky 12 | 13 | ENT.NZOnlyVisibleInCreative = true 14 | 15 | function ENT:Initialize() 16 | 17 | BaseClass.Initialize( self ) 18 | self:SetMaterial( "gmod/edit_sky" ) 19 | 20 | 21 | 22 | -- 23 | -- Over-ride the sky controller with this. 24 | -- 25 | if ( CLIENT ) then 26 | 27 | if ( IsValid( g_SkyPaint ) ) then 28 | -- TODO: Copy settings from `current` sky to here. 29 | end 30 | 31 | g_SkyPaint = self 32 | else 33 | 34 | if !oldsky then oldsky = GetConVar("sv_skyname"):GetString() end 35 | print(oldsky) 36 | RunConsoleCommand("sv_skyname", "painted") 37 | if !IsValid(ents.FindByClass("env_skypaint")[1]) then 38 | local ent = ents.Create("env_skypaint") 39 | ent:Spawn() 40 | end 41 | 42 | end 43 | 44 | end 45 | 46 | function ENT:Think() 47 | 48 | -- 49 | -- Find an env_sun - if we don't already have one. 50 | -- 51 | if ( SERVER && self.EnvSun == nil ) then 52 | 53 | -- so this closure only gets called once - even if it fails 54 | self.EnvSun = false; 55 | 56 | local list = ents.FindByClass( "env_sun" ) 57 | if ( #list > 0 ) then 58 | self.EnvSun = list[1] 59 | end 60 | 61 | end 62 | 63 | -- 64 | -- If we have a sun - force our sun normal to its value 65 | -- 66 | if ( SERVER && IsValid( self.EnvSun ) ) then 67 | 68 | local vec = self.EnvSun:GetInternalVariable( "m_vDirection" ); 69 | 70 | if ( isvector( vec ) ) then 71 | self:SetSunNormal( vec ) 72 | end 73 | 74 | end 75 | 76 | end 77 | 78 | -- 79 | -- This needs to be a 1:1 copy of env_skypaint 80 | -- 81 | function ENT:SetupDataTables() 82 | 83 | local SetupDataTables = scripted_ents.GetMember( "env_skypaint", "SetupDataTables" ) 84 | SetupDataTables( self ) 85 | 86 | end 87 | 88 | function ENT:OnRemove() 89 | if SERVER then 90 | if oldsky and #ents.FindByClass("edit_sky") <= 0 then 91 | RunConsoleCommand("sv_skyname", oldsky) 92 | end 93 | end 94 | end 95 | 96 | -- 97 | -- This edits something global - so always network - even wjen not in PVS 98 | -- 99 | function ENT:UpdateTransmitState() 100 | 101 | return TRANSMIT_ALWAYS 102 | end 103 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_barricade.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("barricade", { 2 | displayname = "Barricade Creator", 3 | desc = "LMB: Place Barricade, RMB: Remove Barricade", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | PrimaryAttack = function(wep, ply, tr, data) 8 | local ent = tr.Entity 9 | if IsValid(ent) and ent:GetClass() == "breakable_entry" then 10 | nzMapping:BreakEntry(ent:GetPos(), ent:GetAngles(), data.planks, data.jump, ply) 11 | ent:Remove() 12 | else 13 | nzMapping:BreakEntry(tr.HitPos + Vector(0,0,45), Angle(0,(tr.HitPos - ply:GetPos()):Angle()[2],0), data.planks, data.jump, ply) 14 | end 15 | end, 16 | SecondaryAttack = function(wep, ply, tr, data) 17 | if IsValid(tr.Entity) and tr.Entity:GetClass() == "breakable_entry" then 18 | tr.Entity:Remove() 19 | end 20 | end, 21 | Reload = function(wep, ply, tr, data) 22 | //Nothing 23 | end, 24 | OnEquip = function(wep, ply, data) 25 | 26 | end, 27 | OnHolster = function(wep, ply, data) 28 | 29 | end 30 | }, { 31 | displayname = "Barricade Creator", 32 | desc = "LMB: Place Barricade, RMB: Remove Barricade", 33 | icon = "icon16/door.png", 34 | weight = 7, 35 | condition = function(wep, ply) 36 | return true 37 | end, 38 | interface = function(frame, data) 39 | local valz = {} 40 | valz["Row1"] = data.planks 41 | valz["Row2"] = data.jump 42 | 43 | local DProperties = vgui.Create( "DProperties", frame ) 44 | DProperties:SetSize( 280, 180 ) 45 | DProperties:SetPos( 10, 10 ) 46 | 47 | function DProperties.CompileData() 48 | data.planks = valz["Row1"] 49 | data.jump = valz["Row2"] 50 | 51 | --PrintTable(data) 52 | 53 | return data 54 | end 55 | 56 | function DProperties.UpdateData(data) -- This function will be overwritten if opened via context menu 57 | nzTools:SendData(data, "barricade") 58 | end 59 | 60 | local Row1 = DProperties:CreateRow( "Barricade", "Has Planks?" ) 61 | Row1:Setup( "Boolean" ) 62 | Row1:SetValue( valz["Row1"] ) 63 | Row1.DataChanged = function( _, val ) valz["Row1"] = val DProperties.UpdateData(DProperties.CompileData()) end 64 | local Row2 = DProperties:CreateRow( "Barricade", "Jump Animations?" ) 65 | Row2:Setup( "Boolean" ) 66 | Row2:SetValue( valz["Row2"] ) 67 | Row2.DataChanged = function( _, val ) valz["Row2"] = val DProperties.UpdateData(DProperties.CompileData()) end 68 | 69 | return DProperties 70 | end, 71 | defaultdata = { 72 | planks = 1, 73 | jump = 0, 74 | } 75 | }) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/cl_precache.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Zombies 3 | util.PrecacheModel("models/nz_zombie/zombie_rerig_animated.mdl") 4 | util.PrecacheModel("models/nz_zombie/zombie_hellhound.mdl") 5 | 6 | -- Perk machines 7 | util.PrecacheModel("models/alig96/perks/cherry/cherry.mdl") 8 | util.PrecacheModel("models/alig96/perks/deadshot/deadshot.mdl") 9 | util.PrecacheModel("models/alig96/perks/doubletap/doubletap_off.mdl") 10 | util.PrecacheModel("models/alig96/perks/doubletap/doubletap_on.mdl") 11 | util.PrecacheModel("models/alig96/perks/doubletap2/doubletap2.mdl") 12 | util.PrecacheModel("models/alig96/perks/jugg/jugg_off.mdl") 13 | util.PrecacheModel("models/alig96/perks/jugg/jugg_on.mdl") 14 | util.PrecacheModel("models/alig96/perks/mulekick/mulekick.mdl") 15 | util.PrecacheModel("models/alig96/perks/packapunch/packapunch.mdl") 16 | util.PrecacheModel("models/alig96/perks/phd/phdflopper.mdl") 17 | util.PrecacheModel("models/alig96/perks/revive/revive_off.mdl") 18 | util.PrecacheModel("models/alig96/perks/revive/revive_on.mdl") 19 | util.PrecacheModel("models/alig96/perks/speed/speed_off.mdl") 20 | util.PrecacheModel("models/alig96/perks/speed/speed_on.mdl") 21 | util.PrecacheModel("models/alig96/perks/staminup/staminup.mdl") 22 | util.PrecacheModel("models/alig96/perks/tombstone/tombstone.mdl") 23 | util.PrecacheModel("models/alig96/perks/vulture/vultureaid.mdl") 24 | util.PrecacheModel("models/alig96/perks/whoswho/whoswho.mdl") 25 | 26 | -- Mysery box, teddy and other props 27 | util.PrecacheModel("models/hoff/props/mysterybox/box.mdl") 28 | util.PrecacheModel("models/hoff/props/mysterybox/box1.mdl") 29 | util.PrecacheModel("models/hoff/props/mysterybox/box2.mdl") 30 | util.PrecacheModel("models/hoff/props/teddy_bear/teddy_bear.mdl") 31 | util.PrecacheModel("models/nzprops/monkey_bomb.mdl") 32 | util.PrecacheModel("models/nzprops/power_lever.mdl") 33 | util.PrecacheModel("models/nzprops/power_lever_handle.mdl") 34 | util.PrecacheModel("models/nzprops/power_lever_short.mdl") 35 | 36 | -- Powerups 37 | util.PrecacheModel("models/nzpowerups/carpenter.mdl") 38 | util.PrecacheModel("models/nzpowerups/nuke.mdl") 39 | util.PrecacheModel("models/nzpowerups/x2.mdl") 40 | util.PrecacheModel("models/nzpowerups/insta.mdl") 41 | 42 | -- Viewmodels 43 | util.PrecacheModel("models/weapons/c_perk_bottle.mdl") 44 | util.PrecacheModel("models/weapons/c_monkey_bomb.mdl") 45 | util.PrecacheModel("models/weapons/c_bowie_knife.mdl") 46 | util.PrecacheModel("models/weapons/c_revive_morphine.mdl") 47 | util.PrecacheModel("models/weapons/c_packapunch_arms.mdl") -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | nZombies 2 | ======== 3 | 4 | A GM13 Nazi Zombies style (WIP) gamemode 5 | 6 | Download folder and place it in garrysmod/garrysmod/addons 7 | Make sure the structure has a path to addon.json like this: garrysmod/garrysmod/addons/nzombies/addon.json 8 | 9 | Get the content pack with all models and materials here: 10 | http://steamcommunity.com/sharedfiles/filedetails/?id=675138912 11 | 12 | Get the collection of weapon packs used by the official configs here: 13 | http://steamcommunity.com/sharedfiles/filedetails/?id=673266588 14 | 15 | If you have bugs, suggestions, or general improvements, open up an issue with the issue button at the top. If you want to help, feel free to create pull requests with your changes. If you have questions, add me on steam :) 16 | 17 | This is an edited version from Aligs original featuring these changes: 18 | 19 | - Revival System & Health 20 | - Fully working revival system, including crawling around and animations 21 | 22 | - Navigation Tools 23 | - Lock areas of the maps based on doors, allowing Zombies to navigate around them 24 | 25 | - Additional Content 26 | - All perks up until Black Ops 3; all DLC working! 27 | - A proper HUD! 28 | - More Powerups 29 | - More sounds 30 | - More effects 31 | - Official configs w/ Full Easter Eggs 32 | - Traps 33 | - Better editing in creative mode 34 | - Undo system 35 | - Context Menu to quickly edit properties without equipping tool (Hold C) 36 | - Many more props, light effects, sky/fog/sun editors, fire entities, and more ... 37 | - Better tool system 38 | 39 | - Better Mapping! 40 | - Decide weapons in box, music easter egg songs, boss rounds, special rounds 41 | - Decide starting weapon and starting amount of points 42 | - Support for many more types of doors 43 | 44 | - Better Zombie AI (Thanks Lolle!) 45 | 46 | - Easy Mismatch Correction System 47 | - Loading configs using weapons you may not have installed creates an easy menu to replace them 48 | - Applies to wall buys, random box list, perks (if scripted in), and more as new stuff is added 49 | 50 | - Better Mechanics 51 | - Proper Weapon System 52 | - Better Zombie health and speed curves 53 | 54 | - Misc changes 55 | - Speed Cola and Double Tap now works on all weapons! 56 | - Wall Buys are actual chalk-outlines! 57 | - Zombies are actual Der Riese models w/ Animations and sound! 58 | 59 | - Workshop Release To-do list: 60 | Check the Issues tab with the "Workshop Release" milestone. Feel free to discuss your opinion about the things in there, it would help greatly. -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/effects/zombie_spawn_dust/init.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | local matground = { 4 | Model("particle/particle_smokegrenade"), 5 | Model("particle/particle_noisesphere") 6 | } 7 | local matshoot = { 8 | Model("particle/particle_debris_01"), 9 | Model("particle/particle_debris_02"), 10 | Model("particle/particle_noisesphere"), 11 | Model("particle/particle_smokegrenade") 12 | } 13 | 14 | 15 | function EFFECT:Init( data ) 16 | local pos = data:GetOrigin() 17 | local duration = data:GetMagnitude() 18 | local em = ParticleEmitter( pos ) 19 | for i = 0, 10 do 20 | local p = em:Add( matshoot[math.random(#matshoot)] , pos ) 21 | if p then 22 | p:SetColor(math.random(45,55), math.random(40,50), math.random(40,50)) 23 | p:SetStartAlpha(255) 24 | p:SetEndAlpha(0) 25 | local vel = VectorRand() * math.Rand(40,70) 26 | vel.z = math.random(200,1000) 27 | p:SetVelocity(vel) 28 | p:SetGravity(Vector(0,0,-1000)) 29 | p:SetLifeTime(0) 30 | 31 | p:SetDieTime(math.Rand(duration + 0.5, duration + 1)) 32 | 33 | p:SetStartSize(math.random(35, 40)) 34 | p:SetEndSize(math.random(10, 20)) 35 | p:SetRoll(math.random(-180, 180)) 36 | p:SetRollDelta(math.Rand(-0.1, 0.1)) 37 | p:SetAirResistance(100) 38 | 39 | p:SetCollide(true) 40 | p:SetBounce(0.4) 41 | 42 | p:SetLighting(false) 43 | end 44 | end 45 | for i = 0, 5 do 46 | local p = em:Add( matground[math.random(#matground)] , pos ) 47 | if p then 48 | p:SetColor(math.random(45,55), math.random(40,50), math.random(40,50)) 49 | p:SetStartAlpha(255) 50 | p:SetEndAlpha(250) 51 | local vel = VectorRand() * math.Rand(10,50) 52 | vel.z = 0 53 | p:SetVelocity(vel) 54 | p:SetLifeTime(0) 55 | 56 | p:SetDieTime(math.Rand(duration + 0.75, duration + 1.5)) 57 | 58 | p:SetStartSize(math.random(45, 50)) 59 | p:SetEndSize(math.random(20, 30)) 60 | p:SetRoll(math.random(-180, 180)) 61 | p:SetRollDelta(math.Rand(-0.1, 0.1)) 62 | p:SetAirResistance(100) 63 | 64 | p:SetCollide(true) 65 | p:SetBounce(0.4) 66 | 67 | p:SetLighting(false) 68 | end 69 | end 70 | em:Finish() 71 | 72 | sound.Play("nz/zombies/spawn/zm_spawn_dirt"..math.random(1,2)..".wav", pos, 75, 100, 1) 73 | end 74 | 75 | function EFFECT:Think() 76 | return false 77 | end 78 | 79 | function EFFECT:Render() 80 | return false 81 | end 82 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/doors/sv_door_meta_functions.lua: -------------------------------------------------------------------------------- 1 | local meta = FindMetaTable("Entity") 2 | 3 | function meta:UnlockDoor() 4 | if self:IsDoor() then 5 | local data = self:GetDoorData() 6 | if data.NextBuy and data.NextBuy > CurTime() then return end 7 | print("Unlocking door ", self) 8 | 9 | self:Fire("unlock", "", 0) 10 | self:Fire("Unlock", "", 0) 11 | self:Fire("open", "", 0) -- Seems like some doors wanted it capitalized 12 | self:Fire("Open", "", 0) 13 | 14 | -- Doors that can be rebought should not be locked - only use this on doors with buttons that should close again! 15 | if tobool(data.rebuyable) then return end 16 | 17 | self:SetLocked(false) 18 | self:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) 19 | 20 | self:Fire("lock", "", 0) 21 | self:Fire("Lock", "", 0) 22 | self:SetKeyValue("wait",-1) 23 | self:SetKeyValue("Wait",-1) 24 | 25 | -- Dem sneaky doors keep closing themselves with their modern triggers - we gotta reopen! 26 | self:Fire("addoutput", "onclose !self:open::0:-1,0,-1") 27 | self:Fire("addoutput", "onclose !self:unlock::0:-1,0,-1") 28 | 29 | elseif self:IsBuyableProp() then 30 | self:SetLocked(false) 31 | self:BlockUnlock() 32 | end 33 | end 34 | 35 | function meta:UnlockButton(rebuyable) 36 | if self:IsButton() then 37 | print("Unlocked button", self) 38 | --print(self) 39 | --self:Fire("unlock") 40 | self:Fire("Unlock") 41 | --self:Fire("press") 42 | self:Fire("Press") 43 | --self:Fire("pressin") 44 | self:Fire("PressIn") 45 | --self:Fire("pressout") 46 | self:Fire("PressOut") 47 | 48 | -- Repurchasable buttons don't lock 49 | if rebuyable then return end 50 | 51 | --self:Fire("lock") 52 | self:Fire("Lock") 53 | --self:SetKeyValue("wait",-1) 54 | self:SetKeyValue("Wait",-1) 55 | 56 | self:SetLocked(false) 57 | end 58 | end 59 | 60 | function meta:LockButton() 61 | if self:IsButton() then 62 | self:SetLocked(true) 63 | --self:Fire("lock", "", 0) 64 | --self:Fire("Lock", "", 0) 65 | end 66 | end 67 | 68 | function meta:LockDoor() 69 | if self:IsDoor() then 70 | local data = self:GetDoorData() 71 | print("Locked ", self) 72 | self:SetLocked(true) 73 | --self:SetCollisionGroup(COLLISION_GROUP_NONE) 74 | 75 | if data.buyable and !tobool(data.buyable) then return end 76 | 77 | self:Fire("close", "", 0) 78 | self:Fire("Close", "", 0) 79 | self:Fire("lock", "", 0) 80 | self:Fire("Lock", "", 0) 81 | elseif self:IsBuyableProp() then 82 | self:BlockLock() 83 | end 84 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/player_class/sv_players.lua: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | function nzPlayers.PlayerNoClip( ply, desiredState ) 4 | if ply:Alive() and nzRound:InState( ROUND_CREATE ) then 5 | return ply:IsInCreative() 6 | --else 7 | --return GetConVar("nz_allow_noclip"):GetBool() 8 | end 9 | end 10 | 11 | function nzPlayers:FullSync( ply ) 12 | -- A full sync module using the new rewrites 13 | if IsValid(ply) then 14 | ply:SendFullSync() 15 | end 16 | end 17 | 18 | local function initialSpawn( ply ) 19 | timer.Simple(1, function() 20 | -- Fully Sync 21 | nzPlayers:FullSync( ply ) 22 | end) 23 | end 24 | 25 | local function playerLeft( ply ) 26 | -- this was previously hooked to PlayerDisconnected 27 | -- it will now detect leaving players via entity removed, to take kicking banning etc into account. 28 | if ply:IsPlayer() then 29 | ply:DropOut() 30 | if IsValid(ply.TimedUseEntity) then 31 | ply:StopTimedUse() 32 | end 33 | end 34 | end 35 | 36 | local function friendlyFire( ply, ent ) 37 | if !ply:GetNotDowned() then return false end 38 | if ent:IsPlayer() then 39 | if ent == ply then 40 | -- You can damage yourself as long as you don't have PhD 41 | return !ply:HasPerk("phd") and !ply.SELFIMMUNE 42 | else 43 | --Friendly fire is disabled for all other players TODO make hardcore setting? 44 | return false 45 | end 46 | elseif ent:IsValidZombie() then 47 | if ply:HasPerk("widowswine") and ply:GetAmmoCount(GetNZAmmoID("grenade")) > 0 then -- WIDOWS WINE TAKE DAMAGE EFFECT 48 | local pos = ply:GetPos() 49 | 50 | ply.SELFIMMUNE = true 51 | util.BlastDamage(ply, ply, pos, 350, 50) 52 | ply.SELFIMMUNE = nil 53 | 54 | local zombls = ents.FindInSphere(pos, 350) 55 | 56 | local e = EffectData() 57 | e:SetMagnitude(1.5) 58 | e:SetScale(20) -- The time the effect lasts 59 | 60 | local fx = EffectData() 61 | fx:SetOrigin(pos) 62 | fx:SetMagnitude(1) 63 | util.Effect("web_explosion", fx) 64 | 65 | for k,v in pairs(zombls) do 66 | if IsValid(v) and v:IsValidZombie() then 67 | v:ApplyWebFreeze(20) 68 | end 69 | end 70 | 71 | ply:SetAmmo(ply:GetAmmoCount(GetNZAmmoID("grenade")) - 1, GetNZAmmoID("grenade")) 72 | end 73 | end 74 | end 75 | 76 | function GM:PlayerNoClip( ply, desiredState ) 77 | return nzPlayers.PlayerNoClip(ply, desiredState) 78 | end 79 | 80 | hook.Add( "PlayerInitialSpawn", "nzPlayerInitialSpawn", initialSpawn ) 81 | hook.Add( "PlayerShouldTakeDamage", "nzFriendlyFire", friendlyFire ) 82 | hook.Add( "EntityRemoved", "nzPlayerLeft", playerLeft ) 83 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_packapunch_arms.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | AddCSLuaFile("nz_packapunch_arms.lua") 3 | SWEP.Weight = 5 4 | SWEP.AutoSwitchTo = false 5 | SWEP.AutoSwitchFrom = true 6 | end 7 | 8 | if CLIENT then 9 | 10 | SWEP.PrintName = "Hands" 11 | SWEP.Slot = 1 12 | SWEP.SlotPos = 1 13 | SWEP.DrawAmmo = false 14 | SWEP.DrawCrosshair = true 15 | 16 | SWEP.Category = "nZombies" 17 | 18 | end 19 | 20 | 21 | SWEP.Author = "Zet0r" 22 | SWEP.Contact = "youtube.com/Zet0r" 23 | SWEP.Purpose = "Fancy Viewmodel Animations" 24 | SWEP.Instructions = "Let the gamemode give you it" 25 | 26 | SWEP.Spawnable = false 27 | SWEP.AdminSpawnable = false 28 | 29 | SWEP.HoldType = "slam" 30 | 31 | SWEP.ViewModel = "models/weapons/c_packapunch_arms.mdl" 32 | SWEP.WorldModel = "" 33 | SWEP.UseHands = true 34 | SWEP.vModel = true 35 | 36 | SWEP.Primary.ClipSize = -1 37 | SWEP.Primary.DefaultClip = -1 38 | SWEP.Primary.Automatic = false 39 | SWEP.Primary.Ammo = "none" 40 | 41 | SWEP.Secondary.ClipSize = -1 42 | SWEP.Secondary.DefaultClip = -1 43 | SWEP.Secondary.Automatic = false 44 | SWEP.Secondary.Ammo = "none" 45 | 46 | SWEP.NZPreventBox = true 47 | SWEP.NZTotalBlacklist = true 48 | 49 | function SWEP:Initialize() 50 | 51 | self:SetHoldType( "slam" ) 52 | 53 | end 54 | 55 | function SWEP:Deploy() 56 | self:SendWeaponAnim(ACT_VM_DRAW) 57 | 58 | timer.Simple(0.5,function() 59 | if IsValid(self) and IsValid(self.Owner) then 60 | if self.Owner:Alive() then 61 | self:EmitSound("nz/perks/knuckle_00.wav") 62 | end 63 | end 64 | end) 65 | 66 | timer.Simple(1.3,function() 67 | if IsValid(self) and IsValid(self.Owner) then 68 | if self.Owner:Alive() then 69 | self:EmitSound("nz/perks/knuckle_01.wav") 70 | end 71 | end 72 | end) 73 | end 74 | 75 | function SWEP:Equip( owner ) 76 | 77 | --timer.Simple(3.2,function() self:Remove() end) 78 | --owner:SetActiveWeapon("nz_packapunch_arms") 79 | 80 | end 81 | 82 | function SWEP:PrimaryAttack() 83 | 84 | end 85 | 86 | function SWEP:PostDrawViewModel() 87 | 88 | end 89 | 90 | function SWEP:DrawWorldModel() 91 | 92 | end 93 | 94 | function SWEP:OnRemove() 95 | 96 | end 97 | 98 | function SWEP:GetViewModelPosition( pos, ang ) 99 | 100 | local newpos = LocalPlayer():EyePos() 101 | local newang = LocalPlayer():EyeAngles() 102 | local up = newang:Up() 103 | 104 | newpos = newpos + LocalPlayer():GetAimVector()*6 - up*63 105 | 106 | return newpos, newang 107 | 108 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/display/cl_fonts.lua: -------------------------------------------------------------------------------- 1 | //Main Text 2 | surface.CreateFont( "nz.display.hud.main", { 3 | font = "DK Umbilical Noose", //Avenir Next 4 | size = 48, 5 | weight = 300, 6 | antialias = true, 7 | } ) 8 | 9 | surface.CreateFont( "nz.display.hud.small", { 10 | font = "DK Umbilical Noose", //Avenir Next 11 | size = 28, 12 | weight = 300, 13 | antialias = true, 14 | } ) 15 | 16 | surface.CreateFont( "nz.display.hud.medium", { 17 | font = "DK Umbilical Noose", //Avenir Next 18 | size = 36, 19 | weight = 300, 20 | antialias = true, 21 | } ) 22 | 23 | surface.CreateFont( "nz.display.hud.points", { 24 | font = "Default", 25 | size = 20, 26 | weight = 5000, 27 | antialias = true, 28 | } ) 29 | 30 | surface.CreateFont( "nz.display.hud.ammo", { 31 | font = "Calibri", 32 | size = 60, 33 | weight = 50, 34 | antialias = true, 35 | } ) 36 | 37 | surface.CreateFont( "nz.display.hud.ammo2", { 38 | font = "Calibri", 39 | size = 40, 40 | weight = 50, 41 | antialias = true, 42 | } ) 43 | 44 | surface.CreateFont( "nz.display.hud.ammo3", { 45 | font = "Calibri", 46 | size = 20, 47 | weight = 50, 48 | antialias = true, 49 | } ) 50 | 51 | surface.CreateFont( "nz.display.hud.ammo4", { 52 | font = "Calibri", 53 | size = 15, 54 | weight = 50, 55 | antialias = true, 56 | } ) 57 | 58 | surface.CreateFont( "nz.display.hud.smaller", { 59 | font = "DK Umbilical Noose", //Avenir Next 60 | size = 18, 61 | weight = 300, 62 | antialias = true, 63 | } ) 64 | 65 | surface.CreateFont( "nz.display.hud.rounds", { 66 | font = "DK Umbilical Noose", //Avenir Next 67 | size = 400, 68 | weight = 30, 69 | antialias = true, 70 | } ) 71 | 72 | -- Rotated text function, as taken from the gmod wiki 73 | local matscale = Vector(1,1,1) 74 | function draw.TextRotatedScaled( text, x, y, color, font, ang, scaleX, scaleY ) 75 | render.PushFilterMag( TEXFILTER.ANISOTROPIC ) 76 | render.PushFilterMin( TEXFILTER.ANISOTROPIC ) 77 | surface.SetFont( font ) 78 | surface.SetTextColor( color ) 79 | surface.SetTextPos( 0, 0 ) 80 | local textWidth, textHeight = surface.GetTextSize( text ) 81 | local rad = -math.rad( ang ) 82 | x = x - ( math.cos( rad ) * textWidth / 2 + math.sin( rad ) * textHeight / 2 ) 83 | y = y + ( math.sin( rad ) * textWidth / 2 + math.cos( rad ) * textHeight / 2 ) 84 | local m = Matrix() 85 | m:SetAngles( Angle( 0, ang, 0 ) ) 86 | m:SetTranslation( Vector( x, y, 0 ) ) 87 | matscale.x = scaleX 88 | matscale.y = scaleY 89 | m:Scale(matscale) 90 | cam.PushModelMatrix( m ) 91 | surface.DrawText( text ) 92 | cam.PopModelMatrix() 93 | render.PopFilterMag() 94 | render.PopFilterMin() 95 | end 96 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/tools/sh_tools_perk.lua: -------------------------------------------------------------------------------- 1 | nzTools:CreateTool("perk", { 2 | displayname = "Perk Machine Placer", 3 | desc = "LMB: Place Perk Machine, RMB: Remove Perk Machine, C: Change Perk", 4 | condition = function(wep, ply) 5 | return true 6 | end, 7 | 8 | PrimaryAttack = function(wep, ply, tr, data) 9 | local ent = tr.Entity 10 | if IsValid(ent) and ent:GetClass() == "perk_machine" or ent:GetClass() == "wunderfizz_machine" then 11 | nzMapping:PerkMachine(ent:GetPos(), ent:GetAngles(), data.perk, ply) -- Hitting a perk, replace it 12 | ent:Remove() 13 | else 14 | nzMapping:PerkMachine(tr.HitPos, Angle(0,(ply:GetPos() - tr.HitPos):Angle()[2],0), data.perk, ply) 15 | end 16 | end, 17 | 18 | SecondaryAttack = function(wep, ply, tr, data) 19 | local ent = tr.Entity 20 | if IsValid(ent) and ent:GetClass() == "perk_machine" or ent:GetClass() == "wunderfizz_machine" then 21 | tr.Entity:Remove() 22 | end 23 | end, 24 | Reload = function(wep, ply, tr, data) 25 | -- Nothing 26 | end, 27 | OnEquip = function(wep, ply, data) 28 | 29 | end, 30 | OnHolster = function(wep, ply, data) 31 | 32 | end 33 | }, { 34 | displayname = "Perk Machine Placer", 35 | desc = "LMB: Place Perk Machine, RMB: Remove Perk Machine, C: Change Perk", 36 | icon = "icon16/drink.png", 37 | weight = 6, 38 | condition = function(wep, ply) 39 | return true 40 | end, 41 | interface = function(frame, data, context) 42 | 43 | local choices = vgui.Create( "DComboBox", frame ) 44 | choices:SetPos( 10, 10 ) 45 | choices:SetSize( 280, 30 ) 46 | choices:SetValue( nzPerks:Get(data.perk).name ) 47 | for k,v in pairs(nzPerks:GetList()) do 48 | choices:AddChoice( v, k ) 49 | end 50 | 51 | function choices.CompileData() 52 | return data 53 | end 54 | 55 | function choices.UpdateData(data) 56 | nzTools:SendData(data, "perk") 57 | end 58 | 59 | choices.OnSelect = function( panel, index, value, id ) 60 | data.perk = id 61 | choices.UpdateData(choices.CompileData()) 62 | end 63 | 64 | return choices 65 | end, 66 | defaultdata = {perk = "jugg"}, 67 | }) 68 | 69 | nzTools:EnableProperties("perk", "Edit Perk...", "icon16/tag_blue_edit.png", 9005, true, function( self, ent, ply ) 70 | if ( !IsValid( ent ) or !IsValid(ply) ) then return false end 71 | if ( ent:GetClass() != "perk_machine" ) then return false end 72 | if !nzRound:InState( ROUND_CREATE ) then return false end 73 | if ( ent:IsPlayer() ) then return false end 74 | if ( !ply:IsInCreative() ) then return false end 75 | 76 | return true 77 | 78 | end, function(ent) 79 | return {perk = ent:GetPerkID()} 80 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/cl_wepswitch.lua: -------------------------------------------------------------------------------- 1 | local plyMeta = FindMetaTable( "Player" ) 2 | AccessorFunc( plyMeta, "iLastWeaponSlot", "LastWeaponSlot", FORCE_NUMBER) 3 | AccessorFunc( plyMeta, "iCurrentWeaponSlot", "CurrentWeaponSlot", FORCE_NUMBER) 4 | function plyMeta:SelectWeapon( class ) 5 | if ( !self:HasWeapon( class ) ) then return end 6 | self.DoWeaponSwitch = self:GetWeapon( class ) 7 | --print(self.DoWeaponSwitch) 8 | end 9 | 10 | function GM:CreateMove( cmd ) 11 | local ply = LocalPlayer() 12 | if ( IsValid( ply.DoWeaponSwitch ) ) then 13 | cmd:SelectWeapon( ply.DoWeaponSwitch ) 14 | 15 | if ( LocalPlayer():GetActiveWeapon() == ply.DoWeaponSwitch ) then 16 | ply:SetCurrentWeaponSlot(ply:GetActiveWeapon():GetNWInt("SwitchSlot", 1)) 17 | ply.DoWeaponSwitch = nil 18 | end 19 | end 20 | end 21 | 22 | function GM:PlayerBindPress( ply, bind, pressed ) 23 | if nzRound:InProgress() or nzRound:InState(ROUND_GO) then 24 | if !ply:GetCurrentWeaponSlot() then ply:SetCurrentWeaponSlot(ply:GetActiveWeapon():GetNWInt("SwitchSlot", 1)) end 25 | local slot 26 | local curslot = ply:GetCurrentWeaponSlot() or 1 27 | if ( string.find( bind, "slot1" ) ) then slot = 1 end 28 | if ( string.find( bind, "slot2" ) ) then slot = 2 end 29 | if ( string.find( bind, "slot3" ) ) then slot = 3 end 30 | if ( string.find( bind, "invnext" ) ) then 31 | slot = curslot + 1 32 | if (ply:HasPerk("mulekick") and slot > 3) or (!ply:HasPerk("mulekick") and slot > 2) then 33 | slot = 1 34 | end 35 | end 36 | if ( string.find( bind, "invprev" ) ) then 37 | slot = curslot - 1 38 | if slot < 1 then 39 | slot = ply:HasPerk("mulekick") and 3 or 2 40 | end 41 | end 42 | if !nzRound:InState(ROUND_CREATE) and (bind == "+menu" and pressed ) then slot = ply:GetLastWeaponSlot() or 1 end 43 | if slot then 44 | ply:SetLastWeaponSlot( ply:GetActiveWeapon():GetNWInt( "SwitchSlot", 1) ) 45 | if slot == 3 then 46 | for k,v in pairs( ply:GetWeapons() ) do 47 | if v:GetNWInt( "SwitchSlot" ) == slot then 48 | ply:SelectWeapon( v:GetClass() ) 49 | return true 50 | end 51 | end 52 | slot = 1 53 | for k,v in pairs( ply:GetWeapons() ) do 54 | if v:GetNWInt( "SwitchSlot" ) == slot then 55 | ply:SelectWeapon( v:GetClass() ) 56 | return true 57 | end 58 | end 59 | else 60 | for k,v in pairs( ply:GetWeapons() ) do 61 | if v:GetNWInt( "SwitchSlot" ) == slot then 62 | ply:SelectWeapon( v:GetClass() ) 63 | return true 64 | end 65 | end 66 | end 67 | end 68 | if ( string.find( bind, "slot" ) ) then return true end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/weapons/sv_wonderweapons.lua: -------------------------------------------------------------------------------- 1 | local wonderweapons = {} 2 | 3 | -- Wonder Weapon system does NOT apply to weapons like Monkey Bombs or Ray Gun 4 | -- ONLY to those that you can only have 1 of at a time 5 | 6 | function nzWeps:AddWonderWeapon(class) 7 | wonderweapons[class] = true 8 | end 9 | 10 | function nzWeps:RemoveWonderWeapon(class) 11 | wonderweapons[class] = nil 12 | end 13 | 14 | function nzWeps:IsWonderWeapon(class) 15 | return wonderweapons[class] or false 16 | end 17 | 18 | function nzWeps:GetHeldWonderWeapons(ply) -- No arguments means all players 19 | local tbl = {} 20 | if IsValid(ply) and ply:IsPlayer() then 21 | for k,v in pairs(ply:GetWeapons()) do 22 | if wonderweapons[v:GetClass()] then 23 | table.insert(tbl, v:GetClass()) 24 | end 25 | end 26 | else 27 | for k,v in pairs(player.GetAll()) do 28 | for k2,v2 in pairs(v:GetWeapons()) do 29 | if wonderweapons[v2:GetClass()] then 30 | table.insert(tbl, v2:GetClass()) 31 | end 32 | end 33 | end 34 | end 35 | 36 | return tbl 37 | end 38 | 39 | function nzWeps:IsWonderWeaponOut(class, ignorewonder) 40 | if (wonderweapons[class] or ignorewonder) then 41 | for k,v in pairs(player.GetAll()) do 42 | for k2,v2 in pairs(v:GetWeapons()) do 43 | local vclass = v2:GetClass() 44 | if vclass == class then 45 | return true 46 | end 47 | end 48 | end 49 | 50 | for k,v in pairs(ents.FindByClass("random_box_windup")) do -- We also gotta check active random boxes 51 | if v:GetWepClass() == class then 52 | return true 53 | end 54 | end 55 | end 56 | return false 57 | end 58 | 59 | -- Now let's add some! 60 | nzWeps:AddWonderWeapon("freeze_gun") 61 | nzWeps:AddWonderWeapon("wunderwaffe") 62 | nzWeps:AddWonderWeapon("weapon_hoff_thundergun") 63 | nzWeps:AddWonderWeapon("weapon_teslagun") 64 | 65 | -- We can also add all weapons which have SWEP.NZWonderWeapon = true set in their files 66 | hook.Add("InitPostEntity", "nzRegisterWonderWeaponsByKey", function() 67 | for k,v in pairs(weapons.GetList()) do 68 | -- Add Wonder Weapons to the list 69 | if v.NZWonderWeapon then nzWeps:AddWonderWeapon(v.ClassName) end 70 | -- If it has a PaP replacement, blacklist that weapon so it can't be gotten in the box 71 | if v.NZPaPReplacement then nzConfig.AddWeaponToBlacklist(v.NZPaPReplacement) end 72 | -- Total blacklisted weapons also need to be added to the box blacklist 73 | if v.NZTotalBlacklist then nzConfig.AddWeaponToBlacklist(v.ClassName) end 74 | end 75 | end) 76 | 77 | -- More wonder weapons should be added by map scripts for their map - if you think you have one that should officially apply to all maps, add me -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/weapons/nz_grenade.lua: -------------------------------------------------------------------------------- 1 | if SERVER then 2 | AddCSLuaFile("nz_grenade.lua") 3 | SWEP.Weight = 1 4 | SWEP.AutoSwitchTo = false 5 | SWEP.AutoSwitchFrom = true 6 | end 7 | 8 | if CLIENT then 9 | 10 | SWEP.PrintName = "M67 Grenade" 11 | SWEP.Slot = 1 12 | SWEP.SlotPos = 1 13 | SWEP.DrawAmmo = false 14 | SWEP.DrawCrosshair = true 15 | 16 | end 17 | 18 | 19 | SWEP.Author = "Zet0r" 20 | SWEP.Contact = "youtube.com/Zet0r" 21 | SWEP.Purpose = "Throws a grenade if you have any" 22 | SWEP.Instructions = "Let the gamemode give you it" 23 | 24 | SWEP.Spawnable = false 25 | SWEP.AdminSpawnable = false 26 | 27 | SWEP.HoldType = "grenade" 28 | 29 | SWEP.ViewModel = "models/weapons/c_grenade.mdl" 30 | SWEP.WorldModel = "models/weapons/w_grenade.mdl" 31 | SWEP.UseHands = true 32 | SWEP.vModel = true 33 | 34 | SWEP.Primary.ClipSize = -1 35 | SWEP.Primary.DefaultClip = -1 36 | SWEP.Primary.Automatic = false 37 | SWEP.Primary.Ammo = "none" 38 | 39 | SWEP.Secondary.ClipSize = -1 40 | SWEP.Secondary.DefaultClip = -1 41 | SWEP.Secondary.Automatic = false 42 | SWEP.Secondary.Ammo = "none" 43 | 44 | SWEP.NextReload = 1 45 | 46 | function SWEP:Initialize() 47 | 48 | self:SetHoldType( self.HoldType ) 49 | 50 | end 51 | 52 | function SWEP:Deploy() 53 | self:SendWeaponAnim(ACT_VM_DRAW) 54 | --if !self.Owner:GetUsingSpecialWeapon() then 55 | --self.Owner:EquipPreviousWeapon() 56 | --end 57 | end 58 | 59 | function SWEP:PrimaryAttack() 60 | self:ThrowGrenade(6000) 61 | end 62 | 63 | function SWEP:ThrowGrenade(force) 64 | self.Owner:SetAnimation(PLAYER_ATTACK1) 65 | self:SendWeaponAnim(ACT_VM_THROW) 66 | 67 | if SERVER then 68 | local nade = ents.Create("nz_fraggrenade") 69 | nade:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector() * 20)) 70 | nade:SetAngles( Angle(30,0,0) ) 71 | nade:Spawn() 72 | nade:Activate() 73 | nade:SetOwner(self.Owner) 74 | if self.Owner:HasPerk("widowswine") then 75 | nade.WidowsWine = true 76 | end 77 | 78 | local nadePhys = nade:GetPhysicsObject() 79 | if !IsValid(nadePhys) then return end 80 | nadePhys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized() * force + self.Owner:GetVelocity()) 81 | nadePhys:AddAngleVelocity(Vector(1000,0,0)) 82 | nade:SetExplosionTimer(3) 83 | end 84 | end 85 | 86 | function SWEP:PostDrawViewModel() 87 | 88 | end 89 | 90 | function SWEP:DrawWorldModel() 91 | end 92 | 93 | function SWEP:OnRemove() 94 | 95 | end 96 | 97 | function SWEP:Holster( wep ) 98 | --if not IsFirstTimePredicted() then return end 99 | return true 100 | end -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/points/sh_points.lua: -------------------------------------------------------------------------------- 1 | local _PLAYER = FindMetaTable("Player") 2 | 3 | function _PLAYER:GetPoints() 4 | return self:GetNWInt("points") or 0 5 | end 6 | 7 | function _PLAYER:HasPoints(amount) 8 | return self:GetPoints() >= amount 9 | end 10 | 11 | function _PLAYER:CanAfford(amount) 12 | return (self:GetPoints() - amount) >= 0 13 | end 14 | 15 | 16 | if (SERVER) then 17 | util.AddNetworkString("nz_points_notification") 18 | -- Sets the character's amount of currency to a specific value. 19 | function _PLAYER:SetPoints(amount) 20 | amount = math.Round(amount, 2) 21 | if !GetConVar("nz_point_notification_clientside"):GetBool() then 22 | local num = amount - self:GetPoints() 23 | if num != 0 then -- 0 points doesn't get sent 24 | net.Start("nz_points_notification") 25 | net.WriteInt(num, 20) 26 | net.WriteEntity(self) 27 | net.Broadcast() 28 | end 29 | end 30 | self:SetNWInt("points", amount) 31 | end 32 | 33 | -- Quick function to set the money to the current amount plus an amount specified. 34 | function _PLAYER:GivePoints(amount, ignoredp) 35 | -- If double points is on. 36 | if nzPowerUps:IsPowerupActive("dp") and !ignoredp then 37 | amount = amount * 2 38 | end 39 | amount = hook.Call("OnPlayerGetPoints", nil, self, amount) or amount 40 | self:SetPoints(self:GetPoints() + amount) 41 | end 42 | 43 | -- Takes away a certain amount by inverting the amount specified. 44 | function _PLAYER:TakePoints(amount, nosound) 45 | -- Changed to prevent double points from removing double the points. - Don't even think of changing this back Ali, Love Ali. 46 | amount = hook.Call("OnPlayerLosePoints", nil, self, amount) or amount 47 | self:SetPoints(self:GetPoints() - amount) 48 | 49 | if !nosound then 50 | self:EmitSound("nz/effects/buy.wav") 51 | end 52 | 53 | -- If you have a clone like this, it tracks money spent which will be refunded on revival 54 | if self.WhosWhoMoney then self.WhosWhoMoney = self.WhosWhoMoney + amount end 55 | end 56 | 57 | function _PLAYER:Buy(amount, ent, func) 58 | local new = hook.Call("OnPlayerBuy", nil, self, amount, ent, func) or amount 59 | if type(new) == "number" then 60 | if self:CanAfford(new) then 61 | local success = func() 62 | if success then 63 | self:TakePoints(new) 64 | hook.Call("OnPlayerBought", nil, self, new, ent) 65 | return true -- If the buy was successfull, this function also returns true 66 | end 67 | else 68 | return false -- Return false if we can't afford 69 | end 70 | else 71 | return false -- And return false if the hook blocked the event by returning true 72 | end 73 | end 74 | 75 | end 76 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/player_class/sh_player_ingame.lua: -------------------------------------------------------------------------------- 1 | DEFINE_BASECLASS( "player_default" ) 2 | 3 | local PLAYER = {} 4 | 5 | -- 6 | -- See gamemodes/base/player_class/player_default.lua for all overridable variables 7 | -- 8 | PLAYER.WalkSpeed = 200 9 | PLAYER.RunSpeed = 300 10 | PLAYER.CanUseFlashlight = true 11 | 12 | function PLAYER:SetupDataTables() 13 | self.Player:NetworkVar("Bool", 0, "UsingSpecialWeapon") 14 | end 15 | 16 | function PLAYER:Init() 17 | -- Don't forget Colours 18 | -- This runs when the player is first brought into the game and when they die during a round and are brought back 19 | 20 | end 21 | 22 | if not ConVarExists("nz_failsafe_preventgrenades") then CreateConVar("nz_failsafe_preventgrenades", 0, {FCVAR_SERVER_CAN_EXECUTE, FCVAR_ARCHIVE, FCVAR_NOTIFY}) end 23 | 24 | function PLAYER:Loadout() 25 | -- Give ammo and guns 26 | 27 | if nzMapping.Settings.startwep then 28 | self.Player:Give( nzMapping.Settings.startwep ) 29 | else 30 | -- A setting does not exist, give default starting weapons 31 | for k,v in pairs(nzConfig.BaseStartingWeapons) do 32 | self.Player:Give( v ) 33 | end 34 | end 35 | self.Player:GiveMaxAmmo() 36 | 37 | if !GetConVar("nz_papattachments"):GetBool() and FAS2_Attachments != nil then 38 | for k,v in pairs(FAS2_Attachments) do 39 | self.Player:FAS2_PickUpAttachment(v.key) 40 | end 41 | end 42 | self.Player:Give("nz_quickknife_crowbar") 43 | 44 | -- We need this to disable the grenades for those that it causes problems with until they've been remade :( 45 | if !GetConVar("nz_failsafe_preventgrenades"):GetBool() then 46 | self.Player:Give("nz_grenade") 47 | end 48 | 49 | end 50 | function PLAYER:Spawn() 51 | 52 | if nzMapping.Settings.startpoints then 53 | if !self.Player:CanAfford(nzMapping.Settings.startpoints) then 54 | self.Player:SetPoints(nzMapping.Settings.startpoints) 55 | end 56 | else 57 | if !self.Player:CanAfford(500) then -- Has less than 500 points 58 | -- Poor guy has no money, lets start him off 59 | self.Player:SetPoints(500) 60 | end 61 | end 62 | 63 | -- Reset their perks 64 | self.Player:RemovePerks() 65 | 66 | -- activate zombie targeting 67 | self.Player:SetTargetPriority(TARGET_PRIORITY_PLAYER) 68 | 69 | local spawns = ents.FindByClass("player_spawns") 70 | -- Get player number 71 | for k,v in pairs(player.GetAll()) do 72 | if v == self.Player then 73 | if IsValid(spawns[k]) then 74 | v:SetPos(spawns[k]:GetPos()) 75 | else 76 | print("No spawn set for player: " .. v:Nick()) 77 | end 78 | end 79 | end 80 | 81 | self.Player:SetUsingSpecialWeapon(false) 82 | end 83 | 84 | player_manager.RegisterClass( "player_ingame", PLAYER, "player_default" ) 85 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/misc/sv_consolecommands.lua: -------------------------------------------------------------------------------- 1 | -- Actual Commands 2 | 3 | -- Quick reload for dedicated severs 4 | concommand.Add("nz_qr", function(ply) 5 | if !IsValid(ply) or ply:IsSuperAdmin() then 6 | RunConsoleCommand("changelevel", game.GetMap()) 7 | end 8 | end) 9 | 10 | concommand.Add( "nz_print_weps", function() 11 | for k,v in pairs( weapons.GetList() ) do 12 | print( v.ClassName ) 13 | end 14 | end) 15 | 16 | concommand.Add("nz_door_id", function() 17 | local tr = util.TraceLine( util.GetPlayerTrace( player.GetByID(1) ) ) 18 | if IsValid( tr.Entity ) then print( tr.Entity:doorIndex() ) end 19 | end) 20 | 21 | concommand.Add("nz_test1", function() 22 | nz.nzDoors.Functions.CreateMapDoorLink( 1236, "price=500,elec=0,link=1" ) 23 | 24 | timer.Simple(5, function() nz.nzDoors.Functions.RemoveMapDoorLink( 1236 ) end) 25 | end) 26 | 27 | concommand.Add("nz_forceround", function(ply, cmd, args, argStr) 28 | if !IsValid(ply) or ply:IsSuperAdmin() then 29 | local round = args[1] and tonumber(args[1]) or nil 30 | local nokill = args[2] and tobool(args[2]) or false 31 | 32 | if !nokill then 33 | nzPowerUps:Nuke(nil, true) -- Nuke kills them all, no points, no position delay 34 | end 35 | 36 | if round then 37 | nzRound:SetNumber( round - 1 ) 38 | local specint = GetConVar("nz_round_special_interval"):GetInt() or 6 39 | nzRound:SetNextSpecialRound( math.ceil(round/specint)*specint) 40 | end 41 | nzRound:Prepare() 42 | end 43 | end) 44 | 45 | -- Isn't used anywhere, marked for removal 46 | function lmne(name, find, listall) 47 | if !IsValid(ply) or ply:IsSuperAdmin() then 48 | if name then 49 | local tbl = {} 50 | if find then 51 | for k,v in pairs(ents.GetAll()) do 52 | if v:GetName() != "" and string.find(string.lower(v:GetName()), string.lower(name)) then 53 | table.insert(tbl, v) 54 | print(v:GetName(),"\t\t\t",v) 55 | end 56 | end 57 | else 58 | tbl = ents.FindByName(name) 59 | end 60 | if !listall then 61 | return tbl[1] 62 | else 63 | return tbl 64 | end 65 | else 66 | local tbl = {} 67 | for k,v in pairs(ents.GetAll()) do 68 | if v:GetName() != "" then 69 | table.insert(tbl, v) 70 | print(v:GetName(),"\t\t\t",v) 71 | end 72 | end 73 | return tbl 74 | end 75 | end 76 | end 77 | 78 | concommand.Add("printeyeentityinfo", function(ply, cmd, args, argstr) 79 | if !ply:IsSuperAdmin() then return end 80 | local ent = ply:GetEyeTrace().Entity 81 | if IsValid(ent) then 82 | local pos = ent:GetPos() 83 | local ang = ent:GetAngles() 84 | print("{pos = Vector("..math.Round(pos.x)..", "..math.Round(pos.y)..", "..math.Round(pos.z).."), ang = Angle("..math.Round(ang[1])..", "..math.Round(ang[2])..", "..math.Round(ang[3])..")}") 85 | end 86 | end) 87 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/logic_points/init.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "point" 2 | 3 | function ENT:Initialize() 4 | -- Remove it as soon as it spawns, if the gamemode hasn't been enabled in Map Settings 5 | if !nzMapping.Settings.gamemodeentities then 6 | self:Remove() 7 | end 8 | end 9 | 10 | -- We need to scale the point requirements up to what fits nZombies more 11 | local conversionrate = 100 12 | 13 | function ENT:Add(pl, amount) 14 | -- Instead of a player team check, we check if the player is playing 15 | if pl and pl:IsValid() and pl:IsPlayer() and pl:IsPlaying() then 16 | amount = math.Round(amount) 17 | if amount < 0 then 18 | pl:TakePoints(-amount) 19 | else 20 | pl:GivePoints(amount, true) -- We ignore double points for this 21 | end 22 | end 23 | end 24 | 25 | function ENT:Set(pl, amount) 26 | -- You CANNOT set the player's points in nZombies! 27 | end 28 | 29 | function ENT:GetAmount(pl) 30 | return pl:GetPoints() 31 | end 32 | 33 | function ENT:CallIf(pl, amount) 34 | if pl and pl:IsValid() and pl:IsPlayer() and pl:IsPlaying() then 35 | self:Input(pl:IsPlaying() and self:GetAmount(pl) >= amount and "onconditionpassed" or "onconditionfailed", pl, self, amount) 36 | end 37 | end 38 | 39 | function ENT:CallIfNot(pl, amount) 40 | if pl and pl:IsValid() and pl:IsPlayer() and pl:IsPlaying() then 41 | self:Input(pl:IsPlaying() and self:GetAmount(pl) >= amount and "onconditionfailed" or "onconditionpassed", pl, self, amount) 42 | end 43 | end 44 | 45 | function ENT:AcceptInput(name, activator, caller, args) 46 | name = string.lower(name) 47 | -- We multiply with our conversion rate and round to nearest 10 48 | local amount = math.Round(tonumber(args) * conversionrate, -1) or 0 49 | if string.sub(name, 1, 2) == "on" then 50 | self:FireOutput(name, activator, caller, args) 51 | elseif name == "addtoactivator" then 52 | self:Add(activator, amount) 53 | elseif name == "takefromactivator" then 54 | self:Add(activator, -amount) 55 | elseif name == "addtocaller" then 56 | self:Add(caller, amount) 57 | elseif name == "takefromcaller" then 58 | self:Add(caller, -amount) 59 | elseif name == "callifactivatorhave" then 60 | self:CallIf(activator, amount) 61 | elseif name == "callifactivatornothave" then 62 | self:CallIfNot(activator, amount) 63 | elseif name == "callifcallerhave" then 64 | self:CallIf(caller, amount) 65 | elseif name == "callifcallernothave" then 66 | self:CallIfNot(caller, amount) 67 | elseif name == "setactivatoramount" then 68 | self:Set(activator, amount) 69 | elseif name == "setcalleramount" then 70 | self:Set(caller, amount) 71 | end 72 | end 73 | 74 | function ENT:KeyValue(key, value) 75 | key = string.lower(key) 76 | if string.sub(key, 1, 2) == "on" then 77 | self:AddOnOutput(key, value) 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_script_soulcatcher/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "nz_script_soulcatcher" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "youtube.com/Zet0r" 8 | ENT.Purpose = "Scriptable soul catcher for nZombies" 9 | ENT.Instructions = "" 10 | 11 | function ENT:Initialize() 12 | if SERVER then 13 | self:SetMoveType( MOVETYPE_NONE ) 14 | self:SetSolid( SOLID_VPHYSICS ) 15 | --self:DrawShadow( false ) 16 | self:SetUseType( SIMPLE_USE ) 17 | self.CurrentAmount = 0 18 | self:SetTargetAmount( self.TargetAmount or 20 ) 19 | self:SetCondition(self.Condition or function(z, dmg) return true end) -- Always allow 20 | self:SetCatchFunction(self.CatchFunc or function(z) end) -- Nothing by default 21 | self:SetCompleteFunction(self.CompleteFunc or function(z) end) -- Nothing either 22 | self:SetRange(self.Range or 500) -- Default range 23 | self:SetEnabled(self.Enabled or true) 24 | end 25 | end 26 | 27 | function ENT:OnRemove() 28 | hook.Call("nzmapscript_SoulCatcherRemoved", nil, self) 29 | end 30 | 31 | function ENT:SetCatchFunction( func ) 32 | self.CatchFunc = func 33 | end 34 | function ENT:SetCompleteFunction( func ) 35 | self.CompleteFunc = func 36 | end 37 | function ENT:SetTargetAmount( num ) 38 | self.TargetAmount = tonumber(num) 39 | end 40 | function ENT:SetCondition( func ) 41 | self.Condition = func 42 | end 43 | function ENT:SetRange( num ) 44 | self.Range = tonumber(num)^2 45 | end 46 | function ENT:SetEnabled( bool ) 47 | self.Enabled = tobool(bool) 48 | end 49 | function ENT:SetReleaseOverride( func ) 50 | self.ReleaseOverride = func 51 | end 52 | 53 | function ENT:SetCurrentAmount( num ) 54 | self.CurrentAmount = tonumber(num) 55 | end 56 | function ENT:Reset() 57 | self.CurrentAmount = 0 58 | end 59 | 60 | function ENT:ReleaseSoul( z ) 61 | if self.ReleaseOverride then 62 | self:ReleaseOverride(z) -- You can override the effect and count logic with this 63 | else 64 | if self.CurrentAmount >= self.TargetAmount then return end 65 | local e = EffectData() 66 | e:SetOrigin(z:GetPos() + Vector(0,0,50)) 67 | e:SetEntity(self) 68 | util.Effect("zombie_soul", e) 69 | self.CurrentAmount = self.CurrentAmount + 1 70 | end 71 | end 72 | 73 | function ENT:CollectSoul() 74 | self:CatchFunc() 75 | if self.CurrentAmount >= self.TargetAmount then 76 | self:CompleteFunc() 77 | end 78 | end 79 | 80 | hook.Add("EntityTakeDamage", "SoulCatchZombies", function(ent, dmg) 81 | if ent:IsValidZombie() and ent:Health() <= dmg:GetDamage() then 82 | for k,v in pairs(ents.FindByClass("nz_script_soulcatcher")) do 83 | if v.Enabled and ent:GetPos():DistToSqr(v:GetPos()) <= v.Range and v:Condition(ent, dmg) then 84 | v:ReleaseSoul(ent) 85 | break 86 | end 87 | end 88 | end 89 | end) 90 | 91 | if CLIENT then 92 | function ENT:Draw() 93 | self:DrawModel() 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_script_triggerzone/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile( ) 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "triggerzone" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | ENT.RenderGroup = RENDERGROUP_TRANSLUCENT 12 | 13 | function ENT:Initialize() 14 | if SERVER then 15 | self:SetMoveType( MOVETYPE_NONE ) 16 | self:SetSolid( SOLID_NONE ) 17 | self:DrawShadow( false ) 18 | self:SetUseType( SIMPLE_USE ) 19 | self.Boundone,self.Boundtwo = self:GetCollisionBounds() 20 | self:SetBuyFunction( function() print(self, "was bought but has no buy function") end ) 21 | end 22 | self:SetRenderMode( RENDERMODE_TRANSALPHA ) 23 | self:SetColor( Color(255,200,100,150) ) 24 | end 25 | 26 | 27 | function ENT:OnRemove() 28 | if SERVER then 29 | nzDoors:RemoveLink( self ) 30 | else 31 | self:SetLocked(false) 32 | end 33 | end 34 | 35 | function ENT:CreateZoneBuy(data) 36 | if IsValid(self) then 37 | self:SetDoorData(data) 38 | self:SetLocked(true) 39 | hook.Call("OnPropDoorLinkCreated", Doors, self, data) 40 | end 41 | end 42 | 43 | function ENT:SetBuyFunction(func) 44 | self.BuyFunction = func 45 | end 46 | 47 | function ENT:SetBounds(w, l, h) 48 | self:SetSolid( SOLID_BBOX ) 49 | self:SetCollisionBounds( Vector(-w/2, -l/2, -h/2), Vector(w/2, l/2, h/2) ) 50 | end 51 | 52 | if CLIENT then 53 | function ENT:Draw() 54 | if nzRound:InState( ROUND_CREATE ) then 55 | self:DrawModel() 56 | end 57 | end 58 | end 59 | 60 | concommand.Add("nz_testbrush2", function(ply) 61 | local ent = ents.Create("nz_triggerzone") 62 | ent:SetPos(ply:GetPos()) 63 | ent:SetBounds(1000,10,10) 64 | ent:SetMaterial("debugtools/toolswhite") 65 | ent:SetModel("models/hunter/blocks/cube4x4x4.mdl") 66 | ent:Spawn() 67 | ent:SetBuyFunction( function(ent) 68 | ent:ChatPrint("Bought!") 69 | end ) 70 | 71 | undo.Create( "Test Brush 2" ) 72 | undo.SetPlayer( ply ) 73 | undo.AddEntity( ent ) 74 | undo.Finish( "Effect (" .. tostring( model ) .. ")" ) 75 | 76 | print(ent) 77 | end) 78 | 79 | concommand.Add("nz_testbrush5", function(ply) 80 | local t = SysTime() 81 | for k,v in pairs(ents.FindByClass("nz_triggerzone_2")) do 82 | if v:NearestPoint(Entity(1):GetPos()):DistToSqr(Entity(1):GetPos()) <= 1 then 83 | print("Found", v) 84 | break 85 | end 86 | end 87 | local time = SysTime() - t 88 | print("Time for FindByClass", time) 89 | 90 | local o = SysTime() 91 | for k,v in pairs(ents.FindInSphere(Entity(1):GetPos(), 1)) do 92 | if v:GetClass() == "nz_triggerzone_2" then 93 | print("Found", v) 94 | break 95 | end 96 | end 97 | local time2 = SysTime()-o 98 | print("Time for FindInSphere", time2) 99 | 100 | print(time2 < time and "Sphere is fastest" or "Class is fastest") 101 | end) 102 | 103 | -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/itemcarrying/sh_meta.lua: -------------------------------------------------------------------------------- 1 | local playerMeta = FindMetaTable("Player") 2 | if SERVER then 3 | 4 | function playerMeta:GiveCarryItem(id, alloverride) 5 | if !nzItemCarry.Players[self] then nzItemCarry.Players[self] = {} end 6 | if nzItemCarry.Items[id].shared and !alloverride then -- If shared, give to all players 7 | for k,v in pairs(player.GetAllPlaying()) do 8 | if !table.HasValue(nzItemCarry.Players[v], id) then 9 | table.insert(nzItemCarry.Players[v], id) 10 | end 11 | end 12 | nzItemCarry:SendPlayerItem() 13 | if nzItemCarry.Items[id].notif then 14 | nzItemCarry:SendPlayerItemNotification(nil, id) 15 | end 16 | else 17 | if !table.HasValue(nzItemCarry.Players[self], id) then 18 | table.insert(nzItemCarry.Players[self], id) 19 | nzItemCarry:SendPlayerItem(self) 20 | if nzItemCarry.Items[id].notif then 21 | nzItemCarry:SendPlayerItemNotification(self, id) 22 | end 23 | end 24 | end 25 | end 26 | 27 | function playerMeta:RemoveCarryItem(id, alloverride) 28 | if !nzItemCarry.Players[self] then nzItemCarry.Players[self] = {} end 29 | if nzItemCarry.Items[id].shared and !alloverride then -- If shared, remove from all players 30 | for k,v in pairs(player.GetAllPlaying()) do 31 | if table.HasValue(nzItemCarry.Players[v], id) then 32 | table.RemoveByValue(nzItemCarry.Players[v], id) 33 | end 34 | end 35 | nzItemCarry:SendPlayerItem() 36 | else 37 | if table.HasValue(nzItemCarry.Players[self], id) then 38 | table.RemoveByValue(nzItemCarry.Players[self], id) 39 | nzItemCarry:SendPlayerItem(self) 40 | end 41 | end 42 | end 43 | 44 | end 45 | 46 | function playerMeta:HasCarryItem(id) 47 | if !nzItemCarry.Players[self] then nzItemCarry.Players[self] = {} end 48 | return table.HasValue(nzItemCarry.Players[self], id) 49 | end 50 | 51 | function playerMeta:GetCarryItems() 52 | if !nzItemCarry.Players[self] then nzItemCarry.Players[self] = {} end 53 | return nzItemCarry.Players[self] 54 | end 55 | 56 | -- On player downed 57 | hook.Add("PlayerDowned", "nzDropCarryItems", function(ply) 58 | if ply.GetCarryItems then 59 | for k,v in pairs(ply:GetCarryItems()) do 60 | local item = nzItemCarry.Items[v] 61 | if item.dropondowned and item.dropfunction then 62 | item:dropfunction(ply) 63 | ply:RemoveCarryItem(v) 64 | end 65 | end 66 | end 67 | end) 68 | 69 | -- Players disconnecting/dropping out need to reset the item so it isn't lost forever 70 | hook.Add("OnPlayerDropOut", "nzResetCarryItems", function(ply) 71 | for k,v in pairs(ply:GetCarryItems()) do 72 | local item = nzItemCarry.Items[v] 73 | if item.dropondowned and item.dropfunction then 74 | item:dropfunction(ply) 75 | else 76 | item:resetfunction() 77 | end 78 | end 79 | nzItemCarry.Players[ply] = nil 80 | nzItemCarry:SendPlayerItem() -- No arguments for full sync, cleans the table of this disconnected player 81 | end) -------------------------------------------------------------------------------- /gamemodes/nzombies/gamemode/effects/cl_electricarcs.lua: -------------------------------------------------------------------------------- 1 | 2 | local mat = Material( "effects/tool_tracer" ) 3 | 4 | local function GenerateArc(startPos, endPos, branchChance, detail, size) 5 | local points = {} 6 | local maxPoints = 2^detail 7 | 8 | if maxPoints % 2 != 0 then 9 | maxPoints = maxPoints + 1 10 | end 11 | 12 | points[0] = startPos 13 | 14 | local randVec = VectorRand() * 10 15 | 16 | randVec.z = math.Clamp(randVec.z, 0, 10) 17 | 18 | points[maxPoints] = endPos + randVec 19 | 20 | local i = 1 21 | 22 | while i < maxPoints do 23 | local j = (maxPoints / i) / 2 24 | while j < maxPoints do 25 | points[j] = ((points[j - (maxPoints / i) / 2] + points[j + (maxPoints / i) / 2]) / 2); 26 | points[j] = points[j] + VectorRand() * 10 27 | if math.Rand(0,1) < branchChance then 28 | points[#points + 1] = GenerateArc(points[j], points[j] + Vector(math.random(-50 * branchChance, 50 * branchChance), math.random(-50 * branchChance, 50 * branchChance), math.random(-50 * branchChance, 10 * branchChance)), branchChance/1.3, detail, size) 29 | end 30 | j = j + maxPoints / i 31 | end 32 | i = i * 2 33 | end 34 | 35 | points.size = math.random(1,3)*size 36 | points.color = Color(200, 240, math.random(230, 255), math.random(200, 255)) 37 | points.dietime = CurTime() + 0.07 38 | 39 | return points 40 | end 41 | 42 | local function RenderArc(arc) 43 | render.SetMaterial( mat ) 44 | for j = 1, #arc - 1 do 45 | 46 | if istable(arc[j]) then 47 | RenderArc(arc[j]) 48 | elseif !istable(arc[j+1]) then 49 | 50 | local texcoord = math.Rand( 0, 1 ) 51 | 52 | local startPos = arc[j] 53 | local endPos = arc[j + 1] 54 | 55 | render.DrawBeam( 56 | startPos, 57 | endPos, 58 | arc.size, 59 | texcoord, 60 | texcoord + ((startPos - endPos):Length() / 128), 61 | arc.color 62 | ) 63 | end 64 | end 65 | end 66 | 67 | function nzEffects:DrawElectricArcs( entity, epos, normal, effectsize, maxarcs, freq ) 68 | 69 | if !IsValid(entity) then return end 70 | 71 | if !entity.NextElecArc or entity.NextElecArc <= CurTime() then 72 | if !entity.ElecArcs then entity.ElecArcs = {} end 73 | 74 | local size = #entity.ElecArcs 75 | --add a arc to the array 76 | while entity.ElecArcs[size] do 77 | size = size + 1 78 | end 79 | local norm = VectorRand() 80 | entity.ElecArcs[size] = GenerateArc(epos - norm*effectsize, epos + norm*effectsize, 0.01, 4, effectsize) 81 | entity.NextElecArc = CurTime() + freq 82 | 83 | if size >= maxarcs then 84 | local i = 1 85 | while not entity.ElecArcs[i] and i <= size do 86 | i = i + 1 87 | end 88 | entity.ElecArcs[i] = nil 89 | end 90 | end 91 | 92 | for _, arc in pairs(entity.ElecArcs) do 93 | if arc.dietime <= CurTime() then 94 | entity.ElecArcs[_] = nil 95 | else 96 | RenderArc(arc) 97 | end 98 | end 99 | 100 | end 101 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/nz_fraggrenade.lua: -------------------------------------------------------------------------------- 1 | ENT.Type = "anim" 2 | ENT.Base = "base_entity" 3 | ENT.PrintName = "Frag Grenade" 4 | ENT.Author = "Zet0r" 5 | 6 | ENT.Spawnable = false 7 | ENT.AdminSpawnable = false 8 | 9 | if SERVER then 10 | AddCSLuaFile("nz_fraggrenade.lua") 11 | end 12 | 13 | function ENT:Initialize() 14 | if SERVER then 15 | self:SetModel("models/weapons/w_grenade.mdl") 16 | self:PhysicsInit(SOLID_VPHYSICS) 17 | self:SetMoveType(MOVETYPE_VPHYSICS) 18 | self:SetCollisionGroup(COLLISION_GROUP_NONE) 19 | self:SetSolid(SOLID_VPHYSICS) 20 | phys = self:GetPhysicsObject() 21 | 22 | if phys and IsValid(phys) then 23 | phys:SetMass(8) 24 | phys:Wake() 25 | phys:SetAngleDragCoefficient(1000) 26 | --print(phys:GetMass()) 27 | end 28 | 29 | self:CollisionRulesChanged() 30 | end 31 | end 32 | 33 | 34 | function ENT:PhysicsCollide(data, physobj) 35 | if SERVER then 36 | if self.WidowsWine then 37 | physobj:SetVelocity(Vector(0,0,0)) 38 | physobj:EnableMotion(false) 39 | physobj:Sleep() 40 | 41 | --self:SetAngles(data.HitNormal:Angle()) 42 | 43 | if IsValid(data.HitEntity) then 44 | self:SetParent(data.HitEntity) 45 | end 46 | else 47 | local vel = physobj:GetVelocity():Length() 48 | if vel > 100 then 49 | self:EmitSound("weapons/hegrenade/he_bounce-1.wav", 75, 100) 50 | end 51 | 52 | local LastSpeed = math.max( data.OurOldVelocity:Length(), data.Speed ) 53 | local NewVelocity = physobj:GetVelocity() 54 | NewVelocity:Normalize() 55 | 56 | LastSpeed = math.max( NewVelocity:Length(), LastSpeed ) 57 | 58 | local TargetVelocity = NewVelocity * LastSpeed * 0.8 59 | 60 | physobj:SetVelocity( TargetVelocity ) 61 | --physobj:SetLocalAngularVelocity( AngleRand() ) 62 | end 63 | end 64 | end 65 | 66 | function ENT:SetExplosionTimer( time ) 67 | 68 | SafeRemoveEntityDelayed( self, time +1 ) --fallback 69 | 70 | timer.Simple(time, function() 71 | if IsValid(self) then 72 | local pos = self:GetPos() 73 | local owner = self:GetOwner() 74 | 75 | util.BlastDamage(self, owner, pos, 350, 50) 76 | 77 | if self.WidowsWine then 78 | local zombls = ents.FindInSphere(pos, 350) 79 | 80 | local e = EffectData() 81 | e:SetMagnitude(1.5) 82 | e:SetScale(20) -- The time the effect lasts 83 | 84 | local fx = EffectData() 85 | fx:SetOrigin(pos) 86 | fx:SetMagnitude(1) 87 | util.Effect("web_explosion", fx) 88 | 89 | for k,v in pairs(zombls) do 90 | if IsValid(v) and v:IsValidZombie() then 91 | v:ApplyWebFreeze(20) 92 | end 93 | end 94 | end 95 | 96 | local fx = EffectData() 97 | fx:SetOrigin(pos) 98 | fx:SetMagnitude(1) 99 | util.Effect("Explosion", fx) 100 | 101 | self:Remove() 102 | end 103 | end) 104 | end 105 | 106 | function ENT:Draw() 107 | self:DrawModel() 108 | end 109 | -------------------------------------------------------------------------------- /gamemodes/nzombies/entities/entities/drop_tombstone/shared.lua: -------------------------------------------------------------------------------- 1 | AddCSLuaFile() 2 | 3 | ENT.Type = "anim" 4 | 5 | ENT.PrintName = "drop_tombstone" 6 | ENT.Author = "Zet0r" 7 | ENT.Contact = "Don't" 8 | ENT.Purpose = "" 9 | ENT.Instructions = "" 10 | 11 | function ENT:SetupDataTables() 12 | 13 | self:NetworkVar( "Entity", 0, "PerkOwner" ) 14 | 15 | end 16 | 17 | function ENT:Initialize() 18 | 19 | self:SetModel("models/props_c17/gravestone003a.mdl") 20 | 21 | --self:PhysicsInit(SOLID_VPHYSICS) 22 | self:PhysicsInitSphere(60, "default_silent") 23 | self:SetMoveType(MOVETYPE_NONE) 24 | self:SetSolid(SOLID_NONE) 25 | if SERVER then 26 | self:SetTrigger(true) 27 | end 28 | self:UseTriggerBounds(true, 0) 29 | self:DrawShadow(false) 30 | self:SetMaterial("models/shiny.vtf") 31 | self:SetColor( Color(255,200,0) ) 32 | 33 | self.OwnerData = {} 34 | 35 | if SERVER then 36 | self:SetUseType(SIMPLE_USE) 37 | end 38 | 39 | --[[timer.Create( self:EntIndex().."_deathtimer", 100, 1, function() 40 | if self:IsValid() then 41 | timer.Destroy(self:EntIndex().."_deathtimer") 42 | if SERVER then 43 | self:Remove() 44 | end 45 | end 46 | end)]] 47 | 48 | --self.RemoveTime = CurTime() + 120 49 | end 50 | 51 | if SERVER then 52 | function ENT:StartTouch(hitEnt) 53 | --print("Collided") 54 | if (IsValid(hitEnt) and hitEnt:IsPlayer() and hitEnt == self:GetPerkOwner()) then 55 | --PrintTable(self.OwnerData) 56 | 57 | -- Weapons are completely replaced 58 | hitEnt:StripWeapons() 59 | for k,v in pairs(self.OwnerData.weps) do 60 | local wep = hitEnt:Give(v.class) 61 | if v.pap then 62 | wep:ApplyNZModifier("pap") 63 | end 64 | end 65 | for k,v in pairs(self.OwnerData.perks) do 66 | if v != "tombstone" then 67 | hitEnt:GivePerk(v) 68 | end 69 | end 70 | hitEnt:GiveMaxAmmo() 71 | 72 | --timer.Destroy(self:EntIndex().."_deathtimer") 73 | self:Remove() 74 | end 75 | end 76 | 77 | function ENT:Think() 78 | if !self.RemoveTime then 79 | local ply = self:GetPerkOwner() 80 | if IsValid(ply) then 81 | if ply:Alive() and ply:GetNotDowned() and (ply:IsPlaying() or ply:IsInCreative()) then 82 | self.RemoveTime = CurTime() + 90 83 | end 84 | else 85 | -- Man, the player must've disconnected or crashed :/ 86 | self:Remove() 87 | end 88 | elseif self.RemoveTime and CurTime() > self.RemoveTime then 89 | self:Remove() 90 | end 91 | end 92 | end 93 | 94 | if CLIENT then 95 | function ENT:Draw() 96 | self:DrawModel() 97 | end 98 | 99 | function ENT:Think() 100 | if !self:GetRenderAngles() then self:SetRenderAngles(self:GetAngles()) end 101 | self:SetRenderAngles(self:GetRenderAngles()+(Angle(0,50,0)*FrameTime())) 102 | end 103 | 104 | hook.Add( "PreDrawHalos", "drop_powerups_halos", function() 105 | halo.Add( ents.FindByClass( "drop_powerup" ), Color( 0, 255, 0 ), 2, 2, 2 ) 106 | end ) 107 | end --------------------------------------------------------------------------------