local PIPETANK_VALUES_TABLE = { PIPETANK_TURRET_MODEL = "models/props_frontline/tank_turret.mdl" PIPETANK_HELMET_MODEL = "models/workshop/player/items/demo/sum22_head_banger/sum22_head_banger.mdl" PIPETANK_SND_SHOOT_CRIT = "weapons/loch_n_load_shoot_crit.wav" PIPETANK_SND_SHOOT = "weapons/loch_n_load_shoot.wav" PIPETANK_PROJECTILE_SPREAD = 4 PIPETANK_PROJECTILE_SPLASH_RADIUS = 180 PIPETANK_PROJECTILE_SPEED = 512 PIPETANK_PROJECTILE_DAMAGE = 120 } foreach(k,v in PIPETANK_VALUES_TABLE) if(!(k in TankExt.ValueOverrides)) ROOT[k] <- v PrecacheSound(PIPETANK_SND_SHOOT) PrecacheSound(PIPETANK_SND_SHOOT_CRIT) TankExt.NewTankScript("pipetank", { OnSpawn = function(hTank, sName, hPath) { local bBlueTeam = hTank.GetTeam() == 3 local hTank_scope = hTank.GetScriptScope() local hModel1 = SpawnEntityFromTable("prop_dynamic", { origin = "-16 -66 108", angles = "-58.5 0 -90", model = PIPETANK_TURRET_MODEL, skin = bBlueTeam ? 2 : 0 }) local hModel2 = SpawnEntityFromTable("prop_dynamic", { origin = "-16 66 108", angles = "-58.5 0 90", model = PIPETANK_TURRET_MODEL, skin = bBlueTeam ? 2 : 0 }) local hModel3 = SpawnEntityFromTable("prop_dynamic", { origin = "-50 0 -15", modelscale = "2.2", model = PIPETANK_HELMET_MODEL, skin = 1 }) hTank_scope.hMimic1 <- SpawnEntityFromTable("tf_point_weapon_mimic", { origin = "51 57 217", angles = "-58.5 0 0", damage = PIPETANK_PROJECTILE_DAMAGE, modelscale = 1, speedmax = PIPETANK_PROJECTILE_SPEED, speedmin = PIPETANK_PROJECTILE_SPEED, splashradius = PIPETANK_PROJECTILE_SPLASH_RADIUS, weapontype = 1, spreadangle = PIPETANK_PROJECTILE_SPREAD }) hTank_scope.hMimic2 <- SpawnEntityFromTable("tf_point_weapon_mimic", { origin = "51 -57 217", angles = "-58.5 0 0", damage = PIPETANK_PROJECTILE_DAMAGE, modelscale = 1, speedmax = PIPETANK_PROJECTILE_SPEED, speedmin = PIPETANK_PROJECTILE_SPEED, splashradius = PIPETANK_PROJECTILE_SPLASH_RADIUS, weapontype = 1, spreadangle = PIPETANK_PROJECTILE_SPREAD }) TankExt.SetParentArray([hTank_scope.hMimic1, hTank_scope.hMimic2, hModel1, hModel2, hModel3], hTank) hTank_scope.hStickies <- [] hTank_scope.flTimeNext <- Time() hTank_scope.ShootStickies <- function(iStickyCount = 1, bCrit = false) { local sMultiple = iStickyCount > 1 ? "FireMultiple" : "FireOnce" local sStickyCount = iStickyCount.tostring() SetPropBool(hMimic1, "m_bCrits", bCrit) SetPropBool(hMimic2, "m_bCrits", bCrit) hMimic1.AcceptInput(sMultiple, sStickyCount, null, null) hMimic2.AcceptInput(sMultiple, sStickyCount, null, null) EmitSoundEx({ sound_name = bCrit ? PIPETANK_SND_SHOOT_CRIT : PIPETANK_SND_SHOOT entity = self filter_type = RECIPIENT_FILTER_GLOBAL sound_level = 82 }) } hTank_scope.PipeThink <- function() { foreach(i, hSticky in hStickies) if(!(hSticky && hSticky.IsValid())) hStickies.remove(i) local FindStickies = function(hMimic) { for(local hSticky; hSticky = FindByClassnameWithin(hSticky, "tf_projectile_pipe", hMimic.GetOrigin(), 32);) if(GetPropEntity(hSticky, "m_hThrower") == null && hSticky.GetOwner() == null) { hSticky.SetTeam(self.GetTeam()) hSticky.SetOwner(self) hStickies.append(hSticky) } } if(hMimic1 && hMimic1.IsValid()) FindStickies(hMimic1) if(hMimic2 && hMimic2.IsValid()) FindStickies(hMimic2) if(Time() >= flTimeNext) { flTimeNext += 7 EntFireByHandle(self, "CallScriptFunction", "ShootStickies", -1, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.1, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.2, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.3, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.4, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(4)", 0.5, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.6, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.7, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.8, null, null) EntFireByHandle(self, "CallScriptFunction", "ShootStickies", 0.9, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(4)", 1, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(1, true)", 1.5, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(2, true)", 2, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(3, true)", 2.5, null, null) EntFireByHandle(self, "RunScriptCode", "ShootStickies(6, true)", 3, null, null) } return -1 } TankExt.AddThinkToEnt(hTank, "PipeThink") } })